#include "TocWidget.h"
+#include "GuiApplication.h"
#include "GuiView.h"
#include "qt_helpers.h"
#include "TocModel.h"
{
setupUi(this);
- moveOutTB->setIcon(QIcon(":/images/promote.png"));
- moveInTB->setIcon(QIcon(":/images/demote.png"));
- moveUpTB->setIcon(QIcon(":/images/up.png"));
- moveDownTB->setIcon(QIcon(":/images/down.png"));
- updateTB->setIcon(QIcon(":/images/reload.png"));
+ moveOutTB->setIcon(QIcon(getPixmap("images/", "promote", "png")));
+ moveInTB->setIcon(QIcon(getPixmap("images/", "demote", "png")));
+ moveUpTB->setIcon(QIcon(getPixmap("images/", "up", "png")));
+ moveDownTB->setIcon(QIcon(getPixmap("images/", "down", "png")));
+ updateTB->setIcon(QIcon(getPixmap("images/", "reload", "png")));
// avoid flickering
tocTV->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
if (!tocTV->model())
return;
+#if QT_VERSION >= 0x040300
+ // this should be faster than our own code below
+ if (depth == 0)
+ tocTV->collapseAll();
+ else
+ tocTV->expandToDepth(depth - 1);
+#else
// expanding and then collapsing is probably better,
// but my qt 4.1.2 doesn't have expandAll()..
//tocTV->expandAll();
QModelIndex index = indices[i];
tocTV->setExpanded(index, indexDepth(index) < depth_);
}
+#endif
}
void TocWidget::enableControls(bool enable)
{
updateTB->setEnabled(enable);
- sortCB->setEnabled(enable);
if (!canOutline(current_type_))
enable = false;
moveDownTB->setEnabled(enable);
moveInTB->setEnabled(enable);
moveOutTB->setEnabled(enable);
- persistentCB->setEnabled(enable);
if (!enable) {
depthSL->setMaximum(0);
depthSL->setValue(0);
tocTV->setEnabled(false);
tocTV->setUpdatesEnabled(false);
- QAbstractItemModel * toc_model = gui_view_.tocModels().model(current_type_);
+ QAbstractItemModel * toc_model = gui_view_.tocModels().model(current_type_);
if (tocTV->model() != toc_model) {
tocTV->setModel(toc_model);
tocTV->setEditTriggers(QAbstractItemView::NoEditTriggers);
- if (persistent_) setTreeDepth(depth_);
+ if (persistent_)
+ setTreeDepth(depth_);
}
sortCB->blockSignals(true);
depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));
depthSL->setValue(depth_);
- if (!persistent_) setTreeDepth(depth_);
+ if (!persistent_)
+ setTreeDepth(depth_);
if (canNavigate(current_type_))
select(gui_view_.tocModels().currentIndex(current_type_));
tocTV->setEnabled(true);
typeCO->blockSignals(true);
typeCO->setCurrentIndex(new_index);
typeCO->blockSignals(false);
- updateView();
}
} // namespace frontend
} // namespace lyx
-#include "TocWidget_moc.cpp"
+#include "moc_TocWidget.cpp"