Fix some issues with screen overlaying windows

This commit is contained in:
ArsenArsen 2017-07-10 16:27:38 +02:00
parent 147e0051f6
commit a4118ea3ac
3 changed files with 13 additions and 7 deletions

View File

@ -5,6 +5,7 @@
#include <QGraphicsPixmapItem> #include <QGraphicsPixmapItem>
#include <QGraphicsTextItem> #include <QGraphicsTextItem>
#include <QTimer> #include <QTimer>
#include <settings.hpp>
ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget) ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget)
: QGraphicsScene(), QGraphicsView(this, parentWidget) { : QGraphicsScene(), QGraphicsView(this, parentWidget) {
@ -16,7 +17,6 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget)
setCursor(QCursor(Qt::CrossCursor)); setCursor(QCursor(Qt::CrossCursor));
setMouseTracking(true); setMouseTracking(true);
setWindowTitle("KShare Color Picker"); setWindowTitle("KShare Color Picker");
setGeometry(pixmap.rect());
move(screenshotutil::smallestScreenCoordinate()); move(screenshotutil::smallestScreenCoordinate());
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@ -36,6 +36,11 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget)
image = pixmap.toImage(); image = pixmap.toImage();
show(); 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) { void ColorPickerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {

View File

@ -13,17 +13,18 @@
CropEditor::CropEditor(QPixmap image, QObject *parent) : QObject(parent) { CropEditor::CropEditor(QPixmap image, QObject *parent) : QObject(parent) {
scene = new CropScene(parent, image); scene = new CropScene(parent, image);
view = new CropView(scene); view = new CropView(scene);
view->show();
view->raise();
QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(image); QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(image);
pixmapItem->setZValue(-1); pixmapItem->setZValue(-1);
scene->addItem(pixmapItem); scene->addItem(pixmapItem);
scene->setSceneRect(image.rect()); scene->setSceneRect(image.rect());
view->resize(image.width(), image.height()); view->resize(image.width(), image.height());
view->setMinimumSize(image.size()); view->setMinimumSize(image.size());
QPoint p = screenshotutil::smallestScreenCoordinate(); QPoint p = screenshotutil::smallestScreenCoordinate()
view->move(p.x() + settings::settings().value("cropx", 0).toInt(), p.y() + settings::settings().value("cropy", 0).toInt()); + 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->setWindowTitle("KShare Crop Editor");
view->show();
view->raise();
view->activateWindow(); view->activateWindow();
connect(scene, &CropScene::closedWithRect, this, &CropEditor::crop); connect(scene, &CropScene::closedWithRect, this, &CropEditor::crop);

View File

@ -17,9 +17,9 @@
#include <recording/encoders/encodersettings.hpp> #include <recording/encoders/encodersettings.hpp>
RecordingFormats::RecordingFormats(formats::Recording f) { RecordingFormats::RecordingFormats(formats::Recording f) {
QString tmp = QStandardPaths::writableLocation(QStandardPaths::TempLocation); if (tmpDir.isValid()) {
if (tmp.isEmpty()) {
validator = [](QSize) { return false; }; validator = [](QSize) { return false; };
qCritical().noquote() << "Could not create temporary directory. Error: " + tmpDir.errorString();
return; return;
} }
iFormat = QImage::Format_RGB888; iFormat = QImage::Format_RGB888;