Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.7k Posts
  • Is it possible to use QML ListView as "pagination"

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    J.HilkJ
    @Wiru I don't know for sure, but I think it simply resets the currentItem/Index I'm not an expert in the model view field, so maybe someone else can give you a better/more detailed answer
  • Image orientation with qml Camera

    Unsolved qml camera ios
    6
    0 Votes
    6 Posts
    2k Views
    J.HilkJ
    @vudangkhoa2906 said in Image orientation with qml Camera: Screen.orientationUpdateMask I never specified an orientation update mask, and this readonly property bool isPortrait: (Screen.primaryOrientation === Qt.PortraitOrientation || Screen.primaryOrientation === Qt.InvertedPortraitOrientation) works fine for me, maybe you don't need it ? 🤷‍♂️
  • Qt Crash when switching between 'States'.

    Unsolved
    1
    0 Votes
    1 Posts
    162 Views
    No one has replied
  • C++ and QML

    Unsolved
    5
    0 Votes
    5 Posts
    452 Views
    KroMignonK
    @AB_TrP Your QML code seems strange to me, can you show the header of CGPSData? For me, it should be something like: class CGPSData : public QObject { Q_OBJECT Q_PROPERTY(QString gpsData READ getGPSData NOTIFY gpsDataChanged) public explicit CGPSData(QObject * parent = 0); QString getGPSData() const { return m_gpsData; } void setGpsData(const QString &gpsData) { if(gpsData != m_gpsData) { m_gpsData = gpsData; emit gpsDataChanged(); } } signals: void gpsDataChanged(); private: QString m_gpsData; }; And then, in your QML import IGPSData 1.1 // this is the registered C++ class, CGPSData{ id: cGPSData } Text { id:txtData anchors.left: parent.left anchors.leftMargin: 5 anchors.top: parent.top anchors.topMargin: 80 text: cGPSData.gpsData visible: true font.family: "Helvetica [Cronyx]" font.bold: true font.pixelSize: parent.width * 0.08 color: "#ffffff" }
  • AnimatedImage very slow on first load

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    C
    I am having the same problem on a raspberry pi 4
  • Accessing and altering the same view from different Qml files

    Unsolved model view prog qml model-view
    2
    0 Votes
    2 Posts
    985 Views
    IntruderExcluderI
    You can get StackView instance from Profile.qml quite easy, using StackView attached properties. Define new property at your StackView: StackView { id: home property var modeldata: null // Define StackView property initialItem: Pane { ... ListView { ... delegate: SwipeDelegate { ... swipe.onCompleted: { if (swipe.position > 0) { home.modeldata = model; // Set StackView property home.pop(); home.push("Profile.qml"); } ... } ... } } } } And then at Profile.qml you can easily get attached StackView property: Pane { id: profile ... Button { ... text: "Delete" onClicked: { let modeldata = profile.StackView.view.modeldata; // Accessing StackView property via attached properties if (modeldata !== null) { user_model.removeRow(modledata.index); } ... } } } In this case you do not need workaround with helper row. Also if you need some objects like your helper - better way is to use QtObject rather than visual 'invisible' object.
  • Tooltip with ComboBox

    Unsolved
    9
    0 Votes
    9 Posts
    3k Views
    U
    @gabor53 : This works for me. Not sure if this will meet your requirement ComboBox{ id: row3_combo_box_element currentIndex: 2 model:["Level 1", "Level 2", "Level 3"] MouseArea{ id: row3_label_ma anchors.fill: parent hoverEnabled: true } ToolTip{ text: qsTr("Test x") visible: row3_label_ma.containsMouse } }
  • Screen captures

    Unsolved
    3
    0 Votes
    3 Posts
    267 Views
    C
    I will implement/test it and let you know thanks.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • How to hide qml source in Qt Quick 2 Extension Plugin?

    Solved
    2
    0 Votes
    2 Posts
    226 Views
    AlienA
    It is so easy that's enough to write the qrc path in front qml module in qmldir qmldir module TimeExample Clock 1.0 Clock.qml plugin qmlqtimeexampleplugin convert it to module TimeExample Clock 1.0 qrc:/Clock .qml plugin qmlqtimeexampleplugin thanks
  • Round corners on one side of ShellSurfaceItem

    Unsolved
    1
    0 Votes
    1 Posts
    154 Views
    No one has replied
  • SIGSEGV when trying to open a file using QFileDialog::getOpenFileName

    Solved
    5
    0 Votes
    5 Posts
    505 Views
    A
    @Pablo-J-Rogina thank your for reminding me :)
  • Image blinking

    Unsolved
    7
    0 Votes
    7 Posts
    2k Views
    S
    when we click and stop on windows voice recorder like that functionality in qml
  • Interactive Map: adjusting a geo path on openstreetmaps through the mouse

    Unsolved
    1
    0 Votes
    1 Posts
    145 Views
    No one has replied
  • lock touch screen

    Solved
    17
    0 Votes
    17 Posts
    3k Views
    I
    @J-Hilk said in lock touch screen: MouseArea{ id:blockAllInput anchors.fill: parent z: 100 onPressed: { var adjusted = mapToItem(blockAllInput, runStop_switch.x, runStop_switch.y) if(mouseX > adjusted.x && mouseX < adjusted.x + runStop_switch.width) if(mouseY > adjusted.y && mouseY < adjusted.y + runStop_switch.height) mouse.accepted = false } } Thank you so much. You gave me the clue. I appreciate your kind help.
  • How to check only one switch in ListView

    Unsolved
    2
    0 Votes
    2 Posts
    220 Views
    IntruderExcluderI
    Try something like this: Switch { id: control ... checked: model.selected checkable: !checked // Prevent to uncheck already checked switch onPressed: { if (!checked) { for (let i = 0; i < langlist.model.count; ++i) { langlist.model.setProperty(i, "selected", i === model.index); // Toggle all switches } } } }
  • switch button problem! qml

    Solved touchscreen lock qml
    7
    0 Votes
    7 Posts
    2k Views
    I
    @jsulm said in switch button problem! qml: @imhs It is, see "The following members are inherited from Item." section in the link you posted. Thanks for your help. I saw it.
  • Is it possible to invoke C++ function before an item draw by qml?

    Solved
    3
    0 Votes
    3 Posts
    333 Views
    AlienA
    Dear @rrlopez Ok I see thanks
  • Qt Quick - What about the future of TableView and TableViewColum?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    jeanmilostJ
    @J-Hilk, Thank you very much
  • Strange behavior with dynamically removed objects

    Unsolved
    2
    0 Votes
    2 Posts
    158 Views
    GrecKoG
    My advise (as most of the time on the forum :P ), would be to not do things like you are doing. Manipulating UI items is not very mainenable and flexible. You should act on your data instead. I don't really know what is your use case, but most of the time you should avoid using Qt.createObject or Qt.createComponent and let view/models class handle the instantiation of your dynamic objects. In your example, you could use a Repeater with a model (an int, a js array, a ListModel, ...). I rewrote it with a ListModel : import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") ListModel { id: listModel } ColumnLayout { RowLayout { Button { text: qsTr("Add") onClicked: listModel.append({text: listModel.count + 1}) } Button { text: qsTr("Remove") onClicked: { if (listModel.count > 0) listModel.remove(0); } } Button { text: qsTr("Clear & Add New 3") onClicked: { listModel.clear(); for (var i = 0; i < 3; ++i) { listModel.append({text: listModel.count + 1}) } } } } ColumnLayout { Repeater { model: listModel Label { // you can replace that with OwnLabel text: "My text: %1, my index: %2".arg(model.text).arg(model.index) } } } } }