diff --git a/colorpicker/colorpickerscene.cpp b/colorpicker/colorpickerscene.cpp index 840ace5..1309462 100644 --- a/colorpicker/colorpickerscene.cpp +++ b/colorpicker/colorpickerscene.cpp @@ -17,6 +17,7 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget) setMouseTracking(true); setWindowTitle("KShare Color Picker"); setGeometry(pixmap.rect()); + move(screenshotutil::smallestScreenCoordinate()); setAttribute(Qt::WA_DeleteOnClose); pItem = addPixmap(pixmap); diff --git a/cropeditor/cropeditor.cpp b/cropeditor/cropeditor.cpp index 16291ff..bac293d 100644 --- a/cropeditor/cropeditor.cpp +++ b/cropeditor/cropeditor.cpp @@ -13,10 +13,8 @@ CropEditor::CropEditor(QPixmap image, QObject *parent) : QObject(parent) { scene = new CropScene(parent, image); view = new CropView(scene); - qreal ratio = QApplication::primaryScreen()->devicePixelRatio(); QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(image); pixmapItem->setZValue(-1); - pixmapItem->setScale(1 / ratio); scene->addItem(pixmapItem); scene->setSceneRect(image.rect()); view->resize(image.width(), image.height()); diff --git a/cropeditor/cropscene.cpp b/cropeditor/cropscene.cpp index 3e69c56..3c1702e 100644 --- a/cropeditor/cropscene.cpp +++ b/cropeditor/cropscene.cpp @@ -103,6 +103,7 @@ CropScene::CropScene(QObject *parent, QPixmap pixmap) polyItem = new QGraphicsPolygonItem(poly); polyItem->setBrush(QBrush(QColor(0, 0, 0, 191))); polyItem->setPen(QPen(Qt::NoPen)); + polyItem->setZValue(1); addItem(polyItem); QTimer::singleShot(0, [&] { auto pf = views()[0]->mapFromGlobal(QCursor::pos()); diff --git a/mainwindow.cpp b/mainwindow.cpp index 8d2a8c3..b54582d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi QAction *recabort = new QAction("Abort recording", this); menu->addActions({ quit, shtoggle, picker }); menu->addSeparator(); - menu->addActions({ fullscreen, area, active }); + menu->addActions({ fullscreen, area }); #ifdef PLATFORM_CAPABILITY_ACTIVEWINDOW menu->addAction(area); #endif diff --git a/platformspecifics/mac/macbackend.cpp b/platformspecifics/mac/macbackend.cpp index 675cc63..f0d1b1b 100644 --- a/platformspecifics/mac/macbackend.cpp +++ b/platformspecifics/mac/macbackend.cpp @@ -1,6 +1,8 @@ #include "macbackend.hpp" -QPixmap PlatformBackend::getCursor() { +#include + +std::tuple PlatformBackend::getCursor() { #warning "TODO: Mac backend" return std::tuple(QPoint(0, 0), QPixmap()); // Not Monday: https://developer.apple.com/reference/appkit/nscursor/1527062-image diff --git a/platformspecifics/mac/macbackend.hpp b/platformspecifics/mac/macbackend.hpp index ea15166..a987d3f 100644 --- a/platformspecifics/mac/macbackend.hpp +++ b/platformspecifics/mac/macbackend.hpp @@ -7,7 +7,7 @@ class PlatformBackend { public: - QPixmap getCursor(); + std::tuple getCursor(); pid_t pid(); static PlatformBackend &inst() { static PlatformBackend inst; diff --git a/screenshotutil.cpp b/screenshotutil.cpp index 9c939f0..0cc7c1d 100644 --- a/screenshotutil.cpp +++ b/screenshotutil.cpp @@ -26,7 +26,7 @@ QPixmap screenshotutil::fullscreen(bool cursor) { for (QScreen *screen : QApplication::screens()) { QRect geo = screen->geometry(); width = qMax(ox + geo.left() + geo.width(), width); - height = qMax(oy + geo.top() + geo.height(), height); // qute abs + height = qMax(oy + geo.top() + geo.height(), height); } image = QPixmap(width, height); image.fill(Qt::transparent); @@ -36,7 +36,8 @@ QPixmap screenshotutil::fullscreen(bool cursor) { for (QScreen *screen : QApplication::screens()) { QPixmap currentScreen = window(0, screen); - painter.drawPixmap(screen->geometry().topLeft(), currentScreen); + QRect geo = screen->geometry(); + painter.drawPixmap(geo.left(), geo.top(), geo.width(), geo.height(), currentScreen); width += screen->size().width(); } #ifdef Q_OS_LINUX @@ -73,3 +74,6 @@ QPoint screenshotutil::smallestScreenCoordinate() { } return smallestCoordinate; } + +QPixmap screenshotutil::renderText(QString toRender, QColor background, QFont font) { +} diff --git a/screenshotutil.hpp b/screenshotutil.hpp index df156d6..83267db 100644 --- a/screenshotutil.hpp +++ b/screenshotutil.hpp @@ -10,6 +10,7 @@ QPixmap fullscreenArea(bool cursor = true, qreal x = 0, qreal y = 0, qreal w = - QPixmap window(WId wid, QScreen *w = QApplication::primaryScreen()); void toClipboard(QString value); QPoint smallestScreenCoordinate(); +QPixmap renderText(QString toRender, QColor background = Qt::transparent, QFont font = QFont()); } #endif // SCREENSHOTUTIL_HPP