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. QtQuick Material in secondary Window
QtWS25 Last Chance

QtQuick Material in secondary Window

Scheduled Pinned Locked Moved Solved QML and Qt Quick
material designqtquick2
3 Posts 2 Posters 1.2k 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.
  • C Offline
    C Offline
    CliverC
    wrote on 5 Aug 2017, 14:14 last edited by
    #1

    Hello, i'm new at QML and want to create a domestic alarm. I succesfully created a window with buttons and images with a Dark theme, but when i want to open a new window i can't set the same theme. I tried putting the code in a different .qml and in the same .qml. My code is like this:

    @
    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Controls.Material 2.0
    import QtQuick.Layouts 1.3
    import QtQuick.Window 2.0

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Smart Home")
    Material.theme: Material.Dark
    Material.accent: "#004D40"
    
    Image {
               ......
    }
    Rectangle {    
        ...
        AnimatedImage {
            ....
        }
    
        MouseArea {
            .....
        }
    }
    
    Window {
        id: ventanaprueba
        visible: true
        Material.theme: Material.Dark
        Material.accent: Material.DeepOrange
    }
    

    }
    @

    The window "ventanaprueba" opens but all white, when it should have a black background. I tried adding in the main.cpp file #include <QQuickStyle> and QQickStyle::setStyle("Material"); but didn't change anything.
    Can someone please help me? Thanks in advance

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrecKo
      Qt Champions 2018
      wrote on 6 Aug 2017, 22:15 last edited by
      #2

      Window isn't aware of the QQuickStyle, if you want to have a style window use ApplicationWindow.

      C 1 Reply Last reply 7 Aug 2017, 17:16
      0
      • G GrecKo
        6 Aug 2017, 22:15

        Window isn't aware of the QQuickStyle, if you want to have a style window use ApplicationWindow.

        C Offline
        C Offline
        CliverC
        wrote on 7 Aug 2017, 17:16 last edited by
        #3

        @GrecKo That was it. Thank you very much!

        1 Reply Last reply
        0

        3/3

        7 Aug 2017, 17:16

        • Login

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