X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FPanelStack.cpp;h=9b6cb639c8678db63a6993288c1389189f56707e;hb=ceb03b1815583a7daf6166562f6d928d7d38b356;hp=ef9c599a340cbf9f53fa7da3602cc44a0d47646a;hpb=fe85162a29893e98bd3426d15c9a9eb62aa90f6b;p=lyx.git diff --git a/src/frontends/qt/PanelStack.cpp b/src/frontends/qt/PanelStack.cpp index ef9c599a34..9b6cb639c8 100644 --- a/src/frontends/qt/PanelStack.cpp +++ b/src/frontends/qt/PanelStack.cpp @@ -13,15 +13,17 @@ #include "PanelStack.h" #include "GuiApplication.h" +#include "GuiFontMetrics.h" #include "qt_helpers.h" +#include "FancyLineEdit.h" + #include "support/debug.h" #include "support/lassert.h" #include #include #include -#include #include #include #include @@ -59,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()); @@ -71,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)), @@ -118,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; @@ -148,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);