Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • JS Fetch API in QML

    Unsolved
    2
    0 Votes
    2 Posts
    169 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
    306 Views
    S
    ok thanks
  • Connect cpp signal to qml registered cpp class

    Unsolved
    3
    0 Votes
    3 Posts
    262 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 combobox scroll
    2
    0 Votes
    2 Posts
    268 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
    207 Views
    Tom assoT
    @JonB Oh, that makes total sense! Thanks!
  • QMediaRecorder not record using QVideoFrameInput

    Unsolved
    1
    0 Votes
    1 Posts
    115 Views
    No one has replied
  • Face coloring on custom geometry

    Unsolved
    2
    0 Votes
    2 Posts
    195 Views
    johngodJ
    Hi @OlivierD You can use colorsemantic using the addAttribute(....) to define a color for each face , iirc just make sure that in the model Material you set lighting: DefaultMaterial.NoLighting
  • PathView delegate use attached attributes

    Solved
    9
    0 Votes
    9 Posts
    610 Views
    JoeCFDJ
    @Fan__ said in PathView delegate use attached attributes: QtVersion: 5.12.5 QtVersion: 5.12.5 is too old. Upgrade Qt above 5.15 or 6.8.
  • Different rendering of c++ QtLabel and Qml label

    Unsolved
    6
    0 Votes
    6 Posts
    389 Views
    GrecKoG
    The sizeHint of a QQuickWidget is based on the actual size of it's root item and not on its implicit size, I think that explains the discrepancy. minimumSizeHint() or minimumSize() are not implemented for QQuickWidget but they are for QLabel. You could try inheriting from QQuickWidget and override both sizeHint and minimumSizeHint by returning its root QQuickItem's implicit width/height.
  • Cannot clear selection in GridView/ListView

    Solved
    2
    0 Votes
    2 Posts
    201 Views
    T
    Qt 6 changed some input event handling, so you might need to adjust the event capturing logic. So the solution is: GridView { id: gridViewNodes anchors.fill: parent cellWidth: 140 cellHeight: 120 clip: true highlightMoveDuration: 100 reuseItems: true // unselect MouseArea { anchors.fill: parent propagateComposedEvents: true onClicked: (mouse) => { gridViewNodes.currentIndex = -1 nodeListMultiSelectionHandler.resetSelection() mouse.accepted = false // allow selection } }
  • 0 Votes
    8 Posts
    1k Views
    H
    The issue was solved Add child model in parent repeater's Compoenet.onCompleted. Repeater { id: repeater1 model: backend.graphModel Component.onCompleted: { repeater2.model = model.GraphMaximumCount } } Repeater { id: repeater2 }
  • This topic is deleted!

    Unsolved
    4
    0 Votes
    4 Posts
    83 Views
  • Keyboard events inside a QQuickPaintedItem/QQuickItem

    3
    0 Votes
    3 Posts
    4k Views
    Q
    you need to call setFlag(ItemAcceptsInputMethod, true);
  • Unqualified access warning on singleton object with QML_NAMED_ELEMENT

    Unsolved
    1
    2 Votes
    1 Posts
    168 Views
    No one has replied
  • Help with Resizable Columns in TableView

    Unsolved
    3
    0 Votes
    3 Posts
    686 Views
    A
    I think this repository can help you. https://github.com/tlaemmlein/TableViewQtQuick2Examples
  • Q_NAMESPACE, Q_ENUM_NS and qmlRegisterUncreatableType

    Solved
    3
    0 Votes
    3 Posts
    270 Views
    DuBuD
    @GrecKo Ah, cool, thank you!
  • qml with QQuickPaintedItem will slow down the ui operation

    Unsolved
    4
    0 Votes
    4 Posts
    251 Views
    Q
    @GrecKo thanks ,i will try video output later, now i use QQuickFramebufferObject.
  • Manage focus between multiple displays on Linux Wayland

    Unsolved
    4
    0 Votes
    4 Posts
    362 Views
    SGaistS
    That's something worth discussing. I currently don't know the details of the Wayland protocols and how to leverage them from Qt for your situation.
  • PySide6-QtQuick & QML problem generating an executable with NUITKA

    Unsolved
    4
    0 Votes
    4 Posts
    574 Views
    SGaistS
    Hi, Which version of PySide6 would that be ? Which version of Nuitka ? On which OS ? Also, while the logs nuitka might mention webengine, are you sure it's actually included ? I did a test on macOS and ended up with a 84MB binary which is not that surprising accounting for the QtQuick stuff plus QtCore and QtGui.
  • picture locations

    Unsolved
    12
    0 Votes
    12 Posts
    757 Views
    G
    I don't understand why something so essential is such a mystery. The documentation page presents a sample fise: [code] <RCC> <qresource prefix="/"> <file>images/copy.png</file> <file>images/cut.png</file> <file>images/new.png</file> <file>images/open.png</file> <file>images/paste.png</file> <file>images/save.png</file> </qresource> </RCC> [/code] It then proceeds to say, one would assume with reference to the above: The Qt Resource System The Qt resource system is a platform-independent mechanism for shipping resource files in an application. Use it if your application always needs a certain set of files (like icons, translation files, images), and you don't want to use system-specific means to package and locate these resources. Most commonly, the resource files are embedded into your application executable, or in libraries and plugins that are loaded by the application executable. Alternatively, the resource files can also be stored in an external resource file. The resource system is based on tight cooperation between Qt's rcc resource compiler, the build system, and the Qt runtime API. Note: Currently, the Qt resource system does not make use of any system-specific capabilities for handling resources, such as the ones on Windows, macOS, and iOS. This might change in a future Qt release. The Qt Resource Compiler (rcc) The Resource Compiler (rcc) command line tool reads resource files and generates either a C++ or Python source file, or an .rcc file. The list of files and related metadata is passed to rcc in the form of a Qt Resource Collection File. By default, rcc will generate C++ source code that is then compiled as part of an executable or library. The -g python option generates Python source code instead. The -binary option generates a binary archive that is by convention saved in an .rcc file and can be loaded at runtime. Note: While it is possible to run rcc from the command line, this is typically best left to a build system. See also the sections about qmake and CMake below. Qt Resource Collection File (.qrc) A .qrc file is an XML document that enumerates local files to be included as runtime resources. It serves as input to rcc. Here's an example .qrc file: <RCC> <qresource prefix="/"> <file>images/copy.png</file> <file>images/cut.png</file> <file>images/new.png</file> <file>images/open.png</file> <file>images/paste.png</file> <file>images/save.png</file> </qresource> </RCC> Each <file> element in the XML identifies a file in the application's source tree. The path is resolved relative to the directory containing the .qrc file. [quote] The path is also used by default to identify the file's content at runtime. That is, the file titlebarLeft.png will be available in the resource system as :/res/titlebarLeft.png or qrc:/res/titlebarLeft.png. To override this default run-time name, see Prefixes and Aliases. [/quote] titlebarLeft.png is not in the file example, I know it's nitpicky but it does not instill confidence. Further it is not made clear which instructions are being given for the QT creator IDE where one would assume that lots of setup is done for you, that is the point of an IDE as well as presumably for use of the library on it's own in whatever environment the programmer chooses.