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. MessageDialog has no states: property?
QtWS25 Last Chance

MessageDialog has no states: property?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlpropertystates
3 Posts 2 Posters 1.6k 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.
  • A Offline
    A Offline
    ars1614
    wrote on last edited by
    #1

    I am trying to use only one MessageDialog for all the applications warnings, errors... Each time I open it, I rewrite everything, but I wondered if there is no such a property like in others controls to do it easier.

    Thanks!

    ? 1 Reply Last reply
    0
    • A ars1614

      I am trying to use only one MessageDialog for all the applications warnings, errors... Each time I open it, I rewrite everything, but I wondered if there is no such a property like in others controls to do it easier.

      Thanks!

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      MessageDialog has no states: property

      That's because dialogs don't inherit from Item. But you can make your own dialog that extends MessageDialog. You can then add your own states property with StateGroup QML Type.

      A 1 Reply Last reply
      2
      • ? A Former User

        MessageDialog has no states: property

        That's because dialogs don't inherit from Item. But you can make your own dialog that extends MessageDialog. You can then add your own states property with StateGroup QML Type.

        A Offline
        A Offline
        ars1614
        wrote on last edited by
        #3

        @Wieland I have tried what you said and I am having this error: Cannot assign to non-existent default property at line StateGroup.
        This is my code:

        MessageDialog {
                id: msgDialog
        
                icon: StandardIcon.Warning;
                standardButtons: StandardButton.Ok
        
                StateGroup {
                    id: msgDialogStates
                    states: [
                        State {
                            name: "ActionsDialog"
                            PropertyChanges {
                                target: msgDialog
                                title: qsTr("Actions Error")
                                text: qsTr("Message.")
                            }
        
                        }, State {
                            name: "PropertiesDialog"
                            PropertyChanges {
                                target: msgDialog
                                title: qsTr("Properties Error");
                                text: qsTr("Another.")
                            }
        
                        }
                    ]
                }
            }
        

        The lines with the properties: title, text, icon and standardButtons are in red as I mencioned in another post.

        1 Reply Last reply
        0

        • Login

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