Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.8k Topics 76.6k Posts
  • Warnings in default `Constants.qml`

    Moved Unsolved
    2
    0 Votes
    2 Posts
    89 Views
    JKSHJ

    Looks like a bug in Qt (not related to Qt Design Studio). I've created a bug report for you: https://bugreports.qt.io/browse/QTBUG-131911

  • Combobox dropdown text not showing

    Unsolved
    6
    0 Votes
    6 Posts
    225 Views
    JonBJ

    @ltlnx
    Me again, who knows nothing about QML :) Wouldn't have thought that theme would go as far as suppressing display of combo dropdown items completely. Are you able to quickly try your thing in something other than your "KDE desktop", like GNOME or whatever?

  • 0 Votes
    4 Posts
    152 Views
    J

    @Bob64

    Thanks for your reply.

    Not only does the closing strategy require the mouse to click outside to disappear, but also a button to control closing and showing. Clicking on the button triggers the closing strategy at the same time, which will cause the window to close and then open again.

  • dynamic margin according to wrapped text

    Solved
    5
    0 Votes
    5 Posts
    159 Views
    O

    Yes great, thank you.
    I add another thing which is to take into consideration the number of lines once the component is completed, because if I manage the margin directly during initialization, it does not work:

    anchors.leftMargin: contentWidth > width ? 12 : 4
    anchors.rightMargin: contentWidth > width ? 12 : 4

    ... Component.onCompleted: { anchors.leftMargin = (lineCount > 1 ? 12 : 4) anchors.rightMargin = (lineCount > 1 ? 12 : 4) }
  • How to communicate between components

    Unsolved
    5
    0 Votes
    5 Posts
    207 Views
    dheerendraD

    Make the topic as "Solved" as well.

  • Help structuring code with QML modules

    Moved Solved
    5
    0 Votes
    5 Posts
    267 Views
    L

    And as a bonus question, I fail to understand why modules are sometimes built as plain modules and sometime as libraries, by adding this (and then linking as a plugin):

    qt_add_library( StyleModule STATIC )

    In that case, also, is this needed in the main.cpp:

    Q_IMPORT_QML_PLUGIN( StyleModulePlugin );

    It works with and without, so I'm missing the point.
    There are a lot of examples circulating online, for various versions of Qt and all of this has changed quite a lot. The documentation being pretty thick, it's not easy to find up-to-date basic guidelines.

    Explanation or examples of use cases welcome! Thanks!

  • Qt nested ListView or can I use TreeView

    Unsolved
    6
    0 Votes
    6 Posts
    6k Views
    C

    bro ur the goat ive been stuck on this for hours, i think the key was wrappping the whole delegate in a component on the qml side

  • Efficient way to draw 2D complicated shape in Qt QML?

    Unsolved
    5
    0 Votes
    5 Posts
    344 Views
    R

    @Asperamanca Sorry for late response, and thanks for your answer, it's helpful, I will try that!

  • fonts not loading in my app

    Moved Unsolved
    4
    0 Votes
    4 Posts
    166 Views
    JonBJ

    @MaximBozek
    Bear in mind that I don't know anything about QML, only non-QML/widgets Qt. There I would expect to be able to go qDebug() << QFile::exists(":/fonts/Onest-....ttf") (I think that is right for non-QML, you could try on "qrc:/fonts/Onest-....ttf" but I believe the qrc is for QML only) and see it confirm that it can find that resource file at least. Can you do something similar from QML? I don't know that you can use any C++ code so I have to leave it to you).

    I don't know anything about whether fonts actually have to be installed or not. One would have thought not, they would work from the resource file, but I don't know.

  • Flickable Drag&Zoom

    Unsolved
    1
    0 Votes
    1 Posts
    70 Views
    No one has replied
  • Embedding external application on QML screen in Linux

    Unsolved
    5
    0 Votes
    5 Posts
    291 Views
    Pl45m4P

    @Vermithor said in Embedding external application on QML screen in Linux:

    These things are helping to bring a new window but unable to run the VS code within the window

    I don't see the reason why you want to do this... but apparently you haven't read the whole thing.
    How to embed foreign windows is indeeed described there.

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Qmlls.exe not find C++ Custom Types

    Unsolved
    3
    0 Votes
    3 Posts
    173 Views
    K

    @chids
    This doesn't work for me。

    I have restarted qmls.exe and cleared CmakeCache。

    dab4ef0f-d534-4781-a9f1-bc09388309e4-1733118107337.png

  • 0 Votes
    1 Posts
    669 Views
    No one has replied
  • propagateComposedEvents for MultiPointTouchArea

    Unsolved
    4
    0 Votes
    4 Posts
    186 Views
    johngodJ

    Hi @therealmatiss Since it is not in the MultiPointTouchArea docs it should not be a bug, maybe it just was not developed for it. You can ask about it in the qt dev mailing list and create a feature request in qt bug report https://bugreports.qt.io/secure/Dashboard.jspa. I am a bit work overloaded right now but when I find the time I will try to check qt code and see if this would be feasible to port.

  • Rounded Image in Qt6

    Solved
    10
    0 Votes
    10 Posts
    3k Views
    J

    To anyone seeing this in the future who has the same problem as me with the jagged edges: The problem seems to actually be caused by the smoothstep that the Qt6 MultiEffect uses but the Qt5 OpacityMask doesn't. This is used for the maskThreshold- and maskSpreadAt- properties of MultiEffect. I don't really understand how these properties work, but by recreating this part of the shader in my own project I found out that if the first two elements of mask are about 0 and 1 respectively, the edges will be smooth. By looking into how these values are calculated, I found that setting maskThresholdMin to 0.5 and maskSpreadAtMin to 1.0 reaches basically this and the edges will then be smooth enough

    TLDR: Set these values in the MultiEffect:
    maskThresholdMin: 0.5
    maskSpreadAtMin: 1.0

    Edit: And just to clarify, layer.smooth: true also has to be set on the mask item

  • QTextDocument cannot size or center images

    Unsolved
    3
    0 Votes
    3 Posts
    130 Views
    F

    Yes, I've tried resizing and centering w/ a parent <div>, parent <table><tr><td align="center"> and many other ways... and it seems to respect any other non-<img> element. There's no defaultStyleSheet on the document and no other HTML/CSS beyond the two <img> components.

    The images are added as resources like such (same QTextDocument as above):

    document->addResource(QTextDocument::ImageResource, QUrl("derp://img1.png"), img1); document->addResource(QTextDocument::ImageResource, QUrl("derp://img2.png"), img2);

    And then setHtml sets the following:

    <html> <body> <img width="50px" height="50px" src="derp://img1.png"/> <img width="50px" height="50px" src="derp://img2.png"/> </body>

    I've started putting together a new document w/ QTextCursor, but it'd be nice to just use HTML.

  • 0 Votes
    12 Posts
    4k Views
    JonBJ

    @Scotsgeek
    Yes, you get that with Qt5.x, Ubuntu 22, Wayland. Nothing you can do about it. It's just a warning, that should not stop you porting 5 to 6. As it happens with Qt6.x, Ubuntu 24, Wayland that message does not appear (though I don't think that means requestActivate() does anything). Still plenty of Wayland issues outside Qt, for my part I have made Ubuntu desktop revert to Xorg.

  • ROS2 Humble with QML

    Solved
    3
    0 Votes
    3 Posts
    239 Views
    R

    My conclusion is don't do this because the cmakes is different in both so try to separete it

  • Qt crashes because of a button background

    Moved
    5
    0 Votes
    5 Posts
    274 Views
    K

    The problem wasn't there at all. It was crashing because of a pie chart