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. Customizable message box
Forum Updated to NodeBB v4.3 + New Features

Customizable message box

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MartinD
    wrote on last edited by
    #1

    Hi,
    I want to display message box (modal) in my qml application that has custom graphical elements so its appearance is the same as the rest of my application. I need to customize buttons, text, colors, add some image in the message box etc.

    Standard MessageDialog QML Type is not good for me as I can't customize its appearance.

    What's the best way to achieve this? The application will run on Windows and Android.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! Just use a QtQuick Window and make it modal; you can then customize whatever you want:

      import QtQuick 2.6
      import QtQuick.Controls 1.5
      import QtQuick.Window 2.2
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Button {
              anchors.bottom: contentItem.bottom
              text: "Show Dialog"
              onClicked: myDialog.visible = true
          }
      
          Window {
              id: myDialog
              visible: false
              flags: Qt.Dialog
              title: "My Dialog"
              color: "plum"
              Button {
                  anchors.centerIn: parent
                  onClicked: myDialog.visible = false
                  text: "Hide"
              }
          }
      }
      
      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