Compare commits

..

No commits in common. "9bf6ed9d1d3373d3bc38fac46b97ea60644113e9" and "06c9b4e3829af636234a98f946603d68c23f6459" have entirely different histories.

4 changed files with 11 additions and 12 deletions

View File

@ -11,16 +11,10 @@ option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
option(FLUENTUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
option(FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF)
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
set(QT_SDK_DIR "${Qt6_DIR}")
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
#QML<QT_SDK_DIR_PATH>\qml\FluentUI
set(FLUENTUI_QML_PLUGIN_DIRECTORY "" CACHE PATH "Path to FluentUI plugin")
if(NOT FLUENTUI_QML_PLUGIN_DIRECTORY)
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/FluentUI)
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
endif()
add_subdirectory(src)

View File

@ -11,6 +11,8 @@ if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
endif()
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
qt_standard_project_setup()
else()

View File

@ -42,24 +42,28 @@ ScreenshotBackground::ScreenshotBackground(QQuickItem* parent) : QQuickPaintedIt
void ScreenshotBackground::paint(QPainter* painter)
{
painter->save();
_sourcePixmap = QPixmap(QSize(_desktopGeometry.width(),_desktopGeometry.height()));
QPainter p(&_sourcePixmap);
QPixmap sourcePixmap;
QPainter p(&sourcePixmap);
p.drawPixmap(_desktopGeometry,_desktopPixmap);
painter->drawPixmap(_desktopGeometry,_sourcePixmap);
painter->drawPixmap(_desktopGeometry,sourcePixmap);
painter->restore();
}
void ScreenshotBackground::capture(const QPoint& start,const QPoint& end){
qDebug()<<start;
qDebug()<<end;
_grabResult = grabToImage();
auto x = qMin(start.x(),end.x());
auto y = qMin(start.y(),end.y());
auto w = qAbs(end.x()-start.x());
auto h = qAbs(end.y()-start.y());
_captureRect = QRect(x,y,w,h);
qDebug()<<_captureRect;
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &ScreenshotBackground::handleGrabResult);
}
void ScreenshotBackground::handleGrabResult(){
_sourcePixmap.copy(_captureRect).save("aaa.png");
_grabResult.data()->image().copy(_captureRect).save("aaa.png");
}

View File

@ -19,7 +19,6 @@ public:
private:
QRect _desktopGeometry;
QPixmap _desktopPixmap;
QPixmap _sourcePixmap;
qreal _devicePixelRatio;
QSharedPointer<QQuickItemGrabResult> _grabResult;
QRect _captureRect;