Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qtquick2
    Log in to post

    • UNSOLVED How do I go about creating a Ribbon component in QT?
      QML and Qt Quick • qml qt5 pyside2 qtquick2 • • Raj97  

      1
      0
      Votes
      1
      Posts
      167
      Views

      No one has replied

    • UNSOLVED Qt Quick Controls 2 - How to grab the items contained in a TableView in images in order to print them?
      QML and Qt Quick • image qtquick2 printing grab printtopdf • • jeanmilost  

      1
      0
      Votes
      1
      Posts
      46
      Views

      No one has replied

    • UNSOLVED QtQuick 2 controls aren't visible in QML-designer after Qt static building
      QML and Qt Quick • qml qtquick2 qt designer static build design mode • • HoShiMin  

      1
      0
      Votes
      1
      Posts
      69
      Views

      No one has replied

    • SOLVED Styling the Busy indicator in QML 2.0
      QML and Qt Quick • qml qtquick2 qtquickcontrol busy indicator • • pra7  

      5
      0
      Votes
      5
      Posts
      681
      Views

      This is how I style one off BusyIndicator: BusyIndicator { running: true Component.onCompleted: { contentItem.pen = "white" contentItem.fill = "white" } } If I recall correctly I was looking at source code of BusyIndicator to understand how to style it.
    • UNSOLVED " Error : Cannot assign [undefined] to QString " while communicating between C++ and QML
      QML and Qt Quick • qml c++ qtquick2 qproperty • • Quentin91  

      6
      0
      Votes
      6
      Posts
      1367
      Views

      @Ronak5 no, I didn't. that's probably not the problem any current test is trying to share a bool with QML and the problem is the same. but I'll remember to try it when sharing a string :) So here is a simpler project and use a Singleton. One of the problem was that I have to declare my object in the QML when using qmlRegisterType. And I don't want to. So here is the new code, the error is the same. I followed the example of the doc here https://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html miniModel.h (the singleton) #ifndef _MINIMODEL_H_ #define _MINIMODEL_H_ #include <stdlib.h> #include <stdio.h> #include <iostream> #include <string> #include <QtGui/qguiapplication.h> #include <QtQml/qqmlcontext.h> #include <QtQml/qqmlapplicationengine.h> #include <QtCore/qdebug.h> #include <QtCore/qobject.h> #include <QtCore/qvariant.h> class MiniModel : public QObject { Q_OBJECT Q_PROPERTY(bool miniboule READ miniboule WRITE setMiniboule NOTIFY minibouleChanged) public: MiniModel(); bool miniboule(); void setMiniboule(bool bouboule); signals: void minibouleChanged(); private: bool m_miniboule; }; #endif main.cpp v1 : singleton using a QObject #include "miniModel.h" //defining a miniModel instance as a singleton static QObject* mp_singleton(QQmlEngine* engine, QJSEngine* scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) MiniModel* miniSingleton = new MiniModel(); return miniSingleton; } int main(int argc=0, char* argv[]=nullptr) { printf("\n launching \n"); QGuiApplication app(argc, argv); qmlRegisterSingletonType<MiniModel>("myModel.miniModel", 1, 0, "MiniModel",mp_singleton); QQmlApplicationEngine engine; engine.addImportPath(QStringLiteral("..\\..\\..\\..\\Tools\\Qt\\5.12.0\\x64\\5.12.0\\msvc2017_64\\qml")); engine.load(QUrl(QStringLiteral("..\\..\\..\\miniModel.qml"))); return app.exec(); } main.cpp v2 : singletin using QJSValue #include "miniModel.h" static QJSValue m_singletonModel(QQmlEngine* engine, QJSEngine* scriptEngine) { Q_UNUSED(engine) static bool m_miniboule; QJSValue miniModel = scriptEngine->newObject(); miniModel.setProperty("miniboule", m_miniboule); return miniModel; } int main(int argc = 0, char* argv[] = nullptr) { printf("\n launching \n"); QGuiApplication app(argc, argv); qmlRegisterSingletonType("myModel.miniModel", 1, 0, "MiniModel", m_singletonModel); QQmlApplicationEngine engine; engine.addImportPath(QStringLiteral("..\\..\\..\\..\\Tools\\Qt\\5.12.0\\x64\\5.12.0\\msvc2017_64\\qml")); engine.load(QUrl(QStringLiteral("..\\..\\..\\miniModel.qml"))); return app.exec(); } and the QML. be careful, it's tough import QtQuick 2.5 import QtQuick.Window 2.5 import QtQuick.Controls 1.4 import myModel.miniModel 1.0 as MyModel ApplicationWindow { id: root width: 300 height: 480 visible:true Text{ id: textTest x: 62 y: 75 color: "#d21616" text: "vanilla" visible: false//the text is supposed to appear when clicking in the mouseArea } MouseArea{ anchors.fill: parent onClicked: textTest.visible= MyModel.Minimodel.miniboule//the boolean I want to acess, defined to true } } now, the error changed, since I called MyModel.MiniModel.miniboule instead of just MiniModel.miniboule the error is TypeError: Cannot read property 'miniboule' of undefined
    • SOLVED How to measure time taken for QML item to appear on the screen since it was loaded?
      QML and Qt Quick • qml qtquick2 loader item time • • diredko  

      5
      0
      Votes
      5
      Posts
      624
      Views

      If you need this for just measuring the performance of your application, maybe you should use the QML Profiler instead http://doc.qt.io/qtcreator/creator-qml-performance-monitor.html
    • UNSOLVED QML ComboBox Popup Issue
      QML and Qt Quick • qml combobox qtquick2 • • pra7  

      1
      0
      Votes
      1
      Posts
      773
      Views

      No one has replied

    • UNSOLVED Bad shader result in a custom QQuickItem
      QML and Qt Quick • qml opengl qtquick2 qquickitem scene graph • • seyed  

      2
      0
      Votes
      2
      Posts
      602
      Views

      @seyed As I understand things, you need to get hold of the item's transform and do whatever your rendering needs to do with it for it to have effect... see https://stackoverflow.com/questions/28535528/how-can-i-get-transform-matrix-for-qquickitem . (Similarly, nothing will implement the opacity property for you... you have to bring it into your OpenGL code and use it in your fragment shader.)
    • UNSOLVED How to add animation to a component while destroying in QML
      QML and Qt Quick • animation qtquick2 qtquickcontrols • • pra7  

      2
      0
      Votes
      2
      Posts
      430
      Views

      Use model classes and views instead of such approach. It will save you a lot of tears in the long run. For a starter, see: https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html
    • UNSOLVED Creating a complex List Model in QML
      QML and Qt Quick • listview qtquick2 listmodel • • pra7  

      1
      0
      Votes
      1
      Posts
      345
      Views

      No one has replied

    • UNSOLVED Remove "British-English" in Virtual Keyboard
      QML and Qt Quick • qtquick2 virtualkeyboard • • pra7  

      2
      0
      Votes
      2
      Posts
      732
      Views

      @pra7 Follow these instructions then edit your styles.qml file and comment out line 437 spaceKeyPanel: KeyPanel { Rectangle { id: spaceKeyBackground radius: 5 color: "#35322f" anchors.fill: parent anchors.margins: keyBackgroundMargin Text { id: spaceKeyText //text: Qt.locale(InputContext.locale).nativeLanguageName
    • UNSOLVED TextField Validation in QML
      QML and Qt Quick • qtquick2 qtquickcontrols textfield • • pra7  

      1
      0
      Votes
      1
      Posts
      726
      Views

      No one has replied

    • UNSOLVED Regular Expression for date and time(DD/MM/YYYY hh:mm:ss) in QML
      QML and Qt Quick • qml qtquick2 regex • • pra7  

      5
      0
      Votes
      5
      Posts
      2680
      Views

      @pra7 See also https://forum.qt.io/topic/82700/datepicker-anyone. BTW you must mean Quick Controls 2, not QML2. You also can use Controls 1 elements in Controls 2 application, although the look&feel may be a problem.
    • SOLVED How to lock screen Orientation(Windows) in QML 2 ?
      QML and Qt Quick • qml qtquick2 orientation • • Praveen_2017  

      2
      0
      Votes
      2
      Posts
      940
      Views

      I got to know that there is no such API to set Screen orientation in QT for windows and thus I used windows API for locking app Orientation, following is the code : Just copy paste below code in main.cpp: #include <Windows.h> typedef enum ORIENTATION_PREFERENCE { ORIENTATION_PREFERENCE_NONE = 0x0, ORIENTATION_PREFERENCE_LANDSCAPE = 0x1, ORIENTATION_PREFERENCE_PORTRAIT = 0x2, ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = 0x4, ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = 0x8 } ORIENTATION_PREFERENCE; typedef BOOL (WINAPI *pSDARP)(ORIENTATION_PREFERENCE orientation); pSDARP pARP; pARP = (pSDARP) GetProcAddress( GetModuleHandle(TEXT("user32.dll")), "SetDisplayAutoRotationPreferences"); if( pARP ){ pARP( (ORIENTATION_PREFERENCE)(ORIENTATION_PREFERENCE_LANDSCAPE | ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED ) ); } For more information please refer : Handling Windows Auto-rotate feature in your application Hope it helps others .
    • SOLVED Time Edit field in QML
      QML and Qt Quick • qtquick2 textfield qtquickcontrol • • pra7  

      13
      0
      Votes
      13
      Posts
      4337
      Views

      @Eeli-K sorry I have read your comment incorrectly :p
    • UNSOLVED How to Open/integrate Virtual keyboard for File Dialog ?
      QML and Qt Quick • qml qtquick2 virtualkeyboard fileinputdialog • • Praveen_2017  

      1
      0
      Votes
      1
      Posts
      465
      Views

      No one has replied

    • SOLVED Setting checked property of a button
      QML and Qt Quick • button qtquick2 qtquick control • • pra7  

      3
      0
      Votes
      3
      Posts
      844
      Views

      @Wieland thanks !!! for the answer.
    • UNSOLVED Application Window and Dialog Issue.
      QML and Qt Quick • qml qtquick2 virtualkeyboard • • pra7  

      1
      0
      Votes
      1
      Posts
      421
      Views

      No one has replied

    • UNSOLVED QML Virtual keyboard Hide button not working.
      QML and Qt Quick • qml qtquick2 keyboard • • Praveen_2017  

      3
      1
      Votes
      3
      Posts
      2082
      Views

      @raven-worx If I remove the line, the keyboard will never hide and the reason for adding visible: Qt.inputMethod.visible is because of the following line that I found in an example : /* The visibility of the InputPanel can be bound to the Qt.inputMethod.visible property, but then the handwriting input panel and the keyboard input panel can be visible at the same time. Here the visibility is bound to InputPanel.active property instead, which allows the handwriting panel to control the visibility when necessary. */ Bad luck is that it's nowhere mentioned in any docs.
    • UNSOLVED Accessing QObject class properties which is stored in QList
      QML and Qt Quick • qml qtquick qtquick2 qproperty • • pra7  

      4
      0
      Votes
      4
      Posts
      1332
      Views

      ClassB, you are using it in a property. By the way, why not use QObjectList and a Q_INVOKABLE method ? Might be more straightforward. More information on how to integrate CPP with QML here.
    • SOLVED Best way to access a cpp structure in QML
      QML and Qt Quick • qml qtquick qtquick2 qvariant • • pra7  

      18
      0
      Votes
      18
      Posts
      12211
      Views

      @pra7, @Wieland how can I access a list of Structure inside another Structure. Eg: From the above example, I need to use QList<MyNewStructure> m_StructList; How is that possible? I have tried, QList<MyNewStructure> m_StructList; Q_PROPERTY(QList<MyNewStruct> newStr MEMBER m_newStr) but didnt help.
    • UNSOLVED Application Full screen issues in windows.
      QML and Qt Quick • qml qtquick2 • • Praveen_2017  

      9
      0
      Votes
      9
      Posts
      2245
      Views

      @mrjj I used Intel Driver updater tool, but i didn't get the latest driver for windows 8 (64 bit) .
    • SOLVED Rectangle width is '0' if i try to access in "Component.OnCompleted"
      QML and Qt Quick • qml qtquick2 qt5.9.1 rect • • pra7  

      8
      0
      Votes
      8
      Posts
      1479
      Views

      @LeLev Thanks , I will try the same .
    • SOLVED QtQuick Material in secondary Window
      QML and Qt Quick • qtquick2 material design • • CliverC  

      3
      0
      Votes
      3
      Posts
      727
      Views

      @GrecKo That was it. Thank you very much!
    • SOLVED How to insert an Item at any position in StackLayout?
      QML and Qt Quick • qml qtquick2 qtquick.control stacklayout • • pra7  

      3
      0
      Votes
      3
      Posts
      2141
      Views

      @Eeli-K Thanks for your suggestion and I will give a try.But I found a way to insert an item at the particular index by using repeaters and Object Model inside a layout, For more information can also refer below link: https://stackoverflow.com/a/43225476/6336374
    • UNSOLVED How to access an ID across QML files
      QML and Qt Quick • qml qtquick qtquick2 qtquick 1.0 • • pra7  

      11
      0
      Votes
      11
      Posts
      9495
      Views

      This got me thinking about how I structure things, which generally results from starting with a small one-file prototype and then breaking bits of it off into different files. Here's an example (all these can be run with qmlscene main.qml): First you might have File main.qml // main.qml import QtQuick 2.7 Rectangle { id: main width: 640 height: 480 property string msg0: "Some text" property string msg1: "Some more text" Column { anchors.centerIn: parent Text {text: main.msg0} Text {text: main.msg1} } } then you might try and organize stuff a bit: import QtQuick 2.7 Rectangle { id: main width: 640 height: 480 Item { id: config property string msg0: "Some text" property string msg1: "Some more text" } Column { anchors.centerIn: parent Text {text: config.msg0} Text {text: config.msg1} } } then you might split that up with a Config.qml: import QtQuick 2.7 Item { property string msg0: "Some text" property string msg1: "Some more text" } and main.qml now simplified to: import QtQuick 2.7 Rectangle { id: main width: 640 height: 480 Config {id: config} Column { anchors.centerIn: parent Text {text: config.msg0} Text {text: config.msg1} } } and then you start moving out other bits of functionality e.g adding a Messages.qml: import QtQuick 2.7 Column { anchors.centerIn: parent Text {text: config.msg0} Text {text: config.msg1} } and main.qml now simplified to: import QtQuick 2.7 Rectangle { id: main width: 640 height: 480 Config {id: config} Messages {} } I've never felt any need for singletons in QML code at all. (Having the hosting C++ set some context properties based on environment or command-line-options is the probably the closest I've come).
    • SOLVED How to Remove an item from Column Element
      QML and Qt Quick • qml qtquick qtquick2 column qtquick.control • • pra7  

      3
      0
      Votes
      3
      Posts
      815
      Views

      @Eeli-K Thanks for the suggestion it worked and also there is another approach "Component.CreateObject()" in which we can create and destroy objects dynamically.
    • SOLVED Adding TabButton dynamically to TabBar
      QML and Qt Quick • qtquick2 qtquickcontrols qtquickcontrol tabbutton • • pra7  

      14
      0
      Votes
      14
      Posts
      6315
      Views

      Simpler alternative, just a Repeater with a ListModel inside TabBar : import QtQuick 2.0 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 640 height: 480 ListModel { id: tabModel } TabBar { Repeater { model: tabModel TabButton { text: model.text + " " + model.index onClicked: tabModel.remove(model.index) } } } Button { anchors.centerIn: parent text:"add" onClicked: tabModel.append({text: "tab"}); } } EDIT: My bad, I didn't saw @LeLev first answer, it's very similar to mine. But I fell compelled to post it cause there's a lot of over complicated code in the following answers.
    • SOLVED QML SwipeView is covering entire window
      QML and Qt Quick • qml qtquick2 qtquick control swipeview • • pra7  

      4
      0
      Votes
      4
      Posts
      2538
      Views

      @pra7 said in QML SwipeView is covering entire window: w That's cool. This solution you came up with is perfect.
    • UNSOLVED StackView issue when "StackView.Immediate" is used.
      QML and Qt Quick • qml qtquick2 stackview qtquick.control • • pra7  

      1
      0
      Votes
      1
      Posts
      444
      Views

      No one has replied

    • UNSOLVED QML combobox styling issue in QtQuick.Controls 2.2
      QML and Qt Quick • qml combobox qtquick2 qtquickcontrol combobox style • • pra7  

      4
      0
      Votes
      4
      Posts
      2080
      Views

      @pra7 did you manage to solve it? I am facing the same issue. I cannot apply any stylesheet on a Combobox using QtQuick.Controls 2.2
    • UNSOLVED Customize TabView/TabBar.
      QML and Qt Quick • qml qtquick2 qtquick control tabviewstyle • • pra7  

      1
      0
      Votes
      1
      Posts
      852
      Views

      No one has replied

    • SOLVED Not able to call canvas.requestPaint()
      QML and Qt Quick • qml qtquick2 qtquickcontrol • • pra7  

      3
      0
      Votes
      3
      Posts
      1373
      Views

      @while1code That's the problem ,i cannot pass canvas ID outside ie.,in onCurrentIndexChanged function. Now I achieved the same using signal and slots by adding following code : Canvas { id: canvas1 anchors.fill: parent width: parent.width height: parent.height onPaint: { styleData.selected ? drawTab(canvas1,"#0C3142") : drawTab(canvas1,"Transparent") } //*** CONNECT TO SIGNAL HERE *** Connections { target: tv onRefresh: canvas1.requestPaint() } ... ... ... onCurrentIndexChanged: { console.log("index changed "+currentIndex) refresh() //emiting refresh signal }
    • SOLVED QML component not recognized when loading from local file
      QML and Qt Quick • qml qtquick2 qqmlengine • • nwoki  

      11
      0
      Votes
      11
      Posts
      6032
      Views

      @nwoki Didn't anticipate that :D Congratulations and Happy Coding :)
    • UNSOLVED gstreamer videosink in QML
      QML and Qt Quick • qml qtquick2 gstreamer video videosurface qt-gstreamer • • RiteshPanchal  

      1
      0
      Votes
      1
      Posts
      2363
      Views

      No one has replied

    • UNSOLVED Resizing axis causes artifacts in a LineSeries binded to QAbstractTableModel
      QML and Qt Quick • qml qtquick2 qtcharts modeldata • • nickaein  

      1
      0
      Votes
      1
      Posts
      593
      Views

      No one has replied

    • Windows application appears blank screen on other computers.
      General and Desktop • qml qtquick2 resources static qt • • Dan Rosen  

      6
      0
      Votes
      6
      Posts
      2022
      Views

      You could compile into a single exe. But that requires commercial license. Most people just combine the exe with Qt dll's. These can be found here, note that *.d.dll are for debug. C:\Qt\Qt5.4.1\5.4\mingw491_32\bin For my version at least.