Added search buttons to the "plus 1" and "regexp" tools

This commit is contained in:
Olivier Teulière 2012-02-25 13:36:20 +01:00
parent 43954a9fe5
commit 746abef2cf
3 changed files with 71 additions and 7 deletions

View file

@ -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;

View file

@ -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

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<width>464</width>
<height>386</height>
</rect>
</property>
@ -55,13 +55,30 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLineEdit" name="lineEditPlus1"/>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="lineEditPlus1"/>
</item>
<item>
<widget class="QPushButton" name="buttonSearchPlus1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>_(&quot;Search&quot;)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="treeViewPlus1">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@ -72,7 +89,21 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLineEdit" name="lineEditRegexp"/>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="lineEditRegexp"/>
</item>
<item>
<widget class="QPushButton" name="buttonSearchRegexp">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>_(&quot;Search&quot;)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -120,6 +151,9 @@
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
@ -249,8 +283,10 @@
<tabstop>tabWidget</tabstop>
<tabstop>lineEditCheck</tabstop>
<tabstop>lineEditPlus1</tabstop>
<tabstop>buttonSearchPlus1</tabstop>
<tabstop>treeViewPlus1</tabstop>
<tabstop>lineEditRegexp</tabstop>
<tabstop>buttonSearchRegexp</tabstop>
<tabstop>spinBoxMinLength</tabstop>
<tabstop>spinBoxMaxLength</tabstop>
<tabstop>treeViewRegexp</tabstop>