#include "PanelStack.h"
#include "GuiApplication.h"
+#include "GuiFontMetrics.h"
#include "qt_helpers.h"
#include "FancyLineEdit.h"
#include <QAbstractButton>
#include <QApplication>
#include <QComboBox>
-#include <QFontMetrics>
#include <QGroupBox>
#include <QHideEvent>
#include <QHash>
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());
// 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)),
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;
}
+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);