#include "qt_helpers.h"
#include <QStackedWidget>
-#include <QFontMetrics>
#include <QTreeWidget>
#include <QHBoxLayout>
-#include <QLayout>
+#include <QHeaderView>
#include <boost/assert.hpp>
stack_ = new QStackedWidget(this);
list_->setColumnCount(1);
- list_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- stack_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
-
- list_->setSortingEnabled(false);
-// list_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-// list_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-// list_->addColumn("");
-// list_->setColumnWidthMode(0, QTreeWidget::Maximum);
-
-// list_->setResizeMode(QTreeWidget::AllColumns);
-
QStringList HeaderLabels; HeaderLabels << QString("Category");
list_->setHeaderLabels(HeaderLabels);
if (parent.empty()) {
item = new QTreeWidgetItem(list_);
item->setText(0, name);
- //list_->addTopLevelItem(item);
}
else {
PanelMap::iterator it = panel_map_.find(parent);
item = new QTreeWidgetItem(it->second);
item->setText(0, name);
- //it->second->addChild(item);
}
panel_map_[n] = item;
- list_->setFixedWidth(list_->sizeHint().width());
-/*
- item->setFlags(false);
- item->setOpen(true);
-
- // calculate the real size the current item needs in the listview
- int itemsize = item->width(list_->fontMetrics(), list_, 0) + 10
- + list_->treeStepSize() * (item->depth() + 1) + list_->itemMargin();
- // adjust the listview width to the max. itemsize
- if (itemsize > list_->minimumWidth())
- list_->setMinimumWidth(itemsize);
- */
+ list_->setMinimumWidth(list_->header()->sectionSize(0) + list_->indentation());
}
addCategory(name, parent);
QTreeWidgetItem * item = panel_map_.find(name)->second;
- // reset the selectability set by addCategory
-// item->setSelectable(true);
-
widget_map_[item] = panel;
stack_->addWidget(panel);
stack_->setMinimumSize(panel->minimumSize());
stack_->setCurrentWidget(cit->second);
}
-#include "panelstack_moc.cpp"
-
-
-namespace lyx {
+QSize PanelStack::sizeHint() const
+{
+ return QSize(list_->width() + stack_->width(),
+ qMax(list_->height(), stack_->height()));
+}
-} // namespace lyx
+#include "panelstack_moc.cpp"