Commit 43306c60 authored by Scott Harvey's avatar Scott Harvey Committed by Henrik Fehlauer

QShortcut: replace 'clickFunc()' with lambda; rename variable to 'takeScreenshotShortcut'

Summary:
Removed `clickFunc()` entirely; replaced with lambda. Renamed `QShortcut` variable
to `takeScreenshotShortcut` for clarity. Eliminated redundant `QTimer::singleShot` function call,
as `animateClick()` emits all the necessary signals on its own.

Test Plan:
  - Launch Spectacle in GUI mode
  - Take screenshot by pressing {key Enter} (default GUI key)
  - Take screenshot by pressing {key CTRL}+{key N} ("new document" shortcut)

Reviewers: #spectacle, rkflx, ngraham

Reviewed By: #spectacle, rkflx

Differential Revision: https://phabricator.kde.org/D11374
parent 978f9ee7
......@@ -124,12 +124,10 @@ KSWidget::KSWidget(QWidget *parent) :
mTakeScreenshotButton->setFocus();
connect(mTakeScreenshotButton, &QPushButton::clicked, this, &KSWidget::newScreenshotClicked);
QShortcut *shortcut = new QShortcut(QKeySequence(QKeySequence::New), mTakeScreenshotButton);
auto clickFunc = [&]() {
QShortcut *takeScreenshotShortcut = new QShortcut(QKeySequence(QKeySequence::New), mTakeScreenshotButton);
connect(takeScreenshotShortcut, &QShortcut::activated, [this]() {
mTakeScreenshotButton->animateClick(100);
QTimer::singleShot(100, mTakeScreenshotButton, &QPushButton::click);
};
connect(shortcut, &QShortcut::activated, clickFunc);
});
// finally, finish up the layouts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment