qml

Video.play returns DirectShowPlayerService::doSetUrlSource: Unresolved error code 800c000d

心已入冬 提交于 2021-02-05 12:12:25
问题 Using Qt Version 5.4.2 Error code returned : DirectShowPlayerService::doSetUrlSource: Unresolved error code 800c000d A QML file has been written with the Video QML type as below. I have added the below in the project file (.pro) Qt+= multimedia Snippet of code as below in the QML file. Video { id: video width : 800 height : 600 source : "Video.mp4" MouseArea { anchors.fill: parent onClicked: { video.play(); } } focus: true Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ?

QML: Initialize empty list

喜夏-厌秋 提交于 2021-01-29 19:00:49
问题 I want to do the following: property list<MenuItem> menuItems: [] This fails with: Unexpected token `]' However, this works: property list<MenuItem> menuItems: [MenuItem{}] So how do I initialize an empty list here? 回答1: Like this: property list<MenuItem> menuItems The declaration with [] requires at least one item. A list is not as flexible as a Javascript Array: Note that objects cannot be individually added to or removed from the list once created; to modify the contents of a list, it must

QML: how to register user custom shortcut

▼魔方 西西 提交于 2021-01-29 16:40:02
问题 I'm currently learning Qt by developing a simple desktop app with Python and QML. The document about Pyside2 with QML is surprisingly insufficient. Anyway, now I'm struggling with user custom shortcut key registering. Some app have a text field in which you can press a key combination and that combination will show in the text field. something like this image According to the official document, there's a QKeySequenceEdit in C++. Is there any way to do this in QML ? Or at least in Pyside2 ? Or

QT QML - Changing Mapbox font size

血红的双手。 提交于 2021-01-29 09:52:23
问题 I'm using QT 5.12.4 with the MapboxGl plugin and I'm trying to figure out how to make the street names display in a larger font but I'm very confused about how to specify a text size. I need to change the size dynamically so using a predefined style is not going to meet the requirements. The two confusing aspects are that Mapbox's documentation has to be translated into "MapParameters" for QML and I'm clueless as to what exactly is needed to change the text size. Between reading through the

How to solve “QML module not found (QtMultimedia)”

风流意气都作罢 提交于 2021-01-29 08:12:44
问题 I'm importing QtMultimedia 5.4 to use a Camera but its raising this error QML module not found (QtMultimedia) . I've tried to echo the $QML_IMPORT_PATH as well as the $QML2_IMPORT_PATH which gave nothing. Thank you for you help. 来源: https://stackoverflow.com/questions/53378451/how-to-solve-qml-module-not-found-qtmultimedia

QQuickView (QML) transparent for mouse events

↘锁芯ラ 提交于 2021-01-29 03:29:26
问题 I have a big rectangle with a button centered. I would like that my rectangle is transparent to mouse events except for the button, which must be clickable. I mean, I would like to be able to select code under my rectangle with the mouse, exactly as if no Rectangle was displayed. I have added a MouseArea for all the big Rect, trying to ignore mouse events, but it does not work. I read that 'Qt::WA_TransparentForMouseEvents' is used for that purpose, but in Qt windows as fasr as I know, not

Reading QML object (CheckBox) property in a loop in C++: always the same value

孤人 提交于 2021-01-28 20:46:06
问题 I made a simple code to read the value of a checkbox from my QML in a C++ loop. However, I always get "unchecked" value, even after I toggle the checkbox with the mouse. QML: CheckBox { objectName: "simulatorCheckbox" text: "text" } C++: QObject *rootObject = engine.rootObjects().first(); QObject *simulatorCheckboxQ = rootObject->findChild<QObject*>("simulatorCheckbox"); if (!simulatorCheckboxQ) { std::cout << "simulatorCheckboxQ not found" << std::endl; std::exit(1); } auto consume = [

Expose variable from c++ to qml

£可爱£侵袭症+ 提交于 2021-01-28 14:00:37
问题 class Program { public: Program() = delete; Program(const QString &n, const QString &ip); Program(const Program &other) = delete; Program(Program &&other) = default; ~Program() = default; Program &operator=(const Program &other) = delete; Program &operator=(const Program &&other) = delete; constexpr static size_t maxProgram = 99; private: QString name; QString imagePath; }; Hi, I want expose my variable maxProgram from this class to QML, I think thant in the following code its work but I

QML map zoom only verticaly

与世无争的帅哥 提交于 2021-01-28 11:20:47
问题 Does map in Qt have a property, so it doesn't move center if I move mouse cursor on random place on map and try to change zoom level with mouse wheel? Because on default, map zooms, but moves existing center towards mouse cursor location (example on picture below; if cursor is on shown position and we try to change zoom, geotag picture will move in arrow direction). I just need it to zoom straight up from designated center of map, regardless of mouse cursor location. Map description: https:/