[qet] [3811] Element panel widget : remove the clear button, and use instead the clear button provided by QLineEdit |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 3811
Author: blacksun
Date: 2015-03-05 17:35:12 +0100 (Thu, 05 Mar 2015)
Log Message:
-----------
Element panel widget : remove the clear button, and use instead the clear button provided by QLineEdit
Modified Paths:
--------------
trunk/sources/elementspanelwidget.cpp
trunk/sources/elementspanelwidget.h
Modified: trunk/sources/elementspanelwidget.cpp
===================================================================
--- trunk/sources/elementspanelwidget.cpp 2015-03-05 13:31:56 UTC (rev 3810)
+++ trunk/sources/elementspanelwidget.cpp 2015-03-05 16:35:12 UTC (rev 3811)
@@ -81,17 +81,14 @@
move_elements_ = new QAction(QET::Icons::IC_MoveFile, tr("Déplacer dans cette catégorie"), this);
copy_elements_ = new QAction(QET::Icons::IC_CopyFile, tr("Copier dans cette catégorie"), this);
cancel_elements_ = new QAction(QET::Icons::Cancel, tr("Annuler"), this);
- erase_textfield = new QAction(QET::Icons::EditClearLocationBar, tr("Effacer le filtre"), this);
reload -> setShortcut(Qt::Key_F5);
// initialise le champ de texte pour filtrer avec une disposition horizontale
- QLabel *filter_label = new QLabel(tr("Filtrer : "), this);
filter_textfield = new QLineEdit(this);
- filter_toolbar = new QToolBar("filter");
- filter_toolbar -> addAction(erase_textfield);
- filter_toolbar -> addWidget(filter_label);
- filter_toolbar -> addWidget(filter_textfield);
+ filter_textfield -> setClearButtonEnabled(true);
+ filter_textfield -> setPlaceholderText(tr("Filtrer"));
+
//@TODO remove the commented code below
// ajoute une petite marge a la droite du champ pour filtrer lorsque le style CleanLooks est utilise
@@ -131,8 +128,7 @@
connect(move_elements_, SIGNAL(triggered()), this, SLOT(moveElements()));
connect(copy_elements_, SIGNAL(triggered()), this, SLOT(copyElements()));
- connect(erase_textfield, SIGNAL(triggered()), this, SLOT(clearFilterTextField()));
- connect(filter_textfield, SIGNAL(textEdited(const QString &)), this, SLOT(filterEdited(const QString &)));
+ connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &)));
connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &)));
@@ -176,7 +172,7 @@
vlayout -> setMargin(0);
vlayout -> setSpacing(0);
vlayout -> addWidget(toolbar);
- vlayout -> addWidget(filter_toolbar);
+ vlayout -> addWidget(filter_textfield);
vlayout -> addWidget(elements_panel);
vlayout -> addWidget(progress_bar_);
vlayout -> setStretchFactor(elements_panel, 75000);
@@ -193,16 +189,6 @@
}
/**
- Vide le champ de texte permettant a l'utilisateur de filtrer, donne le
- focus a ce champ et annule le filtrage.
-*/
-void ElementsPanelWidget::clearFilterTextField() {
- filter_textfield -> clear();
- filter_textfield -> setFocus();
- filterEdited(QString());
-}
-
-/**
Require the desktop environment to open the directory containing the file
represented by the selected item, if any.
*/
Modified: trunk/sources/elementspanelwidget.h
===================================================================
--- trunk/sources/elementspanelwidget.h 2015-03-05 13:31:56 UTC (rev 3810)
+++ trunk/sources/elementspanelwidget.h 2015-03-05 16:35:12 UTC (rev 3811)
@@ -38,7 +38,7 @@
// attributes
private:
ElementsPanel *elements_panel;
- QToolBar *toolbar, *filter_toolbar;
+ QToolBar *toolbar;
QAction *open_directory, *copy_path;
QAction *reload;
QAction *new_category, *edit_category, *delete_category;
@@ -48,7 +48,6 @@
QAction *tbt_add, *tbt_edit, *tbt_remove;
QAction *copy_elements_, *move_elements_, *cancel_elements_;
QMenu *context_menu;
- QAction *erase_textfield;
QLineEdit *filter_textfield;
ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_;
QProgressBar *progress_bar_;
@@ -72,7 +71,6 @@
void requestForDiagramMoveDownx10(Diagram *);
public slots:
- void clearFilterTextField();
void openDirectoryForSelectedItem();
void copyPathForSelectedItem();
void reloadAndFilter();