Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Round the Corner of Map

    Solved
    8
    0 Votes
    8 Posts
    2k Views
    MarkkyboyM
    @tacdin - no idea, sorry, never used slider in a project before.
  • 0 Votes
    22 Posts
    6k Views
    veryqtpersonV
    I've gotten the same problem with my static build of Qt 5.15.2. The solution in my case (using CMake) was to call qt5_import_qml_plugins: get_target_property(QT_TARGET_TYPE Qt5::Core TYPE) if(${QT_TARGET_TYPE} STREQUAL "STATIC_LIBRARY") find_package(Qt5QmlImportScanner REQUIRED) qt5_import_qml_plugins(${CMAKE_PROJECT_NAME}) endif() Not sure what is the equivalent in Qt 6, haven't tested it myself and can't find qt6_import_qml_plugins in documentation. Anyway, qt5_import_qml_plugins is available only from Qt 5.14(?), so for older versions the alternative would be this external module.
  • Found interesting way to crash QML app.

    Solved
    4
    2 Votes
    4 Posts
    767 Views
    fcarneyF
    @JKSH said in Found interesting way to crash QML app.: Would you be willing to submit a bug report to https://bugreports.qt.io/ ? Yeah, I can do that. Edit: https://bugreports.qt.io/browse/QTBUG-98032
  • SQLite db doesn't populate QML ComboBox

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    V
    Would you please tell how do you solve the problem?
  • javascript type annotations do not work in code-behind .js files

    Unsolved javascript qml type safety
    1
    0 Votes
    1 Posts
    474 Views
    No one has replied
  • MediaPlayer often does not play video

    Unsolved
    5
    0 Votes
    5 Posts
    540 Views
    JoeCFDJ
    @Mark81 Multimedia is reworked in Qt 6.2 from the recent talk of Lars Knoll and could have a lot of issues. I would not use it now. I do not use it and still apply gstreamer for playing videos.
  • 0 Votes
    6 Posts
    707 Views
    V
    Got it working. Initially tried to inherit QApplication and incorporate the eventFilter and the signal to be sent in there. That didn't work. Then sorted through Grecko's suggestion, which BTW, qmlRegisterSingletonInstance appears nowhere in the link provided, initially trying to make the QApplication object accessible from QML. That didn't work. Finally got it to work by making the custom object containing the eventFilter and signal accessible from QML (you would think that, installEventFilter, would reparent the object, but then again a custom QApplication that incorporated one didn't work either) and that allowed it to work.
  • Communication between Virtual Keyboard and the rest of my QML

    Unsolved
    1
    0 Votes
    1 Posts
    202 Views
    No one has replied
  • Enum/Flags from C++ to QML

    Solved
    8
    0 Votes
    8 Posts
    2k Views
    KroMignonK
    @Mark81 said in Enum/Flags from C++ to QML: But in the links I provided there is no mention of qmlRegisterUncreatableType nor about the needs of import the domain Then you don't have read carefully the documentation. To get access to enum on QML side, you have to register it (cf. Enumeration Type documentation) Providing the Message class has been registered with the QML type system. The given link is Registering C++ Types with the QML Type System There are multiple way to achieve this, depending on Qt Version you are using and build system (qmake or cmake). But the way exposed by @J-Hilk works in every case.
  • Is it possible to define another set of states in the same qml file

    Solved
    3
    0 Votes
    3 Posts
    268 Views
    J
    @GrecKo Thanks for helping out
  • 0 Votes
    7 Posts
    538 Views
    GrecKoG
    => isn't valid c++ either.
  • QML - Seeking best method to detect user inactivity.

    Solved
    9
    0 Votes
    9 Posts
    2k Views
    GrecKoG
    @VFCraig That was meant as the name of the class you would need to create to watch the events of your application.
  • QT Quick performance with rotation

    Unsolved
    2
    0 Votes
    2 Posts
    247 Views
    H
    For anyone having a similar problem, consider reading the qml performance article: https://doc.qt.io/qt-5/qtquick-performance.html My problem was having a rectangle as root item for my application. QT repaints the whole scene including the rectangle. I switched my root Item to "Item". Now it's smooth. I am still not quite sure why the problem only occured when the rotation is not equal to 0 or 180.
  • Set dynamic text via function

    Unsolved
    8
    0 Votes
    8 Posts
    654 Views
    M
    @GrecKo Ok, it was kinda connected to my Custom Image Button which ... I think overwrites the clicked function. import QtQuick 2.0 import de.martingebske Rectangle{ id: root height: 200 width: 200 color: "transparent" property string kw: "" property string source: "" property double itemHeight: 200 property double itemWidth: 200 property double textMargin: -70 signal clicked() Image { id: img source: root.source height: root.itemHeight width: root.itemWidth Text{ id: txt color: "white" anchors.bottom: img.bottom anchors.horizontalCenter: img.horizontalCenter anchors.bottomMargin: root.textMargin text: root.kw font.pointSize: 20 font.family: "Helvetica" } MouseArea{ id: ma anchors.fill: img enabled: true onClicked: { if(!hpcManager.chargerIsOccupied()){ root.clicked() img.opacity = 0.2; txt.opacity = 0.6; ma.enabled = false } else console.log("No more parking spaces available!") } } } } When I use regular Buttons instead of my custom buttons it works as intended. Still I don't really get it, why the text doesn't change (because it's absolutely not related to the custom Button) but I think it's something in the MouseArea click event.. just a wild guess...
  • Using C++ Models with Qt Quick Views example

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    M
    I'm not sure if this solution is ok, because is quite different from the example but at least it works: main.cpp engine.rootContext()->setContextProperty("modelContent", &flow.modelContent); main.qml PathView { id: view ... model: modelContent
  • "visible" property forced to "false"

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    jeremy_kJ
    @naprile said in "visible" property forced to "false": I'm not an expert Qt programmer. Do you think my problem is due to having used one Loader for each page or can be due to another reason? Thanks. It could be. Extra code is extra complexity to understand. Even if simplifying doesn't fix the issue, it should make it easier to spot.
  • ComboBox text reset on model update

    Unsolved
    3
    0 Votes
    3 Posts
    417 Views
    I
    @J-Hilk Thank you for your reply! I can see that this binding adds something to model. But what if I type something in text edit, and in my C++ code the model gets reset. For example, I have TextField in ComboBox TextField { text: root.editText onTextChanged: { updateModel() } void CustomModel::updateModel() { beginResetModel(); endResetModel(); } But whenever it happens, text in text edit gets erased. So for example. I write one letter in text edit, model gets updated, then I type another letter, and the text gets erased. The most interesting thing is that text that I typed gets erased every second attempt to write something. And if there was some text before it remains unchanged, only my input is affected. Any ideas why it happens? Thank you
  • How to reset order of QAbstractListModel

    Unsolved
    2
    0 Votes
    2 Posts
    461 Views
    JonBJ
    @PhiBh Depends what you mean by "a better way" :) I know nothing about QML, but this seems to be a straight Qt model/view question. You can use begin/endMove Rows(). But I would do that if you are moving, say, 1 row around. It can get difficult to calculate if you are, say, sorting the entire list, or don't want to calculate which of many rows have been moved where. Then it is simpler to just call QAbstractItemModel::beginResetModel(), do your complete changes, and endResetModel(). Note that you should then read the referenced documentation, telling you that all views and e.g. flags() are reset. You would want to test this to see what effect it has on your existing views and how they refresh in response.
  • How to receive files dragged into apps from other apps, such as from a browser?

    Moved Solved
    6
    0 Votes
    6 Posts
    464 Views
    S
    @J-Hilk @JonB Thanks.Found that the drag from the browser is a link.
  • How do I change a ComboBox model and remember the previous selection?

    Solved
    2
    0 Votes
    2 Posts
    618 Views
    D
    I'm such an idiot, lol. I got it working properly with: /** * Update the number of days when the month changes. * Keep the current selection if it's still valid. */ function updateDays(index) { let numDays = days(); comboDay.model = numDays; if (index < numDays.length) { comboDay.currentIndex = index; } } ... ComboBox { id: comboMonth model: _bridge.months() currentIndex: now.getMonth() onActivated: (index) => updateDays(index) }