Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.9k Topics 77.1k Posts
QtWS25 Last Chance
  • QQuick Designer question

    Unsolved a day ago
    0 Votes
    4 Posts
    43 Views
    Sounds correct yes.
  • import qml error:no such directory

    Solved about 22 hours ago
    0 Votes
    9 Posts
    62 Views
    This import does not import a file, but a directory, which is why the above error is always reported: no such directory I understand a little bit now. The use of qml is like the classes and objects of c++. What are defined in the qml file are types. When using them, they cannot be directly referenced by the type name (unless a singleton object is defined). Instead, an object instance should be created using the type defined in qml, and then this instance object should be referenced. For example: [image: 657e3e2e-02f6-4281-a2e6-b140b5aaa175.png] [image: 2b622949-0b55-46e7-82e9-4037d087037f.png] [image: 9f3149dd-971c-4580-a884-3aaa349f0e46.png]
  • Dialog input form validation

    Unsolved 23 days ago
    0 Votes
    2 Posts
    77 Views
    Use client-side validation in QML (e.g., IntValidator, DoubleValidator) for immediate input checks. After that, call a C++ Q_INVOKABLE method to perform server-side validation (e.g., check for unique name/image in the database). Ensure the database check is asynchronous to avoid blocking the UI, and provide feedback if the check fails (e.g., show an error message if the name/image isn't unique). This ensures both local and database validation while maintaining a smooth user experience.
  • Sizing QML Dialog to text

    Unsolved about 22 hours ago
    0 Votes
    2 Posts
    28 Views
    To address this problem, you can try improving the dynamic sizing logic of the dialog using a more flexible approach that leverages implicit sizes more naturally. Here is an updated version of the dialog component, with improved sizing logic to handle dynamic text wrapping without manually adjusting the size of the dialog: import QtQuick 2.9 import QtQuick.Controls 2.2 Dialog { id: dlg visible: false title: "My Dialog" property var msgText property var parentWindow // Automatically determine width based on available space and the width of the content width: Math.min(buttons.implicitWidth * 1.5, parentWindow.width) height: content.implicitHeight + footer.implicitHeight + 20 // Account for content and footer height x: (parentWindow.width - width) / 2 y: (parentWindow.height - height) / 2 header: Label{ text: dlg.title // You can add more customization here, like styling if needed } // Container for content, where the text will go Item { id: content width: dlg.width * 0.8 // Use 80% of the dialog width as the maximum text width height: Text { id: msg text: msgText width: parent.width // Wraps within the given width textFormat: Text.StyledText wrapMode: Text.WordWrap }.implicitHeight // Use the implicit height of the text container for dynamic sizing } footer: Item { width: parent.width height: buttons.implicitHeight Row { id: buttons anchors.horizontalCenter: parent.horizontalCenter padding: 5 spacing: 2 Button { text: "OK" onClicked: dlg.accept() } Button { text: "Cancel" onClicked: dlg.reject() } } } }
  • Preferred line break for japanese translation in TS-file

    Unsolved 3 days ago
    0 Votes
    3 Posts
    61 Views
    @Jyothi Thanks for the response. I have no problem with using translations in QT, I do it for multiple languages. The problem is that one translation is used in multiple places, and thus I want to incorporate preferred line break in the translation itself. The other option is to duplicate the translation string and use one on each place, but that quickly turns cumbersome when you have thousands of strings. I try to minimize the amount of duplicated strings in the application.
  • import QtQuick.Controls,,but the ToolBar cannot be found

    Solved a day ago
    0 Votes
    3 Posts
    30 Views
    It has been resolved. It was caused by selecting a different version of Qt in the build configuration
  • Building a WebSite with Qt Quick and WASM

    Unsolved a day ago
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • Connecting C++ with QML

    Unsolved 6 days ago
    0 Votes
    21 Posts
    302 Views
    @zvoopz check these https://doc.qt.io/qt-5/qtqml-cppintegration-topic.html https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html
  • Correct way to make QML modules Qt 6.5-6.9

    Unsolved 4 days ago
    0 Votes
    14 Posts
    201 Views
    @Redman Yeah, I've seen this option. Thank you very much for your help, I will keep an eye on updates, and as soon as there is a way to make everything working in Qt, I will write in this thread and mark it as solved.
  • Error is not an attribute of QQuickView

    Solved 3 days ago
    0 Votes
    4 Posts
    70 Views
    Thanks guys, this was that.
  • how to create special characters and insert into strings

    Solved 14 Jun 2021, 01:13
    0 Votes
    10 Posts
    3k Views
    Easy way - QChar has a constructor that takes unicode. QChar sdegree(0x00B0);
  • Translation values returned from C++ models

    Solved 3 days ago
    0 Votes
    7 Posts
    88 Views
    Seems to work with qsTranslate in qml and QT_TRANSLATE_NOOP in the vector (inspired by http://imaginativethinking.ca/how-the-heck-can-i-use-qstr-with-variables/). Thank you all.
  • Qt Multimedia QAbstractVideoFilter Missing in Qt 6.9

    Unsolved 7 days ago
    0 Votes
    4 Posts
    83 Views
    @track said in Qt Multimedia QAbstractVideoFilter Missing in Qt 6.9: The SBarcodeDecoder works in the sense that it doesn't throw exceptions anymore, but it also doesn't detect any barcodes. Did you check the content of the frames you're passing to SBarcodeDecoder? Store them as images and see what's inside.
  • Possible memory leak of gradient animation

    Unsolved 23 Jan 2024, 21:29
    0 Votes
    13 Posts
    822 Views
    The problem is that every unique value of grAnim causes a new texture to be generated and stored in the cache: https://bugreports.qt.io/browse/QTBUG-136553
  • RTTI problem with MSVC

    Unsolved 8 days ago
    0 Votes
    1 Posts
    36 Views
    No one has replied
  • QmlSingletonRegisterType and QmlSingletonRegisterIstance

    Unsolved 12 days ago
    0 Votes
    4 Posts
    94 Views
    The existing answers are correct, but to amend them: With qmlRegisterSingletonInstance, the same instance is shared by all engines (which can be somewhat problematic when there's more than one), whereas with qmlRegisterSingletonType, each engine will end up with its own instance. Please see also https://doc.qt.io/qt-6/qml-singleton.html , especially the sections on "Exposing an existing object as a singleton", "Imperative type registration" and "Guidelines for (not) using singletons".
  • Move object to another qml

    Unsolved 10 days ago
    0 Votes
    4 Posts
    96 Views
    Improperly explained problems lead to bad answers. I'm not sure I properly understand what you are asking so I probably won't answer it either and each time I read your question I understand a completely different thing of the previous read. I've read five times and I'm still unsure about what I should understand. If I'm understanding it right, you might be willing to instanciate an object outside a Loader, but be able to access it within it ? if yes then you need to use a binding. Item { id: rootItem SerialData { id: serialData } Loader { id: loader source: someCondition ? "page1.qml" : "page2.qml" } Binding { target: loader property: "serialData" // the property name as it will be available inside the loader WITHIN PARENTHESES value: data } } and inside your loader you can access your property classically via rootItem.serialData other option : you want to instantiate your SerialData component inside some component and make it accessible to it's parent. Then you can declare it as a property inside the component that instanciates it and thus make it available to the parent component. Doing this for data properties is fine, but injecting out an object is bad architecture. That's a very bad choice. It is much cleaner to create it in the main page and inject it into the subpages rather than creating it in a subpage and injecting it out to the main page and back to the siblings.
  • 0 Votes
    7 Posts
    114 Views
    @JoeCFD Hi, Do you know of any sample code?
  • Bring Window to the 2nd Monitor

    Unsolved 24 days ago
    1 Votes
    5 Posts
    143 Views
    You're right, thanks. Running with paramter "-platform xcb" works. (Then, of course, it is no longer Wayland)
  • Segfault after moving project from Ubuntu 22.04 to RHEL 8.10

    Unsolved 12 days ago
    0 Votes
    9 Posts
    94 Views
    Hi all, The issue is now resolved. The project I was porting required glibc 2.29, whereas RHEL 8.10 only supports up to glibc 2.28. When I installed Qt using the online installer, it was expecting 2.29, rather than the system provided version. I couldn't find any precompiled Qt libraries for my version of RHEL, so I rebuilt Qt from source using the system provided version of glibc, and now there is no crash. Thanks for the responses!