Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt-Creator CodeCompletion: C++ models exposing via Q_INVOKABLE to QML
Forum Updated to NodeBB v4.3 + New Features

Qt-Creator CodeCompletion: C++ models exposing via Q_INVOKABLE to QML

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 137 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    stefan_m
    wrote on last edited by
    #1

    Is there a change to get CodeCompletion running Qt-Creator with the following "design":

    C++ Model app:

    #define MODEL_ACCESSOR(method_name, model_member_)
        Q_INVOKABLE QObject* method_name() const 
        { 
            return model_member_; 
        }
    ...
    
    MODEL_ACCESSOR(coffee, coffee_view_model_)
    
    ...
    
    qml_app_engine_.rootContext()->setContextProperty("app", this);
    
    ...
    
    qml_utils::owned_object(coffee_view_model_= new CoffeeModel(this));
    
    ...
    

    Coffee:

    class Coffee: public QObject
    {
        Q_OBJECT
        Q_PROPERTY(int temperature READ temperature NOTIFY temperatureChanged)
    

    QML:

    Coffee{
        temperature: app.coffee().temperature
    }
    

    (my) problem in Qt-Creator:

    Auto Completion works in the QML File for app.coffee() But it cant resolve and autocomplete the propertys of the Coffee class.

    At this point: "app.coffee()." it cant resolve the propertys.

    Does anyone knows an Solution?

    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