Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.5k Posts
  • How to get new parent, when DragHandler is used ?

    Unsolved
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • Ambiguous project when using files in subdirectory

    Unsolved qml cmake
    7
    0 Votes
    7 Posts
    26 Views
    D
    It seems to run properly when I include this line in my cmake file: # workaround for bug with javascript files qt_policy(SET QTP0004 OLD) Thanks for pointing me in the right direction
  • How can I make a QML module visible to other QML files?

    Unsolved
    3
    0 Votes
    3 Posts
    19 Views
    serkan_trS
    @JKSH , In my projects, I use add_executable. In this case, will the system allow me to use qt_add_qml_module()? Should I completely stop using .qrc files, or should I just avoid using them for creating QML modules?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • How to make GridView with special zone , which would be free of delegates ?

    Moved Unsolved
    4
    0 Votes
    4 Posts
    73 Views
    S
    @Bob64 said in How to make GridView with special zone , which would be free of delegates ?: The only possibly relevant thing I can see in the documentation is the footer property, but it seems that that would position the footer item at the end of, but outside, the grid area. My understanding of what is needed here is a special item fixed at the the bottom right corner of the grid area, within the grid area. It seems like this would be a tricky one to solve. If a dummy item is added at the end of the model, it is not going to be in a fixed position. On the other hand, if something is overlaid on top of the grid area, the grid layout will not know about it and will not try to avoid it. My expectation probably is too much. Using of usual footer is a way(not best because it will be in not grid area). Also i can use model customization in order always to have last delegate as dummy delegate with combination of overlaid Item on top of grid area. Qt: 6.9
  • 0 Votes
    7 Posts
    4k Views
    JKSHJ
    @alex_malyu said in plugin cannot be loaded for module "QtQuick.Layouts": Cannot protect module QtQuick.Layouts 2 as it was never registered QML debugging is enabled...: I think closing critical bugs without having them pushed to repo is a bad choice. As discussed at https://bugreports.qt.io/browse/QTBUG-81961, the bug report is invalid. The problem is that you specified the wrong version for the import. @RokeJulianLockhart said in plugin cannot be loaded for module "QtQuick.Layouts": Cannot protect module QtQuick.Layouts 2 as it was never registered QML debugging is enabled...: I see "Cannot protect module QtQuick.Controls 6 as it was never registered" Try removing all the version numbers from your import statements. Version numbers are not required (or recommended) in Qt 6. This shouldn't be possible, because kinfo returns "Qt Version: 6.9.1": What does qml --version show? How about which qml?
  • In Loader don't work item.height

    Unsolved
    3
    0 Votes
    3 Posts
    40 Views
    M
    It's source: Rectangle { id: confItemsList height: 200 ............ It's loader: Loader { id: loader width: parent.width height: status === Loader.Ready ? item.height : 0 And loader get height 0
  • "WARNING: Cannot find style "test" - fallback: "default" "

    Unsolved
    4
    1 Votes
    4 Posts
    865 Views
    E
    Hello. I encountered the same problem, found a solution. It's all about "qrc:/qt/qml". The search for the path "QtQuick/VirtualKeyboard/Styles" starts from there. Accordingly, if you created a resource file not in the root of the application, then you need to add the prefix "/qt/qml/" in the resource file to the directory to your keyboard style. Final structure (using my example): [image: 809f17e6-f89f-4c0f-b67c-92eaddae5718.png] Main.cpp: int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); qputenv("QT_VIRTUALKEYBOARD_STYLE", QByteArray("MXTS")); //Just style name, but before create QML engine! J QApplication app(argc, argv); ModelStorage* model = ModelStorage::instance(); QQmlApplicationEngine engine; qDebug() << engine.importPathList(); // for exmaple: QList("C:/git/Torque_sub/TorqueSub/build/Desktop_Qt_6_8_2_MSVC2022_64bit-Debug", "qrc:/qt-project.org/imports", !!!!!"qrc:/qt/qml"!!!!!, "C:/Qt/6.8.2/msvc2022_64/qml") Style.qml: ...... keyboardBackground: Rectangle { color: "red" } ...... Results: [image: f1467529-5950-4066-a296-51f9fe57c507.png] Ref. from src virtual keyboard qt git src: QString stylePath(const QString &name) const { if (name.isEmpty()) return QString(); QStringList stylePathList; stylePathList << QLatin1String("qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/"); //###### default styles const QStringList importPathList = qmlImportPathList(); //###### get import paths lists // Add QML import path (Note: the QML base dir is usually the last entry in the list) for (int i = importPathList.size() - 1; i >= 0; --i) { const QString stylesPath = importPathList.at(i) + QLatin1String("/QtQuick/VirtualKeyboard/Styles/"); //###### added, so path must: qrc:/qt/qml/QtQuick/VirtualKeyboard/Styles stylePathList += stylesPath; } // Path for backwards compatibility stylePathList << QLatin1String("qrc:/QtQuick/VirtualKeyboard/content/styles/"); for (const QString &stylePath : std::as_const(stylePathList)) { QString filePath = buildStyleFilePath(stylePath, name); bool pathExist = false; pathExist = QFileInfo::exists(filePath); if (pathExist) return buildStylePath(stylePath, name); } return QString(); } Hopefully this will save someone an hour.
  • 0 Votes
    2 Posts
    93 Views
    B
    The most natural way in QML is a model-view approach. If that at all fits your use case it is usually the cleanest way to go. The UI does not need to be a list (view) as such in order to be driven by a list model. You could use a Repeater-based approach for example. You said you struggled to get the bindings to a list model to work properly. This is almost certainly because of something fairly simple that you are doing wrong, so I would advise persevering with that to find out what the problem is. Reduce it down to a simple case and post it here if you are still struggling.
  • Very long time loaded svg in Image.

    Solved
    13
    0 Votes
    13 Posts
    202 Views
    M
    Yes, I add this dll in release and then svg is work, thanks
  • Sudden QML system issues not solved by reinstall

    Unsolved
    8
    0 Votes
    8 Posts
    148 Views
    S
    To add some extra information, this is the full stack of where the Component-related error happens: QQmlApplicationEngine failed to load component file:///home/sander/dev/shoopdaloop/src/qml/applications/shoopdaloop_main.qml:17:5: Type Session unavailable file:///home/sander/dev/shoopdaloop/src/qml/Session.qml:474:9: Type AppControls unavailable file:///home/sander/dev/shoopdaloop/src/qml/AppControls.qml:187:13: Type ProfilingWindow unavailable file:///home/sander/dev/shoopdaloop/src/qml/ProfilingWindow.qml:120:19: Type TreeViewDelegate unavailable qrc:/qt-project.org/imports/QtQuick/Controls/Material/TreeViewDelegate.qml:101:9: Non-existent attached object [Frontend.Application] [WARN] Created invalid object [Frontend.QmlEngine] [WARN] Could not find top-level QQuickWindow to connect back-end refresh to GUI refresh And when I remove the "ProfilingWindow" completely, instead this is the full stack of where the QtObject-related error happens: file:///home/sander/dev/shoopdaloop/src/qml/TrackWidget.qml:141: Error: TrackWidget: Failed to load loop factory: file:///home/sander/dev/shoopdaloop/src/qml/LoopWidget.qml:1687 Type DynamicToolTip unavailable file:///home/sander/dev/shoopdaloop/src/qml/DynamicToolTip.qml:11 Type ToolTip unavailable qrc:/qt/qml/org/kde/breeze/ToolTip.qml:112 Type Impl.StandardRectangle unavailable qrc:/qt/qml/org/kde/breeze/impl/StandardRectangle.qml:-1 Type Theme unavailable qrc:/qt/qml/org/kde/breeze/impl/Theme.qml:10 QtObject is not a type Interestingly, in the first error the culprit is inside TreeViewDelegate which is a built-in QML type. And in the second error it seems at least suspicious that the ToolTip type is for some reason taken from a KDE-specific library instead of a regular QtQuick Controls item. Maybe there is some conflict happening with Qt libraries and/or QML types coming from KDE? Note that I don't explicitly load KDE libraries anywhere in the app. The second error (QtObject) goes away when I run the app in weston instead of in KDE. But the first one persists. EDIT: the second error is completely gone when explicitly importing QtQuick.Controls.Material. Apparently using the Material style in the top-level application window was not enough to force Material throughout the window. The first error still persists though.
  • QQuickImageProvider::requestImage return a QImage and crash

    Unsolved
    4
    0 Votes
    4 Posts
    85 Views
    Christian EhrlicherC
    Does your system supports avx2? Please provide a minimal compileable example to reproduce the problem. No qml needed for this I would guess.
  • 0 Votes
    3 Posts
    483 Views
    P
    The same issue. I am trying to run 5.12 codes with QT creator 6.19 on Win11. On Mac this combination is OK. On Win 11 run with QT 5.12 no such issue.
  • QML - How to keep header and footer fix for all apps.

    Unsolved
    6
    0 Votes
    6 Posts
    163 Views
    JKSHJ
    OK, my previous links were for Wayland, so they don't apply to Android. Is this for Android Automotive? If so, then you probably want to use the ActivityView to embed your 3rd-party apps, and you can put your own header and footer around the ActivityView: https://www.qt.io/blog/qt-android-activity-view https://doc.qt.io/QtAndroidAutomotive-6.9/activityview-examples.html Please note: Qt for Android Automotive is a commercial-only product, and is not available to most users on this community forum. If you require further assistance, please contact Qt Support
  • Qt Networking

    Unsolved
    2
    0 Votes
    2 Posts
    54 Views
    SGaistS
    Hi, Something like the device utilities module ?
  • Windeployqt and QML

    Solved
    7
    2 Votes
    7 Posts
    14k Views
    L
    @Devopia53 Thank you very much !
  • Does QML support native look-and-feel on Windows?

    Solved
    20
    1 Votes
    20 Posts
    5k Views
    RokeJulianLockhartR
    @Asperamanca, you'd be as surprised as me, per discuss.kde.org/t/173/17 and discuss.kde.org/t/13920. Although the focuses are on a very specific (albeit important topic), the latter cites some very verbose criticisms from developers. I'm of the hope it's Kirigami's fault, rather than QML's. However, when I've tried pure QML on Plasma, it's looked worse than even Kirigami does. I'll presume that that's because the original creators of Kirigami attempted to style QML initially, and solely after they realised that they couldn't to their satisfaction, created Kirigami. I'd say that this is in comparison to their QStyle, which doesn't require a middleman to style QtWidgets-based applications. However, considering the Union project has recently come to fruition, that might not be true. Though, it might instead be because they need to style QML so heavily that they can't feasibly maintain a QStyle and QQuickStyle. I'll merely wait a little for Union to be released, to see whether the styling improves across platforms. The FluentWinUI3 were a significant improvement, after seeing them in use in NextCloud on Windows 11. It'd be nice if solely one technology were the future, whether QML or QtWidgets.
  • What is the difference between Canvas3D and View3D in Qt Quick?

    Unsolved
    2
    0 Votes
    2 Posts
    57 Views
    JKSHJ
    @SuhasKrishanamurthy said in What is the difference between Canvas3D and View3D in Qt Quick?: I'm a bit confused about when and why one should be used over the other. Qt Canvas3D was deprecated long ago, and has been removed from Qt 6: https://bugreports.qt.io/browse/QTBUG-70510 So, you should use the Qt Quick 3D module (which contains View3D) because it's the one that is actually available and supported in Qt 6. Here is an example: https://doc.qt.io/qt-6/qtquick3d-view3d-example.html Note: Qt Quick 3D is only available under the GPL and Commercial licenses. It is not available under LGPL.
  • Can QtQuick use MultiThread?

    Unsolved
    2
    0 Votes
    2 Posts
    63 Views
    Christian EhrlicherC
    The gui needs to be handled in the main thread - no matter if widgets or qml or whatever.
  • VideoOutput: poor downscaling quality

    Unsolved
    3
    0 Votes
    3 Posts
    52 Views
    K
    Thank you, I just tried this: layer.enabled: true layer.smooth: true // tried both true and false here layer.mipmap: true No visual changes, unfortunately.