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. Regarding Dialog box in qml

Regarding Dialog box in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 2.0k Views 2 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.
  • Naveen_DN Offline
    Naveen_DN Offline
    Naveen_D
    wrote on last edited by Naveen_D
    #1

    Hi all,

    I am using dialog box in qml, to popup a msg, i want to customize the dialog box to have OK button, i am using the following code,

     Dialog {
            id: initialScreendialoguebox
            modality: Qt.NonModal
            standardButtons: StandardButton.Ok | StandardButton.Cancel
           visible: false
    
            contentItem: Rectangle {
                color: "grey"
                implicitWidth: 500
                implicitHeight: 100
                Text {
                    id: initialScreendialogueboxText
                    text: ""
                    font.pixelSize: 16
                    color: "#ffffff"
                    anchors.centerIn: parent
                }
            }
        }
    

    but i am not able to get the buttons as expected. i am opening the dialog box based on some condition, also the text i am setting is not wrapping within the dialog box.
    Also, how to remove the close, maximize options from the dialog box?
    Can anyone please help me to solve the issue.
    Thank you.

    Naveen_D

    E 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Did you try elide mode option of Text ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      Naveen_DN 1 Reply Last reply
      1
      • Naveen_DN Naveen_D

        Hi all,

        I am using dialog box in qml, to popup a msg, i want to customize the dialog box to have OK button, i am using the following code,

         Dialog {
                id: initialScreendialoguebox
                modality: Qt.NonModal
                standardButtons: StandardButton.Ok | StandardButton.Cancel
               visible: false
        
                contentItem: Rectangle {
                    color: "grey"
                    implicitWidth: 500
                    implicitHeight: 100
                    Text {
                        id: initialScreendialogueboxText
                        text: ""
                        font.pixelSize: 16
                        color: "#ffffff"
                        anchors.centerIn: parent
                    }
                }
            }
        

        but i am not able to get the buttons as expected. i am opening the dialog box based on some condition, also the text i am setting is not wrapping within the dialog box.
        Also, how to remove the close, maximize options from the dialog box?
        Can anyone please help me to solve the issue.
        Thank you.

        E Offline
        E Offline
        Eeli K
        wrote on last edited by
        #3

        @Naveen_D Which one of the types named Dialog you are using?

        Naveen_DN 1 Reply Last reply
        0
        • E Eeli K

          @Naveen_D Which one of the types named Dialog you are using?

          Naveen_DN Offline
          Naveen_DN Offline
          Naveen_D
          wrote on last edited by
          #4

          @Eeli-K i am importing, QtQuick.Dialogs 1.2 and using Dialog
          One thing i came to know since i am customizing the dialog using contentitem, i am not able to get those standard button(ok).

          I tried with message dialog, but i am not able to customize it.

          Naveen_D

          1 Reply Last reply
          0
          • dheerendraD dheerendra

            Did you try elide mode option of Text ?

            Naveen_DN Offline
            Naveen_DN Offline
            Naveen_D
            wrote on last edited by Naveen_D
            #5

            @dheerendra the requirement is, complete text should be visible for which, i tried increasing the width. but is there any way, if the text is more than width it should come in the next line.

            Naveen_D

            1 Reply Last reply
            0
            • GTDevG Offline
              GTDevG Offline
              GTDev
              wrote on last edited by
              #6

              Hi Naveen_D,

              you can also have a look at V-Play Engine for Qt-based mobile apps and games. Besides many other components to make mobile app development simpler, the V-Play Apps SDK also includes an easy-to-use Dialog component:

              import VPlayApps 1.0
              
              App {
                Page {
              
                  AppButton {
                    anchors.centerIn: parent
                    text: "Custom Dialog"
                    onClicked: customDialog.open()
                  }
              
                  Dialog {
                    id: customDialog
                    title: "Do you think this is awesome?"
                    positiveActionLabel: "Yes"
                    negativeActionLabel: "No"
                    onCanceled: title = "Think again!"
                    onAccepted: close()
              
                    AppImage { //will be placed inside the dialogs content area
                      anchors.fill: parent
                      source: "../assets/vplay-logo.png"
                      fillMode: Image.PreserveAspectFit
                    }
                  }
                }
              }
              

              Hope this helps,
              GTDev

              Senior Developer at Felgo - https://felgo.com/qt

              Develop mobile Apps for iOS & Android with Qt
              Felgo is an official Qt Technology Partner

              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