[Qt-qml] Setting the source with a click on QML component

Bartosh Wroblevksy bartosh at live.com
Fri Sep 30 11:56:34 CEST 2011


Thank you Girish, I guess we were looking for a solution where it is the C++ code that drives the loading of the qml files. Our solution keeps crashing after a setSource is executed. With your clicker.qml , we would like to implement something like this:

Rectangle {
signal change();--	MouseArea {		anchors.fill: parent                onClicked:{                container.change()                }	}---}
DeclarativeView::DeclarativeView(QWidget* parent)    :QDeclarativeView(parent){
 setSource(QUrl::fromLocalFile("./clicker.qml"));
 QObject *test= dynamic_cast<QObject*>(rootObject ());
 QObject::connect(test, SIGNAL(change()), this, SLOT(doit()));}
void DeclarativeView::doit(){    setSource(QUrl::fromLocalFile("./another.qml"));}

Thanks,
Bartosh
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110930/92f4c424/attachment.html 


More information about the Qt-qml mailing list