main
zhuzihcu 2023-03-01 22:06:48 +08:00
parent 392f6e0047
commit c8ed6b9ced
9 changed files with 148 additions and 9 deletions

View File

@ -10,13 +10,15 @@ Window {
color: "#00000000"
Component.onCompleted: {
FluApp.isFps = true
FluApp.isDark = false
FluApp.setAppWindow(app)
FluApp.routes = {
"/":"qrc:/MainPage.qml",
"/Setting":"qrc:/SettingPage.qml",
"/About":"qrc:/AboutPage.qml"
"/About":"qrc:/AboutPage.qml",
"/Installer":"qrc:/Installer.qml"
}
FluApp.initialRoute = "/"
FluApp.initialRoute = "/Installer"
FluApp.run()
}

102
example/Installer.qml Normal file
View File

@ -0,0 +1,102 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
FluWindow {
id:window
// width: 800
// height: 400
// maximumSize: Qt.size(800,400)
// minimumSize: Qt.size(800,400)
title:"安装向导"
FluAppBar{
id:appbar
title: "安装向导"
}
ColumnLayout{
width: parent.width
anchors{
top: appbar.bottom
bottom: parent.bottom
topMargin: 20
}
RowLayout{
width: parent.width
FluText{
text:"安装路径:"
Layout.leftMargin: 30
}
Rectangle{
color: FluApp.isDark ? "#323232" : "#FFFFFF"
radius: 4
Layout.fillWidth: true
height: 40
border.width: 1
border.color: FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
FluText{
text:"C:\\Program Files\\RustDesk"
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
leftMargin: 14
}
}
}
FluButton{
text:"更改路径"
Layout.rightMargin: 30
}
}
Item{
width: 1
Layout.fillHeight: true
}
Rectangle{
Layout.fillWidth: true
border.width: 1
border.color: FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
height: 60
color: FluApp.isDark ? "#323232" : "#FFFFFF"
RowLayout{
anchors{
right: parent.right
rightMargin: 30
verticalCenter: parent.verticalCenter
}
spacing: 14
FluButton{
text:"取消"
onClicked: {
window.close()
}
}
FluFilledButton{
text:"同意并安装"
}
FluButton{
text:"不安装直接运行"
onClicked: {
FluApp.navigate("/")
window.close()
}
}
}
}
}
}

View File

@ -24,5 +24,6 @@
<file>res/svg/avatar_10.svg</file>
<file>res/svg/avatar_11.svg</file>
<file>res/svg/avatar_12.svg</file>
<file>Installer.qml</file>
</qresource>
</RCC>

View File

@ -42,12 +42,23 @@ void FluApp::navigate(const QString& route){
}
bool isAppWindow = route==initialRoute();
FramelessView *view = new FramelessView();
view->setProperty("winId","1234243");
qDebug()<<"-----FramelessView--------->";
// view->setWidth(800);
// view->setHeight(500);
// view->setMaximumSize(QSize(800,500));
// view->setMinimumSize(QSize(800,500));
view->setColor(isDark() ? QColor(0,0,0,1) : QColor(255, 255, 255, 1));
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
qDebug()<<"-------------->";
if (status == QQuickView::Status::Ready) {
Q_EMIT windowReady(view);
view->moveToScreenCenter();
view->show();
}
});
qDebug()<<"-----view->setSource((routes().value(route).toString()))--------->";
view->setSource((routes().value(route).toString()));
if(isAppWindow){
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
@ -55,10 +66,13 @@ void FluApp::navigate(const QString& route){
}else{
view->closeDeleteLater();
}
view->moveToScreenCenter();
view->show();
}
bool FluApp::equalsWindow(FramelessView *view,QWindow *window){
qDebug()<<"-----equalsWindow--------->";
view->setWidth(800);
view->setHeight(500);
view->setMaximumSize(QSize(800,500));
view->setMinimumSize(QSize(800,500));
return view->winId() == window->winId();
}

View File

@ -118,7 +118,8 @@ public:
if (oldStyle != newStyle)
{
borderless = enabled;
::SetWindowLongPtrW(handle, GWL_STYLE, static_cast<LONG>(newStyle));
//todo 有待研究这个
// ::SetWindowLongPtrW(handle, GWL_STYLE, static_cast<LONG>(newStyle));
// when switching between borderless and windowed, restore appropriate shadow state
setShadow(handle, borderless_shadow && (newStyle != Style::windowed));

View File

@ -21,3 +21,7 @@ void WindowHelper::setMinimumSize(const QSize &size){
void WindowHelper::setMaximumSize(const QSize &size){
this->window->setMaximumSize(size);
}
void WindowHelper::setSize(const QSize &size){
}

View File

@ -18,6 +18,7 @@ public:
Q_INVOKABLE void setTitle(const QString& text);
Q_INVOKABLE void setMinimumSize(const QSize &size);
Q_INVOKABLE void setMaximumSize(const QSize &size);
Q_INVOKABLE void setSize(const QSize &size);
private:
FramelessView* window;

View File

@ -825,6 +825,10 @@ Module {
name: "setMaximumSize"
Parameter { name: "size"; type: "QSize" }
}
Method {
name: "setSize"
Parameter { name: "size"; type: "QSize" }
}
}
Component {
prototype: "QQuickRectangle"
@ -1176,6 +1180,7 @@ Module {
defaultProperty: "data"
Property { name: "isMax"; type: "bool" }
Property { name: "title"; type: "string" }
Property { name: "winId"; type: "string" }
Property { name: "minimumSize"; type: "QVariant" }
Property { name: "maximumSize"; type: "QVariant" }
Property { name: "window"; type: "QVariant" }
@ -1207,5 +1212,6 @@ Module {
Parameter { name: "duration"; type: "QVariant" }
Parameter { name: "moremsg"; type: "QVariant" }
}
Method { name: "close"; type: "QVariant" }
}
}

View File

@ -12,6 +12,9 @@ Rectangle {
return Window.Maximized === Window.window.visibility
}
property string title: "FluentUI"
property string winId
property var minimumSize
property var maximumSize
@ -40,7 +43,7 @@ Rectangle {
color : FluApp.isDark ? "#202020" : "#F3F3F3"
Component.onCompleted: {
console.debug("onCompleted")
console.debug("Component.onCompleted:"+root.winId)
}
Connections{
@ -55,6 +58,11 @@ Rectangle {
if(maximumSize){
helper.setMaximumSize(maximumSize)
}
if(maximumSize&&minimumSize){
if(maximumSize.width === minimumSize.width && maximumSize.height === minimumSize.height){
helper.disResizable()
}
}
}
}
}
@ -68,7 +76,6 @@ Rectangle {
root: root
}
function showSuccess(text,duration,moremsg){
infoBar.showSuccess(text,duration,moremsg);
}
@ -81,7 +88,8 @@ Rectangle {
function showError(text,duration,moremsg){
infoBar.showError(text,duration,moremsg);
}
function close(){
window.close()
}
}