Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.8k Posts
  • How to use new TableView in 5.15

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    raven-worxR
    @noone seems the documentation hasnt made it yet into a alpha/beta release i think: https://codereview.qt-project.org/gitweb?p=qt%2Fqtquickcontrols2.git;a=commit;h=614759bf9a16a8ffb589edadcbef61ec24c9ec08 but here you have the example: https://codereview.qt-project.org/gitweb?p=qt/qtquickcontrols2.git;a=blob;f=src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml;h=bea46bf33e0007968acf0b4946f029d35f72b788;hb=614759bf9a16a8ffb589edadcbef61ec24c9ec08
  • How do I get rid of the margin around a ChartView?

    Unsolved
    6
    0 Votes
    6 Posts
    3k Views
    J
    Another trick is to add this following lines to ChartView anchors { fill: parent; margins: -15 } margins { right: 0; bottom: 0; left: 0; top: 0 }
  • ReferenceError: data1 is not defined

    Unsolved
    2
    0 Votes
    2 Posts
    435 Views
    J
    Hi @MJoco The reason is explained here: https://doc.qt.io/qt-5/qtqml-documents-scope.html You have to add this following line in the root Item of Datarect.qml (id: datarec) property alias data1: data1 or property Text mytext: mytext and give Datarec an id in main.qml Datarec { id: datarec } Then you can get text from data1 by datarect.data1.text onClicked: datarec.data1.text = Math.floor(Math.random() * 10) You have many other possibilities to do this, like directly alias the text, or to use a property declared in main.qml in Datarec.qml, and so on.... Regards,
  • Why FullHD is not FullHD in Boot2Qt (Apalis iMX8)?

    Solved
    2
    0 Votes
    2 Posts
    218 Views
    V
    I discover that problem is in default template from wizard while I create new QML Quick Application (main.cpp file). #include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) { qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); } If I remove first if block then resolution is OK.
  • Emulating ListView as TableView

    Unsolved qml view listview tableview
    6
    0 Votes
    6 Posts
    1k Views
    AhtiA
    @fcarney I am new to Qt so don't anything about Loader and Can you please take a look at this question too: https://forum.qt.io/topic/111852/inconsistency-between-model-and-view-while-updating-qsqltablemodel-cell
  • QML with PySide2

    Unsolved
    2
    0 Votes
    2 Posts
    273 Views
    C
    I'm new to QML too and I wish that I could help you~ To make a QML Button connect to a python method, you can follow these below: 1.Create a class that contains a python method decorated by "PySide2.QtCore.Slot"; [image: d120a75c-4eda-4d15-8e3a-e98365200061.png] 2.Register the object of the class as a root context property; [image: fd971b1b-46cf-4e0e-b8d4-9f9f455a96f2.png] 3.Then you can call the python method in qml file. [image: 54595968-ea7a-4758-8c43-f51ca1d7580f.png]
  • Flag to set CLANG_ENABLE_OBJC_WEAK to enable weak references in Xcode Project

    Unsolved
    1
    0 Votes
    1 Posts
    560 Views
    No one has replied
  • Text over a ScrollBar

    Solved
    5
    0 Votes
    5 Posts
    453 Views
    A
    @jsulm Yes. I can place a text or a label over the ScrollBar. It works. Thank you.
  • This topic is deleted!

    Solved
    1
    0 Votes
    1 Posts
    21 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    4
    0 Votes
    4 Posts
    41 Views
  • Debug error for in qgridlayoutengine.cpp

    Solved qml gridlayout
    2
    0 Votes
    2 Posts
    574 Views
    A
    I fixed it - so this is for anyone else having a similar issue. I'm not sure why this happened but in a RowLayout, I had a button that used Layout.prefferedWidth + Layout.prefferedHeight. relative to its parent - and this caused the error. Deleting the lines worked, but when I was checking with just 1 of them, I got a 'binding loop' error for the prefferedWidth - I'm guessing multiple of these caused it to crash.
  • Vary spacing in QML Row

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    MarkkyboyM
    By nesting each rectangle you want to space, as follows; Row { spacing: 10 Rectangle { color: "red"; width: 50; height: 50 Label { text: "<b>10 --></b>" anchors.centerIn: parent } } Row { spacing: 20 Rectangle { color: "orange"; width: 50; height: 50 Label { text: "<b>20 --></b>" anchors.centerIn: parent } } Row { spacing: 30 Rectangle { color: "yellow"; width: 50; height: 50 Label { text: "<b>30 --></b>" anchors.centerIn: parent } } Row { spacing: 40 Rectangle { color: "green"; width: 50; height: 50 Label { text: "<b>40 --></b>" anchors.centerIn: parent } } Row { spacing: 50 Rectangle { color: "blue"; width: 50; height: 50 Label { text: "<b>50 --></b>" anchors.centerIn: parent } } Row { spacing: 60 Rectangle { color: "indigo"; width: 50; height: 50 Label { text: "<b>60 --></b>" anchors.centerIn: parent } } Row { Rectangle { color: "violet"; width: 50; height: 50 }} } } } } } } } [image: 8daa6bb9-0556-4b75-ad74-c097a578adf3.JPG]
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • Cannot assign to non-existent property "onTextEdited" TextField QML?

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    ODБOïO
    @Pradeep-P-N said in Cannot assign to non-existent property "onTextEdited" TextField QML?: TextField { } and TextInput { } are completely different components TextField is actually a TextInput
  • Unicode in TextInput not showing

    Unsolved
    2
    0 Votes
    2 Posts
    274 Views
    No one has replied
  • Knowing if an image is portrait or landscape oriented (QmlImage)

    Solved
    7
    0 Votes
    7 Posts
    668 Views
    M
    It's works, thanks a lot =D
  • Problem with Rectangle border width

    Solved
    5
    0 Votes
    5 Posts
    765 Views
    C
    I figured out a way to do this. Well, someone else figured it out and I just applied a Row and Repeater: Row { Repeater { model: 3 Rectangle { width: 100 height: 40 CustomBorder { borderColor: "black" } } } } where CustomBorder is: Rectangle { property bool commonBorder : true property int lBorderwidth : 1 property int rBorderwidth : 1 property int tBorderwidth : 1 property int bBorderwidth : 1 property int commonBorderWidth : 1 z : -1 property string borderColor : "white" color: borderColor anchors { left: parent.left right: parent.right top: parent.top bottom: parent.bottom topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth } } which was created by @ Amit Tomar on SO. I have a question. If instead of separating CustomBorder into it's own QML file. Is there a way I can use Component and Loader s/t I can keep CustomBorder inside of main but still refrence it the same way ie: Rectangle { CustomBorder { } } is that possible?
  • Some numericals missing when i'm changing Qml Label text dynamically.

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    I
    Try adding this line: renderType: Text.NativeRendering
  • WheelHandler: get scroll direction

    Solved
    2
    0 Votes
    2 Posts
    247 Views
    D
    Found it: if (event.angleDelta.y > 0) { up() } else { down() }
  • Issue with using text wrap for international language

    18
    0 Votes
    18 Posts
    13k Views
    M
    Seems there is a patch applied to 5.14 https://code.qt.io/cgit/qt/qtbase.git/commit/?id=d1bab5b1e3d28c0e2925ad3208cea785af755d54