PDA

View Full Version : Could I use QWidget and qml together?



stereoMatching
3rd July 2013, 07:15
I want to use QTextBrowser to create a simple help engine
How could I open a QWidget from qml?

something like



import QtQuick 2.1

import Help 1.0

Rectangle {
width: 100
height: 62

HelpBrowser{id: helpBrowser}

MouseArea{
anchors.fill: parent

onClicked: {
helpBrowser.showBrowser()
}
}

}


Or there exist easier solution in qml?

wysota
3rd July 2013, 08:29
Expose a "HelpBrowser" type to QML that will open a widget when its showBrowser() slot is called. Be aware the widget will be opened in a new window. Also remember to construct a QApplication instead of QGuiApplication and link the widgets module.

stereoMatching
3rd July 2013, 08:35
Thanks, qml do not exist a rich text "browser" like QTextBrowser?
QWebkit is not an option since Qt on android do not support this module yet
But open a new window on mobile is weird too

wysota
3rd July 2013, 08:53
Thanks, qml do not exist a rich text "browser" like QTextBrowser?
You can show rich text using the Text element.

stereoMatching
3rd July 2013, 23:25
I wrote some helps as "html", Text element can't bite all of the tags in those html, but I guess
I don't have a better choice but to do some alternation about the helps by now.

stereoMatching
4th July 2013, 03:21
The codes works now, I typed something wrong before. Thanks for your helps