mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
New shortcut for Copy with Headers and some self-documented shortcuts
Ctrl+H invokes the Copy with Headersers action in the Extended Table Widget as suggested in #1058. The following options in context menu display now their shortcuts: Set to Null, Copy, Copy with Headers and Paste. Some other shortcuts are now displayed in the corresponding tooltips.
This commit is contained in:
@@ -160,8 +160,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>83</width>
|
||||
<height>40</height>
|
||||
<width>98</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@@ -212,6 +212,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonApply">
|
||||
<property name="toolTip">
|
||||
<string>Apply data to cell [Ctrl+Return]</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
|
||||
@@ -95,6 +95,13 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) :
|
||||
m_contextMenu->addAction(pasteAction);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
// This is only for displaying the shortcut in the context menu.
|
||||
// An entry in keyPressEvent is still needed.
|
||||
nullAction->setShortcut(QKeySequence(tr("Alt+Del")));
|
||||
copyAction->setShortcut(QKeySequence::Copy);
|
||||
copyWithHeadersAction->setShortcut(QKeySequence(tr("Ctrl+H")));
|
||||
pasteAction->setShortcut(QKeySequence::Paste);
|
||||
|
||||
// Set up context menu actions
|
||||
connect(this, &QTableView::customContextMenuRequested,
|
||||
[=](const QPoint& pos)
|
||||
@@ -389,11 +396,14 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event)
|
||||
// Call a custom copy method when Ctrl-C is pressed
|
||||
if(event->matches(QKeySequence::Copy))
|
||||
{
|
||||
copy();
|
||||
copy(false);
|
||||
return;
|
||||
} else if(event->matches(QKeySequence::Paste)) {
|
||||
// Call a custom paste method when Ctrl-P is pressed
|
||||
// Call a custom paste method when Ctrl-V is pressed
|
||||
paste();
|
||||
} else if(event->modifiers().testFlag(Qt::ControlModifier) && (event->key() == Qt::Key_H)) {
|
||||
// Call copy with headers when Ctrl-H is pressed
|
||||
copy(true);
|
||||
} else if(event->key() == Qt::Key_Tab && hasFocus() &&
|
||||
selectedIndexes().count() == 1 &&
|
||||
selectedIndexes().at(0).row() == model()->rowCount()-1 && selectedIndexes().at(0).column() == model()->columnCount()-1) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="mainTab">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="structure">
|
||||
<attribute name="title">
|
||||
@@ -130,7 +130,7 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonRefresh">
|
||||
<property name="toolTip">
|
||||
<string>Refresh the data in the selected table.</string>
|
||||
<string>Refresh the data in the selected table [F5, Ctrl+R]</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This button refreshes the data in the currently selected table.</string>
|
||||
|
||||
Reference in New Issue
Block a user