Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for MCUs
  4. Qul: Model Property Signals of Singleton class Not Recognized in Auto-generated C++ Code
Forum Updated to NodeBB v4.3 + New Features

Qul: Model Property Signals of Singleton class Not Recognized in Auto-generated C++ Code

Scheduled Pinned Locked Moved Unsolved Qt for MCUs
1 Posts 1 Posters 42 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Girishsonar88
    wrote last edited by
    #1

    Using Qt MCU 2.11.

    //Vehiclemanager.h
    class VehicleManager : public Qul::Singleton<VehicleManager> {
    public:
    friend class Qul::Singleton<VehicleManager>;

    Qul::Property<WarningModel*> warningModel;
    

    private:
    VehicleManager();
    WarningModel m_warn;
    };

    //WarningModel.h
    class WarningModel : public Qul::Object {
    public:
    WarningModel();

    Qul::Property<int> warningState;
    Qul::Signal<void()> warningStateChanged;
    void setWarningState(VehicleEnums::WarningStates state);
    

    };

    //I can able to use properties in QML like this
    property int chargeState: VehicleManager.warningModel.warningState

    //but i cant able use Signals of same class like below
    VehicleManager.warningModel.onWarningStateChanged: {
    console.log("warning state changed")
    }

    //error
    C:\Users\Girish\Documents\TestApp\build\Qt_for_MCUs_2_11_Desktop_32bpp_MINGW-Debug\CMakeFiles\TestApp.dir\TestApp.cpp:395: error: 'warningModel' was not declared in this scope; did you mean 'WarningModel'?
    C:/Users/Girish/Documents/TestApp/build/Qt_for_MCUs_2_11_Desktop_32bpp_MINGW-Debug/CMakeFiles/TestApp.dir/TestApp.cpp: In constructor 'TestApp::TestApp()':
    C:/Users/Girish/Documents/TestApp/build/Qt_for_MCUs_2_11_Desktop_32bpp_MINGW-Debug/CMakeFiles/TestApp.dir/TestApp.cpp:395:69: error: 'warningModel' was not declared in this scope; did you mean 'WarningModel'?
    395 | _warningModel_value____onWarningStateChanged_binding.connect(&(*warningModel.value()).warningStateChanged, Qul::Private::SlotConnectInitial);
    | ^~~~~~~~~~~~
    | WarningModel

    //and as it suggested to use WarningModel instead warningModel, if i use that

    //error
    C:\Users\Girish\Documents\TestApp\qmlproject\TestApp.qml:54: error: WarningModel does not have any attached properties defined
    C:/Users/Girish/Documents/TestApp/qmlproject/TestApp.qml:54:20: error: WarningModel does not have any attached properties defined
    VehicleManager.WarningModel.warningStateChanged: {
    ^~~~~~~~~~~~

    can anyone please help me how to resolve this issue?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved