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(); labelLimitReached->hide();
// Create connections // Create connections
QObject::connect(lineEditCheck, SIGNAL(textChanged(const QString&)), this, SLOT(refreshCheck())); QObject::connect(lineEditCheck, SIGNAL(textChanged(const QString&)),
QObject::connect(lineEditPlus1, SIGNAL(returnPressed()), this, SLOT(refreshPlus1())); this, SLOT(refreshCheck()));
QObject::connect(lineEditRegexp, SIGNAL(returnPressed()), this, SLOT(refreshRegexp())); QObject::connect(lineEditPlus1, SIGNAL(textChanged(const QString&)),
QObject::connect(buttonSaveWords, SIGNAL(clicked()), this, SLOT(exportWordsList())); 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 // Add context menus for the results
m_customPopupPlus1 = new CustomPopup(treeViewPlus1); m_customPopupPlus1 = new CustomPopup(treeViewPlus1);
@ -170,6 +182,12 @@ void DicToolsWidget::refreshCheck()
} }
void DicToolsWidget::enableSearchPlus1()
{
buttonSearchPlus1->setEnabled(lineEditPlus1->text() != "");
}
void DicToolsWidget::refreshPlus1() void DicToolsWidget::refreshPlus1()
{ {
QStandardItemModel *model = m_plus1Model; QStandardItemModel *model = m_plus1Model;
@ -224,6 +242,12 @@ void DicToolsWidget::refreshPlus1()
} }
void DicToolsWidget::enableSearchRegexp()
{
buttonSearchRegexp->setEnabled(lineEditRegexp->text() != "");
}
void DicToolsWidget::refreshRegexp() void DicToolsWidget::refreshRegexp()
{ {
QStandardItemModel *model = m_regexpModel; QStandardItemModel *model = m_regexpModel;

View file

@ -73,6 +73,10 @@ private:
CustomPopup *m_customPopupRegexp; CustomPopup *m_customPopupRegexp;
private slots: private slots:
void enableSearchPlus1();
void enableSearchRegexp();
/// Force synchronizing the model with the "check" results /// Force synchronizing the model with the "check" results
void refreshCheck(); void refreshCheck();
/// Force synchronizing the model with the "plus 1" results /// Force synchronizing the model with the "plus 1" results

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>435</width> <width>464</width>
<height>386</height> <height>386</height>
</rect> </rect>
</property> </property>
@ -54,14 +54,31 @@
<string>_(&quot;Plus 1&quot;)</string> <string>_(&quot;Plus 1&quot;)</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLineEdit" name="lineEditPlus1"/> <widget class="QLineEdit" name="lineEditPlus1"/>
</item> </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> <item>
<widget class="QTreeView" name="treeViewPlus1"> <widget class="QTreeView" name="treeViewPlus1">
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -71,9 +88,23 @@
<string>_(&quot;Regular expressions&quot;)</string> <string>_(&quot;Regular expressions&quot;)</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLineEdit" name="lineEditRegexp"/> <widget class="QLineEdit" name="lineEditRegexp"/>
</item> </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> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -120,6 +151,9 @@
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated"> <property name="rootIsDecorated">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -249,8 +283,10 @@
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>lineEditCheck</tabstop> <tabstop>lineEditCheck</tabstop>
<tabstop>lineEditPlus1</tabstop> <tabstop>lineEditPlus1</tabstop>
<tabstop>buttonSearchPlus1</tabstop>
<tabstop>treeViewPlus1</tabstop> <tabstop>treeViewPlus1</tabstop>
<tabstop>lineEditRegexp</tabstop> <tabstop>lineEditRegexp</tabstop>
<tabstop>buttonSearchRegexp</tabstop>
<tabstop>spinBoxMinLength</tabstop> <tabstop>spinBoxMinLength</tabstop>
<tabstop>spinBoxMaxLength</tabstop> <tabstop>spinBoxMaxLength</tabstop>
<tabstop>treeViewRegexp</tabstop> <tabstop>treeViewRegexp</tabstop>