Problem of changing the theme
Unsolved
QML and Qt Quick
-
Good evening everyone
I'm on a small test projectIn fact when I change the theme on the application there are problems of the icons they do not display exactly
Theme Fusion on Windows
theme Material sur windows
theme Imagine sur windows
it's theme I didn't create they are available on Qt by defaultActually I would like to solve this problem and how I can change the icons when I change the theme too
I use qml interface side and c++ operation side
code
main.qml
import QtQuick import QtQuick.Controls import QtQuick.Layouts import QtQuick.Dialogs import Qt.labs.settings import BlackEditeur 1.0 ApplicationWindow { id: appWindow property bool closed: false Settings { id: settings property string style property bool dateShow: true property int dateFormat: 0 property int timeFormat: 0 property int language: 1 } width: 640 height: 480 visible: true title: qsTr("Note-Black") StackView { id: stack anchors.fill: parent initialItem: Page{ // Les raccourise Shortcut { sequence: "Ctrl+P" onActivated: myMenu.onPresseKeyParametre() } // Les Action Action{ id: actionSearch onTriggered: onSearch() } Action{ id: onOpenMenuAction onTriggered: myMenu.openMenu() } Action{ id: newNoteAction onTriggered: onLauncerNewNote() } Action{ id: openFileAction onTriggered: onOpenFile.open() } // Header header: ToolBar{ anchors.top: parent.top RowLayout { id: rowLayout anchors.fill: parent spacing: 6 ToolButton { icon.source: "qrc:/Icon//Note-Black/24x24/menu" icon.height: 24 icon.width: 24 Layout.alignment: Qt.AlignLeft action: onOpenMenuAction } ToolSeparator{Layout.fillHeight: true} Label { id: nomeApp2 text: "Note-Black" // color: "white" font.bold: true font.letterSpacing: 2 font.pixelSize: 24 horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter } ToolButton { icon.source: "qrc:/Icon//Note-Black/24x24/search" icon.height: 24 icon.width: 24 action: actionSearch Layout.alignment: Qt.AlignJustify } ToolButton { icon.source: "qrc:/Icon//Note-Black/24x24/sorting" icon.height: 24 icon.width: 24 Layout.alignment: Qt.AlignRight //action: onSortingAction } } } MyMenu { id: myMenu anchors.left: parent.left } Search { id: search visible: false anchors.centerIn: parent.Center } footer: ToolBar{ id: footerPage anchors.bottom: parent.bottom RowLayout { id: rowLayout2 anchors.fill: parent spacing: 6 ToolButton{ icon.source: "qrc:/Icon/Note-Black/24x24/file.png" icon.width: 24 icon.height: 24 action: openFileAction } ToolButton { id: toolLanguage icon.source: "qrc:/Icon/Note-Black/24x24/language.png" icon.width: 24 icon.height: 24 onClicked: pop.open() Layout.alignment: Qt.AlignCenter } ToolButton { icon.source: "qrc:/Icon/Note-Black/24x24/add.png" icon.width: 24 icon.height: 24 action: newNoteAction Layout.alignment: Qt.AlignRight } } } Popup { id: pop x: toolLanguage.x - 50 y: toolLanguage.y + 148 width: parent.width / 5 height: parent.height - 150 modal: Qt.ApplicationModal focus: true ColumnLayout { anchors.fill: parent RadioButton { checked: true text: qsTr("Français") onClicked: console.log(text) } RadioButton { text: qsTr("Arabe") onClicked: console.log(text) } RadioButton { text: qsTr("Somalie") onClicked: console.log(text) } } closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside } } } FileDialog { id: onOpenFile fileMode: FileDialog.OpenFile selectedNameFilter.index: 1 nameFilters: ["Fichier texte (*.txt)", "Fichier Html (*.html *.htm)", "Fichier Source Cpp/C (*.cpp *.c *.cxx)", "Fichier header Cpp/C (*.h *.hpp *.hxx)", "Tous les fichier (*.*)"] currentFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) onAccepted:{ onLauncerNewNotef(selectedFile) } } function onLauncerNewNotef(filePath) { var component = Qt.createComponent("qrc:/MyEditeur.qml") var editor = component.createObject(appWindow); editor.loads(filePath) stack.push(editor) } function onLauncerNewNote() { stack.push("qrc:/MyEditeur.qml") } function onSearch() { search.visible = true } }