Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problem of changing the theme
QtWS25 Last Chance

Problem of changing the theme

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 319 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fortiga
    wrote on 24 Apr 2023, 16:36 last edited by
    #1

    Good evening everyone
    I'm on a small test project

    In fact when I change the theme on the application there are problems of the icons they do not display exactly

    Theme Fusion on Windows
    interface.png

    theme Material sur windows
    interface2.png

    theme Imagine sur windows
    interface3.png
    it's theme I didn't create they are available on Qt by default

    Actually 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
        }
    
    
    }
    

    Juste pour aller de l'avant et apprendre des choses, lorsque vous voulez devenir une légende, cela ne se fait pas du jour au lendemain.

    MarkkyboyM 1 Reply Last reply 25 Apr 2023, 13:32
    0
    • F Fortiga
      24 Apr 2023, 16:36

      Good evening everyone
      I'm on a small test project

      In fact when I change the theme on the application there are problems of the icons they do not display exactly

      Theme Fusion on Windows
      interface.png

      theme Material sur windows
      interface2.png

      theme Imagine sur windows
      interface3.png
      it's theme I didn't create they are available on Qt by default

      Actually 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
          }
      
      
      }
      
      MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on 25 Apr 2023, 13:32 last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0

      1/2

      24 Apr 2023, 16:36

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved