From 746abef2cfe7cfcb111da1b2020ec119e1ccc30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Sat, 25 Feb 2012 13:36:20 +0100 Subject: [PATCH] Added search buttons to the "plus 1" and "regexp" tools --- qt/dic_tools_widget.cpp | 32 +++++++++++++++++++++++++---- qt/dic_tools_widget.h | 4 ++++ qt/ui/dic_tools_widget.ui | 42 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/qt/dic_tools_widget.cpp b/qt/dic_tools_widget.cpp index 7d41786..7afb4de 100644 --- a/qt/dic_tools_widget.cpp +++ b/qt/dic_tools_widget.cpp @@ -61,10 +61,22 @@ DicToolsWidget::DicToolsWidget(QWidget *parent) labelLimitReached->hide(); // Create connections - QObject::connect(lineEditCheck, SIGNAL(textChanged(const QString&)), this, SLOT(refreshCheck())); - QObject::connect(lineEditPlus1, SIGNAL(returnPressed()), this, SLOT(refreshPlus1())); - QObject::connect(lineEditRegexp, SIGNAL(returnPressed()), this, SLOT(refreshRegexp())); - QObject::connect(buttonSaveWords, SIGNAL(clicked()), this, SLOT(exportWordsList())); + QObject::connect(lineEditCheck, SIGNAL(textChanged(const QString&)), + this, SLOT(refreshCheck())); + QObject::connect(lineEditPlus1, SIGNAL(textChanged(const QString&)), + this, SLOT(enableSearchPlus1())); + QObject::connect(lineEditPlus1, SIGNAL(returnPressed()), + this, SLOT(refreshPlus1())); + QObject::connect(buttonSearchPlus1, SIGNAL(clicked()), + this, SLOT(refreshPlus1())); + QObject::connect(lineEditRegexp, SIGNAL(textChanged(const QString&)), + this, SLOT(enableSearchRegexp())); + QObject::connect(lineEditRegexp, SIGNAL(returnPressed()), + this, SLOT(refreshRegexp())); + QObject::connect(buttonSearchRegexp, SIGNAL(clicked()), + this, SLOT(refreshRegexp())); + QObject::connect(buttonSaveWords, SIGNAL(clicked()), + this, SLOT(exportWordsList())); // Add context menus for the results m_customPopupPlus1 = new CustomPopup(treeViewPlus1); @@ -170,6 +182,12 @@ void DicToolsWidget::refreshCheck() } +void DicToolsWidget::enableSearchPlus1() +{ + buttonSearchPlus1->setEnabled(lineEditPlus1->text() != ""); +} + + void DicToolsWidget::refreshPlus1() { QStandardItemModel *model = m_plus1Model; @@ -224,6 +242,12 @@ void DicToolsWidget::refreshPlus1() } +void DicToolsWidget::enableSearchRegexp() +{ + buttonSearchRegexp->setEnabled(lineEditRegexp->text() != ""); +} + + void DicToolsWidget::refreshRegexp() { QStandardItemModel *model = m_regexpModel; diff --git a/qt/dic_tools_widget.h b/qt/dic_tools_widget.h index cb0c441..87bf6ed 100644 --- a/qt/dic_tools_widget.h +++ b/qt/dic_tools_widget.h @@ -73,6 +73,10 @@ private: CustomPopup *m_customPopupRegexp; private slots: + + void enableSearchPlus1(); + void enableSearchRegexp(); + /// Force synchronizing the model with the "check" results void refreshCheck(); /// Force synchronizing the model with the "plus 1" results diff --git a/qt/ui/dic_tools_widget.ui b/qt/ui/dic_tools_widget.ui index f3f5976..11fcdc1 100644 --- a/qt/ui/dic_tools_widget.ui +++ b/qt/ui/dic_tools_widget.ui @@ -6,7 +6,7 @@ 0 0 - 435 + 464 386 @@ -55,13 +55,30 @@ - + + + + + + + + false + + + _("Search") + + + + QAbstractItemView::NoEditTriggers + + true + @@ -72,7 +89,21 @@ - + + + + + + + + false + + + _("Search") + + + + @@ -120,6 +151,9 @@ QAbstractItemView::NoEditTriggers + + true + false @@ -249,8 +283,10 @@ tabWidget lineEditCheck lineEditPlus1 + buttonSearchPlus1 treeViewPlus1 lineEditRegexp + buttonSearchRegexp spinBoxMinLength spinBoxMaxLength treeViewRegexp