跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k 主題 77.2k 貼文
  • Passing Array from C++ to QML?

    Solved
    11
    0 評價
    11 貼文
    8k 瀏覽
    J
    @LeLev and thx for fast response on an old topic :) I just tried it and it does what I need I'm pretty new to Qt. So much to learn. Cheers
  • Why is this 'keyValueList.push(KeyValue{})' code syntax incorrect in qml?

    Solved
    4
    0 評價
    4 貼文
    397 瀏覽
    ODБOïO
    @mirro said in Why is this 'keyValueList.push(KeyValue{})' code syntax incorrect in qml?: But I don't understand why you can't just assign values but use temporary variables instead? you can, but be aware of https://doc.qt.io/qt-5/qml-variant.html#storing-arrays-and-objects Additionally, since items and attributes are not QML objects, changing the values they contain does not trigger property change notifications. If the above example had onItemsChanged or onAttributesChanged signal handlers, they would not be called when assigning individual entries in either property. If, however, the items or attributes properties themselves were reassigned to different values, then such handlers would be called. @mirro said in Why is this 'keyValueList.push(KeyValue{})' code syntax incorrect in qml?: Also, do I need to free memory in this 'Component.onDestruction'? AFAIK no, because there is automatic garbage collection
  • The service provider does not support the QNavigationManager type

    Unsolved
    1
    0 評價
    1 貼文
    186 瀏覽
    尚無回覆
  • Qml: How to use your own .db file

    Unsolved
    1
    0 評價
    1 貼文
    252 瀏覽
    尚無回覆
  • How to create SwipeView gallery with prev/next pages visible?

    Unsolved
    2
    0 評價
    2 貼文
    165 瀏覽
    maratoriyM
    I think you should use PathView instead of SwipeView, since the first one is originally intended for your purposes.
  • Numbers are treated as strings - why?

    Solved
    3
    0 評價
    3 貼文
    229 瀏覽
    P
    Thanks. Problem solved. In code I had line var number = "" and I put this variable as parameter into function.
  • How To Change Color in Listview Delegate ?

    Solved
    3
    0 評價
    3 貼文
    385 瀏覽
    ?
    I thinks solution is Connections. It's work. ColorOverlay { id: favIconOverlay anchors.fill: favIcon source: favIcon color: getColorCode(id) transform: rotation antialiasing: true Connections { target: favoriteModel function onCountChanged(foo) { var newColor = getColorCode(id) if(newColor === '#ed670e') { favIcon.isFav = true } else { favIcon.isFav = false } favIconOverlay.color = newColor } } }
  • Is there something like class in QtQuick/QML?

    Solved
    2
    0 評價
    2 貼文
    147 瀏覽
    M
    https://doc.qt.io/qt-5/qml-qtqml-qtobject.html
  • How to add MenuItem dynamically (text is not set)

    Solved
    7
    0 評價
    7 貼文
    670 瀏覽
    P
    Below full code of Menu with adding and reading menuitem Menu { id: submenuAlarms title: "Alarms" function createMenuItemDefault() { var defaultAlarms = ["30s", "1m", "3m", "5m", "10m", "20m", "30m", "1h"]; var numberOfAlarms = defaultAlarms.length var alarmsItems = [numberOfAlarms]; var index = 0 for (var alarm of defaultAlarms) { console.log(alarm) var item = submenuAlarms.addItem(alarm) item.id = "ID_"+alarm item.triggered.connect(function(){console.log("Value: " + alarmsItems[__selectedIndex])}) alarmsItems[index] = item.text index++ } return alarmsItems } Component.onCompleted: { createMenuItemDefault() } }
  • Call base object method from QML

    Unsolved
    9
    0 評價
    9 貼文
    1k 瀏覽
    KH-219DesignK
    I'm not sure if I understand things with total clarity. However, if I understand, then these both exist in a base class: /* (1) */ Q_INVOKABLE void saveToFile(QUrl url) {saveToFile(url.toLocalFile())}; /* (2) */ Q_INVOKABLE virtual void saveToFile(QString string) = 0; And some QML code is triggering entry/execution into (2) instead of (1). In that case, I wonder why not just remove Q_INVOKABLE from (2) so that it is not-invokable from QML?
  • Qt Quick Websocket and Listview

    Solved
    2
    0 評價
    2 貼文
    212 瀏覽
    ODБOïO
    hi @NullByte said in Qt Quick Websocket and Listview: Can we update the Listview instantly by QML? Yes, add whatever you want to you ListModel using append method
  • Multiple layers

    Unsolved
    2
    0 評價
    2 貼文
    548 瀏覽
    sierdzioS
    Each graphical effect is a separate component, you can combine as many of them as you want. If you need to blend them, use Blend component.
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    7 瀏覽
    尚無回覆
  • Open folder on computer QML

    Unsolved
    6
    0 評價
    6 貼文
    816 瀏覽
    ODБOïO
    hi @Designer23 said in Open folder on computer QML: filedia.setFolder("D:/Users/hp/Doc") I dont see setFolder() mthod here https://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#methods maybe try filedia.folder = "D:/Users/hp/Doc"
  • QML filters in the table header

    Unsolved qml tableview hdr filter textfield
    1
    0 評價
    1 貼文
    589 瀏覽
    尚無回覆
  • QtQuick Controls 2 Style: Material.background and Universal.background NOT working

    Unsolved
    2
    0 評價
    2 貼文
    368 瀏覽
    D
    I'm sending also printscreen: [image: 5024d9ca-a876-49b6-9d07-5cae564b22dc.png]
  • Struggles with Page/ScrollView/ColumnView centering and scrolling

    Solved qml scrollview columnlayout positioning
    2
    0 評價
    2 貼文
    1k 瀏覽
    PendletonicP
    Hello! I think what is missing is a specification of the contentWidth and contentHeight of the ScrollView. The reason this breaks in the main case is because ColumnLayout has no default width/height. In spite of your specification of an implicitHeight and implicitWidth the ScrollView still must have the content sizes specified manually. So adding: contentWidth: parent.width contentHeight: the_column.height to the ScrollView resolves the issues.
  • QCompass in QT Quick mobile App

    Unsolved
    8
    0 評價
    8 貼文
    863 瀏覽
    P
    Deploying this code on Windows doesn't change the situation, just checked this out.
  • Missing Translations for Standard Buttons in QtQucikControls2

    Solved
    4
    0 評價
    4 貼文
    492 瀏覽
    S
    I found this link useful.
  • left-hand side of assignment operator is not an lvalue

    Solved
    2
    0 評價
    2 貼文
    2k 瀏覽
    ODБOïO
    hi You use "play" as property name and button id