Ajout d'un bouton pour effacer le filtre dans le panel d'elements

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@283 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2008-01-20 18:50:10 +00:00
parent fe06bfd425
commit cec010c1e7
7 changed files with 20 additions and 10 deletions

View File

@@ -251,4 +251,3 @@ QRectF PartLine::boundingRect() const {
bool PartLine::isUseless() const {
return(sceneP1() == sceneP2());
}

View File

@@ -34,13 +34,15 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
new_element = new QAction(QIcon(":/ico/new.png"), tr("Nouvel \351l\351ment"), this);
edit_element = new QAction(QIcon(":/ico/edit.png"), tr("\311diter l'\351l\351ment"), this);
delete_element = new QAction(QIcon(":/ico/delete.png"), tr("Supprimer l'\351l\351ment"), this);
erase_textfield = new QAction(QIcon(":/ico/erase.png"), tr("Effacer le filtre"), this);
// initialise le champ de texte pour filtrer avec une disposition horizontale
QLabel *filter_label = new QLabel(tr("Filtrer : "), this);
filter_textfield = new QLineEdit(this);
QHBoxLayout *hlayout = new QHBoxLayout();
hlayout -> addWidget(filter_label);
hlayout -> addWidget(filter_textfield);
filter_toolbar = new QToolBar("filter");
filter_toolbar -> addAction(erase_textfield);
filter_toolbar -> addWidget(filter_label);
filter_toolbar -> addWidget(filter_textfield);
context_menu = new QMenu(this);
@@ -52,6 +54,8 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
connect(edit_element, SIGNAL(triggered()), elements_panel, SLOT(editElement()));
connect(delete_element, SIGNAL(triggered()), elements_panel, SLOT(deleteElement()));
connect(erase_textfield, SIGNAL(triggered()), filter_textfield, SLOT(clear()));
connect(erase_textfield, SIGNAL(triggered()), filter_textfield, SLOT(setFocus()));
connect(filter_textfield, SIGNAL(textEdited(const QString &)), elements_panel, SLOT(filter(const QString &)));
connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
@@ -75,7 +79,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
vlayout -> setMargin(0);
vlayout -> setSpacing(0);
vlayout -> addWidget(toolbar);
vlayout -> addLayout(hlayout);
vlayout -> addWidget(filter_toolbar);
vlayout -> addWidget(elements_panel);
vlayout -> setStretchFactor(elements_panel, 75000);
setLayout(vlayout);

View File

@@ -38,11 +38,12 @@ class ElementsPanelWidget : public QWidget {
// attributs
private:
ElementsPanel *elements_panel;
QToolBar *toolbar;
QToolBar *toolbar, *filter_toolbar;
QAction *reload;
QAction *new_category, *edit_category, *delete_category;
QAction *new_element, *edit_element, *delete_element;
QMenu *context_menu;
QAction *erase_textfield;
QLineEdit *filter_textfield;
// methodes

BIN
ico/erase.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

View File

@@ -616,20 +616,25 @@ Changes will be permanent.</translation>
<translation>Delete element</translation>
</message>
<message>
<location filename="../elementspanelwidget.cpp" line="104"/>
<location filename="../elementspanelwidget.cpp" line="120"/>
<source>Gestionnaire de cat&#xe9;gories</source>
<translation>Categories manager</translation>
</message>
<message>
<location filename="../elementspanelwidget.cpp" line="107"/>
<location filename="../elementspanelwidget.cpp" line="123"/>
<source>Vous pouvez utiliser ce gestionnaire pour ajouter, supprimer ou modifier les cat&#xe9;gories.</source>
<translation>Use this manager to add, delete or modify categories.</translation>
</message>
<message>
<location filename="../elementspanelwidget.cpp" line="39"/>
<location filename="../elementspanelwidget.cpp" line="40"/>
<source>Filtrer : </source>
<translation>Filter: </translation>
</message>
<message>
<location filename="../elementspanelwidget.cpp" line="37"/>
<source>Effacer le filtre</source>
<translation>Erase filter</translation>
</message>
</context>
<context>
<name>EllipseEditor</name>

View File

@@ -26,6 +26,7 @@
<file>ico/edit.png</file>
<file>ico/ellipse.png</file>
<file>ico/entrer_fs.png</file>
<file>ico/erase.png</file>
<file>ico/exit.png</file>
<file>ico/export.png</file>
<file>ico/fileclose.png</file>