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 <QGraphicsTextItem>
#include <QTimer>
#include <settings.hpp>
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) {

View File

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

View File

@ -17,9 +17,9 @@
#include <recording/encoders/encodersettings.hpp>
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;