From a0da4b16a8768779ce32480046d3c0109595d5e5 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 21 May 2017 19:10:19 -0300 Subject: [PATCH] Display the number of selected elements in Selection View --- src/Gui/SelectionView.cpp | 12 ++++++++++-- src/Gui/SelectionView.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index 8b7b740ecd..bd525eeaff 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -30,6 +30,7 @@ # include # include # include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... @@ -53,7 +54,7 @@ using namespace Gui::DockWnd; SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent) : DockWindow(pcDocument,parent) { - setWindowTitle(tr("Property View")); + setWindowTitle(tr("Selection View")); QVBoxLayout* vLayout = new QVBoxLayout(this); vLayout->setSpacing(0); @@ -65,14 +66,20 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent) #endif searchBox->setToolTip(tr("Searches object labels")); QHBoxLayout* hLayout = new QHBoxLayout(); + hLayout->setSpacing(2); QToolButton* clearButton = new QToolButton(this); clearButton->setFixedSize(18, 21); clearButton->setCursor(Qt::ArrowCursor); - clearButton->setStyleSheet(QString::fromLatin1("QToolButton {margin-bottom:6px}")); + clearButton->setStyleSheet(QString::fromUtf8("QToolButton {margin-bottom:1px}")); clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg")); clearButton->setToolTip(tr("Clears the search field")); + clearButton->setAutoRaise(true); + countLabel = new QLabel(this); + countLabel->setText(QString::fromUtf8("0")); + countLabel->setToolTip(tr("The number of selected items")); hLayout->addWidget(searchBox); hLayout->addWidget(clearButton,0,Qt::AlignRight); + hLayout->addWidget(countLabel,0,Qt::AlignRight); vLayout->addLayout(hLayout); selectionView = new QListWidget(this); @@ -164,6 +171,7 @@ void SelectionView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, new QListWidgetItem(selObject, selectionView); } } + countLabel->setText(QString::number(selectionView->count())); } void SelectionView::search(const QString& text) diff --git a/src/Gui/SelectionView.h b/src/Gui/SelectionView.h index 15153fbea1..ff10405532 100644 --- a/src/Gui/SelectionView.h +++ b/src/Gui/SelectionView.h @@ -30,6 +30,7 @@ #include "Selection.h" class QListWidget; +class QLabel; namespace App { class DocumentObject; @@ -71,6 +72,7 @@ public: virtual void onUpdate(void); QListWidget* selectionView; + QLabel* countLabel; public Q_SLOTS: /// get called when text is entered in the search box