GUI: add shortcut to toggle showing results as table. Default: Ctrl+T

This commit is contained in:
Jean-Francois Dockes 2021-01-27 09:37:44 +01:00
parent 7dd93f7bbf
commit cced5efb45
2 changed files with 14 additions and 0 deletions

View File

@ -350,6 +350,11 @@ void RclMain::onNewShortcuts()
"Ctrl+Shift+S", m_focustosearcholdsc, takeFocus);
SETSHORTCUT(sSearch, tr("Main Window"), tr("Clear Search"),
"Ctrl+S", m_clearsearchsc, clearAll);
// We could set this as an action shortcut, but then, it would not
// be editable
SETSHORTCUT(this, tr("Main Window"), tr("Toggle table display"),
"Ctrl+T", m_toggletablesc, toggleTable);
ks = scb.get(tr("Main Window"), tr("Focus to Result Table"), "Ctrl+R");
if (!ks.isEmpty()) {
delete m_focustotablesc;
@ -1004,6 +1009,13 @@ void RclMain::onSortDataChanged(DocSeqSortSpec spec)
initiateQuery();
}
// Needed only because an action is not a widget, so can't be used
// with SETSHORTCUT
void RclMain::toggleTable()
{
actionShowResultsAsTable->toggle();
}
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
{
LOGDEB("RclMain::on_actionShowResultsAsTable_toggled(" << on << ")\n");

View File

@ -168,6 +168,7 @@ public slots:
virtual void showTrayMessage(const QString& text);
virtual void onSetDescription(QString);
virtual void onNewShortcuts();
virtual void toggleTable();
private slots:
virtual void updateIdxStatus();
@ -220,6 +221,7 @@ private:
QShortcut *m_focustosearchsc{0};
QShortcut *m_focustosearcholdsc{0};
QShortcut *m_clearsearchsc{0};
QShortcut *m_toggletablesc{0};
QFileSystemWatcher m_watcher;
vector<ExecCmd*> m_viewers;
ExecCmd *m_idxproc{0}; // Indexing process