Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • How to set the margin for the header and content of a QML ListView?

    Unsolved
    2
    0 Votes
    2 Posts
    198 Views
    GrecKoG
    You could add this margin in the header component itself. ListView leftMargin can't be used here since it puts the margin on the left of header. If using a Control as the header you could use rightPadding or rightInset to easily add a inside margin.
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    95 Views
    No one has replied
  • Detec U-Disk Insert and Remove

    Unsolved
    11
    0 Votes
    11 Posts
    803 Views
    Z
    @J-Hilk Thank you for your reply, Indeed, after I discovered that the "nativeEvent" inherits from the "QWidget", I tried something else, as you said, using the "NativeEventFilter" that inherits from the "QCoreApplication ", but the problem remained. How can I modify and adjust it
  • Creating custom modules

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    KoryK
    Thanks for the help, I appreciate it. First time using modules and I'm learning a lot What I've learnt so far: Using qt_add_qml_module automatically makes a qmldir and QResources file Cmake file for our project needs this to include a module with our library add_subdirectory(<FolderOfModule>) target_link_libraries(<applicationLibrary> PRIVATE <UriOfModule>plugin) Our module needs to be in it's own folder. Put CMake file, QML files, and resource files we're using for that module Cmake file for our QML module needs this qt_add_qml_module(<NameOfModule>) URI <ImportNameOfModule> VERSION <VersionNumber> RESOURCE_PREFIX <Prefix> QML_FILES <QML_Files> RESOURCES <Resource_Files> Perhaps it also needs this qt_add_library(<NameOfModule> STATIC) set_target_properties(<NameOfModule> PROPERTIES AUTOMOC ON) target_link_libraries(<NameOfModule> PRIVATE Qt6::Quick ) Can optionally specify an output directory too it seems QML file where we include our module needs this import <ImportNameOfModule> <VersionNumber> Then if we want to use a custom QML element from our module, we refer to it by it's like filename without the extension Will also need to make this addition to our main.cpp file engine.addImportPath("qrc:/"); Without this, we'll get a "is not a type" error If there's anything else I might not know about modules, let me know and I'll check it out. Think I've made some progress with them now at least. Was using import paths before but modules are what I'm trying to replace all of that with Got a module in one's actual project to work as opposed to a project consisting merely of a test module. So many things to get right between the cpp, qml, cmakelists, auto generated QResourceFile, and sci file too in this case My module was a text input module. It has a text input base QML file and email text input QML file that inherits from this base. And it uses a border image so that's why there's a .sci resource for that [image: d39cf436-86a1-4e68-8bcb-824d3743b4be.png] Now I'll have to do all of the other modules too
  • Application comes up black when using software sceneGraphBackend

    Unsolved
    1
    0 Votes
    1 Posts
    131 Views
    No one has replied
  • "Simple" masking

    Unsolved
    2
    0 Votes
    2 Posts
    237 Views
    johngodJ
    Hi @Pena Note that I am not very experienced with MultiEffect, but did you try setting maskSource ? Did you check the MultiEffect examples ? One other option would be to use a ShaderEffect with a custom shader to discard pixels you want to remove,this is probably a bit overkill and not that trivial.
  • Need to run the a VS code with in the QLM Application window itself.

    Unsolved
    4
    0 Votes
    4 Posts
    342 Views
    SGaistS
    Then you should continue on the original thread. Asking what is mostly the same question in an other thread just spread the attention and the information.
  • QML Graphs using dynamic data (from C++)

    Unsolved
    2
    0 Votes
    2 Posts
    299 Views
    GrecKoG
    Use a XYModelMapper in combination of a QAbstractItemModel.
  • Overlay QML View on QOpenGLWindow

    Unsolved
    2
    0 Votes
    2 Posts
    148 Views
    A
    @dheerendra , could you please help
  • QMLLS: QML Module not found even in most basic example

    Unsolved
    1
    0 Votes
    1 Posts
    258 Views
    No one has replied
  • Warnings in default `Constants.qml`

    Moved Unsolved
    2
    0 Votes
    2 Posts
    160 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
  • Qt window automatically closes the window when clicking outside the window area

    Unsolved
    4
    0 Votes
    4 Posts
    343 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
    355 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
    401 Views
    dheerendraD
    Make the topic as "Solved" as well.
  • Help structuring code with QML modules

    Moved Solved
    5
    0 Votes
    5 Posts
    557 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 c++ listview treeview qml
    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
    536 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
    361 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
    136 Views
    No one has replied
  • Embedding external application on QML screen in Linux

    Unsolved
    5
    0 Votes
    5 Posts
    519 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.