Make the toolbar position better

This commit is contained in:
ArsenArsen 2017-07-25 01:33:01 +02:00
parent e258a1c852
commit 91b8831e16
No known key found for this signature in database
GPG Key ID: C631EC9C50708CF4

View File

@ -1,4 +1,5 @@
#include "cropscene.hpp" #include "cropscene.hpp"
#include <QApplication>
#include <QColorDialog> #include <QColorDialog>
#include <QDebug> #include <QDebug>
#include <QFontDialog> #include <QFontDialog>
@ -8,6 +9,7 @@
#include <QGraphicsView> #include <QGraphicsView>
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QScreen>
#include <QTimer> #include <QTimer>
#include <cropeditor/drawing/arrowitem.hpp> #include <cropeditor/drawing/arrowitem.hpp>
#include <cropeditor/drawing/bluritem.hpp> #include <cropeditor/drawing/bluritem.hpp>
@ -145,11 +147,13 @@ CropScene::CropScene(QObject *parent, QPixmap pixmap)
widget->setPos(100, 100); widget->setPos(100, 100);
proxyMenu = widget; proxyMenu = widget;
QTimer::singleShot(0, [&] { QTimer::singleShot(0, [&, widget] {
auto pf = views()[0]->mapFromGlobal(QCursor::pos()); auto pf = views()[0]->mapFromGlobal(QCursor::pos());
cursorPos = QPoint(pf.x(), pf.y()); cursorPos = QPoint(pf.x(), pf.y());
cursorItem->setPos(cursorPos); cursorItem->setPos(cursorPos);
updateMag(); updateMag();
int w = QApplication::primaryScreen()->geometry().width();
widget->setPos((w - widget->boundingRect().width()) / 2, 100);
}); });
} }