]> git.lyx.org Git - lyx.git/commitdiff
* src/frontends/qt4/PanelStack.{cpp, h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Wed, 19 Mar 2008 18:15:16 +0000 (18:15 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Wed, 19 Mar 2008 18:15:16 +0000 (18:15 +0000)
- fix issues with clicking and keyboard movement

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23834 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/PanelStack.cpp
src/frontends/qt4/PanelStack.h
src/frontends/qt4/ui/FontUi.ui

index 08a24e7585b8a41acdb4f37413248b3dc4fd1af9..145da5b9b2763a403c6596f05085a0522ee4ecd7 100644 (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,19 +115,28 @@ 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);
-               list_->setCurrentItem(item->child(0));
+               if (previous != item->child(0))
+                       list_->setCurrentItem(item->child(0));
        }
        if (QWidget * w = widget_map_.value(item, 0))
                stack_->setCurrentWidget(w);
 }
 
 
+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(),
index 45ca24bb25719d28723d943787c9ff381a9cb54a..fa32a54e44bbc507a8816677c564ae32b716e87b 100644 (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:
        ///
index 7f072a195a22386ada6838af3f362321d74d4258..5572acbc7a0d9e0e4c04482477e57a6fd904330e 100644 (file)
    <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>
-   </property>
-   <property name="spacing" >
-    <number>6</number>
-   </property>
-   <item row="7" column="0" colspan="4" >
-    <spacer>
+   <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="text" >
+      <string>Use &amp;XeTeX</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="5" >
+    <widget class="Line" name="line" >
      <property name="orientation" >
-      <enum>Qt::Vertical</enum>
+      <enum>Qt::Horizontal</enum>
      </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
+    </widget>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QLabel" name="fontsDefaultLA" >
+     <property name="text" >
+      <string>&amp;Default Family:</string>
      </property>
-     <property name="sizeHint" >
-      <size>
-       <width>391</width>
-       <height>21</height>
-      </size>
+     <property name="buddy" >
+      <cstring>fontsDefaultCO</cstring>
      </property>
-    </spacer>
+    </widget>
+   </item>
+   <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="buddy" >
+      <cstring>fontsizeCO</cstring>
+     </property>
+    </widget>
    </item>
-   <item row="2" column="2" colspan="2" >
+   <item row="2" column="4" >
+    <widget class="QComboBox" name="fontsizeCO" />
+   </item>
+   <item row="3" column="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>131</width>
-       <height>20</height>
+       <width>182</width>
+       <height>16</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="4" column="3" >
-    <widget class="QSpinBox" name="scaleTypewriterSB" >
-     <property name="maximum" >
-      <number>200</number>
+   <item row="4" column="0" >
+    <widget class="QLabel" name="fontsRomanLA" >
+     <property name="text" >
+      <string>&amp;Roman:</string>
      </property>
-     <property name="minimum" >
-      <number>10</number>
+     <property name="buddy" >
+      <cstring>fontsRomanCO</cstring>
      </property>
     </widget>
    </item>
    <item row="4" column="2" >
-    <widget class="QLabel" name="scaleTypewriterLA" >
-     <property name="text" >
-      <string>Sc&amp;ale (%):</string>
+    <widget class="QComboBox" name="fontsRomanCO" />
+   </item>
+   <item row="4" column="3" colspan="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
      </property>
-     <property name="buddy" >
-      <cstring>scaleTypewriterSB</cstring>
+     <property name="sizeHint" >
+      <size>
+       <width>131</width>
+       <height>20</height>
+      </size>
      </property>
-    </widget>
-   </item>
-   <item row="4" column="1" >
-    <widget class="QComboBox" name="fontsTypewriterCO" />
+    </spacer>
    </item>
-   <item row="4" column="0" >
-    <widget class="QLabel" name="fontsTypewriterLA" >
+   <item row="5" column="0" >
+    <widget class="QLabel" name="fontsSansLA" >
      <property name="text" >
-      <string>&amp;Typewriter:</string>
+      <string>&amp;Sans Serif:</string>
      </property>
      <property name="buddy" >
-      <cstring>fontsTypewriterCO</cstring>
+      <cstring>fontsSansCO</cstring>
      </property>
     </widget>
    </item>
-   <item row="2" column="1" >
-    <widget class="QComboBox" name="fontsRomanCO" />
+   <item row="5" column="2" >
+    <widget class="QComboBox" name="fontsSansCO" />
    </item>
-   <item row="2" column="0" >
-    <widget class="QLabel" name="fontsRomanLA" >
+   <item row="5" column="3" >
+    <widget class="QLabel" name="scaleSansLA" >
      <property name="text" >
-      <string>&amp;Roman:</string>
+      <string>S&amp;cale (%):</string>
      </property>
      <property name="buddy" >
-      <cstring>fontsRomanCO</cstring>
+      <cstring>scaleSansSB</cstring>
      </property>
     </widget>
    </item>
-   <item row="3" column="3" >
+   <item row="5" column="4" >
     <widget class="QSpinBox" name="scaleSansSB" >
-     <property name="maximum" >
-      <number>200</number>
-     </property>
      <property name="minimum" >
       <number>10</number>
      </property>
+     <property name="maximum" >
+      <number>200</number>
+     </property>
     </widget>
    </item>
-   <item row="3" column="2" >
-    <widget class="QLabel" name="scaleSansLA" >
+   <item row="6" column="0" >
+    <widget class="QLabel" name="fontsTypewriterLA" >
      <property name="text" >
-      <string>S&amp;cale (%):</string>
+      <string>&amp;Typewriter:</string>
      </property>
      <property name="buddy" >
-      <cstring>scaleSansSB</cstring>
+      <cstring>fontsTypewriterCO</cstring>
      </property>
     </widget>
    </item>
-   <item row="3" column="1" >
-    <widget class="QComboBox" name="fontsSansCO" />
+   <item row="6" column="2" >
+    <widget class="QComboBox" name="fontsTypewriterCO" />
    </item>
-   <item row="3" column="0" >
-    <widget class="QLabel" name="fontsSansLA" >
+   <item row="6" column="3" >
+    <widget class="QLabel" name="scaleTypewriterLA" >
      <property name="text" >
-      <string>&amp;Sans Serif:</string>
+      <string>Sc&amp;ale (%):</string>
      </property>
      <property name="buddy" >
-      <cstring>fontsSansCO</cstring>
+      <cstring>scaleTypewriterSB</cstring>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>182</width>
-       <height>16</height>
-      </size>
+   <item row="6" column="4" >
+    <widget class="QSpinBox" name="scaleTypewriterSB" >
+     <property name="minimum" >
+      <number>10</number>
      </property>
-    </spacer>
-   </item>
-   <item row="6" column="1" >
-    <widget class="QCheckBox" name="fontOsfCB" >
-     <property name="text" >
-      <string>Use &amp;Old Style Figures</string>
+     <property name="maximum" >
+      <number>200</number>
      </property>
     </widget>
    </item>
-   <item row="5" column="1" >
+   <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>