Re: [Qt-qml] Modal dialogs in QML?

2010-11-24 Thread Jan
Two ideas:

You could create a fully opaque Rectangle filling the whole screen with 
a centred, smaller Rectangle as child (the real visible dialog). But I 
guess opacity is inherited by the child ... maybe the smaller one it 
needs to be independent.

Or you create a global property in the top Rectangle disabling 
(attached to) all Mouseareas in child items (except the dlg's) if the 
dialog is visible.

Jan

Am 24.11.2010 05:35, schrieb Bart Kelsey:
 Greets!

 Is there any way to create a modal dialog in QML, such that mouse input
 outside of the dialog box is blocked?  I've tried making a dialog with a
 MouseArea under it (which would catch mouse input and do nothing with it),
 but I can't seem to figure out how to make the MouseArea fill the entire
 screen.  Any ideas?

 Bart




 ___
 Qt-qml mailing list
 Qt-qml@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-qml

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Modal dialogs in QML?

2010-11-24 Thread Girish Ramakrishnan
Hi,

On Wed, Nov 24, 2010 at 10:05 AM, Bart Kelsey elba...@gmail.com wrote:
 Greets!

 Is there any way to create a modal dialog in QML, such that mouse input
 outside of the dialog box is blocked?  I've tried making a dialog with a
 MouseArea under it (which would catch mouse input and do nothing with it),
 but I can't seem to figure out how to make the MouseArea fill the entire
 screen.  Any ideas?


Conceptually something like,
// main.qml
Item {

Dialog { // make Dialog a direct child of the main window
anchors.fill: parent; // Dialog spans the entire window
MouseArea { anchors.fill: parent; onClicked: opacity = 0; } //
handle outside clicks
Rectangle { // the dialogs content
anchors.centerIn: parent
MouseArea { anchors.fill: parent; } // absorb clicks in
the content area so that it won't close the dialog
...your dialog's widgets...
}
}
}

You can expand on the above idea to use a Loader so that the Dialog
gets created lazily.

Girish

___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml