mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 06:41:49 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
84b3a367b2 | |||
a02ee68483 | |||
c330dc840e | |||
438d1fe623 | |||
e92b1dbea6 | |||
4d4c0f2259 |
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest]
|
||||
qt_ver: [6.6.1]
|
||||
qt_ver: [6.6.2]
|
||||
qt_arch: [clang_64]
|
||||
env:
|
||||
targetName: example
|
||||
|
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
qt_ver: [6.6.1]
|
||||
qt_ver: [6.6.2]
|
||||
qt_arch: [gcc_64]
|
||||
env:
|
||||
targetName: example
|
||||
|
2
.github/workflows/windows-mingw.yml
vendored
2
.github/workflows/windows-mingw.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
os: [windows-latest]
|
||||
include:
|
||||
- qt_arch: win64_mingw
|
||||
qt_ver: 6.6.1
|
||||
qt_ver: 6.6.2
|
||||
qt_tools: "tools_mingw,9.0.0-1-202203221220,qt.tools.win64_mingw900"
|
||||
qt_tools_mingw_install: mingw900_64
|
||||
env:
|
||||
|
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
matrix:
|
||||
os: [windows-latest]
|
||||
include:
|
||||
- qt_ver: 6.6.1
|
||||
- qt_ver: 6.6.2
|
||||
qt_arch: win64_msvc2019_64
|
||||
msvc_arch: x64
|
||||
qt_arch_install: msvc2019_64
|
||||
|
@ -154,10 +154,9 @@
|
||||
<file>qml/page/T_RatingControl.qml</file>
|
||||
<file>qml/page/T_Rectangle.qml</file>
|
||||
<file>qml/page/T_RemoteLoader.qml</file>
|
||||
<file>qml/page/T_Screenshot.qml</file>
|
||||
<file>qml/page/T_Settings.qml</file>
|
||||
<file>qml/page/T_Slider.qml</file>
|
||||
<file>qml/page/T_StatusView.qml</file>
|
||||
<file>qml/page/T_StatusLayout.qml</file>
|
||||
<file>qml/page/T_TableView.qml</file>
|
||||
<file>qml/page/T_TabView.qml</file>
|
||||
<file>qml/page/T_Text.qml</file>
|
||||
|
@ -118,7 +118,7 @@ FluExpander{
|
||||
"FluTableView",
|
||||
"FluColors",
|
||||
"FluTheme",
|
||||
"FluStatusView",
|
||||
"FluStatusLayout",
|
||||
"FluRatingControl",
|
||||
"FluPasswordBox",
|
||||
"FluBreadcrumbBar",
|
||||
|
@ -192,12 +192,6 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_Clip.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"StatusView"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_StatusView.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Carousel"
|
||||
menuDelegate: paneItemMenu
|
||||
@ -233,6 +227,12 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_SplitLayout.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"StatusLayout"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_StatusLayout.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
@ -432,12 +432,6 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_Timeline.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Screenshot(Todo)"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_Screenshot.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Captcha"
|
||||
menuDelegate: paneItemMenu
|
||||
|
@ -1,57 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
import Qt.labs.platform
|
||||
import "../component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Screenshot"
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 100
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
FluFilledButton{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text:"Open Screenshot"
|
||||
onClicked: {
|
||||
screenshot.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
Layout.preferredHeight: 400
|
||||
Layout.preferredWidth: 400
|
||||
Layout.topMargin: 10
|
||||
Layout.leftMargin: 4
|
||||
Layout.bottomMargin: 4
|
||||
radius: 4
|
||||
color: FluTheme.dark ? FluColors.Black : FluColors.White
|
||||
FluShadow{
|
||||
radius: 4
|
||||
color: FluTheme.primaryColor
|
||||
}
|
||||
Image{
|
||||
id:image
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
}
|
||||
}
|
||||
|
||||
FluScreenshot{
|
||||
id:screenshot
|
||||
captrueMode: FluScreenshotType.File
|
||||
saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot"
|
||||
onCaptrueCompleted:
|
||||
(captrue)=>{
|
||||
image.source = captrue
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import "../component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"StatusView"
|
||||
title:"StatusLayout"
|
||||
|
||||
FluArea{
|
||||
id:layout_actions
|
||||
@ -25,28 +25,28 @@ FluScrollablePage{
|
||||
text:"Loading"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Loading
|
||||
status_view.statusMode = FluStatusLayoutType.Loading
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Empty"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Empty
|
||||
status_view.statusMode = FluStatusLayoutType.Empty
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Error"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Error
|
||||
status_view.statusMode = FluStatusLayoutType.Error
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Success"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Success
|
||||
status_view.statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ FluScrollablePage{
|
||||
Layout.topMargin: 10
|
||||
height: 380
|
||||
paddings: 10
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
anchors.fill: parent
|
||||
onErrorClicked:{
|
||||
@ -73,9 +73,9 @@ FluScrollablePage{
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluStatusView{
|
||||
code:'FluStatusLayout{
|
||||
anchors.fill: parent
|
||||
statusMode: FluStatusViewType.Loading
|
||||
statusMode: FluStatusLayoutType.Loading
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color:FluTheme.primaryColor
|
@ -31,39 +31,38 @@ FluContentPage{
|
||||
|
||||
FluContentDialog{
|
||||
id:custom_update_dialog
|
||||
signal showDialog(string text,var callback)
|
||||
property var _textBox
|
||||
property var text
|
||||
property var onAccpetListener
|
||||
title:"修改列名"
|
||||
negativeText:"取消"
|
||||
contentDelegate: Component{
|
||||
Item{
|
||||
width: parent.width
|
||||
height: 60
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 60
|
||||
FluTextBox{
|
||||
id:textbox_text
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Connections{
|
||||
target: custom_update_dialog
|
||||
function onShowDialog(text,callback){
|
||||
custom_update_dialog._textBox = textbox_text
|
||||
custom_update_dialog.onAccpetListener = callback
|
||||
textbox_text.text = text
|
||||
textbox_text.forceActiveFocus()
|
||||
custom_update_dialog.open()
|
||||
onTextChanged: {
|
||||
custom_update_dialog.text = textbox_text.text
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
textbox_text.text = custom_update_dialog.text
|
||||
textbox_text.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
onNegativeClicked:{
|
||||
}
|
||||
positiveText:"确定"
|
||||
onPositiveClicked:{
|
||||
if(custom_update_dialog.onAccpetListener && custom_update_dialog._textBox){
|
||||
custom_update_dialog.onAccpetListener(custom_update_dialog._textBox.text)
|
||||
if(custom_update_dialog.onAccpetListener){
|
||||
custom_update_dialog.onAccpetListener(custom_update_dialog.text)
|
||||
}
|
||||
}
|
||||
function showDialog(text,listener){
|
||||
custom_update_dialog.text = text
|
||||
custom_update_dialog.onAccpetListener = listener
|
||||
custom_update_dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
@ -298,19 +297,17 @@ FluContentPage{
|
||||
dataIndex: 'checkbox',
|
||||
width:80,
|
||||
minimumWidth:80,
|
||||
maximumWidth:80,
|
||||
maximumWidth:80
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_update_title,{title:'头像'}),
|
||||
dataIndex: 'avatar',
|
||||
width:100,
|
||||
minimumWidth:100,
|
||||
maximumWidth:100
|
||||
width:100
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
readOnly:true,
|
||||
readOnly:true
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_sort_age,{sort:0}),
|
||||
@ -414,5 +411,4 @@ FluContentPage{
|
||||
root.dataSource = dataSource
|
||||
table_view.dataSource = root.dataSource
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ FluWindow {
|
||||
FluRemoteLoader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
lazy: true
|
||||
errorItem: Item{
|
||||
FluText{
|
||||
@ -43,7 +43,7 @@ FluWindow {
|
||||
text:"拖入qml文件"
|
||||
font.pixelSize: 26
|
||||
anchors.centerIn: parent
|
||||
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusViewType.Success
|
||||
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success
|
||||
}
|
||||
Rectangle{
|
||||
radius: 4
|
||||
|
@ -118,7 +118,7 @@ FluExpander{
|
||||
"FluTableView",
|
||||
"FluColors",
|
||||
"FluTheme",
|
||||
"FluStatusView",
|
||||
"FluStatusLayout",
|
||||
"FluRatingControl",
|
||||
"FluPasswordBox",
|
||||
"FluBreadcrumbBar",
|
||||
|
@ -192,12 +192,6 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_Clip.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"StatusView"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_StatusView.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Carousel"
|
||||
menuDelegate: paneItemMenu
|
||||
@ -233,6 +227,12 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_SplitLayout.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"StatusLayout"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_StatusLayout.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
@ -432,12 +432,6 @@ FluObject{
|
||||
url:"qrc:/example/qml/page/T_Timeline.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Screenshot(Todo)"
|
||||
menuDelegate: paneItemMenu
|
||||
url:"qrc:/example/qml/page/T_Screenshot.qml"
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Captcha"
|
||||
menuDelegate: paneItemMenu
|
||||
|
@ -1,57 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
import Qt.labs.platform 1.0
|
||||
import "../component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Screenshot"
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 100
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
FluFilledButton{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text:"Open Screenshot"
|
||||
onClicked: {
|
||||
screenshot.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
Layout.preferredHeight: 400
|
||||
Layout.preferredWidth: 400
|
||||
Layout.topMargin: 10
|
||||
Layout.leftMargin: 4
|
||||
Layout.bottomMargin: 4
|
||||
radius: 4
|
||||
color: FluTheme.dark ? FluColors.Black : FluColors.White
|
||||
FluShadow{
|
||||
radius: 4
|
||||
color: FluTheme.primaryColor
|
||||
}
|
||||
Image{
|
||||
id:image
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
}
|
||||
}
|
||||
|
||||
FluScreenshot{
|
||||
id:screenshot
|
||||
captrueMode: FluScreenshotType.File
|
||||
saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot"
|
||||
onCaptrueCompleted:
|
||||
(captrue)=>{
|
||||
image.source = captrue
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import "../component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"StatusView"
|
||||
title:"StatusLayout"
|
||||
|
||||
FluArea{
|
||||
id:layout_actions
|
||||
@ -25,28 +25,28 @@ FluScrollablePage{
|
||||
text:"Loading"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Loading
|
||||
status_view.statusMode = FluStatusLayoutType.Loading
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Empty"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Empty
|
||||
status_view.statusMode = FluStatusLayoutType.Empty
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Error"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Error
|
||||
status_view.statusMode = FluStatusLayoutType.Error
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"Success"
|
||||
onClicked: {
|
||||
btn_status_mode.text = text
|
||||
status_view.statusMode = FluStatusViewType.Success
|
||||
status_view.statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ FluScrollablePage{
|
||||
Layout.topMargin: 10
|
||||
height: 380
|
||||
paddings: 10
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
anchors.fill: parent
|
||||
onErrorClicked:{
|
||||
@ -73,9 +73,9 @@ FluScrollablePage{
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluStatusView{
|
||||
code:'FluStatusLayout{
|
||||
anchors.fill: parent
|
||||
statusMode: FluStatusViewType.Loading
|
||||
statusMode: FluStatusLayoutType.Loading
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color:FluTheme.primaryColor
|
@ -31,39 +31,38 @@ FluContentPage{
|
||||
|
||||
FluContentDialog{
|
||||
id:custom_update_dialog
|
||||
signal showDialog(string text,var callback)
|
||||
property var _textBox
|
||||
property var text
|
||||
property var onAccpetListener
|
||||
title:"修改列名"
|
||||
negativeText:"取消"
|
||||
contentDelegate: Component{
|
||||
Item{
|
||||
width: parent.width
|
||||
height: 60
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 60
|
||||
FluTextBox{
|
||||
id:textbox_text
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Connections{
|
||||
target: custom_update_dialog
|
||||
function onShowDialog(text,callback){
|
||||
custom_update_dialog._textBox = textbox_text
|
||||
custom_update_dialog.onAccpetListener = callback
|
||||
textbox_text.text = text
|
||||
textbox_text.forceActiveFocus()
|
||||
custom_update_dialog.open()
|
||||
onTextChanged: {
|
||||
custom_update_dialog.text = textbox_text.text
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
textbox_text.text = custom_update_dialog.text
|
||||
textbox_text.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
onNegativeClicked:{
|
||||
}
|
||||
positiveText:"确定"
|
||||
onPositiveClicked:{
|
||||
if(custom_update_dialog.onAccpetListener && custom_update_dialog._textBox){
|
||||
custom_update_dialog.onAccpetListener(custom_update_dialog._textBox.text)
|
||||
if(custom_update_dialog.onAccpetListener){
|
||||
custom_update_dialog.onAccpetListener(custom_update_dialog.text)
|
||||
}
|
||||
}
|
||||
function showDialog(text,listener){
|
||||
custom_update_dialog.text = text
|
||||
custom_update_dialog.onAccpetListener = listener
|
||||
custom_update_dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
@ -298,19 +297,17 @@ FluContentPage{
|
||||
dataIndex: 'checkbox',
|
||||
width:80,
|
||||
minimumWidth:80,
|
||||
maximumWidth:80,
|
||||
maximumWidth:80
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_update_title,{title:'头像'}),
|
||||
dataIndex: 'avatar',
|
||||
width:100,
|
||||
minimumWidth:100,
|
||||
maximumWidth:100
|
||||
width:100
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
readOnly:true,
|
||||
readOnly:true
|
||||
},
|
||||
{
|
||||
title: table_view.customItem(com_column_sort_age,{sort:0}),
|
||||
@ -414,5 +411,4 @@ FluContentPage{
|
||||
root.dataSource = dataSource
|
||||
table_view.dataSource = root.dataSource
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ FluWindow {
|
||||
FluRemoteLoader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
lazy: true
|
||||
errorItem: Item{
|
||||
FluText{
|
||||
@ -43,7 +43,7 @@ FluWindow {
|
||||
text:"拖入qml文件"
|
||||
font.pixelSize: 26
|
||||
anchors.centerIn: parent
|
||||
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusViewType.Success
|
||||
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success
|
||||
}
|
||||
Rectangle{
|
||||
radius: 4
|
||||
|
14
src/Def.h
14
src/Def.h
@ -26,16 +26,6 @@ Q_ENUM_NS(CacheMode)
|
||||
QML_NAMED_ELEMENT(FluNetworkType)
|
||||
}
|
||||
|
||||
namespace FluScreenshotType {
|
||||
Q_NAMESPACE
|
||||
enum CaptrueMode {
|
||||
Pixmap = 0x0000,
|
||||
File = 0x0001,
|
||||
};
|
||||
Q_ENUM_NS(CaptrueMode)
|
||||
QML_NAMED_ELEMENT(FluScreenshotType)
|
||||
}
|
||||
|
||||
namespace FluThemeType {
|
||||
Q_NAMESPACE
|
||||
enum DarkMode {
|
||||
@ -92,7 +82,7 @@ Q_ENUM_NS(SelectionMode)
|
||||
QML_NAMED_ELEMENT(FluTreeViewType)
|
||||
}
|
||||
|
||||
namespace FluStatusViewType {
|
||||
namespace FluStatusLayoutType {
|
||||
Q_NAMESPACE
|
||||
enum StatusMode {
|
||||
Loading = 0x0000,
|
||||
@ -101,7 +91,7 @@ enum StatusMode {
|
||||
Success = 0x0004
|
||||
};
|
||||
Q_ENUM_NS(StatusMode)
|
||||
QML_NAMED_ELEMENT(FluStatusViewType)
|
||||
QML_NAMED_ELEMENT(FluStatusLayoutType)
|
||||
}
|
||||
|
||||
namespace FluContentDialogType {
|
||||
|
@ -257,7 +257,7 @@ void FluFramelessHelper::componentComplete(){
|
||||
_realWidth = QQmlProperty(window,"_realWidth");
|
||||
_appBarHeight = QQmlProperty(window,"_appBarHeight");
|
||||
#ifdef Q_OS_WIN
|
||||
window->setFlag(Qt::CustomizeWindowHint,true);
|
||||
window->setFlags((window->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint);
|
||||
_nativeEvent =new FramelessEventFilter(this);
|
||||
qApp->installNativeEventFilter(_nativeEvent);
|
||||
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
||||
@ -272,6 +272,15 @@ void FluFramelessHelper::componentComplete(){
|
||||
SetWindowLongPtr(hwnd, GWL_EXSTYLE, exstyle);
|
||||
SetLayeredWindowAttributes(hwnd, RGB(251, 255, 242), 0, LWA_COLORKEY);
|
||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
connect(window,&QQuickWindow::activeChanged,this,[this,hwnd]{
|
||||
if(this->window->isActive()){
|
||||
LONG exstyle = ::GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
if(exstyle & WS_EX_LAYERED){
|
||||
exstyle = exstyle &~ WS_EX_LAYERED;
|
||||
SetWindowLongPtr(hwnd, GWL_EXSTYLE, exstyle);
|
||||
}
|
||||
}
|
||||
});
|
||||
#else
|
||||
window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window);
|
||||
#endif
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "FluEventBus.h"
|
||||
#include "FluTreeModel.h"
|
||||
#include "FluViewModel.h"
|
||||
#include "Screenshot.h"
|
||||
#include "FluRectangle.h"
|
||||
#include "FluNetwork.h"
|
||||
#include "FluFramelessHelper.h"
|
||||
@ -32,8 +31,6 @@ void FluentUI::registerTypes(const char *uri){
|
||||
qmlRegisterType<QRCode>(uri,major,minor,"QRCode");
|
||||
qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha");
|
||||
qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark");
|
||||
qmlRegisterType<ScreenshotBackground>(uri,major,minor,"ScreenshotBackground");
|
||||
qmlRegisterType<Screenshot>(uri,major,minor,"Screenshot");
|
||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||
qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent");
|
||||
qmlRegisterType<FluViewModel>(uri,major,minor,"FluViewModel");
|
||||
@ -107,14 +104,13 @@ void FluentUI::registerTypes(const char *uri){
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButtons.qml"),uri,major,minor,"FluRadioButtons");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRemoteLoader.qml"),uri,major,minor,"FluRemoteLoader");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScreenshot.qml"),uri,major,minor,"FluScreenshot");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollBar.qml"),uri,major,minor,"FluScrollBar");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollIndicator.qml"),uri,major,minor,"FluScrollIndicator");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollablePage.qml"),uri,major,minor,"FluScrollablePage");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShadow.qml"),uri,major,minor,"FluShadow");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSlider.qml"),uri,major,minor,"FluSlider");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSpinBox.qml"),uri,major,minor,"FluSpinBox");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStatusView.qml"),uri,major,minor,"FluStatusView");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStatusLayout.qml"),uri,major,minor,"FluStatusLayout");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTabView.qml"),uri,major,minor,"FluTabView");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTableView.qml"),uri,major,minor,"FluTableView");
|
||||
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluText.qml"),uri,major,minor,"FluText");
|
||||
@ -144,14 +140,13 @@ void FluentUI::registerTypes(const char *uri){
|
||||
qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri,major,minor,"FluPageType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri,major,minor,"FluWindowType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluTreeViewType::staticMetaObject, uri,major,minor,"FluTreeViewType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluStatusViewType::staticMetaObject, uri,major,minor,"FluStatusViewType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluStatusLayoutType::staticMetaObject, uri,major,minor,"FluStatusLayoutType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluContentDialogType::staticMetaObject, uri,major,minor,"FluContentDialogType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluTimePickerType::staticMetaObject, uri,major,minor,"FluTimePickerType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluCalendarViewType::staticMetaObject, uri,major,minor,"FluCalendarViewType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri,major,minor,"FluTimelineType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluScreenshotType::staticMetaObject, uri,major,minor,"FluScreenshotType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluViewModelType::staticMetaObject, uri,major,minor,"FluViewModelType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluNetworkType::staticMetaObject, uri,major,minor,"FluNetworkType", "Access to enums & flags only");
|
||||
|
||||
|
@ -102,9 +102,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.NeutralButton
|
||||
FluButton{
|
||||
id:neutral_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.NeutralButton
|
||||
text: neutralText
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
@ -121,9 +121,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.NegativeButton
|
||||
FluButton{
|
||||
id:negative_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.NegativeButton
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
text: negativeText
|
||||
@ -140,9 +140,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.PositiveButton
|
||||
FluFilledButton{
|
||||
id:positive_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.PositiveButton
|
||||
text: positiveText
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
|
@ -37,10 +37,10 @@ FluPage {
|
||||
rightMargin: control.rightPadding
|
||||
}
|
||||
}
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
color: "#00000000"
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
onErrorClicked: control.errorClicked()
|
||||
anchors{
|
||||
left: parent.left
|
||||
|
@ -8,7 +8,9 @@ Popup {
|
||||
id: popup
|
||||
padding: 0
|
||||
modal:true
|
||||
anchors.centerIn: Overlay.overlay
|
||||
parent: Overlay.overlay
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
|
@ -4,6 +4,7 @@ import QtQuick.Shapes 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
ProgressBar{
|
||||
property int duration: 2000
|
||||
property real strokeWidth: 6
|
||||
property bool progressVisible: false
|
||||
property color color: FluTheme.primaryColor
|
||||
@ -20,16 +21,12 @@ ProgressBar{
|
||||
border.width: control.strokeWidth
|
||||
}
|
||||
onIndeterminateChanged:{
|
||||
if(!indeterminate){
|
||||
animator_r.duration = 0
|
||||
layout_item.rotation = 0
|
||||
animator_r.duration = 888
|
||||
}
|
||||
canvas.requestPaint()
|
||||
}
|
||||
QtObject{
|
||||
id:d
|
||||
property real _radius: control.width/2-control.strokeWidth/2
|
||||
property real _progress: control.indeterminate ? 0.3 : control.visualPosition
|
||||
property real _progress: control.indeterminate ? 0.0 : control.visualPosition
|
||||
on_ProgressChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
@ -42,27 +39,39 @@ ProgressBar{
|
||||
}
|
||||
contentItem: Item {
|
||||
id:layout_item
|
||||
RotationAnimation on rotation {
|
||||
id:animator_r
|
||||
running: control.indeterminate && control.visible
|
||||
from: 0
|
||||
to:360
|
||||
loops: Animation.Infinite
|
||||
duration: 888
|
||||
}
|
||||
Canvas {
|
||||
id:canvas
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
renderTarget: Canvas.Image
|
||||
property real startAngle: 0
|
||||
property real sweepAngle: 0
|
||||
SequentialAnimation on startAngle {
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { from: 0; to: 450; duration: control.duration/2 }
|
||||
PropertyAnimation { from: 450; to: 1080; duration: control.duration/2 }
|
||||
}
|
||||
SequentialAnimation on sweepAngle {
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { from: 0; to: 180; duration: control.duration/2 }
|
||||
PropertyAnimation { from: 180; to: 0; duration: control.duration/2 }
|
||||
}
|
||||
onStartAngleChanged: {
|
||||
requestPaint()
|
||||
}
|
||||
onPaint: {
|
||||
var ctx = canvas.getContext("2d")
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||
ctx.save()
|
||||
ctx.lineWidth = control.strokeWidth
|
||||
ctx.strokeStyle = control.color
|
||||
ctx.lineCap = "round"
|
||||
ctx.beginPath()
|
||||
ctx.arc(width/2, height/2, d._radius ,-0.5 * Math.PI,-0.5 * Math.PI + d._progress * 2 * Math.PI)
|
||||
if(control.indeterminate){
|
||||
ctx.arc(width/2, height/2, d._radius , Math.PI * (startAngle - 90) / 180, Math.PI * (startAngle - 90 + sweepAngle) / 180)
|
||||
}else{
|
||||
ctx.arc(width/2, height/2, d._radius , -0.5 * Math.PI , -0.5 * Math.PI + d._progress * 2 * Math.PI)
|
||||
}
|
||||
ctx.stroke()
|
||||
ctx.closePath()
|
||||
ctx.restore()
|
||||
@ -80,4 +89,3 @@ ProgressBar{
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluStatusView {
|
||||
FluStatusLayout {
|
||||
property url source: ""
|
||||
property bool lazy: false
|
||||
color:"transparent"
|
||||
@ -21,11 +21,11 @@ FluStatusView {
|
||||
asynchronous: true
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Error){
|
||||
control.statusMode = FluStatusViewType.Error
|
||||
control.statusMode = FluStatusLayoutType.Error
|
||||
}else if(status === Loader.Loading){
|
||||
control.statusMode = FluStatusViewType.Loading
|
||||
control.statusMode = FluStatusLayoutType.Loading
|
||||
}else{
|
||||
control.statusMode = FluStatusViewType.Success
|
||||
control.statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,523 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import Qt.labs.platform 1.1
|
||||
import FluentUI 1.0
|
||||
|
||||
Item{
|
||||
id:control
|
||||
property int captrueMode: FluScreenshotType.Pixmap
|
||||
property int dotSize: 5
|
||||
property int borderSize: 1
|
||||
property var saveFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
|
||||
property color borderColor: FluTheme.primaryColor
|
||||
signal captrueCompleted(var captrue)
|
||||
QtObject{
|
||||
id:d
|
||||
property int dotMouseSize: control.dotSize+10
|
||||
property int dotMargins: -(control.dotSize-control.borderSize)/2
|
||||
property bool enablePosition: false
|
||||
property int menuMargins: 6
|
||||
}
|
||||
Loader {
|
||||
id:loader
|
||||
}
|
||||
Component{
|
||||
id:com_screen
|
||||
Window{
|
||||
property bool isZeroPos: screenshot.start.x === 0 && screenshot.start.y === 0 && screenshot.end.x === 0 && screenshot.end.y === 0
|
||||
id:window_screen
|
||||
flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||
x:-1
|
||||
y:-1
|
||||
width: 1
|
||||
height: 1
|
||||
visible: true
|
||||
color: "#00000000"
|
||||
onVisibleChanged: {
|
||||
if(!window_screen.visible){
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
setGeometry(0,0,screenshot_background.width,screenshot_background.height+1)
|
||||
}
|
||||
ScreenshotBackground{
|
||||
id:screenshot_background
|
||||
captureMode:control.captrueMode
|
||||
saveFolder: {
|
||||
if(typeof control.saveFolder === 'string'){
|
||||
return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder))
|
||||
}else{
|
||||
return FluTools.toLocalPath(control.saveFolder)
|
||||
}
|
||||
}
|
||||
onCaptrueToPixmapCompleted:
|
||||
(captrue)=>{
|
||||
control.captrueCompleted(captrue)
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
onCaptrueToFileCompleted:
|
||||
(captrue)=>{
|
||||
control.captrueCompleted(captrue)
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
Screenshot{
|
||||
id:screenshot
|
||||
anchors.fill: parent
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||
onPressed:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = true
|
||||
screenshot.start = Qt.point(mouse.x,mouse.y)
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
if(d.enablePosition){
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = false
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = false
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
(mouse)=>{
|
||||
if (mouse.button === Qt.RightButton){
|
||||
if(isZeroPos){
|
||||
loader.sourceComponent = undefined
|
||||
return
|
||||
}
|
||||
screenshot.start = Qt.point(0,0)
|
||||
screenshot.end = Qt.point(0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_capture
|
||||
x:Math.min(screenshot.start.x,screenshot.end.x)
|
||||
y:Math.min(screenshot.start.y,screenshot.end.y)
|
||||
width: Math.abs(screenshot.end.x - screenshot.start.x)
|
||||
height: Math.abs(screenshot.end.y - screenshot.start.y)
|
||||
color:"#00000000"
|
||||
border.width: control.borderSize
|
||||
border.color: control.borderColor
|
||||
MouseArea{
|
||||
property point clickPos: Qt.point(0,0)
|
||||
anchors.fill: parent
|
||||
cursorShape: d.isEdit ? Qt.ArrowCursor : Qt.SizeAllCursor
|
||||
onPressed:
|
||||
(mouse)=>{
|
||||
clickPos = Qt.point(mouse.x, mouse.y)
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
var delta = Qt.point(mouse.x - clickPos.x,mouse.y - clickPos.y)
|
||||
var w = Math.abs(screenshot.end.x - screenshot.start.x)
|
||||
var h = Math.abs(screenshot.end.y - screenshot.start.y)
|
||||
var x = Math.min(Math.max(rect_capture.x + delta.x,0),window_screen.width-w)
|
||||
var y = Math.min(Math.max(rect_capture.y + delta.y,0),window_screen.height-h)
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_left
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeFDiagCursor
|
||||
anchors.centerIn: rect_top_left
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
FluTools.setOverrideCursor(cursorShape)
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y+h)
|
||||
screenshot.end = Qt.point(x,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
horizontalCenter: rect_capture.horizontalCenter
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeVerCursor
|
||||
anchors.centerIn: rect_top_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
FluTools.setOverrideCursor(cursorShape)
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y+h)
|
||||
screenshot.end = Qt.point(x,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
screenshot.end = Qt.point(x,mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).y)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_right
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeBDiagCursor
|
||||
anchors.centerIn: rect_top_right
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y+h)
|
||||
screenshot.end = Qt.point(x+w,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_right_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
verticalCenter: rect_capture.verticalCenter
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeHorCursor
|
||||
anchors.centerIn: rect_right_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var y = rect_capture.y
|
||||
var h = rect_capture.height
|
||||
screenshot.end = Qt.point(mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).x,y+h)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_right_bottom
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeFDiagCursor
|
||||
anchors.centerIn: rect_right_bottom
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_bottom_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
horizontalCenter: rect_capture.horizontalCenter
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeVerCursor
|
||||
anchors.centerIn: rect_bottom_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var w = rect_capture.width
|
||||
screenshot.end = Qt.point(x+w,mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).y)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_bottom_left
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeBDiagCursor
|
||||
anchors.centerIn: rect_bottom_left
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y)
|
||||
screenshot.end = Qt.point(x,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_left_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
verticalCenter: rect_capture.verticalCenter
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeHorCursor
|
||||
anchors.centerIn: rect_left_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y)
|
||||
screenshot.end = Qt.point(x,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var y = rect_capture.y
|
||||
var h = rect_capture.height
|
||||
screenshot.end = Qt.point(mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).x,y+h)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Pane{
|
||||
width: 100
|
||||
height: 40
|
||||
visible: {
|
||||
if(isZeroPos){
|
||||
return false
|
||||
}
|
||||
if(d.enablePosition){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
x:rect_capture.x + rect_capture.width - width
|
||||
y:{
|
||||
if(rect_capture.y + rect_capture.height + d.menuMargins < screenshot.height-height){
|
||||
return rect_capture.y + rect_capture.height + d.menuMargins
|
||||
}else if(rect_capture.y - height - d.menuMargins > 0){
|
||||
return rect_capture.y - height - d.menuMargins
|
||||
}else{
|
||||
screenshot.height - height - d.menuMargins
|
||||
}
|
||||
}
|
||||
RowLayout{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.Cancel
|
||||
iconSize: 18
|
||||
iconColor: Qt.rgba(247/255,75/255,77/255,1)
|
||||
onClicked: {
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconColor: FluTheme.primaryColor
|
||||
onClicked: {
|
||||
screenshot_background.capture(screenshot.start,screenshot.end)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function open(){
|
||||
loader.sourceComponent = com_screen
|
||||
}
|
||||
}
|
@ -38,10 +38,10 @@ FluPage {
|
||||
rightMargin: control.rightPadding
|
||||
}
|
||||
}
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
color: "#00000000"
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
onErrorClicked: control.errorClicked()
|
||||
anchors{
|
||||
left: parent.left
|
||||
|
@ -123,19 +123,21 @@ FluIconButton {
|
||||
visible: control.activeFocus
|
||||
}
|
||||
}
|
||||
component ItemKey:Rectangle{
|
||||
id:item_key_control
|
||||
property string text : ""
|
||||
color:FluTheme.primaryColor
|
||||
width: Math.max(item_text.implicitWidth+12,28)
|
||||
height: Math.max(item_text.implicitHeight,28)
|
||||
radius: 4
|
||||
Text{
|
||||
id:item_text
|
||||
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
font.pixelSize: 13
|
||||
text: item_key_control.text
|
||||
anchors.centerIn: parent
|
||||
Component{
|
||||
id:com_item_key
|
||||
Rectangle{
|
||||
id:item_key_control
|
||||
color:FluTheme.primaryColor
|
||||
width: Math.max(item_text.implicitWidth+12,28)
|
||||
height: Math.max(item_text.implicitHeight,28)
|
||||
radius: 4
|
||||
Text{
|
||||
id:item_text
|
||||
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
font.pixelSize: 13
|
||||
text: keyText
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
Row{
|
||||
@ -144,8 +146,9 @@ FluIconButton {
|
||||
anchors.centerIn: parent
|
||||
Repeater{
|
||||
model: control.current
|
||||
delegate: ItemKey{
|
||||
text: modelData
|
||||
delegate: Loader{
|
||||
property var keyText: modelData
|
||||
sourceComponent: com_item_key
|
||||
}
|
||||
}
|
||||
Item{
|
||||
@ -183,8 +186,8 @@ FluIconButton {
|
||||
}
|
||||
contentDelegate: Component{
|
||||
Item{
|
||||
width: parent.width
|
||||
height: 100
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 100
|
||||
Component.onCompleted: {
|
||||
forceActiveFocus()
|
||||
}
|
||||
@ -217,8 +220,9 @@ FluIconButton {
|
||||
anchors.centerIn: parent
|
||||
Repeater{
|
||||
model: content_dialog.keysModel
|
||||
delegate: ItemKey{
|
||||
text: modelData
|
||||
delegate: Loader{
|
||||
property var keyText: modelData
|
||||
sourceComponent: com_item_key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import FluentUI 1.0
|
||||
Item{
|
||||
id:control
|
||||
default property alias content: container.data
|
||||
property int statusMode: FluStatusViewType.Loading
|
||||
property int statusMode: FluStatusLayoutType.Loading
|
||||
property string loadingText:"正在加载..."
|
||||
property string emptyText: "空空如也"
|
||||
property string errorText: "页面出错了.."
|
||||
@ -21,20 +21,20 @@ Item{
|
||||
Item{
|
||||
id:container
|
||||
anchors.fill: parent
|
||||
visible: statusMode===FluStatusViewType.Success
|
||||
visible: statusMode===FluStatusLayoutType.Success
|
||||
}
|
||||
FluLoader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
visible: statusMode!==FluStatusViewType.Success
|
||||
visible: statusMode!==FluStatusLayoutType.Success
|
||||
sourceComponent: {
|
||||
if(statusMode === FluStatusViewType.Loading){
|
||||
if(statusMode === FluStatusLayoutType.Loading){
|
||||
return loadingItem
|
||||
}
|
||||
if(statusMode === FluStatusViewType.Empty){
|
||||
if(statusMode === FluStatusLayoutType.Empty){
|
||||
return emptyItem
|
||||
}
|
||||
if(statusMode === FluStatusViewType.Error){
|
||||
if(statusMode === FluStatusLayoutType.Error){
|
||||
return errorItem
|
||||
}
|
||||
return undefined
|
||||
@ -103,15 +103,15 @@ Item{
|
||||
}
|
||||
}
|
||||
function showSuccessView(){
|
||||
statusMode = FluStatusViewType.Success
|
||||
statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
function showLoadingView(){
|
||||
statusMode = FluStatusViewType.Loading
|
||||
statusMode = FluStatusLayoutType.Loading
|
||||
}
|
||||
function showEmptyView(){
|
||||
statusMode = FluStatusViewType.Empty
|
||||
statusMode = FluStatusLayoutType.Empty
|
||||
}
|
||||
function showErrorView(){
|
||||
statusMode = FluStatusViewType.Error
|
||||
statusMode = FluStatusLayoutType.Error
|
||||
}
|
||||
}
|
@ -145,21 +145,8 @@ Module {
|
||||
Property { name: "radius"; type: "QList<int>" }
|
||||
}
|
||||
Component {
|
||||
name: "FluScreenshotType"
|
||||
exports: ["FluentUI/FluScreenshotType 1.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "CaptrueMode"
|
||||
values: {
|
||||
"Pixmap": 0,
|
||||
"File": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "FluStatusViewType"
|
||||
exports: ["FluentUI/FluStatusViewType 1.0"]
|
||||
name: "FluStatusLayoutType"
|
||||
exports: ["FluentUI/FluStatusLayoutType 1.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
@ -2168,38 +2155,6 @@ Module {
|
||||
Property { name: "bgColor"; type: "QColor" }
|
||||
Property { name: "size"; type: "int" }
|
||||
}
|
||||
Component {
|
||||
name: "Screenshot"
|
||||
defaultProperty: "data"
|
||||
prototype: "QQuickPaintedItem"
|
||||
exports: ["FluentUI/Screenshot 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "start"; type: "QPoint" }
|
||||
Property { name: "end"; type: "QPoint" }
|
||||
Property { name: "maskColor"; type: "QColor" }
|
||||
}
|
||||
Component {
|
||||
name: "ScreenshotBackground"
|
||||
defaultProperty: "data"
|
||||
prototype: "QQuickPaintedItem"
|
||||
exports: ["FluentUI/ScreenshotBackground 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "saveFolder"; type: "string" }
|
||||
Property { name: "captureMode"; type: "int" }
|
||||
Signal {
|
||||
name: "captrueToPixmapCompleted"
|
||||
Parameter { name: "captrue"; type: "QPixmap" }
|
||||
}
|
||||
Signal {
|
||||
name: "captrueToFileCompleted"
|
||||
Parameter { name: "captrue"; type: "QUrl" }
|
||||
}
|
||||
Method {
|
||||
name: "capture"
|
||||
Parameter { name: "start"; type: "QPoint" }
|
||||
Parameter { name: "end"; type: "QPoint" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "WindowLifecycle"
|
||||
prototype: "QObject"
|
||||
@ -3017,15 +2972,15 @@ Module {
|
||||
defaultProperty: "data"
|
||||
Property { name: "logo"; type: "QUrl" }
|
||||
Property { name: "title"; type: "string" }
|
||||
Property { name: "items"; type: "FluObject_QMLTYPE_159"; isPointer: true }
|
||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_159"; isPointer: true }
|
||||
Property { name: "items"; type: "FluObject_QMLTYPE_156"; isPointer: true }
|
||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_156"; isPointer: true }
|
||||
Property { name: "displayMode"; type: "int" }
|
||||
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "topPadding"; type: "int" }
|
||||
Property { name: "pageMode"; type: "int" }
|
||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
|
||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
|
||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true }
|
||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true }
|
||||
Property { name: "navCompactWidth"; type: "int" }
|
||||
Property { name: "navTopMargin"; type: "int" }
|
||||
Property { name: "cellHeight"; type: "int" }
|
||||
@ -3274,6 +3229,7 @@ Module {
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
defaultProperty: "data"
|
||||
Property { name: "duration"; type: "int" }
|
||||
Property { name: "strokeWidth"; type: "double" }
|
||||
Property { name: "progressVisible"; type: "bool" }
|
||||
Property { name: "color"; type: "QColor" }
|
||||
@ -3371,24 +3327,6 @@ Module {
|
||||
Method { name: "showEmptyView"; type: "QVariant" }
|
||||
Method { name: "showErrorView"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickItem"
|
||||
name: "FluentUI/FluScreenshot 1.0"
|
||||
exports: ["FluentUI/FluScreenshot 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
defaultProperty: "data"
|
||||
Property { name: "captrueMode"; type: "int" }
|
||||
Property { name: "dotSize"; type: "int" }
|
||||
Property { name: "borderSize"; type: "int" }
|
||||
Property { name: "saveFolder"; type: "QVariant" }
|
||||
Property { name: "borderColor"; type: "QColor" }
|
||||
Signal {
|
||||
name: "captrueCompleted"
|
||||
Parameter { name: "captrue"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "open"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickScrollBar"
|
||||
name: "FluentUI/FluScrollBar 1.0"
|
||||
@ -3521,8 +3459,8 @@ Module {
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickItem"
|
||||
name: "FluentUI/FluStatusView 1.0"
|
||||
exports: ["FluentUI/FluStatusView 1.0"]
|
||||
name: "FluentUI/FluStatusLayout 1.0"
|
||||
exports: ["FluentUI/FluStatusLayout 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
defaultProperty: "content"
|
||||
|
@ -62,7 +62,6 @@
|
||||
<file>FluentUI/Controls/FluRangeSlider.qml</file>
|
||||
<file>FluentUI/Controls/FluRatingControl.qml</file>
|
||||
<file>FluentUI/Controls/FluRemoteLoader.qml</file>
|
||||
<file>FluentUI/Controls/FluScreenshot.qml</file>
|
||||
<file>FluentUI/Controls/FluScrollablePage.qml</file>
|
||||
<file>FluentUI/Controls/FluScrollBar.qml</file>
|
||||
<file>FluentUI/Controls/FluScrollIndicator.qml</file>
|
||||
@ -70,7 +69,7 @@
|
||||
<file>FluentUI/Controls/FluSlider.qml</file>
|
||||
<file>FluentUI/Controls/FluSpinBox.qml</file>
|
||||
<file>FluentUI/Controls/FluStaggeredLayout.qml</file>
|
||||
<file>FluentUI/Controls/FluStatusView.qml</file>
|
||||
<file>FluentUI/Controls/FluStatusLayout.qml</file>
|
||||
<file>FluentUI/Controls/FluTableView.qml</file>
|
||||
<file>FluentUI/Controls/FluTabView.qml</file>
|
||||
<file>FluentUI/Controls/FluText.qml</file>
|
||||
|
@ -102,9 +102,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.NeutralButton
|
||||
FluButton{
|
||||
id:neutral_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.NeutralButton
|
||||
text: neutralText
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
@ -121,9 +121,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.NegativeButton
|
||||
FluButton{
|
||||
id:negative_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.NegativeButton
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
text: negativeText
|
||||
@ -140,9 +140,9 @@ FluPopup {
|
||||
Item{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: control.buttonFlags&FluContentDialogType.PositiveButton
|
||||
FluFilledButton{
|
||||
id:positive_btn
|
||||
visible: control.buttonFlags&FluContentDialogType.PositiveButton
|
||||
text: positiveText
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
|
@ -37,10 +37,10 @@ FluPage {
|
||||
rightMargin: control.rightPadding
|
||||
}
|
||||
}
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
color: "#00000000"
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
onErrorClicked: control.errorClicked()
|
||||
anchors{
|
||||
left: parent.left
|
||||
|
@ -8,7 +8,9 @@ Popup {
|
||||
id: popup
|
||||
padding: 0
|
||||
modal:true
|
||||
anchors.centerIn: Overlay.overlay
|
||||
parent: Overlay.overlay
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
ProgressBar{
|
||||
property int duration: 888
|
||||
property int duration: 2000
|
||||
property real strokeWidth: 6
|
||||
property bool progressVisible: false
|
||||
property color color: FluTheme.primaryColor
|
||||
@ -21,16 +21,12 @@ ProgressBar{
|
||||
border.width: control.strokeWidth
|
||||
}
|
||||
onIndeterminateChanged:{
|
||||
if(!indeterminate){
|
||||
animator_r.duration = 0
|
||||
layout_item.rotation = 0
|
||||
animator_r.duration = control.duration
|
||||
}
|
||||
canvas.requestPaint()
|
||||
}
|
||||
QtObject{
|
||||
id:d
|
||||
property real _radius: control.width/2-control.strokeWidth/2
|
||||
property real _progress: control.indeterminate ? 0.3 : control.visualPosition
|
||||
property real _progress: control.indeterminate ? 0.0 : control.visualPosition
|
||||
on_ProgressChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
@ -43,27 +39,39 @@ ProgressBar{
|
||||
}
|
||||
contentItem: Item {
|
||||
id:layout_item
|
||||
RotationAnimation on rotation {
|
||||
id:animator_r
|
||||
running: control.indeterminate && control.visible
|
||||
from: 0
|
||||
to:360
|
||||
loops: Animation.Infinite
|
||||
duration: control.duration
|
||||
}
|
||||
Canvas {
|
||||
id:canvas
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
renderTarget: Canvas.Image
|
||||
property real startAngle: 0
|
||||
property real sweepAngle: 0
|
||||
SequentialAnimation on startAngle {
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { from: 0; to: 450; duration: control.duration/2 }
|
||||
PropertyAnimation { from: 450; to: 1080; duration: control.duration/2 }
|
||||
}
|
||||
SequentialAnimation on sweepAngle {
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { from: 0; to: 180; duration: control.duration/2 }
|
||||
PropertyAnimation { from: 180; to: 0; duration: control.duration/2 }
|
||||
}
|
||||
onStartAngleChanged: {
|
||||
requestPaint()
|
||||
}
|
||||
onPaint: {
|
||||
var ctx = canvas.getContext("2d")
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||
ctx.save()
|
||||
ctx.lineWidth = control.strokeWidth
|
||||
ctx.strokeStyle = control.color
|
||||
ctx.lineCap = "round"
|
||||
ctx.beginPath()
|
||||
ctx.arc(width/2, height/2, d._radius ,-0.5 * Math.PI,-0.5 * Math.PI + d._progress * 2 * Math.PI)
|
||||
if(control.indeterminate){
|
||||
ctx.arc(width/2, height/2, d._radius , Math.PI * (startAngle - 90) / 180, Math.PI * (startAngle - 90 + sweepAngle) / 180)
|
||||
}else{
|
||||
ctx.arc(width/2, height/2, d._radius , -0.5 * Math.PI , -0.5 * Math.PI + d._progress * 2 * Math.PI)
|
||||
}
|
||||
ctx.stroke()
|
||||
ctx.closePath()
|
||||
ctx.restore()
|
||||
|
@ -2,7 +2,7 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
FluStatusView {
|
||||
FluStatusLayout {
|
||||
property url source: ""
|
||||
property bool lazy: false
|
||||
color:"transparent"
|
||||
@ -21,11 +21,11 @@ FluStatusView {
|
||||
asynchronous: true
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Error){
|
||||
control.statusMode = FluStatusViewType.Error
|
||||
control.statusMode = FluStatusLayoutType.Error
|
||||
}else if(status === Loader.Loading){
|
||||
control.statusMode = FluStatusViewType.Loading
|
||||
control.statusMode = FluStatusLayoutType.Loading
|
||||
}else{
|
||||
control.statusMode = FluStatusViewType.Success
|
||||
control.statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,523 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import Qt.labs.platform
|
||||
import FluentUI
|
||||
|
||||
Item{
|
||||
id:control
|
||||
property int captrueMode: FluScreenshotType.Pixmap
|
||||
property int dotSize: 5
|
||||
property int borderSize: 1
|
||||
property var saveFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
|
||||
property color borderColor: FluTheme.primaryColor
|
||||
signal captrueCompleted(var captrue)
|
||||
QtObject{
|
||||
id:d
|
||||
property int dotMouseSize: control.dotSize+10
|
||||
property int dotMargins: -(control.dotSize-control.borderSize)/2
|
||||
property bool enablePosition: false
|
||||
property int menuMargins: 6
|
||||
}
|
||||
Loader {
|
||||
id:loader
|
||||
}
|
||||
Component{
|
||||
id:com_screen
|
||||
Window{
|
||||
property bool isZeroPos: screenshot.start.x === 0 && screenshot.start.y === 0 && screenshot.end.x === 0 && screenshot.end.y === 0
|
||||
id:window_screen
|
||||
flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||
x:-1
|
||||
y:-1
|
||||
width: 1
|
||||
height: 1
|
||||
visible: true
|
||||
color: "#00000000"
|
||||
onVisibleChanged: {
|
||||
if(!window_screen.visible){
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
setGeometry(0,0,screenshot_background.width,screenshot_background.height+1)
|
||||
}
|
||||
ScreenshotBackground{
|
||||
id:screenshot_background
|
||||
captureMode:control.captrueMode
|
||||
saveFolder: {
|
||||
if(typeof control.saveFolder === 'string'){
|
||||
return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder))
|
||||
}else{
|
||||
return FluTools.toLocalPath(control.saveFolder)
|
||||
}
|
||||
}
|
||||
onCaptrueToPixmapCompleted:
|
||||
(captrue)=>{
|
||||
control.captrueCompleted(captrue)
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
onCaptrueToFileCompleted:
|
||||
(captrue)=>{
|
||||
control.captrueCompleted(captrue)
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
Screenshot{
|
||||
id:screenshot
|
||||
anchors.fill: parent
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||
onPressed:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = true
|
||||
screenshot.start = Qt.point(mouse.x,mouse.y)
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
if(d.enablePosition){
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = false
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=>{
|
||||
if(mouse.button === Qt.LeftButton){
|
||||
d.enablePosition = false
|
||||
screenshot.end = Qt.point(mouse.x,mouse.y)
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
(mouse)=>{
|
||||
if (mouse.button === Qt.RightButton){
|
||||
if(isZeroPos){
|
||||
loader.sourceComponent = undefined
|
||||
return
|
||||
}
|
||||
screenshot.start = Qt.point(0,0)
|
||||
screenshot.end = Qt.point(0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_capture
|
||||
x:Math.min(screenshot.start.x,screenshot.end.x)
|
||||
y:Math.min(screenshot.start.y,screenshot.end.y)
|
||||
width: Math.abs(screenshot.end.x - screenshot.start.x)
|
||||
height: Math.abs(screenshot.end.y - screenshot.start.y)
|
||||
color:"#00000000"
|
||||
border.width: control.borderSize
|
||||
border.color: control.borderColor
|
||||
MouseArea{
|
||||
property point clickPos: Qt.point(0,0)
|
||||
anchors.fill: parent
|
||||
cursorShape: d.isEdit ? Qt.ArrowCursor : Qt.SizeAllCursor
|
||||
onPressed:
|
||||
(mouse)=>{
|
||||
clickPos = Qt.point(mouse.x, mouse.y)
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
var delta = Qt.point(mouse.x - clickPos.x,mouse.y - clickPos.y)
|
||||
var w = Math.abs(screenshot.end.x - screenshot.start.x)
|
||||
var h = Math.abs(screenshot.end.y - screenshot.start.y)
|
||||
var x = Math.min(Math.max(rect_capture.x + delta.x,0),window_screen.width-w)
|
||||
var y = Math.min(Math.max(rect_capture.y + delta.y,0),window_screen.height-h)
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_left
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeFDiagCursor
|
||||
anchors.centerIn: rect_top_left
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
FluTools.setOverrideCursor(cursorShape)
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y+h)
|
||||
screenshot.end = Qt.point(x,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
horizontalCenter: rect_capture.horizontalCenter
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeVerCursor
|
||||
anchors.centerIn: rect_top_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
FluTools.setOverrideCursor(cursorShape)
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y+h)
|
||||
screenshot.end = Qt.point(x,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
screenshot.end = Qt.point(x,mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).y)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_top_right
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
topMargin: d.dotMargins
|
||||
top: rect_capture.top
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeBDiagCursor
|
||||
anchors.centerIn: rect_top_right
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y+h)
|
||||
screenshot.end = Qt.point(x+w,y)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_right_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
verticalCenter: rect_capture.verticalCenter
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeHorCursor
|
||||
anchors.centerIn: rect_right_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var y = rect_capture.y
|
||||
var h = rect_capture.height
|
||||
screenshot.end = Qt.point(mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).x,y+h)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_right_bottom
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
right: rect_capture.right
|
||||
rightMargin: d.dotMargins
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeFDiagCursor
|
||||
anchors.centerIn: rect_right_bottom
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_bottom_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
horizontalCenter: rect_capture.horizontalCenter
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeVerCursor
|
||||
anchors.centerIn: rect_bottom_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x,y)
|
||||
screenshot.end = Qt.point(x+w,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var w = rect_capture.width
|
||||
screenshot.end = Qt.point(x+w,mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).y)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_bottom_left
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
bottom: rect_capture.bottom
|
||||
bottomMargin: d.dotMargins
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeBDiagCursor
|
||||
anchors.centerIn: rect_bottom_left
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y)
|
||||
screenshot.end = Qt.point(x,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
screenshot.end = mapToItem(screenshot,Qt.point(mouse.x,mouse.y))
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:rect_left_center
|
||||
width: control.dotSize
|
||||
height: control.dotSize
|
||||
color: control.borderColor
|
||||
visible: !isZeroPos
|
||||
anchors{
|
||||
left: rect_capture.left
|
||||
leftMargin: d.dotMargins
|
||||
verticalCenter: rect_capture.verticalCenter
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
cursorShape: Qt.SizeHorCursor
|
||||
anchors.centerIn: rect_left_center
|
||||
width: d.dotMouseSize
|
||||
height: d.dotMouseSize
|
||||
visible: !isZeroPos
|
||||
onPressed:
|
||||
(mouse)=> {
|
||||
var x = rect_capture.x
|
||||
var y = rect_capture.y
|
||||
var w = rect_capture.width
|
||||
var h = rect_capture.height
|
||||
screenshot.start = Qt.point(x+w,y)
|
||||
screenshot.end = Qt.point(x,y+h)
|
||||
}
|
||||
onReleased:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
var y = rect_capture.y
|
||||
var h = rect_capture.height
|
||||
screenshot.end = Qt.point(mapToItem(screenshot,Qt.point(mouse.x,mouse.y)).x,y+h)
|
||||
}
|
||||
onCanceled:
|
||||
(mouse)=> {
|
||||
FluTools.restoreOverrideCursor()
|
||||
}
|
||||
}
|
||||
Pane{
|
||||
width: 100
|
||||
height: 40
|
||||
visible: {
|
||||
if(isZeroPos){
|
||||
return false
|
||||
}
|
||||
if(d.enablePosition){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
x:rect_capture.x + rect_capture.width - width
|
||||
y:{
|
||||
if(rect_capture.y + rect_capture.height + d.menuMargins < screenshot.height-height){
|
||||
return rect_capture.y + rect_capture.height + d.menuMargins
|
||||
}else if(rect_capture.y - height - d.menuMargins > 0){
|
||||
return rect_capture.y - height - d.menuMargins
|
||||
}else{
|
||||
screenshot.height - height - d.menuMargins
|
||||
}
|
||||
}
|
||||
RowLayout{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.Cancel
|
||||
iconSize: 18
|
||||
iconColor: Qt.rgba(247/255,75/255,77/255,1)
|
||||
onClicked: {
|
||||
loader.sourceComponent = undefined
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconColor: FluTheme.primaryColor
|
||||
onClicked: {
|
||||
screenshot_background.capture(screenshot.start,screenshot.end)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function open(){
|
||||
loader.sourceComponent = com_screen
|
||||
}
|
||||
}
|
@ -38,10 +38,10 @@ FluPage {
|
||||
rightMargin: control.rightPadding
|
||||
}
|
||||
}
|
||||
FluStatusView{
|
||||
FluStatusLayout{
|
||||
id:status_view
|
||||
color: "#00000000"
|
||||
statusMode: FluStatusViewType.Success
|
||||
statusMode: FluStatusLayoutType.Success
|
||||
onErrorClicked: control.errorClicked()
|
||||
anchors{
|
||||
left: parent.left
|
||||
|
@ -123,19 +123,21 @@ FluIconButton {
|
||||
visible: control.activeFocus
|
||||
}
|
||||
}
|
||||
component ItemKey:Rectangle{
|
||||
id:item_key_control
|
||||
property string text : ""
|
||||
color:FluTheme.primaryColor
|
||||
width: Math.max(item_text.implicitWidth+12,28)
|
||||
height: Math.max(item_text.implicitHeight,28)
|
||||
radius: 4
|
||||
Text{
|
||||
id:item_text
|
||||
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
font.pixelSize: 13
|
||||
text: item_key_control.text
|
||||
anchors.centerIn: parent
|
||||
Component{
|
||||
id:com_item_key
|
||||
Rectangle{
|
||||
id:item_key_control
|
||||
color:FluTheme.primaryColor
|
||||
width: Math.max(item_text.implicitWidth+12,28)
|
||||
height: Math.max(item_text.implicitHeight,28)
|
||||
radius: 4
|
||||
Text{
|
||||
id:item_text
|
||||
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
font.pixelSize: 13
|
||||
text: keyText
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
Row{
|
||||
@ -144,8 +146,9 @@ FluIconButton {
|
||||
anchors.centerIn: parent
|
||||
Repeater{
|
||||
model: control.current
|
||||
delegate: ItemKey{
|
||||
text: modelData
|
||||
delegate: Loader{
|
||||
property var keyText: modelData
|
||||
sourceComponent: com_item_key
|
||||
}
|
||||
}
|
||||
Item{
|
||||
@ -183,8 +186,8 @@ FluIconButton {
|
||||
}
|
||||
contentDelegate: Component{
|
||||
Item{
|
||||
width: parent.width
|
||||
height: 100
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 100
|
||||
Component.onCompleted: {
|
||||
forceActiveFocus()
|
||||
}
|
||||
@ -217,8 +220,9 @@ FluIconButton {
|
||||
anchors.centerIn: parent
|
||||
Repeater{
|
||||
model: content_dialog.keysModel
|
||||
delegate: ItemKey{
|
||||
text: modelData
|
||||
delegate: Loader{
|
||||
property var keyText: modelData
|
||||
sourceComponent: com_item_key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import FluentUI
|
||||
Item{
|
||||
id:control
|
||||
default property alias content: container.data
|
||||
property int statusMode: FluStatusViewType.Loading
|
||||
property int statusMode: FluStatusLayoutType.Loading
|
||||
property string loadingText:"正在加载..."
|
||||
property string emptyText: "空空如也"
|
||||
property string errorText: "页面出错了.."
|
||||
@ -20,20 +20,20 @@ Item{
|
||||
Item{
|
||||
id:container
|
||||
anchors.fill: parent
|
||||
visible: statusMode===FluStatusViewType.Success
|
||||
visible: statusMode===FluStatusLayoutType.Success
|
||||
}
|
||||
FluLoader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
visible: statusMode!==FluStatusViewType.Success
|
||||
visible: statusMode!==FluStatusLayoutType.Success
|
||||
sourceComponent: {
|
||||
if(statusMode === FluStatusViewType.Loading){
|
||||
if(statusMode === FluStatusLayoutType.Loading){
|
||||
return loadingItem
|
||||
}
|
||||
if(statusMode === FluStatusViewType.Empty){
|
||||
if(statusMode === FluStatusLayoutType.Empty){
|
||||
return emptyItem
|
||||
}
|
||||
if(statusMode === FluStatusViewType.Error){
|
||||
if(statusMode === FluStatusLayoutType.Error){
|
||||
return errorItem
|
||||
}
|
||||
return undefined
|
||||
@ -102,15 +102,15 @@ Item{
|
||||
}
|
||||
}
|
||||
function showSuccessView(){
|
||||
statusMode = FluStatusViewType.Success
|
||||
statusMode = FluStatusLayoutType.Success
|
||||
}
|
||||
function showLoadingView(){
|
||||
statusMode = FluStatusViewType.Loading
|
||||
statusMode = FluStatusLayoutType.Loading
|
||||
}
|
||||
function showEmptyView(){
|
||||
statusMode = FluStatusViewType.Empty
|
||||
statusMode = FluStatusLayoutType.Empty
|
||||
}
|
||||
function showErrorView(){
|
||||
statusMode = FluStatusViewType.Error
|
||||
statusMode = FluStatusLayoutType.Error
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
#include "Screenshot.h"
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QQuickWindow>
|
||||
#include <QDir>
|
||||
#include <QtMath>
|
||||
#include <QDateTime>
|
||||
#include <QThreadPool>
|
||||
#include "Def.h"
|
||||
|
||||
Screenshot::Screenshot(QQuickItem* parent):QQuickPaintedItem(parent){
|
||||
_desktopGeometry = qApp->primaryScreen()->virtualGeometry();
|
||||
maskColor(QColor(0,0,0,150));
|
||||
start(QPoint(0,0));
|
||||
end(QPoint(0,0));
|
||||
connect(this,&Screenshot::startChanged,this,[=]{update();});
|
||||
connect(this,&Screenshot::endChanged,this,[=]{update();});
|
||||
}
|
||||
|
||||
void Screenshot::paint(QPainter* painter){
|
||||
painter->save();
|
||||
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){
|
||||
_devicePixelRatio = qApp->primaryScreen()->devicePixelRatio();
|
||||
_desktopGeometry = qApp->primaryScreen()->virtualGeometry();
|
||||
_desktopPixmap = qApp->primaryScreen()->grabWindow(0, _desktopGeometry.x(), _desktopGeometry.y(), _desktopGeometry.width(), _desktopGeometry.height());
|
||||
int w = qApp->primaryScreen()->geometry().width();
|
||||
int h = qApp->primaryScreen()->geometry().height();
|
||||
foreach (auto item, qApp->screens()) {
|
||||
if(item != qApp->primaryScreen()){
|
||||
w = w + item->geometry().width()/qApp->primaryScreen()->devicePixelRatio();
|
||||
}
|
||||
}
|
||||
setWidth(w);
|
||||
setHeight(h);
|
||||
}
|
||||
|
||||
void ScreenshotBackground::paint(QPainter* painter){
|
||||
painter->save();
|
||||
_sourcePixmap = _desktopPixmap.copy();
|
||||
painter->drawPixmap(_desktopGeometry,_sourcePixmap);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void ScreenshotBackground::capture(const QPoint& start,const QPoint& end){
|
||||
update();
|
||||
auto pixelRatio = qApp->primaryScreen()->devicePixelRatio();
|
||||
auto x = qMin(start.x(),end.x()) * pixelRatio;
|
||||
auto y = qMin(start.y(),end.y()) * pixelRatio;
|
||||
auto w = qAbs(end.x()-start.x()) * pixelRatio;
|
||||
auto h = qAbs(end.y()-start.y()) * pixelRatio;
|
||||
_captureRect = QRect(x,y,w,h);
|
||||
if(_captureMode == FluScreenshotType::CaptrueMode::Pixmap){
|
||||
Q_EMIT captrueToPixmapCompleted(_sourcePixmap.copy(_captureRect));
|
||||
}
|
||||
if(_captureMode == FluScreenshotType::CaptrueMode::File){
|
||||
QDir dir = _saveFolder;
|
||||
if (!dir.exists(_saveFolder)){
|
||||
dir.mkpath(_saveFolder);
|
||||
}
|
||||
auto filePath = _saveFolder.append("/").append(QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch())).append(".png");
|
||||
_sourcePixmap.copy(_captureRect).save(filePath);
|
||||
Q_EMIT captrueToFileCompleted(QUrl::fromLocalFile(filePath));
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
#ifndef SCREENSHOT_H
|
||||
#define SCREENSHOT_H
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQuickPaintedItem>
|
||||
#include <QPainter>
|
||||
#include <QQuickItemGrabResult>
|
||||
#include "stdafx.h"
|
||||
#include <qmath.h>
|
||||
|
||||
class ScreenshotBackground : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT;
|
||||
QML_NAMED_ELEMENT(ScreenshotBackground)
|
||||
Q_PROPERTY_AUTO(QString,saveFolder);
|
||||
Q_PROPERTY_AUTO(int,captureMode);
|
||||
public:
|
||||
ScreenshotBackground(QQuickItem* parent = nullptr);
|
||||
void paint(QPainter* painter) override;
|
||||
Q_INVOKABLE void capture(const QPoint& start,const QPoint& end);
|
||||
Q_SIGNAL void captrueToPixmapCompleted(QPixmap captrue);
|
||||
Q_SIGNAL void captrueToFileCompleted(QUrl captrue);
|
||||
private:
|
||||
QRect _desktopGeometry;
|
||||
QPixmap _desktopPixmap;
|
||||
QPixmap _sourcePixmap;
|
||||
qreal _devicePixelRatio;
|
||||
QSharedPointer<QQuickItemGrabResult> _grabResult;
|
||||
QRect _captureRect;
|
||||
};
|
||||
|
||||
class Screenshot : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_NAMED_ELEMENT(Screenshot)
|
||||
Q_PROPERTY_AUTO(QPoint,start);
|
||||
Q_PROPERTY_AUTO(QPoint,end);
|
||||
Q_PROPERTY_AUTO(QColor,maskColor);
|
||||
public:
|
||||
Screenshot(QQuickItem* parent = nullptr);
|
||||
void paint(QPainter* painter) override;
|
||||
private:
|
||||
QRect _desktopGeometry;
|
||||
};
|
||||
|
||||
#endif // SCREENSHOT_H
|
Reference in New Issue
Block a user