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()));
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);
}
{
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
removePB->setEnabled(!items.isEmpty() && !items[0]->text(1).isEmpty());
+ modifyPB->setEnabled(!items.isEmpty());
if (items.isEmpty())
return;
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();
}
}
+void PrefShortcuts::on_modifyPB_pressed()
+{
+ modifyShortcut();
+}
+
+
void PrefShortcuts::on_newPB_pressed()
{
shortcut_->lfunLE->clear();
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,
public Q_SLOTS:
void select_bind();
+ void on_modifyPB_pressed();
void on_newPB_pressed();
void on_removePB_pressed();
void on_searchLE_textEdited();
<property name="spacing" >
<number>6</number>
</property>
- <item row="1" column="0" colspan="3" >
+ <item row="3" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<number>6</number>
</property>
<item>
- <widget class="QLabel" name="shortcutsLBL" >
+ <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>Show ke&y-bindings containing:</string>
+ <string>&Modify</string>
</property>
- <property name="buddy" >
- <cstring>searchLE</cstring>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removePB" >
+ <property name="text" >
+ <string>Remo&ve</string>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="searchLE" />
+ <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" >
</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" >
+ <item row="1" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<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" >
+ <widget class="QLabel" name="shortcutsLBL" >
<property name="text" >
- <string>Remo&ve</string>
+ <string>Show ke&y-bindings containing:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>searchLE</cstring>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="newPB" >
- <property name="text" >
- <string>Ne&w</string>
- </property>
- </widget>
+ <widget class="QLineEdit" name="searchLE" />
</item>
</layout>
</item>
<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
<class>shortcutUi</class>
<widget class="QDialog" name="shortcutUi" >
<property name="geometry" >
<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/>
<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/>
<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>
</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>