From c6a6f8829c9c1e1120d52a86fe340d1935193dba Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 30 Oct 2012 07:44:53 +0100 Subject: [PATCH] snippets: move search zone in button area. Fix shortcuts --- src/qtgui/snippets.ui | 190 +++++++++++++++++++-------------------- src/qtgui/snippets_w.cpp | 14 ++- 2 files changed, 108 insertions(+), 96 deletions(-) diff --git a/src/qtgui/snippets.ui b/src/qtgui/snippets.ui index 253ccf8d..18fd8c71 100644 --- a/src/qtgui/snippets.ui +++ b/src/qtgui/snippets.ui @@ -13,9 +13,9 @@ Snippets - + - + @@ -26,88 +26,104 @@ - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - + + + + + + 1 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 1 - - X + + 1 - - Qt::ToolButtonTextOnly - - - - - - - Find: - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Next - - - - - - - - 0 - 0 - - - - Prev - - - - - + + + + + 0 + 0 + + + + X + + + Qt::ToolButtonTextOnly + + + + + + + Find: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Next + + + + + + + + 0 + 0 + + + + Prev + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - @@ -119,22 +135,6 @@ - - buttonBox - clicked(QAbstractButton*) - Snippets - close() - - - 257 - 369 - - - 257 - 197 - - - searchClosePB clicked() diff --git a/src/qtgui/snippets_w.cpp b/src/qtgui/snippets_w.cpp index 27766eca..d2428c20 100644 --- a/src/qtgui/snippets_w.cpp +++ b/src/qtgui/snippets_w.cpp @@ -64,17 +64,29 @@ void SnippetsW::init() if (m_source.isNull()) return; + QPushButton *searchButton = new QPushButton(tr("Search")); + searchButton->setAutoDefault(false); + buttonBox->addButton(searchButton, QDialogButtonBox::ActionRole); + searchFM->hide(); new QShortcut(QKeySequence::Find, this, SLOT(slotEditFind())); new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind())); + new QShortcut(QKeySequence(Qt::Key_Escape), searchFM, SLOT(hide())); new QShortcut(QKeySequence::FindNext, this, SLOT(slotEditFindNext())); + new QShortcut(QKeySequence(Qt::Key_F3), this, SLOT(slotEditFindNext())); new QShortcut(QKeySequence::FindPrevious, this, SLOT(slotEditFindPrevious())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3), + this, SLOT(slotEditFindPrevious())); + + QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); + if (closeButton) + connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(searchButton, SIGNAL(clicked()), this, SLOT(slotEditFind())); connect(searchLE, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&))); connect(nextPB, SIGNAL(clicked()), this, SLOT(slotEditFindNext())); - new QShortcut(QKeySequence(Qt::Key_F3), this, SLOT(slotEditFindNext())); connect(prevPB, SIGNAL(clicked()), this, SLOT(slotEditFindPrevious())); #ifdef SNIPPETS_WEBKIT