fix windows build

This commit is contained in:
uncor3
2026-05-14 06:33:31 +03:00
parent 6671cc5f2a
commit 13b71fc80c
10 changed files with 137 additions and 185 deletions
+25 -10
View File
@@ -116,12 +116,13 @@ fn main() {
qputenv("QSG_RENDER_LOOP", "basic");
#endif
// FIXME: fluentui example app was forcing OpenGL
// but do we need this ?
// #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
// QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
#ifdef Q_OS_WINDOWS
// uxplay now uses qml6glsink so we have to use opengl on Windows
// Linux is fine with QT_QPA_PLATFORM=xcb
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QQuickStyle::setStyle("FluentWinUI3");
#endif
// QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
// #endif
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
@@ -228,9 +229,14 @@ fn main() {
let engine_ptr = engine.cpp_ptr();
// cpp!(unsafe [engine_ptr as "QQmlApplicationEngine *"] {
// engine_ptr->rootContext()->setContextProperty("NetworkDeviceProvider", NetworkDeviceProvider::sharedInstance());
// });
cpp!(unsafe [engine_ptr as "QQmlApplicationEngine *"] {
// FIXME: workaround to find FluentUI
#ifdef Q_OS_WINDOWS
engine_ptr->addImportPath("C:/Qt/6.9.3/mingw_64/qml");
#endif
// #endif
// engine_ptr->rootContext()->setContextProperty("NetworkDeviceProvider", NetworkDeviceProvider::sharedInstance());
});
let service_factory = QObjectBox::new(crate::service_factory::ServiceFactory::new(engine_ptr));
engine.set_object_property("serviceFactory".into(), service_factory.pinned());
@@ -258,8 +264,17 @@ fn main() {
engine.load_url(QString::from("qrc:/src/ui/Main.qml").into());
}
} else {
engine.load_file(format!("{}/src/ui/Main.qml", env!("CARGO_MANIFEST_DIR")).into());
let ui_path = QString::from(format!("{}/src/ui", env!("CARGO_MANIFEST_DIR")));
let manifest_dir = env!("CARGO_MANIFEST_DIR");
let main_qml_path = if cfg!(target_os = "windows") {
format!("{}/src/ui/windows/Main.qml", manifest_dir).into()
} else {
format!("{}/src/ui/Main.qml", manifest_dir).into()
};
engine.load_file(main_qml_path);
let ui_path = QString::from(format!("{}/src/ui", manifest_dir));
cpp!(unsafe [engine_ptr as "QQmlApplicationEngine *", ui_path as "QString"] { init_live_reload(engine_ptr, ui_path); });
}
+1 -1
View File
@@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Qt5Compat.GraphicalEffects 1.15
import Qt5Compat.GraphicalEffects
import QtQuick.Controls.impl
Item {
+6 -7
View File
@@ -21,16 +21,16 @@ Item {
// Layout.fillHeight : true
ColumnLayout {
Layout.fillWidth : true
// Layout.fillWidth : true
Layout.fillHeight : true
Layout.preferredWidth: 220
Repeater {
model: App.DeviceContext.devices
delegate: Item {
SidebarTabButton {
Layout.fillWidth: true
Layout.preferredWidth: 220
Layout.preferredHeight: 40
delegate:SidebarTabButton {
Layout.fillHeight : true
Layout.preferredWidth: 200
Layout.alignment: Qt.AlignHCenter
currentSection: root.currentSection
// udid: model.udid
// anchors.fill: parent
@@ -41,7 +41,6 @@ Item {
// root.currentDeviceUdid = udid
if (root.currentSection !== sectionIndex)
root.currentSection = sectionIndex
}
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Qt5Compat.GraphicalEffects 1.15
import Qt5Compat.GraphicalEffects
Rectangle {
id: root
+79 -59
View File
@@ -1,69 +1,89 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI
ColumnLayout {
id:root
signal sectionChanged(int sectionIndex)
Button {
Layout.preferredWidth: 220
Layout.fillHeight: true
contentItem : Text {
text: "Info"
color: "Red"
}
background : Rectangle {
color : "transparent"
}
onClicked: {
root.sectionChanged(0)
FluExpander {
id: root
property int currentSection : 1
signal sectionChanged(int sectionIndex)
ListModel {
id: nav_model
ListElement { name: qsTr("Info"); sectionIndex: 0 }
ListElement { name: qsTr("Apps"); sectionIndex: 1 }
ListElement { name: qsTr("Gallery"); sectionIndex: 2 }
ListElement { name: qsTr("Files"); sectionIndex: 3 }
}
implicitWidth: 200
contentHeight : 40 * 4 + 40
headerDelegate: Component {
Item {
FluToggleButton {
anchors.centerIn: parent
text: qsTr("TODO")
}
}
}
Button {
Layout.preferredWidth: 220
Layout.fillHeight: true
contentItem : Text {
text: "Apps"
color: "Red"
}
background : Rectangle {
color : "transparent"
}
onClicked: {
root.sectionChanged(1)
content: Item {
anchors.fill: parent
ListView {
id: nav_list
anchors.fill: parent
anchors.margins : 10
clip: true
spacing : 5
model: nav_model
interactive: false
boundsBehavior: ListView.StopAtBounds
currentIndex : root.currentSection
highlightMoveDuration: FluTheme.animationEnabled ? 167 : 0
highlight: Item{
z:99
clip: true
Rectangle{
height: 18
radius: 1.5
color: FluTheme.primaryColor
width: 3
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 6
}
}
}
delegate: FluButton {
text: name
width: nav_list.width
height: 40
// verticalPadding: 5
// horizontalPadding:20
background : Rectangle {
color : {
if (nav_list.currentIndex == index) {
return FluTheme.itemCheckColor
}
if (hovered) {
return FluTheme.itemHoverColor
}
return "transparent"
}
radius : 4
}
onClicked : {
nav_list.currentIndex = index
root.sectionChanged(sectionIndex)
}
}
}
}
Button {
Layout.preferredWidth: 220
Layout.fillHeight: true
contentItem : Text {
text: "Gallery"
color: "Red"
}
background : Rectangle {
color : "transparent"
}
onClicked: {
root.sectionChanged(2)
}
}
Button {
Layout.preferredWidth: 220
Layout.fillHeight: true
contentItem : Text {
text: "Files"
color: "Red"
}
background : Rectangle {
color : "transparent"
}
onClicked: {
root.sectionChanged(3)
}
}
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import QtQuick.Layouts 1.15
import "."
import ".."
FluWindow {
@@ -55,6 +55,6 @@ FluWindow {
Tabs {
currentIndex: window.currentIndex
anchors.fill: parent
anchors.topMargin: appBar.height
anchors.topMargin: appBar.height + 25
}
}
+5 -1
View File
@@ -3,6 +3,7 @@ import QtQuick.Window 2.15
// import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
import "../"
FluLauncher {
id: app
@@ -36,8 +37,11 @@ FluLauncher {
// FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.darkMode = false
FluTheme.animationEnabled = true
var indexUrl = Qt.resolvedUrl("Index.qml")
console.log("Index URL =", indexUrl)
FluRouter.routes = {
"/":"qrc:/src/qml/windows/Index.qml",
"/": indexUrl
}
var args = Qt.application.arguments
if(args.length>=2 && args[1].startsWith("-crashed=")){