#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);