Merge branch 'blueprint' of https://github.com/vicr123/theshell into blueprint

This commit is contained in:
Victor Tran 2017-10-03 00:27:16 +11:00
commit 85ebddae75
2 changed files with 24 additions and 1 deletions

View file

@ -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));

View file

@ -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);
};