Implement selectAll and keyboard shortcut (#1106)

This commit is contained in:
David Mitchell
2021-02-06 18:01:45 -08:00
committed by GitHub
parent 013c0f1169
commit aee943af5d
3 changed files with 23 additions and 0 deletions

View File

@@ -1036,6 +1036,19 @@ void CaptureWidget::resizeDown()
adjustSelection(QMargins(0, 0, 0, 1));
}
void CaptureWidget::selectAll()
{
QRect newGeometry = rect();
m_selection->setGeometry(newGeometry);
m_context.selection = extendedRect(&newGeometry);
m_selection->setVisible(true);
m_showInitialMsg = false;
m_buttonHandler->updatePosition(m_selection->geometry());
updateSizeIndicator();
m_buttonHandler->show();
update();
}
void CaptureWidget::initShortcuts()
{
QString shortcut = ConfigHandler().shortcut(
@@ -1097,6 +1110,10 @@ void CaptureWidget::initShortcuts()
this,
SLOT(commitCurrentTool()));
new QShortcut(QKeySequence(ConfigHandler().shortcut("TYPE_SELECT_ALL")),
this,
SLOT(selectAll()));
new QShortcut(Qt::Key_Escape, this, SLOT(deleteToolwidgetOrClose()));
}