]> git.lyx.org Git - features.git/commitdiff
- add label and remove subclassed SearchLineEdit
authorEdwin Leuven <e.leuven@gmail.com>
Mon, 29 Oct 2007 08:56:30 +0000 (08:56 +0000)
committerEdwin Leuven <e.leuven@gmail.com>
Mon, 29 Oct 2007 08:56:30 +0000 (08:56 +0000)
- put ShortcutLineEdit in namespace lyx::frontend
- additional dialog layout tweaks

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

src/frontends/qt4/CustomizedWidgets.cpp
src/frontends/qt4/CustomizedWidgets.h
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/ui/PrefShortcutsUi.ui
src/frontends/qt4/ui/ShortcutUi.ui

index a653fdf0b6737e1624c8e28e9f430a81e22cdf71..32c09f779384f2898a319e2df55074cb1fac3b7f 100644 (file)
@@ -36,6 +36,9 @@ using lyx::KeySequence;
 using lyx::KeyModifier;
 using lyx::toqstr;
 
+namespace lyx {
+namespace frontend {
+
 ShortcutLineEdit::ShortcutLineEdit(QWidget * parent)
        : QLineEdit(parent), keysequence_()
 {
@@ -128,25 +131,7 @@ void ShortcutLineEdit::appendToSequence(QKeyEvent * e)
        keysequence_.addkey(sym, mod, lyx::NoModifier);
 }
 
-
-QString const SearchLineEdit::hintMessage() const
-{
-       return toqstr("Search ...");
-}
-
-
-void SearchLineEdit::focusInEvent(QFocusEvent * e)
-{
-       if (text() == hintMessage())
-               clear();
-}
-
-
-void SearchLineEdit::focusOutEvent(QFocusEvent * e)
-{
-       if (text().isEmpty())
-               setText(hintMessage());
-}
-
+} // namespace frontend
+} // namespace lyx
 
 #include "CustomizedWidgets_moc.cpp"
index 495f56a3d1eefa61a35a4280bf731f9f1df3ecdf..6b3226c3e4f20821ca0d6ec6a6879bd057a5a7d8 100644 (file)
@@ -19,6 +19,9 @@
 class QEvent;
 class QKeyEvent;
 
+namespace lyx {
+namespace frontend {
+
 /**
  * A lineedit for inputting shortcuts
  */
@@ -38,20 +41,7 @@ private:
        bool has_cursor_;
 };
 
-
-/**
-  * A lineedit that displays a hint message when there is no
-  * text and not under focus.
-  */
-class SearchLineEdit : public QLineEdit {
-       Q_OBJECT
-public:
-       QString const hintMessage() const;
-       SearchLineEdit(QWidget * parent) : QLineEdit(parent) {}
-protected Q_SLOTS:
-       void focusInEvent(QFocusEvent * e);
-       void focusOutEvent(QFocusEvent * e);
-};
-
+} // namespace frontend
+} // namespace lyx
 
 #endif // CUSTOMIZEDWIDGETS_H
index 40d7a7785a7adc9047cf7a5fd0a8761959d01657..9fd303de60f5658432cb0099e940f82c8569c92c 100644 (file)
@@ -2021,10 +2021,8 @@ void PrefShortcuts::on_removePB_pressed()
 }
 
 
