跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • QSortFilterProxyModel sub-class registration and instantiation issue.

    Solved
    2
    0 評價
    2 貼文
    337 瀏覽
    SiN_BizkitS
    Maybe it will help someone. This code fixed the issue: #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1); #else qmlRegisterType<QAbstractItemModel>(); #endif
  • How can I bind properties of select Listview delegate with other component properties?

    Solved
    2
    0 評價
    2 貼文
    254 瀏覽
    oria66O
    For the record, I used custom getters of the model, with the current index of the Listmodel.
  • QML TreeView using only QtQuick 2 works fine?

    Solved
    5
    1 評價
    5 貼文
    2k 瀏覽
    jsulmJ
    @maxwell31 What exactly do you mean? Do you want to modify QQuickTreeModelAdaptor? Or why else you would need to "copy"? If you want to modify QQuickTreeModelAdaptor then you have ot make your changes open source (LGPL requirement).
  • Qt Quick emulation crashed. (line 1) error

    Unsolved
    1
    0 評價
    1 貼文
    166 瀏覽
    尚無回覆
  • module "QtApplicationManager" is not installed

    Unsolved
    2
    0 評價
    2 貼文
    611 瀏覽
    raven-worxR
    @flwwater when you are talking about this QtApplicationManager type, you will need a commercial license of Qt first.
  • Get file name, line number and function name in QML Javascript. How?

    Solved
    9
    1 評價
    9 貼文
    6k 瀏覽
    KH-219DesignK
    @ondrejandrej said in Get file name, line number and function name in QML Javascript. How?: Is there a way to print file name only? Yes and no. These are the tokens accepted by qSetMessagePattern: https://doc.qt.io/qt-5/qtglobal.html#qSetMessagePattern For filename, there is only one choice (the "%{file}" that we have already seen). There isn't anything like "shortfile" or "filebasename" from what I can see. So I can think of two options. (1) you can write your own QtMessageHandler function, as done in this example: https://github.com/qt/qtbase/blob/fcea8e7aa8a/examples/vulkan/hellovulkanwidget/main.cpp#L79 Anything that is logged will get routed to your handler function, and you can get the filename and all the other info from the QMessageLogContext passed to the handler, and you can then have total control over logging. (2) Keep the logging as you have it now (with long file name and file path), and write a separate little bash script (or perl script, or python script) to filter the output whenever you pipe logging info to your script. I guess (2) might not be great if you are looking at the output inside a debugger. Nonetheless, here is an example of what I mean in (2), as demonstrated at a bash prompt... If I launch my app like so: ./app This long line of output appears 2021-04-26 08:33:52 [QT-info][thr:1991]/opt/repositories/client/self/heory/gits/heory/src/app/event_filter.cc(76): this GUI thread is running unblocked. But if I launch it and pipe output through a sed filter: ./app |& sed 's/opt\/repositories\/client\/self\/heory\/gits//' That same log line will shrink to: 2021-04-26 08:33:46 [QT-info][thr:1951]//heory/src/app/event_filter.cc(76): this GUI thread is running unblocked. (Sidenote: in case the |& that I like to call pipepersand is as new to anyone as it is recently new to me, here is a reference on piping in bash with {pipe,ampersand})
  • 0 評價
    4 貼文
    384 瀏覽
    JKSHJ
    @JL-SABATIER You're most welcome. Happy coding!
  • [SOLVED] Is it possible to conditionally handle a gradient

    4
    0 評價
    4 貼文
    4k 瀏覽
    B
    It worked for me. :)
  • Load image from C++ on QML

    Unsolved
    5
    0 評價
    5 貼文
    722 瀏覽
    J
    @jeremy_k Thank you for your advice. I have changed few things, but I don't know if I did it in a right way.
  • How to load image using Timer in QML?

    Unsolved
    2
    0 評價
    2 貼文
    199 瀏覽
    jeremy_kJ
    This is a repost of https://forum.qt.io/topic/125992/load-image-from-c-on-qml/3. Please stick to the original thread rather than repeating the question.
  • Switching visibility of a Rectangle via button

    Solved
    4
    0 評價
    4 貼文
    1k 瀏覽
    A
    Thanks gents, @eyllanesc is it possible to bind the myRectangle visibility to 2 buttons? Something like this: Rectangle { id: myRectangle visible: myButton.checked : myButton2.checked no idea of the correct syntax...
  • [QML] Fixed Popup direction

    Unsolved
    1
    0 評價
    1 貼文
    192 瀏覽
    尚無回覆
  • Adding behavior prevents color change of rectangle

    Solved
    2
    0 評價
    2 貼文
    315 瀏覽
    ocgltdO
    Seems to be an error in the docs (in an example). Once I used ColorAnimation instead of NumberAnimation it worked.
  • list of images with different sources [Repeater]

    Solved
    2
    1 評價
    2 貼文
    203 瀏覽
    M
    after perseverence, I ended up finding a good approach. but I stay tuned if there is better: delegate-prop Grid { columns: 1 spacing: 2 Rectangle { color: "red"; width: 200; height: 200; Column { Repeater { id: rep Image { source: modelData } } } } Button { text: "Load" onClicked: { var img = ['https://pbs.twimg.com/profile_images/875749462957670400/T0lwiBK8_400x400.jpg', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQNWZZEtSli3K3SYZN-Mhsl0WPo_1o6qYQ5ag&usqp=CAU']; rep.model = img } } }
  • Flickable contentY alias in views

    Unsolved flickable property alias mvc
    1
    0 評價
    1 貼文
    363 瀏覽
    尚無回覆
  • Can't change current item in TreeView (v2) by mouse

    Unsolved
    1
    0 評價
    1 貼文
    220 瀏覽
    尚無回覆
  • Can't add to ItemSelectionModel list of selected model indexes

    Unsolved
    2
    0 評價
    2 貼文
    308 瀏覽
    ocgltdO
    It's starting to look like a bug...but this is so simple I can't understand how it got past QA. Not sure if this stems from QAbstractItemModel, SelectItemModel, or TreeView (v2).
  • Documentation for TreeView in MarketPlace - feels like an incomplete product

    Solved
    4
    0 評價
    4 貼文
    450 瀏覽
    B
    @ocgltd thanks for the warning. I had been thinking about asking my company to purchase this, which having to do separately from licensing Qt is in itself is an annoying complication. But it sounds like it will not be worth it anyway. The whole handling by Qt of the TreeView thing has been an utter shambles. There was a long standing bug that there was no TreeView in Qt Quick 2, which was supposedly resolved by making this marketplace add-on available. I don't understand why a tree view is not considered to be a basic, core component of a GUI toolkit and why this was not provided years ago as a proper, integrated, documented component of QML.
  • about 'import'

    Unsolved
    2
    0 評價
    2 貼文
    184 瀏覽
    SGaistS
    Hi and welcome to devnet, From a quick search, would say you can read the code starting from here.
  • Missing libraries QtQuick

    Unsolved qtquick websocket webengineview
    5
    0 評價
    5 貼文
    1k 瀏覽
    M
    I think that I found my answer https://wiki.qt.io/Qt_6.0.0_Modules Not supported. [image: d9040d3b-d348-4864-abd7-275b2f07c331.png] Thanks for help. I guess I will have to try to rollback. I wanted to write a small simple app for (for now) my own use, but the functionalities seem to be pretty restricted on Qt 6.0 then...