diff options
| author | 2014-09-26 20:00:17 +0000 | |
|---|---|---|
| committer | 2014-09-26 20:00:17 +0000 | |
| commit | 0146446e5c3e26c36544ea96ecd97d2ff3f852d9 (patch) | |
| tree | 672b6326472954f1db2d8cb701f02c253fd4ba1f /src | |
| parent | Fix references to "kvirc.rc"/"kvirc.ini" to kvirc4 (diff) | |
| download | KVIrc-0146446e5c3e26c36544ea96ecd97d2ff3f852d9.tar.gz KVIrc-0146446e5c3e26c36544ea96ecd97d2ff3f852d9.tar.bz2 KVIrc-0146446e5c3e26c36544ea96ecd97d2ff3f852d9.zip | |
Ensure focussed widget is sensible when search mode is toggled
I.e. finding text in a channel, PM, etc - when the search widget is
summoned, it gets the focus, when dismissed, the input gets the focus
Fixes #1350 / https://svn.kvirc.de/kvirc/ticket/1350
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@6390 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/KviIrcView.cpp | 7 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView_tools.cpp | 11 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView_tools.h | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/kvirc/ui/KviIrcView.cpp b/src/kvirc/ui/KviIrcView.cpp index eb36f6328..80086ff2f 100644 --- a/src/kvirc/ui/KviIrcView.cpp +++ b/src/kvirc/ui/KviIrcView.cpp @@ -2144,6 +2144,10 @@ void KviIrcView::toggleToolWidget() { m_pToolWidget->setVisible(false); m_pCursorLine = 0; + + // When the tool widget is hidden, ensure the input is focussed (otherwise text is still entered into the 'string to find' widget...) + if(m_pKviWindow && m_pKviWindow->input()) m_pKviWindow->input()->setFocus(); + } else { if(!m_pToolWidget) m_pToolWidget = new KviIrcViewToolWidget(this); @@ -2152,6 +2156,9 @@ void KviIrcView::toggleToolWidget() int iScr = m_pScrollBar->sizeHint().width(); m_pToolWidget->setGeometry(0, height() - h, width() - iScr, h); m_pToolWidget->setVisible(true); + + // Ensure the 'string to find' widget is always in focus when the search functionality is requested + m_pToolWidget->focusStringToFind(); } repaint(); diff --git a/src/kvirc/ui/KviIrcView_tools.cpp b/src/kvirc/ui/KviIrcView_tools.cpp index a9e182804..5bdef7bec 100644 --- a/src/kvirc/ui/KviIrcView_tools.cpp +++ b/src/kvirc/ui/KviIrcView_tools.cpp @@ -169,9 +169,7 @@ KviIrcViewToolWidget::KviIrcViewToolWidget(KviIrcView * pParent) // m_pFindResult->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); // pOptionsLayout->addWidget(m_pFindResult,0,6); -#ifndef COMPILE_ON_MAC - m_pStringToFind->setFocus(); // this makes MacOSX version of Qt go nuts and crash -#endif //!COMPILE_ON_MAC + // Focussing the 'string to find' widget has been moved to the toggle function so that it happens whenever the widget is shown KviShortcut::create(Qt::Key_Escape,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut); KviShortcut::create(KVI_SHORTCUTS_WIN_SEARCH,m_pIrcView,SLOT(toggleToolWidget()),0,Qt::WidgetWithChildrenShortcut); @@ -264,6 +262,13 @@ void KviIrcViewToolWidget::filterSave() } } +void KviIrcViewToolWidget::focusStringToFind() +{ + #ifndef COMPILE_ON_MAC + m_pStringToFind->setFocus(); // this makes MacOSX version of Qt go nuts and crash + #endif //!COMPILE_ON_MAC +} + void KviIrcViewToolWidget::forceRepaint() { #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) diff --git a/src/kvirc/ui/KviIrcView_tools.h b/src/kvirc/ui/KviIrcView_tools.h index 7f1377c78..6a4840ece 100644 --- a/src/kvirc/ui/KviIrcView_tools.h +++ b/src/kvirc/ui/KviIrcView_tools.h @@ -109,6 +109,7 @@ protected: public: enum SearchMode { PlainText, Wildcards, RegExp }; void setFindResult(const QString & text); + void focusStringToFind(); inline bool messageEnabled(int msg_type){ return m_pFilterItems[msg_type]->isOn();}; void forceRepaint(); protected slots: |
