From 608236c0db2d4be30157eff907d29f86463a123b Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Mon, 29 Oct 2007 08:56:30 +0000 Subject: [PATCH] - add label and remove subclassed SearchLineEdit - 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 | 25 +--- src/frontends/qt4/CustomizedWidgets.h | 20 +-- src/frontends/qt4/GuiPrefs.cpp | 4 +- src/frontends/qt4/GuiPrefs.h | 2 +- src/frontends/qt4/ui/PrefShortcutsUi.ui | 163 +++++++++++++----------- src/frontends/qt4/ui/ShortcutUi.ui | 76 +++++------ 6 files changed, 131 insertions(+), 159 deletions(-) diff --git a/src/frontends/qt4/CustomizedWidgets.cpp b/src/frontends/qt4/CustomizedWidgets.cpp index a653fdf0b6..32c09f7793 100644 --- a/src/frontends/qt4/CustomizedWidgets.cpp +++ b/src/frontends/qt4/CustomizedWidgets.cpp @@ -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" diff --git a/src/frontends/qt4/CustomizedWidgets.h b/src/frontends/qt4/CustomizedWidgets.h index 495f56a3d1..6b3226c3e4 100644 --- a/src/frontends/qt4/CustomizedWidgets.h +++ b/src/frontends/qt4/CustomizedWidgets.h @@ -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 diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 40d7a7785a..9fd303de60 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -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); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 9a8520e447..0eff31969a 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -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(); diff --git a/src/frontends/qt4/ui/PrefShortcutsUi.ui b/src/frontends/qt4/ui/PrefShortcutsUi.ui index 9854b41539..44ad762ac9 100644 --- a/src/frontends/qt4/ui/PrefShortcutsUi.ui +++ b/src/frontends/qt4/ui/PrefShortcutsUi.ui @@ -1,4 +1,7 @@ + + + PrefShortcuts @@ -6,7 +9,7 @@ 0 0 409 - 418 + 494 @@ -27,58 +30,79 @@ 6 - - - - Qt::Vertical + + + + 0 - - QSizePolicy::Expanding + + 6 - - - 51 - 83 - - - + + + + Show commands containing: + + + searchLE + + + + + + + - - - - Qt::Vertical + + + + <- Clea&r - - QSizePolicy::Expanding + + + + + + 0 - - - 51 - 83 - + + 6 - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Remove + + + + + + + New + + + + + + + - - - - - - - Remove - - - - - - - New - - - @@ -96,44 +120,37 @@ - - - - Shortcuts: - - - - - - - - 1 - 0 - 0 - 0 - - - - Search ... - - - - - - SearchLineEdit - QLineEdit -
CustomizedWidgets.h
-
-
+ bindFileED bindFilePB + searchLE + shortcutsTW + removePB + newPB qt_helpers.h - + + + pushButton + clicked() + searchLE + clear() + + + 349 + 52 + + + 265 + 52 + + + +
diff --git a/src/frontends/qt4/ui/ShortcutUi.ui b/src/frontends/qt4/ui/ShortcutUi.ui index f3571f5f63..9b9eb9d59e 100644 --- a/src/frontends/qt4/ui/ShortcutUi.ui +++ b/src/frontends/qt4/ui/ShortcutUi.ui @@ -1,22 +1,17 @@ + + + shortcutUi 0 0 - 277 - 147 + 348 + 106 - - - 1 - 1 - 0 - 0 - - Edit shortcut @@ -30,16 +25,21 @@ 6 + + + + true + + + Enter BibTeX database name + + + + + + - - - 7 - 0 - 0 - 0 - - Enter BibTeX database name @@ -55,13 +55,6 @@ - - - - Shortcut - - - @@ -69,6 +62,13 @@ + + + + Shortcut + + + @@ -118,34 +118,16 @@ - - - - true - - - - 13 - 13 - 0 - 0 - - - - Enter BibTeX database name - - - - - - + - ShortcutLineEdit + lyx::frontend::ShortcutLineEdit QLineEdit
CustomizedWidgets.h
+ 0 +