Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.9k Topics 76.8k Posts
  • QML app freezes for a bit after deactivating Loader3D

    Unsolved
    1
    0 Votes
    1 Posts
    52 Views
    No one has replied
  • QML TreeView

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    JonBJ

    @chapayev
    I know nothing about QML. Your code looks to me as though it handles expansion/contraction, and subitems? Are you saying this addresses the OP's question

    The representation requires that rows have to be displayed differently - for example some rows have a checkbox some dont.

    ?

  • 0 Votes
    4 Posts
    100 Views
    B

    @Pivit I tried your example but for now I have only this in my onCompleted:

    console.log("Lights List:", MyManager.lightsList) console.log("Lights List length:", MyManager.lightsList.length)

    and if I debug from the QML into the C++, I see that the correct manager object is called and that the lisghtsList is non-empty:

    Filled lights: 5 qml: Lights List: [QVariant(Light, ),QVariant(Light, ),QVariant(Light, ),QVariant(Light, ),QVariant(Light, )] qml: Lights List length: 5

    I think your issue is that you have not properly exposed Light to QML. For a simple struct-type class the easiest thing is to make it a Q_GADGET to expose the properties to QML:

    #include <QVariant> struct Light { private: Q_GADGET Q_PROPERTY(uint id MEMBER id) Q_PROPERTY(uint intensity MEMBER intensity) public: uint id; quint16 intensity; // ... same as your code }; Q_DECLARE_METATYPE(Light)

    I have only exposed the id and intensity members for now, but it is enough to try it out. I added an extra print in the onCompleted:

    console.log("Lights List first id:", MyManager.lightsList[0].id)

    The output is now:

    Filled lights: 5 qml: Lights List: [Light(0, 0),Light(1, 100),Light(2, 200),Light(3, 300),Light(4, 400)] qml: Lights List length: 5 qml: Lights List first id: 0
  • how to make water ripple (circles)

    Unsolved
    2
    0 Votes
    2 Posts
    55 Views
    S

    Here How You Can Do With Animation Method

    Rectangle { width: radius * 2 height: radius * 2 color: "rgba(255, 255, 255, 0.4)" radius: width / 2 anchors.centerIn: parent // Animation to expand the ripple NumberAnimation { target: parent property: "radius" from: 0 to: 100 duration: 1000 loops: Animation.Infinite easing.type: Easing.OutElastic } }
  • How to fix height and width of filedailog in qml.

    Unsolved
    4
    0 Votes
    4 Posts
    148 Views
    S

    You're right — my earlier response was focused on QFileDialog from Qt Widgets, but the OP is indeed asking about QML's FileDialog.
    If the OP needs full control over the size or wants to add a background overlay, the alternative would be to create a custom file browser UI in QML using FolderListModel, ListView, and other controls instead of relying on FileDialog.

    Thanks again for pointing this out!

  • import marble in qml qt

    Unsolved
    2
    0 Votes
    2 Posts
    98 Views
    R

    Step 1: Verify Marble Installation
    ls /usr/lib/qml/org/kde/marble

    Step 2: Check Where Marble Installed Its QML Module
    find /usr -type d -name "org.kde.marble"
    find /usr/local -type d -name "org.kde.marble"

    Step 3: Manually Add QML Import Path
    // Set additional import path for QML modules
    engine.addImportPath("/usr/local/lib/qml"); // Adjust if necessary in main.cpp

    Step 4: Verify Installed Marble Libraries
    ldd /usr/local/lib/libmarblewidget-qt5.so
    If any dependencies are "not found", you might need to add /usr/local/lib to your library path:

    sh
    Copy
    Edit
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

    Step 5: Try Importing Again in QML
    import org.kde.marble 0.20 // Change version based on installed version

  • How to place inside flickable other components

    Unsolved
    2
    0 Votes
    2 Posts
    125 Views
    S

    There’s nothing wrong with your current code — you are already doing it right.
    The documentation is just warning you not to accidentally anchor to flick.

  • 0 Votes
    1 Posts
    42 Views
    No one has replied
  • macdeployqt dmg references with links

    Unsolved
    1
    0 Votes
    1 Posts
    37 Views
    No one has replied
  • How to get aggregated scaling factor for QML items?

    Unsolved
    3
    0 Votes
    3 Posts
    101 Views
    A

    Thanks for your reply. I should have been more specific in my question: I know how to write it myself, I was looking for an existing function that already gives the that, akin to QGraphicsItem::sceneTransform.

    Because how would you expose such a function to QML, so you have it available globally, for all items? I guess that would mean something like a singleton object.

  • Introducing 'Toastify' for QML

    3
    1 Votes
    3 Posts
    132 Views
    aeriqueA

    About the zero dependencies: it is indeed really nice that I just have to drop two files in my project to get nice toast functionality.

  • qml type annotation with local enum

    Unsolved
    3
    0 Votes
    3 Posts
    104 Views
    M

    @Shrishashank thank you very much.

  • custom style for virtual keyboard

    Solved
    8
    0 Votes
    8 Posts
    787 Views
    mzimmersM

    OK, so here's what I needed to do:

    create a resource file for the custom style. add a prefix: <qresource prefix="/VKeyboardStyles/QtQuick/VirtualKeyboard/Styles/mydefault"> create a folder with the name "mydefault" place my custom style.qml in this folder (along with any custom images I wanted) add this to my main.cpp: qputenv("QT_VIRTUALKEYBOARD_STYLE","mydefault");

    I really don't see why this has to be so complicated, but maybe this will help anyone else who's trying to do the same thing.

    Thanks to everyone who looked.

  • 0 Votes
    2 Posts
    99 Views
    N

    Some other possibilities: QQuickPaintedItem, Canvas...

  • FontLoader not loading woff2 format

    Unsolved
    8
    0 Votes
    8 Posts
    263 Views
    SGaistS

    Use forward slashes for your paths. Backslashes are for escape sequences.

    AFAIR, it's the file:// scheme to grab stuff from your local drive

  • JS Fetch API in QML

    Unsolved
    2
    0 Votes
    2 Posts
    78 Views
    piervalliP

    You find an example in the doc.
    https://doc.qt.io/qt-6/qml-qtqml-xmlhttprequest.html

  • customize my ApplicationWindows in Qml

    Unsolved
    5
    0 Votes
    5 Posts
    113 Views
    S

    ok thanks

  • Connect cpp signal to qml registered cpp class

    Unsolved
    3
    0 Votes
    3 Posts
    165 Views
    S
    Modify dataGenerator Signal:
    Qt does not allow non-const references (&) in signals for queued connections. Modify the signal to use a const reference:

    class dataGenerator : public QObject {
    Q_OBJECT
    signals:
    void DataChunkGenerated(const QVector<double> &dataChunk); // Use const reference
    };
    2. Ensure dataDisplay Slot Matches the Signature:
    Your dataDisplay class already has:

    class dataDisplay : public QObject {
    Q_OBJECT
    public slots:
    void updateData(const QVector<double> &dataChunk);
    };
    This matches the modified signal.

    Connect the Signal to the Slot in C++:
    You can establish the connection in main.cpp or wherever you create these objects:

    dataGenerator *generator = new dataGenerator();
    dataDisplay *display = new dataDisplay();

    // Connecting the signal from dataGenerator to the slot in dataDisplay
    QObject::connect(generator, &dataGenerator::DataChunkGenerated,
    display, &dataDisplay::updateData);

  • Custom ComboBox not scrolling

    Unsolved
    2
    0 Votes
    2 Posts
    125 Views
    S

    It seems the issue you're experiencing with the ComboBox not scrolling when there are many items is due to the absence of proper height configuration for the ListView inside the Popup. The ListView needs an explicit height to trigger scrolling behavior, and without it, the dropdown won't scroll even when there are many items.

    To fix this, you can add a fixed or constrained height to the ListView, and ensure the ScrollIndicator appears when needed. Here's the updated code for the popup section:

    popup: Popup {
    y: control.height - 1

    width: control.width implicitHeight: contentItem.implicitHeight padding: 0 contentItem: ListView { width: parent.width height: Math.min(200, contentHeight) // Constrain the ListView height or set a max height clip: true model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex ScrollIndicator.vertical: ScrollIndicator { visible: contentHeight > height // Only show the scroll indicator if the content exceeds the viewable area } } background: Rectangle { radius: 0 color: Qt.color(AppTheme.colors["UFO_ComboBox_Popup_Background"]) border.color: Qt.color(AppTheme.colors["UFO_ComboBox_DropBox_Border"]) }

    }

  • Basic QML object declaration syntax question

    Solved
    4
    0 Votes
    4 Posts
    89 Views
    Tom assoT

    @JonB Oh, that makes total sense! Thanks!