Navigation

    Qt Forum

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

    • SOLVED Accessing property by name or by READ function ?
      QML and Qt Quick • qml property • • Mixlu  

      6
      0
      Votes
      6
      Posts
      49
      Views

      @fcarney This will be configurable in Qt Creator 4.15 : https://bugreports.qt.io/browse/QTCREATORBUG-15779 https://codereview.qt-project.org/c/qt-creator/qt-creator/+/310832
    • SOLVED C++ PROPERTY changed() to QML
      General and Desktop • qml c++ property c++ to qml change • • TMJJ001  

      5
      0
      Votes
      5
      Posts
      166
      Views

      @KroMignon Thanks for the extensive explanation! Now I understand what I was doing wrong. Kind regards
    • SOLVED nesting multiple Q_INVOKABLE methods
      QML and Qt Quick • property repeater nested invokable • • devDawg  

      6
      0
      Votes
      6
      Posts
      1048
      Views

      @KillerSmath Its working! NOTIFY did the trick. The final touch that I also included was to use a Q_INVOKABLE getModuleAt(i) instead of a Q_INVOKABLE getTextBodyAt(i); this allowed me direct access to the DataModule's property: Text{ text: dataModel.getModuleAt(index).TextBody } portion of datamodule.h: class DataModule: public QObject { Q_OBJECT Q_PROPERTY(QString TextBody MEMBER textBody NOTIFY textBodyChanged) . . . signals: void newVal(DataPiece*); void textBodyChanged(QString newText); Q_INVOKABLE method inside of the QML context class datamodel.h: Q_INVOKABLE DataModule *getModuleAt(int i); Brilliant! Thanks for the help mate. Hopefully this is helpful to others as well.
    • SOLVED default property
      QML and Qt Quick • qml property • • dream_captain  

      6
      1
      Votes
      6
      Posts
      2619
      Views

      I get it. Thanks!
    • SOLVED Invalid alias reference. Unable to find id
      QML and Qt Quick • qml qt quick property settings alias • • mbnoimi  

      9
      0
      Votes
      9
      Posts
      5736
      Views

      That's it @Eeli-K Thanks a lot
    • UNSOLVED Id and properties not found problem
      QML and Qt Quick • property component • • olivierguzziIDEOL  

      5
      0
      Votes
      5
      Posts
      1455
      Views

      @olivierguzziIDEOL You can define Component.onCompleted for each item where you check if azert is available. Component.onCompleted: { console.log("Tab(/Rectangle/ParamsPanel) is now completed") console.log(azert) } It should be at least in ParamPanel's onCompleted. There you should be able to bind the Tab's properties dynamically.
    • UNSOLVED QDbus from Python: read DBus property
      General and Desktop • python property dbus get • • Mark81  

      1
      0
      Votes
      1
      Posts
      1194
      Views

      No one has replied

    • UNSOLVED How disabled few properties for class on one OS
      General and Desktop • c++ property macros • • shav  

      9
      0
      Votes
      9
      Posts
      1843
      Views

      I tried this logic (../Helpers/nestleanconstants.h): #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) #define NESTLEAN_MOBILE 1 #else #define NESTLEAN_DESKTOP 1 #endif And header of class: #ifndef NESTLEANREQUESTMANAGER_H #define NESTLEANREQUESTMANAGER_H #include <QtCore> #include <QtNetwork> #include "../Helpers/nestleanconstants.h" //Others headers #if defined(NESTLEAN_DESKTOP) #include "WebSocket/nestleanwebsocketmanager.h" #endif class NestleanRequestManager : public QObject { Q_OBJECT Q_CLASSINFO("version", "1.1") Q_PROPERTY(NestleanApplicationRequestsManager* appManager READ getAppManager) //other properties #if defined(NESTLEAN_DESKTOP) Q_PROPERTY(NestleanWebSocketManager* webSocketManager READ getWebSocketManager) #endif private: //some code #if defined(NESTLEAN_DESKTOP) NestleanWebSocketManager* m_webSocketManager; #endif public: //some code #if defined(NESTLEAN_DESKTOP) inline NestleanWebSocketManager* getWebSocketManager() { return m_webSocketManager; } #endif signals: public slots: }; #endif // NESTLEANREQUESTMANAGER_H Errors the same. I can't understand why it happens.
    • UNSOLVED MessageDialog has no states: property?
      QML and Qt Quick • qml property states • • ars1614  

      3
      0
      Votes
      3
      Posts
      978
      Views

      @Wieland I have tried what you said and I am having this error: Cannot assign to non-existent default property at line StateGroup. This is my code: MessageDialog { id: msgDialog icon: StandardIcon.Warning; standardButtons: StandardButton.Ok StateGroup { id: msgDialogStates states: [ State { name: "ActionsDialog" PropertyChanges { target: msgDialog title: qsTr("Actions Error") text: qsTr("Message.") } }, State { name: "PropertiesDialog" PropertyChanges { target: msgDialog title: qsTr("Properties Error"); text: qsTr("Another.") } } ] } } The lines with the properties: title, text, icon and standardButtons are in red as I mencioned in another post.
    • UNSOLVED Does really property var mdl: model copies the full model object in memory?
      QML and Qt Quick • qml property properties • • Kofr  

      4
      0
      Votes
      4
      Posts
      1208
      Views

      @Kofr Hi! If you want to be really sure (because you don't trust the docs or your code ^_^) then add something like qDebug() << "hello"; to the destructor of the model and see how often that's called.
    • SOLVED Access and Change QList<QObject*> dynamic property in QObject*
      General and Desktop • qobject property dynamic reference qlistqobject • • Dong  

      9
      0
      Votes
      9
      Posts
      5114
      Views

      @Dong Hello, Sorry for the late reply. Yes, you've got the essence of it. Qt's containers (QList included) are pretty smart in respect to copying, they will not copy the actual data until you change it. They are implicitly shared. This is done so you can return and copy the container many times, but in actuality internally only a pointer is reassigned and reference counter updated. When you call a non-const function on that list, Qt checks the reference counter and if more than one object is attached to the data, then and only then the data is detached (copied). When you put your list in the QVariant it is stored by value (making a shallow copy), but QVariant will return a shallow copy as well (meaning the data will not be changed, only the internal pointer reassigned and reference counter incremented). Now, for your particular case: The first line of code works, because you don't modify the list, but take an element (which is a pointer) and modify the object the list is holding reference to. This doesn't cause the list data to be copied. The second line you have, doesn't work, because you're changing the list data (assigning a new value to a list's element), which causes the list data to be detached and in practice, you're operating on a completely different set of data. Here is a reference if you're interested in the way QList and other containers manage their data, and what implicit sharing is.
    • [SOLVED] Problems with setting properties in Qt 5.4
      General and Desktop • qobject property • • ttuna  

      7
      0
      Votes
      7
      Posts
      1673
      Views

      They are two different types so there might have been something going because of that
    • Record a specific value from databse
      QML and Qt Quick • sql database sqlite function property sqlite database • • Pisko  

      1
      0
      Votes
      1
      Posts
      687
      Views

      No one has replied

    • How to initiate a binding property updating by change another property from javascript?
      QML and Qt Quick • qml javascript property • • DenisFromNN  

      3
      0
      Votes
      3
      Posts
      915
      Views

      You should be able to do this declaratively, by declaring either: width: image.width OR width: childrenRect.width for the "element" column. Note that this will "bind" the values. Binding is automatic in QML declarations. If you wish to bind from an imperative statement (ie, from within a JavaScript function) you can use: width = Qt.binding(function() { image.width }); Hope this helps!
    • [solved] Access to custom CPP object
      QML and Qt Quick • qml cpp property • • helenebro  

      3
      0
      Votes
      3
      Posts
      1129
      Views

      Thank you for your answer but I have find my mistake. The property should be : property variant myObject: MyLib.monObject
    • Using aliases of modelfunctions
      QML and Qt Quick • qml model property alias • • louis  

      1
      0
      Votes
      1
      Posts
      520
      Views

      No one has replied

    • Forced update the properties of qml item
      QML and Qt Quick • qml qt quick update item property forced update • • Lix_  

      5
      0
      Votes
      5
      Posts
      1684
      Views

      @p3c0 Thanks!
    • Editing C++ properties from QML with updates from C++
      QML and Qt Quick • qml property binding • • swegmann  

      3
      0
      Votes
      3
      Posts
      819
      Views

      @richardo I appreciate your input. Still I'm not sure I really like this approach that much better. As for the cycle, I couldn't see any of those usual cyclic property warnings that QML gives you in those cases. I think this cycle is already properly broken by using the correct construction in setMyCppValue: void setMyCppValue(int newValue) { if (newValue!=myCppValue) { myCppValue = newValue; emit myCppValueChanged(); } }
    • Pass and modify C++ data from a Custom QML Item
      QML and Qt Quick • qml c++ property custom item • • Fred Waltzer  

      4
      0
      Votes
      4
      Posts
      1065
      Views

      @Fred-Waltzer MyQMLObject will be available in all the QML files of the project. So no need to create different C++ variable.
    • Exposing a dynamic set of properties to Qml
      General and Desktop • qml property • • Smatcher  

      1
      0
      Votes
      1
      Posts
      778
      Views

      No one has replied

    • declare property of pointer in qml
      QML and Qt Quick • property • • themts  

      15
      0
      Votes
      15
      Posts
      4931
      Views

      @themts Hmmm that sounds really odd, but without the code, I don't know why it would output that error. I will say that you do not need a copy constructor. You could make a new qml type from class Thing : public QObject { Q_OBJECT public: explicit Thing(QObject* parent = nullptr); virtual ~Thing(); };