mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
736c19c41e
commit
2d492ceb95
@ -21,7 +21,6 @@ CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||
void CircularReveal::paint(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->eraseRect(boundingRect());
|
||||
painter->drawImage(QRect(0, 0, static_cast<int>(width()), static_cast<int>(height())), _source);
|
||||
QPainterPath path;
|
||||
path.moveTo(_center.x(),_center.y());
|
||||
|
@ -9,7 +9,6 @@ Screenshot::Screenshot(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||
start(QPoint(0,0));
|
||||
end(QPoint(0,0));
|
||||
_desktopGeometry = qApp->primaryScreen()->virtualGeometry();
|
||||
_desktopPixmap = qApp->primaryScreen()->grabWindow(0, _desktopGeometry.x(), _desktopGeometry.y(), _desktopGeometry.width(), _desktopGeometry.height());
|
||||
connect(this,&Screenshot::startChanged,this,[=]{update();});
|
||||
connect(this,&Screenshot::endChanged,this,[=]{update();});
|
||||
}
|
||||
@ -17,10 +16,22 @@ Screenshot::Screenshot(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||
void Screenshot::paint(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->eraseRect(boundingRect());
|
||||
painter->drawPixmap(_desktopGeometry,_desktopPixmap);
|
||||
painter->fillRect(_desktopGeometry,_maskColor);
|
||||
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
||||
painter->fillRect(QRect(_start.x(),_start.y(),_end.x()-_start.x(),_end.y()-_start.y()), Qt::black);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
ScreenshotBackground::ScreenshotBackground(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||
{
|
||||
|
||||
_desktopGeometry = qApp->primaryScreen()->virtualGeometry();
|
||||
_desktopPixmap = qApp->primaryScreen()->grabWindow(0, _desktopGeometry.x(), _desktopGeometry.y(), _desktopGeometry.width(), _desktopGeometry.height());
|
||||
}
|
||||
|
||||
void ScreenshotBackground::paint(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->drawPixmap(_desktopGeometry,_desktopPixmap);
|
||||
painter->restore();
|
||||
}
|
||||
|
@ -6,6 +6,20 @@
|
||||
#include <QPainter>
|
||||
#include "stdafx.h"
|
||||
|
||||
class ScreenshotBackground : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT;
|
||||
QML_NAMED_ELEMENT(ScreenshotBackground)
|
||||
public:
|
||||
ScreenshotBackground(QQuickItem* parent = nullptr);
|
||||
void paint(QPainter* painter) override;
|
||||
|
||||
private:
|
||||
QRect _desktopGeometry;
|
||||
QPixmap _desktopPixmap;
|
||||
};
|
||||
|
||||
|
||||
class Screenshot : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -19,8 +33,6 @@ public:
|
||||
|
||||
private:
|
||||
QRect _desktopGeometry;
|
||||
QPixmap _desktopPixmap;
|
||||
bool _isFirst = true;
|
||||
};
|
||||
|
||||
#endif // SCREENSHOT_H
|
||||
|
@ -35,6 +35,9 @@ Loader {
|
||||
Component.onCompleted: {
|
||||
setGeometry(0,0,Screen.desktopAvailableWidth,Screen.height)
|
||||
}
|
||||
ScreenshotBackground{
|
||||
anchors.fill: parent
|
||||
}
|
||||
Screenshot{
|
||||
id:screenshot
|
||||
anchors.fill: parent
|
||||
|
Loading…
Reference in New Issue
Block a user