mirror of
https://github.com/vicr123/theshell.git
synced 2025-01-23 04:11:49 -05:00
Merge pull request #30 from zBlakee/screenshotOverhaul
Add keyboard shortcuts to screenshotWindow
This commit is contained in:
commit
718d7f8f00
2 changed files with 24 additions and 1 deletions
|
@ -77,6 +77,28 @@ screenshotWindow::~screenshotWindow()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void screenshotWindow::keyPressEvent( QKeyEvent* event ) {
|
||||
switch ( event->key() ) {
|
||||
case Qt::Key_Escape:
|
||||
//on ESC, close ui
|
||||
on_discardButton_clicked();
|
||||
break;
|
||||
case Qt::Key_Enter: //We need to capture both Enter and Return since it can vary between keyboards
|
||||
on_saveButton_clicked();
|
||||
break;
|
||||
case Qt::Key_Return:
|
||||
on_saveButton_clicked();
|
||||
break;
|
||||
default:
|
||||
if(Qt::Key_C && modifiers() & Qt::ControlModifier) {
|
||||
on_copyButton_clicked();
|
||||
break;
|
||||
}
|
||||
event->ignore();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void screenshotWindow::paintEvent(QPaintEvent *event) {
|
||||
QPainter painter(this);
|
||||
painter.setBrush(QColor(0, 0, 0, 150));
|
||||
|
|
|
@ -78,7 +78,8 @@ private:
|
|||
QRubberBand* band;
|
||||
QPoint bandOrigin;
|
||||
QRectF originalGeometry;
|
||||
|
||||
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void paintEvent(QPaintEvent* event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue