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
1 changed files with 5 additions and 1 deletions

View File

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