跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.8k 貼文
  • Custom QML component using QAbstractTableModel

    Unsolved qml components qtquick2 qml types
    4
    0 評價
    4 貼文
    1k 瀏覽
    M
    Would switching to a QAbstractListModel (you'll get roles instead of columns to define your data) and using a Repeater with a custom delegate work in your usecase? Whether it's a list or a table model doesn't matter much. The number of columns is fixed, so a list model (using roles instead of columns) is fine. This is actually a separate question I wanted to ask in another thread... I don't really understand the concept of "roles." I keep googling it to find more explanations but none of them make sense to me for some reason. The bigger issue is that I don't think I understand how to use a Repeater for this, if what I really need to do is draw something on a canvas for each of the items in the list (or for each row in the table). Can a repeater be used that way? That's because *Views already have the basic plumbing to connect to a model in place [...] just design a component that react to those signals. I think that's the part I was having trouble verbalizing, thank you for attaching the right words to it! Just to make sure I actually understand the methodology, let me type out a scenario and make sure it passes a sanity check. Let's say that I have my subclass of QAbstractTableModel, which, like all descendants of QAbstractItemModel, emits those signals. What I need to do is develop a QML component that connects to those signals. Here's where I'm a little weak in my understanding... It seems to me that there are two things I need to do: Somehow declare a model for the component, where the model is some QAbstractItemModel object in the context of my QQmlApplicationEngine Declare onDataChanged for my custom component, and it will automatically be connected to the dataChanged signal that gets emitted from that QAbstractItemModel object Is that correct, and if so, how do I declare the model object for my custom component? ListView and TableView do this through a delegate model, which, as I mentioned above, I'm not sure I know how to use to draw things on a canvas. Thanks for the help, @GrecKo and @VRonin!
  • How to add line number for TableView?

    Unsolved
    4
    0 評價
    4 貼文
    419 瀏覽
    S
    I encapsulated a vertical table header myself.
  • Hello World "pixelSize is not a member of QFont" (similar w/ "family")

    Unsolved
    7
    0 評價
    7 貼文
    874 瀏覽
    KroMignonK
    @veryqtperson said in Hello World "pixelSize is not a member of QFont" (similar w/ "family"): Yet, one would expect a Qt-specific IDE such as Qt Creator not to have such errors when it doesn't know about documented properties of standard Qt/QML types. It depends on what kind of error you are talking about. Qt creator has nothing to do with JavaScript Engine used to run the QML code. What I said, is that even if you QML code is not totally correct, you can run it as long as you are not going through the wrong code part. This is the way JavaScript / interpreted languages works, so nothing direct link with Qt Creator. But, yes, Qt-Creator is far away from being bug free and the 'M16' error messages are very annoying
  • Application Window inactive while Busy Indicator Running

    Unsolved
    1
    0 評價
    1 貼文
    118 瀏覽
    尚無回覆
  • get metadata from video qml

    Unsolved
    1
    0 評價
    1 貼文
    182 瀏覽
    尚無回覆
  • Using barcode scanner causes disappearing of GUI of application

    Unsolved
    2
    0 評價
    2 貼文
    288 瀏覽
    SGaistS
    Hi, @MHermann said in Using barcode scanner causes disappearing of GUI of application: What is this and what can I do to prevent it? Not knowing anything about the implementation, it's hard to tell anything about what is going on.
  • qml video metadata: undefined

    Unsolved
    1
    0 評價
    1 貼文
    201 瀏覽
    尚無回覆
  • Round the Corner of Map

    Solved
    8
    0 評價
    8 貼文
    2k 瀏覽
    MarkkyboyM
    @tacdin - no idea, sorry, never used slider in a project before.
  • "QtQuick" plugin "qtquick2plugin" not found in MacOS C++ app using Qt5.15.2

    Unsolved qtquick2plugin 5.15
    22
    0 評價
    22 貼文
    6k 瀏覽
    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 評價
    4 貼文
    801 瀏覽
    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 評價
    5 貼文
    1k 瀏覽
    Vahid KaraBeyV
    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 評價
    1 貼文
    498 瀏覽
    尚無回覆
  • MediaPlayer often does not play video

    Unsolved
    5
    0 評價
    5 貼文
    584 瀏覽
    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 評價
    6 貼文
    757 瀏覽
    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 評價
    1 貼文
    211 瀏覽
    尚無回覆
  • Enum/Flags from C++ to QML

    Solved
    8
    0 評價
    8 貼文
    2k 瀏覽
    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 評價
    3 貼文
    291 瀏覽
    J
    @GrecKo Thanks for helping out
  • 0 評價
    7 貼文
    577 瀏覽
    GrecKoG
    => isn't valid c++ either.
  • QML - Seeking best method to detect user inactivity.

    Solved
    9
    0 評價
    9 貼文
    2k 瀏覽
    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 評價
    2 貼文
    267 瀏覽
    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.