Implement selectAll and keyboard shortcut (#1106)
This commit is contained in:
@@ -39,6 +39,10 @@ const QVector<QStringList>& ConfigShortcuts::captureShortcutsDefault(
|
||||
<< QObject::tr("Resize selection down 1px")
|
||||
<< QKeySequence(Qt::SHIFT + Qt::Key_Down).toString());
|
||||
|
||||
m_shortcuts << (QStringList()
|
||||
<< "TYPE_SELECT_ALL" << QObject::tr("Select entire screen")
|
||||
<< QKeySequence(Qt::CTRL + Qt::Key_A).toString());
|
||||
|
||||
m_shortcuts << (QStringList() << "TYPE_MOVE_LEFT"
|
||||
<< QObject::tr("Move selection left 1px")
|
||||
<< QKeySequence(Qt::Key_Left).toString());
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ private slots:
|
||||
void childEnter();
|
||||
void childLeave();
|
||||
|
||||
void selectAll();
|
||||
|
||||
void resizeLeft();
|
||||
void resizeRight();
|
||||
void resizeUp();
|
||||
|
||||
Reference in New Issue
Block a user