Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Error - QML Image: Cannot open: url

    Solved
    14
    0 Votes
    14 Posts
    1k Views
    Anton1978A
    surprising, but it turned out to be correct qrc:\res\heaven.png Why ?
  • 0 Votes
    11 Posts
    819 Views
    N
    Thanks a lot, it fine now ![image: f7323171-190d-4df1-adff-e61f66ae9088.jpg]
  • Eager load views

    Solved
    11
    0 Votes
    11 Posts
    796 Views
    A
    oh yep, didn't notice that detail
  • Configure qt for android-error

    Unsolved android qt 6.8.0 android 10
    2
    0 Votes
    2 Posts
    335 Views
    jsulmJ
    @BILAL-KHAN-34 Put the mouse cursor over the yellow warning icon to see the pop-up with the information about the problem.
  • 0 Votes
    1 Posts
    107 Views
    No one has replied
  • How to pass an array (list) filled with custom data to QML?

    Solved
    6
    0 Votes
    6 Posts
    499 Views
    Pl45m4P
    @Charby said in How to pass an array (list) filled with custom data to QML?: console.info(gameModel[0].mark) // should be 0 console.info(gameModel[0].mark) // should be 1 console.info(gameModel[1].mark) // should be 1 :) @Anton1978 As @Charby wrote above, you can access the list data using the index and the member you want to address, like this: (with the changes shown below) // return a list reference // consider to make it const if you dont plan to modify the list later (only in C++ code) Q_INVOKABLE const QList<MinePlace *> &getModel() { return _forSend;} In QML something like property var gameModel = gamecalcID.getModel(); for (var mp in gameModel) console.log(mp.mark)
  • limiting spaced used by a ListView

    Unsolved
    7
    0 Votes
    7 Posts
    588 Views
    A
    I'm not really sure this could achieve what you are looking for. but ListView has (header and) footer properties. also footerPositionning. Have you looked in that direction ?
  • When graphing from a file, my app stops responding

    Unsolved
    7
    0 Votes
    7 Posts
    512 Views
    A
    This is what I get when it gets unresponsive: [image: b2074342-90b3-45fc-9dd7-c9d8a9c428e9.png]
  • Can't retroactively add points to ScatterSeries

    Unsolved
    2
    0 Votes
    2 Posts
    222 Views
    B
    I'm still using Qt 5 but I had a look at the doc and it seems to me that the API exposed to QML is more limited in QtGraphs than it was in QtCharts. The append method is available in the QXYSeries C++ implementation class but not in QML as far as I can see. You might need to write a function in some backend C++ code that you expose to QML. This function would accept a QXYSeries* and you will be able to access append in the function's C++ implementation. You will be able to pass your scatterSeries object to this function from QML and it will be received as a QXYSeries*.
  • 0 Votes
    3 Posts
    376 Views
    L
    @Kai-Nickel said in How to access QJSValue's QQmlEngine in Q_INVOKABLE to support callback pattern for C++ models: Just a lucky shot: did you try using qjsEngine(this) instead of qmlEngine(this)? I did not and I'm happy to report that qjsEngine() does work! Looking at the source code of qmlEngine() vs qjsEngine() it is obvious why: qmlEngine() only works if there is a qml context for that object. I was under the assumption that qmlEngine() simply called qobject_cast<QQmlEngine*>(qjsEngine(obj)), which is why I didn't look at the differences between the two. Evidently my assumptions proved wrong. QQmlEngine *qmlEngine(const QObject *obj) { QQmlData *data = QQmlData::get(obj, false); if (!data || !data->context) return nullptr; return data->context->engine; } QJSEngine *qjsEngine(const QObject *object) { QQmlData *data = QQmlData::get(object, false); if (!data || data->jsWrapper.isNullOrUndefined()) return nullptr; return data->jsWrapper.engine()->jsEngine(); }
  • Creation of Qt Quick Project does not occur

    Unsolved
    3
    0 Votes
    3 Posts
    314 Views
    B
    @Axel-Spoerl thanks for answer. It explains a lot. Initially, I thought it was my bad and I did something wrong. I have windows 11 as well as it was described there, that same problem
  • Impicit import 'QtQml' of QML module 'QtQuick' not found

    Unsolved
    3
    0 Votes
    3 Posts
    851 Views
    F
    @sable I was having a similar issue on Ubuntu as well. I needed to install qml6-module-qtqml and that fixed the warning. Which is odd because the base project compiled just fine before then.
  • 0 Votes
    4 Posts
    322 Views
    Axel SpoerlA
    My bad. You have to import the URI, so it should actually be import Test03
  • QML Image: Cannot open - CMake qrc

    Solved qt6.5 qml qrc cmake qtcreator 10.0
    13
    2 Votes
    13 Posts
    7k Views
    F
    @JohnKS Wow, I just spent like an hour trying to figure this out and copying detailed tutorials verbatim to try and get it working and it's this non-default flag that apparently doesn't always need to be set seeing as it doesn't appear anywhere in Qt's examples. It would be really helpful if this was mentioned more prominently somewhere.
  • Behavior that i cant explain between RowLayout and custom RowLayout nested in Rectangle

    Unsolved
    1
    0 Votes
    1 Posts
    138 Views
    No one has replied
  • How to bring all the application windows on top?

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    M
    I got the following solution connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, [this](QWindow* focusWindow) { if (!focusWindow) { return; } auto windowList = QGuiApplication::allWindows(); windowList.removeIf([focusWindow](QWindow* w) { return !w->isVisible() || w->transientParent() || w == focusWindow; }); // Attempt to restore windows in the order in which they were opened. std::sort(windowList.begin(), windowList.end(), [](QWindow* l, QWindow* r) { return l->property(FOCUS_TIME_PROPERTY).value<qint64>() < r->property(FOCUS_TIME_PROPERTY).value<qint64>(); }); for (auto window : windowList) { qDebug() << "Raise" << window->title(); window->raise(); } focusWindow->raise(); focusWindow->setProperty(FOCUS_TIME_PROPERTY, QDateTime::currentMSecsSinceEpoch()); });
  • Get the child items of the qquckwaylanditem on the wayland server

    Unsolved
    1
    0 Votes
    1 Posts
    152 Views
    No one has replied
  • Import of module in Javascript does not respect qmldir->prefer

    Unsolved
    1
    0 Votes
    1 Posts
    185 Views
    No one has replied
  • GridLayout Layout.rowSpan and uniformCellHeights

    Unsolved
    3
    0 Votes
    3 Posts
    287 Views
    P
    @ankou29666 Thank you, will contact support. Workaround meanwhile is to implement my own GridLayout based on the following: https://stackoverflow.com/a/61804867 Surprisingly simple and effective. I then added support for rowSpacing and columnSpacing to that.
  • Using C++ model for MonthGrid in calendar

    Unsolved
    5
    0 Votes
    5 Posts
    439 Views
    B
    Thank you, it's an interesting idea! I will give it a try.