Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
18.6k Topics 76.2k Posts
  • Looking at throughput in Qt Quick

    Pinned
    11
    6 Votes
    11 Posts
    13k Views
    Y

    @Markkyboy
    I agree with you!

  • 0 Votes
    10 Posts
    89 Views
    B

    I know nothing about this, but wasn't it pointed out above that it should be "qml6glsink"?

  • 0 Votes
    1 Posts
    21 Views
    No one has replied
  • 0 Votes
    1 Posts
    9 Views
    No one has replied
  • 0 Votes
    5 Posts
    93 Views
    Tom assoT

    @Bob64 - Thanks, Bob.
    Emitter actually emits a signal sendMsg(). The reason that connect() failed is because I need to specify data passed as QVariant (not QMessage) when data is exchanged between C++ and QML. So the following compiles and connects properly:

    Emitter.h:

    class Emitter : public QObject { signal: sendMsg(QVariant msg); };

    main.cpp:

    QObject::connect(&backend.emitter, SIGNAL(sendMsg(QVariant)), rootObject, SLOT(showInfoDialog(QVariant)));

    My application includes a lot of legacy 'C' code, and passes Backend static function pointers to that C code. Now that I have it working it seems ok.
    Thanks!

  • 0 Votes
    3 Posts
    32 Views
    mzimmersM

    I've encountered a similar error, though it's intermittent for me. I can't say for sure, but I think it has something to do with the order in which objects are destroyed on application exit. In the OP's example, his CustomItems are being destroyed before the window that's displaying them.

    Just an estimated guess, but hopefully someone more knowledgeable can weigh in on this.

  • Qml 6 Bug on Window Restore from Task Bar

    Unsolved
    9
    0 Votes
    9 Posts
    90 Views
    JoeCFDJ

    @Nan-Feng https://bugreports.qt.io/secure/Dashboard.jspa

  • bug in a JS function

    Unsolved
    14
    0 Votes
    14 Posts
    212 Views
    mzimmersM

    @JKSH Here it is:

    my zip zile

    If you can figure out what's going on with this, I'll buy you a seafood dinner the next time you're in Monterey.

  • QML charts gridline styling

    Unsolved
    1
    0 Votes
    1 Posts
    25 Views
    No one has replied
  • Slider support for tickmarks?

    Unsolved
    9
    0 Votes
    9 Posts
    123 Views
    Pl45m4P

    @GrecKo

    That's what I meant... the documentation shows the tick marks in some subsection

  • 0 Votes
    3 Posts
    54 Views
    L

    @Axel-Spoerl Thank you. Actually, I've found that putting a string also works :

    ListElement { display: "1" ... }
  • About QT

    Unsolved
    5
    0 Votes
    5 Posts
    72 Views
    T

    @johngod thanks a lot!

  • Thumb wheel control?

    Unsolved
    2
    0 Votes
    2 Posts
    48 Views
    MarkkyboyM
    import QtQuick 2.6 import Sailfish.Silica 1.0 //probably use QtQuick.Controls instead import QtGraphicalEffects 1.0 import QtFeedback 5.0 Page { id: page allowedOrientations: Orientation.All // sailfishOS stuff // feedback - vibra HapticsEffect { id: vibrate attackIntensity: 10 attackTime: 10 intensity: 0.1 fadeIntensity: 0.1 fadeTime: 1 period: 1 duration: 100 running: false } // path rectangle - make it look like synth hardware Rectangle { id: root width: 220 height: 1200 color: "black" radius: 22 border { width: 11; color: "grey" } anchors.centerIn: parent clip: true // path PathView { id: path model: 100 width: parent.width height: parent.height anchors.centerIn: parent path: Path { id: pathView startX: root.width / 2 startY: 0 // play with this lot!! PathAttribute { name: "itemZ"; value: 0 } PathAttribute { name: "itemOpacity"; value: 0.25 } //PathAttribute { name: "itemAngle"; value: -90.0; } PathAttribute { name: "itemScale"; value: 0.5; } PathLine { x: root.width / 2; y: root.height * 0.4; } //PathPercent { value: 0.48; } PathLine { x: root.width / 2; y: root.height * 0.5; } //PathAttribute { name: "itemAngle"; value: 0.0; } PathAttribute { name: "itemScale"; value: 0.7; } PathAttribute { name: "itemOpacity"; value: 1.0 } PathAttribute { name: "itemZ"; value: 100 } PathLine { x: root.width / 2; y: root.height * 0.6; } //PathPercent { value: 0.52; } PathLine { x: root.width / 2; y: root.height; } //PathAttribute { name: "itemAngle"; value: 90.0; } PathAttribute { name: "itemScale"; value: 0.5; } PathAttribute { name: "itemOpacity"; value: 0.25 } PathAttribute { name: "itemZ"; value: 0 } } clip: true pathItemCount: 19 flickDeceleration: 50000 preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 delegate: flipCardDelegate } // delegate Component { id: flipCardDelegate // this rectangle makes up scroll wheel color and shape Rectangle { id: wrapper width: 200 height: width/2 z: PathView.itemZ antialiasing: true visible: PathView.onPath scale: PathView.itemScale opacity: PathView.itemOpacity gradient: Gradient { GradientStop { position: 0.0; color: "#292929" } GradientStop { position: 0.5; color: "#494949" } GradientStop { position: 1.0; color: "#292929" } } border { width: 4; color: "black" } Label { text: index+1 visible: false anchors.centerIn: parent color: wrapper.PathView.isCurrentItem ? "green" : "red" } } } } // percentage label and percent icon Label { id: percentLabel font.pixelSize: 86 text: path.currentIndex + " %" anchors { top: root.bottom; topMargin: Theme.horizontalPageMargin; horizontalCenter: root.horizontalCenter } } }

    Screenshot_20240429_003.png

  • QML Threaded Animation

    Solved
    2
    0 Votes
    2 Posts
    26 Views
    beeckscheB

    A different image, but same effect. Fixed it with the BusyIndicator class.

    Button { text: "Run Blocking Function in C++" onPressed: busyIndicator.running = true onClicked: MyObjectInCpp.start() } BusyIndicator { id: busyIndicator running: false Connection { target: MyObjectInCpp function onFinished() { busyIndicator.running = false } } }
  • 0 Votes
    7 Posts
    321 Views
    SGaistS

    @firen I am not aware of such a page but you are not alone having that issue.

  • Link failed when using QQuickMaterialStyle in Qt6.4

    Unsolved
    1
    0 Votes
    1 Posts
    29 Views
    No one has replied
  • QML Warnings

    Solved
    7
    0 Votes
    7 Posts
    111 Views
    GrecKoG

    @Veltroniv the preferred Connections syntax is now:

    Connections { function onLoginCorrect(token) { console.log("Token: ", token); } }
  • How to order object creation

    Solved
    4
    0 Votes
    4 Posts
    57 Views
    JKSHJ

    @mzimmers said in How to order object creation:

    I can just use outcome directly (which is preferable).

    Please don't do that! That is called "unqualified access", which prevents the QML compiler from optimizing your code.

    See https://www.qt.io/blog/compiling-qml-to-c-fixing-unqualfied-access for a discussion about unqualified access See https://www.qt.io/blog/the-numbers-performance-benefits-of-the-new-qt-quick-compiler for a peek at the optimization

    Use property bindings correctly (without doing special construction and assignment in Component.onCompleted) and you should get things the right order:

    // main.qml Window { id: window property Outcome outcome: outcomeComponent.createObject(window) as Outcome Component { id: outcomeComponent Outcome {} } ListView { delegate: VspEdit { outcome: window.outcome } } } // VspEdit.qml ColumnLayout { id: vspEdit required property Outcome outcome Component.onCompleted: console.log(vspEdit.outcome) }

    Notice that I fully qualify my variables (window.outcome, vspEdit.outcome)

    property var outcome

    Use the actual type instead of var for more optimization (and also so that modern tools like qmllint can scan your code and help you find any issues)

  • How to clear Settings (QtCore) from inside QML?

    Unsolved
    3
    0 Votes
    3 Posts
    50 Views
    johngodJ

    @Ntachy I did this by creating my own clear function (I name it reset() ), where I set all the properties to their default values. In my case I had a button where the user would click to reset the values, dont know your use case, where you would called it is up to you.
    If you want to clear the values "outside" the running app, check here for where the values are stored:
    https://doc.qt.io/qt-6/qsettings.html#platform-specific-notes

  • This topic is deleted!

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