Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Declaring window manager hints 🪟

    Unsolved
    1
    0 Votes
    1 Posts
    124 Views
    No one has replied
  • 0 Votes
    6 Posts
    555 Views
    H
    @JonB Hello my dear! Using the QML profiler, I was able to identify the origin of the problem. I currently have 3 js files: app.js, main.js and countries.js. The main.js file contains my main js functions. The countries.js file should contain the list of countries in a constant and functions to manipulate them. I import all my js files into app.js. The countries.js file was recently added. While I was working there, I had an emergency. So I stopped the work by leaving in countries.js an empty array const and a function that does nothing. const list = []; function func() { } This is what was causing the problem. I just commented out the countries.js import statement in app.js and it fixed the problem. Thanks for the guidance.
  • TextField::inputMethodHints no longer works as expected in QT 6.7.2

    Unsolved
    2
    1 Votes
    2 Posts
    252 Views
    A
    Hi, there's a bug in Qt 6.7.1 and 6.7.2 related to what you're experiencing: inputMethodHints are being ignored in Android. Lucky it's fixed in Qt 6.7.3 and 6.8 :) https://bugreports.qt.io/browse/QTBUG-125410
  • Different result when I try to make a QML example

    Unsolved
    3
    0 Votes
    3 Posts
    274 Views
    E
    @Markkyboy My QtCreator version is 10.0.1 based on Qt 6.4.3 (Windows) Designer is not a part of QtCreator I enabled QtQuick plugin I am unable to access your Github at any time, Try again, there's an issue with github. At least I want to understand why the progress bar doesn't work, it's crazy !
  • 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
    820 Views
    N
    Thanks a lot, it fine now ![image: f7323171-190d-4df1-adff-e61f66ae9088.jpg]
  • Eager load views

    Solved
    11
    0 Votes
    11 Posts
    797 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
    336 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
    589 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
    377 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
    855 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()); });