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