mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
improvements to the Shortcuts UI.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24412 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2a96bf93b2
commit
5084d54f41
@ -1972,7 +1972,6 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form, QWidget * parent)
|
||||
shortcutsTW->setSortingEnabled(true);
|
||||
// Multi-selection can be annoying.
|
||||
// shortcutsTW->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
shortcutsTW->header()->resizeSection(0, 200);
|
||||
|
||||
connect(bindFilePB, SIGNAL(clicked()),
|
||||
this, SLOT(select_bind()));
|
||||
@ -2085,6 +2084,9 @@ void PrefShortcuts::updateShortcutsTW()
|
||||
shortcutsTW->sortItems(0, Qt::AscendingOrder);
|
||||
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
|
||||
removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty());
|
||||
modifyPB->setEnabled(!items.isEmpty());
|
||||
|
||||
shortcutsTW->resizeColumnToContents(0);
|
||||
}
|
||||
|
||||
|
||||
@ -2178,6 +2180,7 @@ void PrefShortcuts::on_shortcutsTW_itemSelectionChanged()
|
||||
{
|
||||
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
|
||||
removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty());
|
||||
modifyPB->setEnabled(!items.isEmpty());
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
|
||||
@ -2190,13 +2193,17 @@ void PrefShortcuts::on_shortcutsTW_itemSelectionChanged()
|
||||
|
||||
|
||||
void PrefShortcuts::on_shortcutsTW_itemDoubleClicked()
|
||||
{
|
||||
modifyShortcut();
|
||||
}
|
||||
|
||||
|
||||
void PrefShortcuts::modifyShortcut()
|
||||
{
|
||||
QTreeWidgetItem * item = shortcutsTW->currentItem();
|
||||
if (item->flags() & Qt::ItemIsSelectable) {
|
||||
shortcut_->lfunLE->setText(item->text(0));
|
||||
// clear the shortcut because I assume that a user will enter
|
||||
// a new shortcut.
|
||||
shortcut_->shortcutLE->reset();
|
||||
shortcut_->shortcutLE->setText(item->text(1));
|
||||
shortcut_->shortcutLE->setFocus();
|
||||
shortcut_->exec();
|
||||
}
|
||||
@ -2215,6 +2222,12 @@ void PrefShortcuts::select_bind()
|
||||
}
|
||||
|
||||
|
||||
void PrefShortcuts::on_modifyPB_pressed()
|
||||
{
|
||||
modifyShortcut();
|
||||
}
|
||||
|
||||
|
||||
void PrefShortcuts::on_newPB_pressed()
|
||||
{
|
||||
shortcut_->lfunLE->clear();
|
||||
|
@ -399,6 +399,7 @@ public:
|
||||
void apply(LyXRC & rc) const;
|
||||
void update(LyXRC const & rc);
|
||||
void updateShortcutsTW();
|
||||
void modifyShortcut();
|
||||
///
|
||||
void setItemType(QTreeWidgetItem * item, item_type tag);
|
||||
QTreeWidgetItem * insertShortcutItem(FuncRequest const & lfun,
|
||||
@ -406,6 +407,7 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void select_bind();
|
||||
void on_modifyPB_pressed();
|
||||
void on_newPB_pressed();
|
||||
void on_removePB_pressed();
|
||||
void on_searchLE_textEdited();
|
||||
|
@ -27,6 +27,73 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0" colspan="3" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="modifyPB" >
|
||||
<property name="text" >
|
||||
<string>&Modify</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removePB" >
|
||||
<property name="text" >
|
||||
<string>Remo&ve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newPB" >
|
||||
<property name="text" >
|
||||
<string>Ne&w</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3" >
|
||||
<widget class="QTreeWidget" name="shortcutsTW" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="bindFileED" />
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="bindFilePB" >
|
||||
<property name="text" >
|
||||
<string>Br&owse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="bindFileLA" >
|
||||
<property name="text" >
|
||||
<string>&Bind file:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>bindFileED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
@ -50,66 +117,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="bindFileLA" >
|
||||
<property name="text" >
|
||||
<string>&Bind file:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>bindFileED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="bindFilePB" >
|
||||
<property name="text" >
|
||||
<string>Br&owse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="bindFileED" />
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3" >
|
||||
<widget class="QTreeWidget" name="shortcutsTW" />
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<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>Remo&ve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newPB" >
|
||||
<property name="text" >
|
||||
<string>Ne&w</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -1,7 +1,4 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>shortcutUi</class>
|
||||
<widget class="QDialog" name="shortcutUi" >
|
||||
<property name="geometry" >
|
||||
@ -31,7 +28,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Enter BibTeX database name</string>
|
||||
<string>Type shortcut while the cursor is in this field</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
@ -41,7 +38,7 @@
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="lfunLE" >
|
||||
<property name="toolTip" >
|
||||
<string>Enter BibTeX database name</string>
|
||||
<string>Enter LyX function or command sequence</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
@ -51,21 +48,27 @@
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="clearPB" >
|
||||
<property name="text" >
|
||||
<string>Clear</string>
|
||||
<string>C&lear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lfunLBL" >
|
||||
<property name="text" >
|
||||
<string>Function:</string>
|
||||
<string>&Function:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>lfunLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="shortcutLBL" >
|
||||
<property name="text" >
|
||||
<string>Shortcut</string>
|
||||
<string>&Shortcut:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>shortcutLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -120,14 +123,11 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lyx::frontend::ShortcutLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>CustomizedWidgets.h</header>
|
||||
<container>0</container>
|
||||
<pixmap></pixmap>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
Loading…
x
Reference in New Issue
Block a user