From a4118ea3acce132857af16090c3a79d7428a8e06 Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Mon, 10 Jul 2017 16:27:38 +0200 Subject: [PATCH] Fix some issues with screen overlaying windows --- colorpicker/colorpickerscene.cpp | 7 ++++++- cropeditor/cropeditor.cpp | 9 +++++---- recording/recordingformats.cpp | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/colorpicker/colorpickerscene.cpp b/colorpicker/colorpickerscene.cpp index 1309462..45a4ab3 100644 --- a/colorpicker/colorpickerscene.cpp +++ b/colorpicker/colorpickerscene.cpp @@ -5,6 +5,7 @@ #include #include #include +#include ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget) : QGraphicsScene(), QGraphicsView(this, parentWidget) { @@ -16,7 +17,6 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget) setCursor(QCursor(Qt::CrossCursor)); setMouseTracking(true); setWindowTitle("KShare Color Picker"); - setGeometry(pixmap.rect()); move(screenshotutil::smallestScreenCoordinate()); setAttribute(Qt::WA_DeleteOnClose); @@ -36,6 +36,11 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget) image = pixmap.toImage(); show(); + activateWindow(); + setGeometry(pixmap.rect()); + QPoint p = screenshotutil::smallestScreenCoordinate() + + QPoint(settings::settings().value("cropx", 0).toInt(), settings::settings().value("cropy", 0).toInt()); + move(p.x(), p.y()); } void ColorPickerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { diff --git a/cropeditor/cropeditor.cpp b/cropeditor/cropeditor.cpp index a0e5e5c..4f0605c 100644 --- a/cropeditor/cropeditor.cpp +++ b/cropeditor/cropeditor.cpp @@ -13,17 +13,18 @@ CropEditor::CropEditor(QPixmap image, QObject *parent) : QObject(parent) { scene = new CropScene(parent, image); view = new CropView(scene); + view->show(); + view->raise(); QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(image); pixmapItem->setZValue(-1); scene->addItem(pixmapItem); scene->setSceneRect(image.rect()); view->resize(image.width(), image.height()); view->setMinimumSize(image.size()); - QPoint p = screenshotutil::smallestScreenCoordinate(); - view->move(p.x() + settings::settings().value("cropx", 0).toInt(), p.y() + settings::settings().value("cropy", 0).toInt()); + QPoint p = screenshotutil::smallestScreenCoordinate() + + QPoint(settings::settings().value("cropx", 0).toInt(), settings::settings().value("cropy", 0).toInt()); + view->move(p.x(), p.y()); view->setWindowTitle("KShare Crop Editor"); - view->show(); - view->raise(); view->activateWindow(); connect(scene, &CropScene::closedWithRect, this, &CropEditor::crop); diff --git a/recording/recordingformats.cpp b/recording/recordingformats.cpp index bf10f9a..b55ee5b 100644 --- a/recording/recordingformats.cpp +++ b/recording/recordingformats.cpp @@ -17,9 +17,9 @@ #include RecordingFormats::RecordingFormats(formats::Recording f) { - QString tmp = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - if (tmp.isEmpty()) { + if (tmpDir.isValid()) { validator = [](QSize) { return false; }; + qCritical().noquote() << "Could not create temporary directory. Error: " + tmpDir.errorString(); return; } iFormat = QImage::Format_RGB888;