-void PrefShortcuts::on_searchLE_textChanged()
+void PrefShortcuts::on_searchLE_textEdited()
 {
-       if (searchLE->text() == searchLE->hintMessage())
-               return;
        if (searchLE->text().isEmpty()) {
                // show all hidden items
                QTreeWidgetItemIterator it(shortcutsTW, QTreeWidgetItemIterator::Hidden);
index 9a8520e44732f0802b382e545e1e569665073b14..0eff31969a661754d75e8906404f6586a829b359 100644 (file)
@@ -382,7 +382,7 @@ public Q_SLOTS:
        void select_bind();
        void on_newPB_pressed();
        void on_removePB_pressed();
-       void on_searchLE_textChanged();
+       void on_searchLE_textEdited();
        ///
        void on_shortcutsTW_itemSelectionChanged();
        void shortcut_okPB_pressed();
index 9854b4153904964ae8aaef30317062cfb94bb314..44ad762ac9b72fdcbc24fb4c123593691a9a97d7 100644 (file)
@@ -1,4 +1,7 @@
 <ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
  <class>PrefShortcuts</class>
  <widget class="QWidget" name="PrefShortcuts" >
   <property name="geometry" >
@@ -6,7 +9,7 @@
     <x>0</x>
     <y>0</y>
     <width>409</width>
-    <height>418</height>
+    <height>494</height>
    </rect>
   </property>
   <property name="sizePolicy" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="6" column="2" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
+   <item row="1" column="0" colspan="2" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
      </property>
-     <property name="sizeHint" >
-      <size>
-       <width>51</width>
-       <height>83</height>
-      </size>
+     <property name="spacing" >
+      <number>6</number>
      </property>
-    </spacer>
+     <item>
+      <widget class="QLabel" name="shortcutsLBL" >
+       <property name="text" >
+        <string>Show commands containing:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>searchLE</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="searchLE" />
+     </item>
+    </layout>
    </item>
-   <item row="4" column="2" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
+   <item row="1" column="2" >
+    <widget class="QPushButton" name="pushButton" >
+     <property name="text" >
+      <string>&lt;- Clea&amp;r</string>
      </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="3" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
      </property>
-     <property name="sizeHint" >
-      <size>
-       <width>51</width>
-       <height>83</height>
-      </size>
+     <property name="spacing" >
+      <number>6</number>
      </property>
-    </spacer>
-   </item>
-   <item row="0" column="1" >
-    <widget class="QLineEdit" name="bindFileED" />
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="removePB" >
+       <property name="text" >
+        <string>&amp;Remove</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="newPB" >
+       <property name="text" >
+        <string>New</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
-   <item rowspan="5" row="2" column="0" colspan="2" >
+   <item row="2" column="0" colspan="3" >
     <widget class="QTreeWidget" name="shortcutsTW" />
    </item>
-   <item row="3" column="2" >
-    <widget class="QPushButton" name="removePB" >
-     <property name="text" >
-      <string>Remove</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="2" >
-    <widget class="QPushButton" name="newPB" >
-     <property name="text" >
-      <string>New</string>
-     </property>
-    </widget>
+   <item row="0" column="1" >
+    <widget class="QLineEdit" name="bindFileED" />
    </item>
    <item row="0" column="2" >
     <widget class="QPushButton" name="bindFilePB" >
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="2" >
-    <widget class="QLabel" name="shortcutsLBL" >
-     <property name="text" >
-      <string>Shortcuts:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="2" >
-    <widget class="SearchLineEdit" name="searchLE" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>1</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text" >
-      <string>Search ...</string>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>SearchLineEdit</class>
-   <extends>QLineEdit</extends>
-   <header>CustomizedWidgets.h</header>
-  </customwidget>
- </customwidgets>
+ <pixmapfunction></pixmapfunction>
  <tabstops>
   <tabstop>bindFileED</tabstop>
   <tabstop>bindFilePB</tabstop>
+  <tabstop>searchLE</tabstop>
+  <tabstop>shortcutsTW</tabstop>
+  <tabstop>removePB</tabstop>
+  <tabstop>newPB</tabstop>
  </tabstops>
  <includes>
   <include location="local" >qt_helpers.h</include>
  </includes>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>pushButton</sender>
+   <signal>clicked()</signal>
+   <receiver>searchLE</receiver>
+   <slot>clear()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>349</x>
+     <y>52</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>265</x>
+     <y>52</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
index f3571f5f6329290071ffc12243ceb6bc401062f8..9b9eb9d59e33506f0acaf21dc564a7bb99c4b745 100644 (file)
@@ -1,22 +1,17 @@
 <ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
  <class>shortcutUi</class>
  <widget class="QDialog" name="shortcutUi" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>277</width>
-    <height>147</height>
+    <width>348</width>
+    <height>106</height>
    </rect>
   </property>
-  <property name="sizePolicy" >
-   <sizepolicy>
-    <hsizetype>1</hsizetype>
-    <vsizetype>1</vsizetype>
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
   <property name="windowTitle" >
    <string>Edit shortcut</string>
   </property>
    <property name="spacing" >
     <number>6</number>
    </property>
+   <item row="1" column="1" >
+    <widget class="lyx::frontend::ShortcutLineEdit" name="shortcutLE" >
+     <property name="enabled" >
+      <bool>true</bool>
+     </property>
+     <property name="toolTip" >
+      <string>Enter BibTeX database name</string>
+     </property>
+     <property name="text" >
+      <string/>
+     </property>
+    </widget>
+   </item>
    <item row="0" column="1" colspan="2" >
     <widget class="QLineEdit" name="lfunLE" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>7</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
      <property name="toolTip" >
       <string>Enter BibTeX database name</string>
      </property>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" >
-    <widget class="QLabel" name="shortcutLBL" >
+   <item row="0" column="0" >
+    <widget class="QLabel" name="lfunLBL" >
      <property name="text" >
-      <string>Shortcut</string>
+      <string>Function:</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="0" >
-    <widget class="QLabel" name="lfunLBL" >
+   <item row="1" column="0" >
+    <widget class="QLabel" name="shortcutLBL" >
      <property name="text" >
-      <string>Function:</string>
+      <string>Shortcut</string>
      </property>
     </widget>
    </item>
      </item>
     </layout>
    </item>
-   <item row="1" column="1" >
-    <widget class="ShortcutLineEdit" name="shortcutLE" >
-     <property name="enabled" >
-      <bool>true</bool>
-     </property>
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>13</hsizetype>
-       <vsizetype>13</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="toolTip" >
-      <string>Enter BibTeX database name</string>
-     </property>
-     <property name="text" >
-      <string/>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
+ <pixmapfunction></pixmapfunction>
  <customwidgets>
   <customwidget>
-   <class>ShortcutLineEdit</class>
+   <class>lyx::frontend::ShortcutLineEdit</class>
    <extends>QLineEdit</extends>
    <header>CustomizedWidgets.h</header>
+   <container>0</container>
+   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
  <tabstops>