]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/PanelStack.cpp
Amend 4cd568d31266
[lyx.git] / src / frontends / qt / PanelStack.cpp
index 2614284a8d2f287b8a00cb1c912ecc6ab786a2c5..9b6cb639c8678db63a6993288c1389189f56707e 100644 (file)
@@ -13,6 +13,7 @@
 #include "PanelStack.h"
 
 #include "GuiApplication.h"
+#include "GuiFontMetrics.h"
 #include "qt_helpers.h"
 
 #include "FancyLineEdit.h"
@@ -23,7 +24,6 @@
 #include <QAbstractButton>
 #include <QApplication>
 #include <QComboBox>
-#include <QFontMetrics>
 #include <QGroupBox>
 #include <QHideEvent>
 #include <QHash>
@@ -61,7 +61,7 @@ PanelStack::PanelStack(QWidget * parent)
        list_->setRootIsDecorated(false);
        list_->setColumnCount(1);
        list_->header()->hide();
-       setSectionResizeMode(list_->header(), QHeaderView::ResizeToContents);
+       list_->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
        list_->header()->setStretchLastSection(false);
        list_->setMinimumSize(list_->viewport()->size());
 
@@ -73,11 +73,7 @@ PanelStack::PanelStack(QWidget * parent)
 
        // Configure the search box
        search_->setPlaceholderText(qt_("Search"));
-       search_->setButtonPixmap(FancyLineEdit::Right,
-                                getPixmap("images/", "editclear", "svgz,png"));
-       search_->setButtonVisible(FancyLineEdit::Right, true);
-       search_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
-       search_->setAutoHideButton(FancyLineEdit::Right, true);
+       search_->setClearButton(true);
        connect(search_, SIGNAL(rightButtonClicked()),
                this, SLOT(resetSearch()));
        connect(search_, SIGNAL(textEdited(QString)),
@@ -120,7 +116,7 @@ void PanelStack::addCategory(QString const & name, QString const & parent)
 
        panel_map_[name] = item;
 
-       QFontMetrics fm(list_->font());
+       GuiFontMetrics fm(list_->font());
 
        // calculate the real size the current item needs in the listview
        int itemsize = fm.width(qt_(name)) + 10 + list_->indentation() * depth;
@@ -150,6 +146,22 @@ void PanelStack::showPanel(QString const & name, bool show)
 }
 
 
+void PanelStack::markPanelValid(QString const & name, bool valid)
+{
+       QTreeWidgetItem * item = panel_map_.value(name, 0);
+       LASSERT(item, return);
+
+       if (valid) {
+               item->setIcon(0, QIcon());
+               item->setToolTip(0, QString());
+       } else {
+               QIcon warn(getPixmap("images/", "emblem-shellescape", "svgz,png"));
+               item->setIcon(0, warn);
+               item->setToolTip(0, qt_("This section contains invalid input. Please fix!"));
+       }
+}
+
+
 void PanelStack::setCurrentPanel(QString const & name)
 {
        QTreeWidgetItem * item = panel_map_.value(name, 0);