mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 18:24:48 +00:00
Add persistent view switch to the outliner.
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg144343.html git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26684 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4dc976497f
commit
2ca370b135
@ -35,7 +35,7 @@ namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
|
||||
: QWidget(parent), depth_(0), gui_view_(gui_view)
|
||||
: QWidget(parent), depth_(0), persistent_(false), gui_view_(gui_view)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -105,6 +105,12 @@ void TocWidget::on_sortCB_stateChanged(int state)
|
||||
updateView();
|
||||
}
|
||||
|
||||
void TocWidget::on_persistentCB_stateChanged(int state)
|
||||
{
|
||||
persistent_ = state == Qt::Checked;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME (Ugras 17/11/06):
|
||||
I have implemented a indexDepth function to get the model indices. In my
|
||||
opinion, somebody should derive a new qvariant class for tocModelItem
|
||||
@ -228,6 +234,7 @@ void TocWidget::enableControls(bool enable)
|
||||
moveDownTB->setEnabled(enable);
|
||||
moveInTB->setEnabled(enable);
|
||||
moveOutTB->setEnabled(enable);
|
||||
persistentCB->setEnabled(enable);
|
||||
if (!enable) {
|
||||
depthSL->setMaximum(0);
|
||||
depthSL->setValue(0);
|
||||
@ -263,19 +270,22 @@ void TocWidget::updateView()
|
||||
if (tocTV->model() != toc_model) {
|
||||
tocTV->setModel(toc_model);
|
||||
tocTV->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setTreeDepth(depth_);
|
||||
if (persistent_) setTreeDepth(depth_);
|
||||
}
|
||||
|
||||
sortCB->blockSignals(true);
|
||||
sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_));
|
||||
sortCB->blockSignals(false);
|
||||
|
||||
persistentCB->setChecked(persistent_);
|
||||
|
||||
bool controls_enabled = toc_model && toc_model->rowCount() > 0
|
||||
&& !gui_view_.buffer()->isReadonly();
|
||||
enableControls(controls_enabled);
|
||||
|
||||
depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));
|
||||
depthSL->setValue(depth_);
|
||||
if (!persistent_) setTreeDepth(depth_);
|
||||
if (canNavigate(current_type_))
|
||||
select(gui_view_.tocModels().currentIndex(current_type_));
|
||||
tocTV->setEnabled(true);
|
||||
|
@ -49,6 +49,7 @@ protected Q_SLOTS:
|
||||
void on_tocTV_clicked(QModelIndex const &);
|
||||
void on_updateTB_clicked();
|
||||
void on_sortCB_stateChanged(int state);
|
||||
void on_persistentCB_stateChanged(int state);
|
||||
void on_depthSL_valueChanged(int depth);
|
||||
void on_typeCO_currentIndexChanged(int value);
|
||||
void on_moveUpTB_clicked();
|
||||
@ -68,6 +69,8 @@ private:
|
||||
|
||||
/// depth of list shown
|
||||
int depth_;
|
||||
/// persistence of uncollapsed nodes in toc view
|
||||
bool persistent_;
|
||||
///
|
||||
GuiView & gui_view_;
|
||||
};
|
||||
|
@ -8,15 +8,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>185</width>
|
||||
<height>184</height>
|
||||
<width>202</width>
|
||||
<height>332</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" colspan="4" >
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QComboBox" name="typeCO" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
|
||||
@ -29,7 +29,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4" >
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QTreeView" name="tocTV" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Ignored" >
|
||||
@ -39,7 +39,89 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4" >
|
||||
<item row="2" column="0" >
|
||||
<widget class="QSlider" name="depthSL" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Adjust the depth of the navigation tree</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<layout class="QVBoxLayout" name="_2" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="sortCB" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Sort</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="persistentCB" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Try to keep persistent view of the uncollapsed nodes</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Keep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
@ -162,41 +244,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3" >
|
||||
<widget class="QSlider" name="depthSL" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Adjust the depth of the navigation tree</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" >
|
||||
<widget class="QCheckBox" name="sortCB" >
|
||||
<property name="text" >
|
||||
<string>Sort</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
Loading…
Reference in New Issue
Block a user