2013年9月12日星期四

[Android] How to put a QWidget object thrown into QML side show ?

If that ha.

there is a premise is that my QWidget object is already in memory of it.

For example, I have a QMainWidget has generated good .
# include

int main (int argc, char * argv [])
{
QApplication a (argc, argv);
QDeclarativeView view;
view.setSource (QUrl (". / main.qml"));

QMainWidget * w = new MainWindow (& view);
QGraphicsProxyWidget container;
container.setWidget (w);

/ / This code should write Shane ?
/ / view.rootContext () -> setContextProperty (xxxxxxx); corresponding QML Zuosa there needs to modify it . Still need other way ?
view.show ();

return a.exec ();
}

Thank you ha.
------ Solution ---------------------------------------- ----
assistan in
Home> Examples> QML Examples & Demos> C + + Extensions: QWidgets Example
example can help you, the key is you want to register your widget in qml
int qmlRegisterType (const char * uri, int versionMajor, int versionMinor, const char * qmlName)
--- --- eference ---------------------------------------
sorry. Complemented .

main purpose is to use qml layout and animation effects.

going to put a QWidget outside the set qml item of outerwear . . .
------ eference --------------------------------------- < br> oh. . I suddenly want to see. . I want to be

already have a QWidget called myWidget it. In memory.
Then I have main.qml follows
Rectangle
{
width: 400
height: 400

Rectangle
{
width: 50
height: 50
id: rect1
}
Rectangle
{
width: 50
height: 50
x: 50
y: 50
id: rect2
}
}

how to put rect2 in my myWidget . Completely filled . And displayed ?
------ eference --------------------------------------- < br> help ~ ~ ~
------ eference ---------------------------------- -----
ah what . This is a registered type of thing. Registered can write directly on the qml side . .

however. Current difficulties yes. .
My QWidget is already generated good ~ ~ There nothing approach ?






------ eference ------------------------------------ ---
I do not understand , do not know that I understand right QWidget
If you are unable to modify , then write a class package QWidget, the import QML, I do not know that okay

------ eference ------------------------------------ ---
ask the landlord is how to solve the problem now, I have encountered the same problem , I do not know how to solve , requesting support

没有评论:

发表评论