Regarding Dialog box in qml
-
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. -
Did you try elide mode option of Text ?
-
@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.
-
@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.
-
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