qml

Qt - selectively allow a click to fall through to a lower application window

。_饼干妹妹 提交于 2021-01-27 20:54:18
问题 Is it possible to receive a mouse click even in a Qt application, evaluate it, and if necessary, let it fall through to whatever might happen to be below the Qt application window? Note that Qt::WA_TransparentForMouseEvents doesn't facilitate evaluating the click before passing it through. And since the click evaluation incorporates some dynamic logic, it is not applicable to set a static mask either, on top of this having a visual impact as well. Ideally, I would like a way to selectively

PyQt5 QML treeview example

让人想犯罪 __ 提交于 2021-01-27 17:54:01
问题 I try to setup a simple treeview example with PyQt5.6 (Python 3.4) and QML. I just found a few C++ examples, but nothing related to PyQt. I picked up the simpletreemodel example comming with PyQt source and modified it (https://github.com/baoboa/pyqt5/tree/master/examples/itemviews/simpletreemodel). Most likely something is wrong with the model. I got two error messages: simpletreemodel.qml:13:5: QML TreeView: Binding loop detected for property "model" ...qt/5.6/gcc_64/qml/QtQuick/Controls

Disable Android keyboard in qml application

久未见 提交于 2021-01-27 13:01:56
问题 I'm porting an existing QML/C++ application to the Android system. The application is already running on the Android tablet, but I have issues with Android keyboard. Since my QML/C++ application has implemented its own keyboard, I would like to disable an Android one. I've tried to add android:windowSoftInputMode="stateAlwaysHidden" line in AndroidManifest.xml file, but keyboard still appears when I press an edit box. Since I'm porting an existing application, I do not want to edit the code

QML - Q_INVOKABLE functions

荒凉一梦 提交于 2021-01-27 06:51:54
问题 I have a problem with QML, with calling Q_INVOKABLE functions. Although I marked functions as Q_INVOKABLE I'm getting errors TypeError: Result of expression 'azdownloader.setData' is not a function TypeError: Result of expression 'azdownloader.perform' is not a function I have this class: typedef QString lyricsDownloaderString; class lyricsDownloader : public QObject { public: Q_INVOKABLE virtual short perform() = 0; Q_INVOKABLE inline void setData(const string & a, const string & t); // set

Qt3D default uniform and attributes

a 夏天 提交于 2021-01-27 05:22:17
问题 I began to learn using shaders with QML, and I can't find any references that talk about default uniform and attribute values that are passed to the shaders. In certain examples, we can saw several of them like vertexPosition or modelViewProjection (that is also passed as mvp ), but there is no clear list containing all the variables that we can use. After investigating in Qt source code, I found out default name for many variables: uniform variables (found in renderview.cpp ) modelMatrix

How to implement a singleton provider for qmlRegisterSingletonType?

☆樱花仙子☆ 提交于 2021-01-27 05:13:29
问题 I want to use C++ Classes as Singleton instances in QML and figured that I have to register them with qmlRegisterSingletonType. This function requires a function which provides an instance of the registered C++ class. I am using latest Qt 5.3.1 with included MinGW 4.8 on Windows. The documentation shows the following example of a provider function: static QJSValue example_qjsvalue_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) static int seedValue = 5;

How to implement a singleton provider for qmlRegisterSingletonType?

£可爱£侵袭症+ 提交于 2021-01-27 05:11:18
问题 I want to use C++ Classes as Singleton instances in QML and figured that I have to register them with qmlRegisterSingletonType. This function requires a function which provides an instance of the registered C++ class. I am using latest Qt 5.3.1 with included MinGW 4.8 on Windows. The documentation shows the following example of a provider function: static QJSValue example_qjsvalue_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) static int seedValue = 5;

How to make a non-modal Dialog window be always on top?

你。 提交于 2021-01-27 03:57:22
问题 I am using an instance of a Dialog {} in my application to display a small controller window that the user can interact with to affect the functions in the main window (sort of a remote control). I can make this Dialog modal ( modality: Qt.WindowModal or modality: Qt.ApplicationModal ) or I can make it non-modal with modality: Qt.NonModal . My problem is that I need to make it non-modal but be always on top of the main window. If I use Qt.NonModal I can still click on the main form but then

Q_INVOKABLE method returning custom C++ type

淺唱寂寞╮ 提交于 2021-01-26 21:53:56
问题 I have a C++ method made Q_INVOKABLE. I can call this method from QML and it works when it returns basic types (like QString). But I can't with a custom type. How should I do this? Should I return a QVariant instead? Ideally, I would like to return a pointer to my custom type if possible. EDIT I do: qmlRegisterType<MyType>("Mine", 1, 0, "MyType"); qmlEngine->rootContext()->setContextProperty("testObj", new MyType()); I can use testObj global object or create MyType QML component. But I cannot

Q_INVOKABLE method returning custom C++ type

不羁岁月 提交于 2021-01-26 21:53:33
问题 I have a C++ method made Q_INVOKABLE. I can call this method from QML and it works when it returns basic types (like QString). But I can't with a custom type. How should I do this? Should I return a QVariant instead? Ideally, I would like to return a pointer to my custom type if possible. EDIT I do: qmlRegisterType<MyType>("Mine", 1, 0, "MyType"); qmlEngine->rootContext()->setContextProperty("testObj", new MyType()); I can use testObj global object or create MyType QML component. But I cannot