Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Promise() as text in Label

    Unsolved
    2
    0 Votes
    2 Posts
    179 Views
    GrecKoG
    You don't. That's not how promises work. then doesn't return a value, it takes a function that will be eventually called and returns the promise itself (the QJSValue or [object Promise] you see). Also you need to call resolve when writing a promise to indicate it is finished : (resolve => resolve(calculateDate))); More info here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises What you could try doing is declaring a new Binding and use the fact that it can change a property, something like the following: // PromiseBinding import QtQml Binding { property var promise onPromiseChanged: promise.then(v => value = v) } Usage would be like this: Label { PromiseBinding on text { promise: new Promise (resolve => resolve(calculateDate().toString())) } } Disclaimer: I haven't tried that.
  • How to generate a surface3D of image gray height ?

    Unsolved
    1
    0 Votes
    1 Posts
    101 Views
    No one has replied
  • Application crashes after fast load using ```Qt.createComponent```

    Moved Unsolved
    5
    0 Votes
    5 Posts
    407 Views
    K
    @piervalli I am currently on macOS
  • QQmlComponent::Error "Type xxx cannot declare new members."

    Solved
    3
    0 Votes
    3 Posts
    495 Views
    Q
    I found a solution to my own problem. The problem was actually not the class Body, but another class that is a parent to Body in the qml-file. I had a forward declared class here that I had missed. This used to work in Qt5 but now in Qt6 they have to be replaced with Q_MOC_INCLUDE.
  • Best way to change the color of Qt Quick Controls

    Unsolved color change controls 2 qt quick qml
    3
    0 Votes
    3 Posts
    680 Views
    SavizS
    @costasjames479 I am aware that other styles are available for Qt Quick Controls. However, according to the documentation, the Basic Style is the most performant and platform-compatible, which is why I prefer to use it. With this in mind, how can I figure out what to place as the attribute or property name instead of ? in the following code: TextField { palette { ?: "blue" ?: "white" } } ComboBox { palette { ?: "blue" ?: "white" } } In other words, is there a detailed list in the documentation that specifies the name of each attribute, which I might have overlooked?
  • This topic is deleted!

    Unsolved
    5
    0 Votes
    5 Posts
    93 Views
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Reduce the right space in a context menu

    Solved
    3
    0 Votes
    3 Posts
    278 Views
    franco.amatoF
    @GrecKo below the code showing how the LogoMenuItem is used: Menu { id: logoMenu x: parent.width - logoMenu.width y: parent.height LogoMenuItem { text: qsTr("General Settings") defaultIconSource: "qrc:/Resources/images/Launcher/ContextMenu/settings_default.png" hoverIconSource: "qrc:/Resources/images/Launcher/ContextMenu/settings_hover.png" iconWidth: 21 iconHeight: 23 } LogoMenuItem { text: qsTr("Support") defaultIconSource: "qrc:/Resources/images/Launcher/ContextMenu/support_default.png" hoverIconSource: "qrc:/Resources/images/Launcher/ContextMenu/support_hover.png" iconWidth: 21 iconHeight: 16 } LogoMenuItem { text: qsTr("Log Out") defaultIconSource: "qrc:/Resources/images/Launcher/ContextMenu/logout_default.png" hoverIconSource: "qrc:/Resources/images/Launcher/ContextMenu/logout_hover.png" iconWidth: 21 iconHeight: 19 } LogoMenuItem { text: qsTr("Mobile App") defaultIconSource: "qrc:/Resources/images/Launcher/ContextMenu/mobile_default.png" hoverIconSource: "qrc:/Resources/images/Launcher/ContextMenu/mobile_hover.png" iconWidth: 17 iconHeight: 24 } LogoMenuItem { text: qsTr("Exit") defaultIconSource: "qrc:/Resources/images/Launcher/ContextMenu/exit_default.png" hoverIconSource: "qrc:/Resources/images/Launcher/ContextMenu/exit_hover.png" iconWidth: 21 iconHeight: 22 onTriggered: Qt.quit() } background: Rectangle { implicitWidth: 220 // Changing this value has no effect color: "#21212D" } } onClicked: logoMenu.open() The parent is Menu {}
  • qmlsc compilation fails for qmlRegisterSingletonInstance

    Solved
    3
    0 Votes
    3 Posts
    448 Views
    R
    Yes and no. No: I did not solve it the way I have imagined it. Yes: I changed DummyData to be QML_SINGLETON and use QQmlEngine::singletonInstance to get the pointer to the instance in the C++ code.
  • Qt6.7 (QML) breaks Dialog rotation.

    Unsolved
    2
    0 Votes
    2 Posts
    275 Views
    C
    Hi ! Same issue for me after upgrading from 6.4.2 to 6.8.1. In my case, I'm setting orientation in "main.cpp".
  • material theme custom effect

    Unsolved
    1
    0 Votes
    1 Posts
    781 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    SavizS
    I did some more research and it seems this is the way to do it: // This code must be placed directly in the ListView WheelHandler { acceptedDevices: PointerDevice.Mouse property int speed: 2 property Flickable flickable: parent.parent onWheel: (event) => { let scroll_flick = event.angleDelta.y * speed; if(flickable.verticalOvershoot != 0.0 || (scroll_flick>0 && (flickable.verticalVelocity<=0)) || (scroll_flick<0 && (flickable.verticalVelocity>=0))) { flickable.flick(0, (scroll_flick - flickable.verticalVelocity)); return; } else { flickable.cancelFlick(); return; } } } Hope this helps someone.
  • Qt android reports generator

    Unsolved
    2
    0 Votes
    2 Posts
    353 Views
    jsulmJ
    @Victor-Manuel said in Qt android reports generator: but their libraries are not compatible with armelf_linux_eabi You can build them by yourself for armelf_linux_eabi
  • how to off ShaderEffectSource animation qt

    Unsolved
    1
    0 Votes
    1 Posts
    106 Views
    No one has replied
  • Onscreen keyboard scrolling w/ TextField

    Solved
    2
    0 Votes
    2 Posts
    355 Views
    S
    Nevermind this behavior already seems to happen
  • Creating a new Qt Quick Application with cmake already has errors

    Solved
    4
    0 Votes
    4 Posts
    585 Views
    dheerendraD
    @pillexyz_z. Good news. Move the ticket to solved as well.
  • Moving data in QML Listview using QSortFilterProxyModel

    Unsolved
    1
    0 Votes
    1 Posts
    127 Views
    No one has replied
  • How to create a FlickablePage ?

    Unsolved
    1
    0 Votes
    1 Posts
    117 Views
    No one has replied
  • Template how to use with SplitView ?

    Solved
    3
    0 Votes
    3 Posts
    249 Views
    L
    @SGaist Using import QtQuick.Controls.Material auto in qmldir, I found that there is no need to use template for SplitView.
  • how to transferred QLineSeries from c++ to qml

    Unsolved
    1
    0 Votes
    1 Posts
    131 Views
    No one has replied