ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #01646
Re: Ubuntu QML Dialogs
Hello,
I used Dialog by this way:
I created ConfirmationDialog.qml:
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.Popups 0.1
Item {
signal confirmed;
signal canceled;
signal show(variant caller);
Component {
id: dialogComponent
Dialog {
id: dialog
title: "Exit Game"
text: "Are you sure that you want to exit?"
Button {
text: "cancel"
onClicked:
{
canceled();
PopupUtils.close(dialog);
}
}
Button {
text: "confirm"
color: "orange"
onClicked:
{
confirmed();
PopupUtils.close(dialog);
}
}
}
}
onShow:
{
PopupUtils.open(dialogComponent, caller)
}
}
And in MainMenu.qml I create item:
ConfirmationDialog
{
id: confirmExitDialog
}
And call this dialog in button:
Button {
id: quitBtn
onClicked: {
confirmExitDialog.confirmed.connect(quit);
confirmExitDialog.show(quitBtn);
}
}
Is this a good dialog usage? How to use aliases for changing title and
text in item creation?
If I write:
property alias title: dialog.title
in Item's body in ConfirmationDialog.qml, I see error:
qrc:/ConfirmationDialog.qml:8:23: Invalid alias reference. Unable to
find id "dialog"
How to resolve this?
Best regards,
Nick
2013/4/11 Николай Шатохин <n.shatokhin@xxxxxxxxx>
> I don't need help with Dialog. I need help with showing them and getting
> value from them. I created ConfirmationDialog.qml that has Component with
> Dialog. How can I show it in MainMenu.qml and get selected value from them?
>
>
> 2013/4/11 Robert Bruce Park <robert.park@xxxxxxxxxxxxx>
>
>> On Thu, Apr 11, 2013 at 12:00:19AM +0300, Николай Шатохин wrote:
>> > How to use this dialog?
>> http://developer.ubuntu.com/api/ubuntu-12.10/qml/mobile
>> > /qml-ubuntu-components-popups0-dialog.html
>>
>> The first screenful of this page gives a code listing that shows how
>> to define the dialogue and how to have it pop up when a button is
>> clicked. What part of that do you need help with?
>>
>> > For example, I have main menu with few buttons and I want to ask user
>> > confirmation when he's clicking exit button.
>>
>> That sounds to me like you can copy&paste exactly what is in the
>> example and just name your button 'Quit'.
>>
>> > How to create dialog with radio or check buttons?
>>
>> That I don't know.
>>
>
>
Follow ups
References