parent
15ca46f3d0
commit
ce75426552
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "macbackend.hpp"
|
||||
|
||||
QPixmap PlatformBackend::getCursor() {
|
||||
#include <unistd.h>
|
||||
|
||||
std::tuple<QPoint, QPixmap> PlatformBackend::getCursor() {
|
||||
#warning "TODO: Mac backend"
|
||||
return std::tuple<QPoint, QPixmap>(QPoint(0, 0), QPixmap());
|
||||
// Not Monday: https://developer.apple.com/reference/appkit/nscursor/1527062-image
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class PlatformBackend {
|
||||
public:
|
||||
QPixmap getCursor();
|
||||
std::tuple<QPoint, QPixmap> getCursor();
|
||||
pid_t pid();
|
||||
static PlatformBackend &inst() {
|
||||
static PlatformBackend inst;
|
||||
|
@ -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) {
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user