I have no idea
This commit is contained in:
parent
7c58d37ab0
commit
6a978fbfb3
1
--force
Submodule
1
--force
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f7839bedd9c9d28d4eb2e9a07c1e30e908783f63
|
@ -73,7 +73,9 @@ HEADERS += mainwindow.hpp \
|
|||||||
cropeditor/drawing/lineitem.hpp \
|
cropeditor/drawing/lineitem.hpp \
|
||||||
cropeditor/drawing/textitem.hpp \
|
cropeditor/drawing/textitem.hpp \
|
||||||
colorpicker/colorpickerscene.hpp \
|
colorpicker/colorpickerscene.hpp \
|
||||||
platformbackend.hpp
|
platformbackend.hpp \
|
||||||
|
gif-h/gif.h
|
||||||
|
|
||||||
mac {
|
mac {
|
||||||
SOURCES += $$PWD/platformspecifics/mac/macbackend.cpp
|
SOURCES += $$PWD/platformspecifics/mac/macbackend.cpp
|
||||||
HEADERS += $$PWD/platformspecifics/mac/macbackend.hpp
|
HEADERS += $$PWD/platformspecifics/mac/macbackend.hpp
|
||||||
|
7
main.cpp
7
main.cpp
@ -1,10 +1,7 @@
|
|||||||
#include "mainwindow.hpp"
|
#include "mainwindow.hpp"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QTimer>
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <colorpicker/colorpickerscene.hpp>
|
|
||||||
#include <screenshotutil.hpp>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
@ -13,10 +10,10 @@ void handler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
|
|||||||
QByteArray localMsg = msg.toLocal8Bit();
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
if (verbose) fprintf(stderr, "DEBUG: %s\n", localMsg.constData());
|
if (verbose) fprintf(stdout, "DEBUG: %s\n", localMsg.constData());
|
||||||
break;
|
break;
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
fprintf(stderr, "INFO: %s\n", localMsg.constData());
|
fprintf(stdout, "INFO: %s\n", localMsg.constData());
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
fprintf(stderr, "WARN: %s\n", localMsg.constData());
|
fprintf(stderr, "WARN: %s\n", localMsg.constData());
|
||||||
|
@ -21,7 +21,7 @@ QPixmap *screenshotutil::fullscreen(bool cursor) {
|
|||||||
return window(0);
|
return window(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap *screenshotutil::window(long wid) {
|
QPixmap *screenshotutil::window(WId wid) {
|
||||||
QScreen *w = QApplication::primaryScreen();
|
QScreen *w = QApplication::primaryScreen();
|
||||||
QPixmap screen = w->grabWindow(wid);
|
QPixmap screen = w->grabWindow(wid);
|
||||||
QPixmap *pm = new QPixmap(screen.size());
|
QPixmap *pm = new QPixmap(screen.size());
|
||||||
@ -32,3 +32,21 @@ QPixmap *screenshotutil::window(long wid) {
|
|||||||
void screenshotutil::toClipboard(QString value) {
|
void screenshotutil::toClipboard(QString value) {
|
||||||
QApplication::clipboard()->setText(value);
|
QApplication::clipboard()->setText(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPixmap *screenshotutil::fullscreenArea(bool cursor, qreal x, qreal y, qreal w, qreal h) {
|
||||||
|
auto scr = QApplication::primaryScreen();
|
||||||
|
QRectF area(x, y, w < 0 ? scr->size().width() : w, h < 0 ? scr->size().height() : h);
|
||||||
|
if (cursor) {
|
||||||
|
QPointF point = QCursor::pos(scr);
|
||||||
|
if (area.contains(point)) {
|
||||||
|
QPixmap noCursor = scr->grabWindow(0, area.x(), area.y(), area.width(), area.height());
|
||||||
|
QPixmap *withCursor = new QPixmap(noCursor);
|
||||||
|
QPainter painter(withCursor);
|
||||||
|
auto cursorData = PlatformBackend::inst().getCursor();
|
||||||
|
painter.drawPixmap(QCursor::pos() - std::get<0>(cursorData), std::get<1>(cursorData));
|
||||||
|
painter.end();
|
||||||
|
return withCursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new QPixmap(scr->grabWindow(0, area.x(), area.y(), area.width(), area.height()));
|
||||||
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef SCREENSHOTUTIL_HPP
|
#ifndef SCREENSHOTUTIL_HPP
|
||||||
#define SCREENSHOTUTIL_HPP
|
#define SCREENSHOTUTIL_HPP
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace screenshotutil {
|
namespace screenshotutil {
|
||||||
QPixmap *fullscreen(bool cursor = true);
|
QPixmap *fullscreen(bool cursor = true);
|
||||||
QPixmap *window(long wid);
|
QPixmap *fullscreenArea(bool cursor = true, qreal x = 0, qreal y = 0, qreal w = -1, qreal h = -1);
|
||||||
|
QPixmap *window(WId wid);
|
||||||
void toClipboard(QString value);
|
void toClipboard(QString value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user