Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.8k Topics 76.6k Posts
  • Can't access ListModel's roles

    Solved
    4
    0 Votes
    4 Posts
    131 Views
    pillexyz_zP

    @GrecKo Thanks for your answer, now it finally works. ^_^

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    91 Views
  • Promise() as text in Label

    Unsolved
    2
    0 Votes
    2 Posts
    84 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
    37 Views
    No one has replied
  • 0 Votes
    5 Posts
    171 Views
    K

    @piervalli
    I am currently on macOS

  • 0 Votes
    3 Posts
    158 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.

  • 0 Votes
    3 Posts
    146 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
    120 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
    250 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
    152 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
    712 Views
    No one has replied
  • 0 Votes
    3 Posts
    931 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
    255 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
    69 Views
    No one has replied
  • Onscreen keyboard scrolling w/ TextField

    Solved
    2
    0 Votes
    2 Posts
    294 Views
    S

    Nevermind this behavior already seems to happen

  • 0 Votes
    4 Posts
    216 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
    61 Views
    No one has replied