Element panel widget : remove the clear button, and use instead the clear button provided by QLineEdit

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3811 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-03-05 16:35:12 +00:00
parent 3556a8ad3e
commit 431028a86a
2 changed files with 6 additions and 22 deletions

View File

@@ -81,17 +81,14 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
move_elements_ = new QAction(QET::Icons::IC_MoveFile, tr("Déplacer dans cette catégorie"), this); 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); 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); 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); reload -> setShortcut(Qt::Key_F5);
// initialise le champ de texte pour filtrer avec une disposition horizontale // 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_textfield = new QLineEdit(this);
filter_toolbar = new QToolBar("filter"); filter_textfield -> setClearButtonEnabled(true);
filter_toolbar -> addAction(erase_textfield); filter_textfield -> setPlaceholderText(tr("Filtrer"));
filter_toolbar -> addWidget(filter_label);
filter_toolbar -> addWidget(filter_textfield);
//@TODO remove the commented code below //@TODO remove the commented code below
// ajoute une petite marge a la droite du champ pour filtrer lorsque le style CleanLooks est utilise // ajoute une petite marge a la droite du champ pour filtrer lorsque le style CleanLooks est utilise
@@ -131,8 +128,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
connect(move_elements_, SIGNAL(triggered()), this, SLOT(moveElements())); connect(move_elements_, SIGNAL(triggered()), this, SLOT(moveElements()));
connect(copy_elements_, SIGNAL(triggered()), this, SLOT(copyElements())); connect(copy_elements_, SIGNAL(triggered()), this, SLOT(copyElements()));
connect(erase_textfield, SIGNAL(triggered()), this, SLOT(clearFilterTextField())); connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &)));
connect(filter_textfield, SIGNAL(textEdited(const QString &)), this, SLOT(filterEdited(const QString &)));
connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons())); connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &))); connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &)));
@@ -176,7 +172,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
vlayout -> setMargin(0); vlayout -> setMargin(0);
vlayout -> setSpacing(0); vlayout -> setSpacing(0);
vlayout -> addWidget(toolbar); vlayout -> addWidget(toolbar);
vlayout -> addWidget(filter_toolbar); vlayout -> addWidget(filter_textfield);
vlayout -> addWidget(elements_panel); vlayout -> addWidget(elements_panel);
vlayout -> addWidget(progress_bar_); vlayout -> addWidget(progress_bar_);
vlayout -> setStretchFactor(elements_panel, 75000); vlayout -> setStretchFactor(elements_panel, 75000);
@@ -192,16 +188,6 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
ElementsPanelWidget::~ElementsPanelWidget() { ElementsPanelWidget::~ElementsPanelWidget() {
} }
/**
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 Require the desktop environment to open the directory containing the file
represented by the selected item, if any. represented by the selected item, if any.

View File

@@ -38,7 +38,7 @@ class ElementsPanelWidget : public QWidget {
// attributes // attributes
private: private:
ElementsPanel *elements_panel; ElementsPanel *elements_panel;
QToolBar *toolbar, *filter_toolbar; QToolBar *toolbar;
QAction *open_directory, *copy_path; QAction *open_directory, *copy_path;
QAction *reload; QAction *reload;
QAction *new_category, *edit_category, *delete_category; QAction *new_category, *edit_category, *delete_category;
@@ -48,7 +48,6 @@ class ElementsPanelWidget : public QWidget {
QAction *tbt_add, *tbt_edit, *tbt_remove; QAction *tbt_add, *tbt_edit, *tbt_remove;
QAction *copy_elements_, *move_elements_, *cancel_elements_; QAction *copy_elements_, *move_elements_, *cancel_elements_;
QMenu *context_menu; QMenu *context_menu;
QAction *erase_textfield;
QLineEdit *filter_textfield; QLineEdit *filter_textfield;
ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_; ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_;
QProgressBar *progress_bar_; QProgressBar *progress_bar_;
@@ -72,7 +71,6 @@ class ElementsPanelWidget : public QWidget {
void requestForDiagramMoveDownx10(Diagram *); void requestForDiagramMoveDownx10(Diagram *);
public slots: public slots:
void clearFilterTextField();
void openDirectoryForSelectedItem(); void openDirectoryForSelectedItem();
void copyPathForSelectedItem(); void copyPathForSelectedItem();
void reloadAndFilter(); void reloadAndFilter();