Add outlining functionality to the Qt4 TOC dialog.

The Toc dialog is not finished yet, there's some clean-up to do especially in select_adapdator which doesn't seem to work. This makes lyx crash when clicking on the Up, Down, In or Out buttons.

    * frontends/qt4/QTocDialog.[Ch]: add automatic slots

    * frontends/qt4/QTocDialog.[Ch]: add "enableButtons(bool)"

    * frontends/qt4/ui/QTocUi.ui: add pushbuttons

    * frontends/qt4/QToc.[Ch]: add move* methods.

The following Qt4 equivalent changes to revision r13521 are not done yet:
    * frontends/qt2/QToc.[Ch]: add move* method.
    (QToc::updateToc):
    (QToc::select): add code for TOC window positioning, and
    outlining methods



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13530 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-03-29 16:57:47 +00:00
parent 9063a63083
commit 5a4d33d97e
5 changed files with 253 additions and 118 deletions

View File

@ -70,5 +70,33 @@ void QToc::select(string const & text)
controller().goTo(*iter);
}
void QToc::moveUp()
{
controller().outline(toc::UP);
update_contents();
}
void QToc::moveDown()
{
controller().outline(toc::DOWN);
update_contents();
}
void QToc::moveIn()
{
controller().outline(toc::IN);
update_contents();
}
void QToc::moveOut()
{
controller().outline(toc::OUT);
update_contents();
}
} // namespace frontend
} // namespace lyx

View File

@ -35,6 +35,11 @@ public:
/// return the toc list
lyx::toc::Toc & get_toclist() { return toclist;}
void moveUp();
void moveDown();
void moveIn();
void moveOut();
private:
/// select an entry

View File

@ -63,6 +63,43 @@ QTocDialog::~QTocDialog()
{
}
void QTocDialog::on_moveUpPB_clicked()
{
enableButtons(false);
form_->moveUp();
enableButtons();
}
void QTocDialog::on_moveDownPB_clicked()
{
enableButtons(false);
form_->moveDown();
enableButtons();
}
void QTocDialog::on_moveInPB_clicked()
{
enableButtons(false);
form_->moveIn();
enableButtons();
}
void QTocDialog::on_moveOutPB_clicked()
{
enableButtons(false);
form_->moveOut();
enableButtons();
}
void QTocDialog::enableButtons(bool enable)
{
moveUpPB->setEnabled(enable);
moveDownPB->setEnabled(enable);
moveInPB->setEnabled(enable);
moveOutPB->setEnabled(enable);
updatePB->setEnabled(enable);
}
void QTocDialog::updateType()
{
typeCO->clear();

View File

@ -44,8 +44,17 @@ public slots:
void depth_adaptor(int);
void select_adaptor(QTreeWidgetItem *);
void update_adaptor();
protected slots:
void on_moveUpPB_clicked();
void on_moveDownPB_clicked();
void on_moveInPB_clicked();
void on_moveOutPB_clicked();
protected:
void enableButtons(bool enable = true);
void closeEvent(QCloseEvent * e);
private:
void populateItem(QTreeWidgetItem * parentItem, toc::Toc::const_iterator& iter);

View File

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>357</width>
<height>313</height>
<width>358</width>
<height>351</height>
</rect>
</property>
<property name="windowTitle" >
@ -18,124 +18,180 @@
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
<widget class="QWidget" name="" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="typeLA" >
<property name="text" >
<string>&amp;Type:</string>
</property>
<property name="buddy" >
<cstring>typeCO</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="typeCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QSlider" name="depthSL" >
<property name="geometry" >
<rect>
<x>11</x>
<y>248</y>
<width>335</width>
<height>21</height>
</rect>
</property>
<property name="spacing" >
<number>6</number>
<property name="maximum" >
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="typeLA" >
<property name="text" >
<string>&amp;Type:</string>
</property>
<property name="buddy" >
<cstring>typeCO</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="typeCO" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="tocTW" />
</item>
<item>
<widget class="QSlider" name="depthSL" >
<property name="maximum" >
<number>5</number>
</property>
<property name="pageStep" >
<number>1</number>
</property>
<property name="value" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="updatePB" >
<property name="text" >
<string>&amp;Update</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closePB" >
<property name="text" >
<string>&amp;Close</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<property name="pageStep" >
<number>1</number>
</property>
<property name="value" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QWidget" name="" >
<property name="geometry" >
<rect>
<x>20</x>
<y>280</y>
<width>328</width>
<height>27</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QPushButton" name="moveUpPB" >
<property name="text" >
<string>&amp;Up</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="moveDownPB" >
<property name="text" >
<string>&amp;Down</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="moveOutPB" >
<property name="text" >
<string>&amp;Out</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="moveInPB" >
<property name="text" >
<string>&amp;In</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="" >
<property name="geometry" >
<rect>
<x>140</x>
<y>320</y>
<width>208</width>
<height>27</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="2" >
<widget class="QPushButton" name="closePB" >
<property name="text" >
<string>&amp;Close</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="updatePB" >
<property name="text" >
<string>&amp;Update</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QTreeWidget" name="tocTW" >
<property name="geometry" >
<rect>
<x>11</x>
<y>39</y>
<width>331</width>
<height>203</height>
</rect>
</property>
</widget>
</widget>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<resources/>