restable: add shortcut to open snippets window (ctrl+e). connections cleanup

This commit is contained in:
Jean-Francois Dockes 2019-11-22 18:22:47 +01:00
parent 021941bf6f
commit fdd653a2cf
2 changed files with 289 additions and 298 deletions

View File

@ -278,11 +278,6 @@ void RclMain::init()
actionShowResultsAsTable->setChecked(prefs.showResultsAsTable);
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
// Must not do this when restable is a child of rclmain
// sc = new QShortcut(quitKeySeq, restable);
// connect(sc, SIGNAL (activated()), this, SLOT (fileExit()));
// A shortcut to get the focus back to the search entry.
QKeySequence seq("Ctrl+Shift+s");
QShortcut *sc = new QShortcut(seq, this);
@ -389,16 +384,8 @@ void RclMain::init()
this, SLOT(docExpand(Rcl::Doc)));
connect(restable, SIGNAL(showSubDocs(Rcl::Doc)),
this, SLOT(showSubDocs(Rcl::Doc)));
connect(restable, SIGNAL(previewRequested(Rcl::Doc)),
this, SLOT(startPreview(Rcl::Doc)));
connect(restable, SIGNAL(editRequested(Rcl::Doc)),
this, SLOT(startNativeViewer(Rcl::Doc)));
connect(restable, SIGNAL(openWithRequested(Rcl::Doc, string)),
this, SLOT(openWith(Rcl::Doc, string)));
connect(restable, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
this, SLOT(saveDocToFile(Rcl::Doc)));
connect(restable, SIGNAL(showSnippets(Rcl::Doc)),
this, SLOT(showSnippets(Rcl::Doc)));
reslist->setRclMain(this, true);
connect(this, SIGNAL(docSourceChanged(std::shared_ptr<DocSequence>)),

View File

@ -512,6 +512,8 @@ void ResTable::init()
new QShortcut(QKeySequence("Ctrl+o"), this, SLOT(menuEdit()));
new QShortcut(QKeySequence("Ctrl+Shift+o"), this, SLOT(menuEditAndQuit()));
new QShortcut(QKeySequence("Ctrl+d"), this, SLOT(menuPreview()));
new QShortcut(QKeySequence("Ctrl+e"), this, SLOT(menuShowSnippets()));
connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(createPopupMenu(const QPoint&)));
@ -543,10 +545,8 @@ void ResTable::init()
ROWHEIGHTPAD);
}
QKeySequence seq("Esc");
QShortcut *sc = new QShortcut(seq, this);
connect(sc, SIGNAL(activated()),
tableView->selectionModel(), SLOT(clear()));
QShortcut *sc = new QShortcut(QKeySequence(Qt::Key_Escape), this);
connect(sc, SIGNAL(activated()), tableView->selectionModel(), SLOT(clear()));
connect(tableView->selectionModel(),
SIGNAL(currentChanged(const QModelIndex&, const QModelIndex &)),
this, SLOT(onTableView_currentChanged(const QModelIndex&)));
@ -609,17 +609,21 @@ void ResTable::setRclMain(RclMain *m, bool ismain)
tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
if (!m_ismainres) {
connect(new QShortcut(closeKeySeq, this), SIGNAL (activated()),
this, SLOT (close()));
connect(new QShortcut(quitKeySeq, this), SIGNAL (activated()),
// don't set this shortcut when we are a child of main, would
// be duplicate/ambiguous
connect(new QShortcut(quitKeySeq, this), SIGNAL(activated()),
m_rclmain, SLOT (fileExit()));
}
new QShortcut(closeKeySeq, this, SLOT (close()));
connect(this, SIGNAL(previewRequested(Rcl::Doc)),
m_rclmain, SLOT(startPreview(Rcl::Doc)));
connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
connect(this, SIGNAL(editRequested(Rcl::Doc)),
m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
}
connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
connect(this, SIGNAL(showSnippets(Rcl::Doc)),
m_rclmain, SLOT(showSnippets(Rcl::Doc)));
}
int ResTable::getDetailDocNumOrTopRow()
@ -638,7 +642,7 @@ void ResTable::makeRowVisible(int row)
tableView->selectionModel()->clear();
m_detail->clear();
m_detaildocnum = -1;
}
}
// This is called by rclmain_w prior to exiting
void ResTable::saveColState()