* src/frontends/qt4/PanelStack.{cpp, h}:

- fix issues with clicking and keyboard movement

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23834 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-03-19 18:15:16 +00:00
parent 6998b9a47c
commit ce09085156
3 changed files with 146 additions and 122 deletions

View File

@ -48,6 +48,8 @@ PanelStack::PanelStack(QWidget * parent)
connect(list_, SIGNAL(currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(switchPanel(QTreeWidgetItem *, QTreeWidgetItem*)));
connect(list_, SIGNAL(itemClicked (QTreeWidgetItem*, int)),
this, SLOT(itemSelected(QTreeWidgetItem *, int)));
QHBoxLayout * layout = new QHBoxLayout(this);
layout->addWidget(list_, 0);
@ -113,12 +115,13 @@ void PanelStack::setCurrentPanel(QString const & name)
void PanelStack::switchPanel(QTreeWidgetItem * item,
QTreeWidgetItem * /*previous*/)
QTreeWidgetItem * previous)
{
// if we have a category, expand the tree and go to the
// first item
if (item->childCount() > 0) {
item->setExpanded(true);
if (previous != item->child(0))
list_->setCurrentItem(item->child(0));
}
if (QWidget * w = widget_map_.value(item, 0))
@ -126,6 +129,14 @@ void PanelStack::switchPanel(QTreeWidgetItem * item,
}
void PanelStack::itemSelected(QTreeWidgetItem * item, int)
{
// de-select the category if a child is selected
if (item->childCount() > 0 && item->child(0)->isSelected())
item->setSelected(false);
}
QSize PanelStack::sizeHint() const
{
return QSize(list_->width() + stack_->width(),

View File

@ -43,6 +43,8 @@ public:
public Q_SLOTS:
/// set current panel from an item
void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
/// click on the tree
void itemSelected(QTreeWidgetItem *, int);
private:
///

View File

@ -5,129 +5,58 @@
<rect>
<x>0</x>
<y>0</y>
<width>409</width>
<height>232</height>
<width>497</width>
<height>299</height>
</rect>
</property>
<property name="windowTitle" >
<string>FontUi</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
<item row="0" column="0" >
<widget class="QCheckBox" name="xetexCB" >
<property name="toolTip" >
<string>Use the XeTeX processor, which allows access to all system fonts</string>
</property>
<property name="spacing" >
<number>6</number>
<property name="text" >
<string>Use &amp;XeTeX</string>
</property>
<item row="7" column="0" colspan="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>391</width>
<height>21</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="2" column="2" colspan="2" >
<spacer>
<item row="1" column="0" colspan="5" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="3" >
<widget class="QSpinBox" name="scaleTypewriterSB" >
<property name="maximum" >
<number>200</number>
</property>
<property name="minimum" >
<number>10</number>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QLabel" name="scaleTypewriterLA" >
<property name="text" >
<string>Sc&amp;ale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleTypewriterSB</cstring>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QComboBox" name="fontsTypewriterCO" />
</item>
<item row="4" column="0" >
<widget class="QLabel" name="fontsTypewriterLA" >
<property name="text" >
<string>&amp;Typewriter:</string>
</property>
<property name="buddy" >
<cstring>fontsTypewriterCO</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QComboBox" name="fontsRomanCO" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="fontsRomanLA" >
<widget class="QLabel" name="fontsDefaultLA" >
<property name="text" >
<string>&amp;Roman:</string>
<string>&amp;Default Family:</string>
</property>
<property name="buddy" >
<cstring>fontsRomanCO</cstring>
<cstring>fontsDefaultCO</cstring>
</property>
</widget>
</item>
<item row="3" column="3" >
<widget class="QSpinBox" name="scaleSansSB" >
<property name="maximum" >
<number>200</number>
<item row="2" column="2" >
<widget class="QComboBox" name="fontsDefaultCO" />
</item>
<item row="2" column="3" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Base Size:</string>
</property>
<property name="minimum" >
<number>10</number>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
</property>
</widget>
</item>
<item row="2" column="4" >
<widget class="QComboBox" name="fontsizeCO" />
</item>
<item row="3" column="2" >
<widget class="QLabel" name="scaleSansLA" >
<property name="text" >
<string>S&amp;cale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleSansSB</cstring>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="fontsSansCO" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="fontsSansLA" >
<property name="text" >
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" >
<cstring>fontsSansCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@ -140,45 +69,127 @@
</property>
</spacer>
</item>
<item row="6" column="1" >
<widget class="QCheckBox" name="fontOsfCB" >
<item row="4" column="0" >
<widget class="QLabel" name="fontsRomanLA" >
<property name="text" >
<string>Use &amp;Old Style Figures</string>
<string>&amp;Roman:</string>
</property>
<property name="buddy" >
<cstring>fontsRomanCO</cstring>
</property>
</widget>
</item>
<item row="5" column="1" >
<item row="4" column="2" >
<widget class="QComboBox" name="fontsRomanCO" />
</item>
<item row="4" column="3" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="fontsSansLA" >
<property name="text" >
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" >
<cstring>fontsSansCO</cstring>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QComboBox" name="fontsSansCO" />
</item>
<item row="5" column="3" >
<widget class="QLabel" name="scaleSansLA" >
<property name="text" >
<string>S&amp;cale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleSansSB</cstring>
</property>
</widget>
</item>
<item row="5" column="4" >
<widget class="QSpinBox" name="scaleSansSB" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>200</number>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="fontsTypewriterLA" >
<property name="text" >
<string>&amp;Typewriter:</string>
</property>
<property name="buddy" >
<cstring>fontsTypewriterCO</cstring>
</property>
</widget>
</item>
<item row="6" column="2" >
<widget class="QComboBox" name="fontsTypewriterCO" />
</item>
<item row="6" column="3" >
<widget class="QLabel" name="scaleTypewriterLA" >
<property name="text" >
<string>Sc&amp;ale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleTypewriterSB</cstring>
</property>
</widget>
</item>
<item row="6" column="4" >
<widget class="QSpinBox" name="scaleTypewriterSB" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>200</number>
</property>
</widget>
</item>
<item row="7" column="2" >
<widget class="QCheckBox" name="fontScCB" >
<property name="text" >
<string>Use true S&amp;mall Caps</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="fontsDefaultLA" >
<item row="8" column="2" >
<widget class="QCheckBox" name="fontOsfCB" >
<property name="text" >
<string>&amp;Default Family:</string>
</property>
<property name="buddy" >
<cstring>fontsDefaultCO</cstring>
<string>Use &amp;Old Style Figures</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QComboBox" name="fontsizeCO" />
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Base Size:</string>
<item row="9" column="0" colspan="5" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="fontsDefaultCO" />
<property name="sizeHint" >
<size>
<width>450</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>