Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • How to load different components with different properties in the same Loader?

    Solved
    3
    0 Votes
    3 Posts
    307 Views
    jeanmilostJ
    @fcarney Thank you for your answer. Finally I could resolve my issue by getting the Loader created by the Repeater, and to calling its setSource() function directly, with the correct properties, adapted for each component I need to load.
  • Dynamic height of tableviewcolumn according to text length

    Unsolved
    2
    0 Votes
    2 Posts
    685 Views
    L
    @Laito Unfortunately I almost forgot about the old quick controls. Here is an idea of how you could do it with the new controls. Note, I added a wrapper for spacing around the table, to show there is no overflowing: import QtQuick.Window 2.15 import QtQuick 2.15 import QtQuick.Controls 2.15 import Qt.labs.qmlmodels 1.0 ApplicationWindow { title: qsTr("TableView example") id: root width: 500 height: 400 visible: true Item { id: wrapper anchors.fill: parent anchors.margins: 20 HorizontalHeaderView { id: header z: 1 interactive: false syncView: tableView anchors.top: parent.top implicitHeight: 50 model: ["Number", "Elevation Max", "Elevation Min", "Length", "Depth"] delegate: Rectangle { implicitWidth: 100 implicitHeight: 50 color: "#0A1B2D" Text { anchors.fill: parent anchors.margins: 5 wrapMode: Text.Wrap text: modelData color: "#ffffff" font.pixelSize: 15 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } } } TableView { id: tableView anchors.fill: parent topMargin: header.implicitHeight columnSpacing: 1 rowSpacing: 1 clip: true flickableDirection: Flickable.VerticalFlick boundsBehavior: Flickable.StopAtBounds property int selectedRow: -1 model: TableModel { TableModelColumn { display: "number" } TableModelColumn { display: "elevation_Max" } TableModelColumn { display: "elevation_Min" } TableModelColumn { display: "length" } TableModelColumn { display: "depth" } rows: [{ "number": 1, "elevation_Max": 90000, "elevation_Min": 50, "length": "52-73\n122-163\n200-264\n280-317", "depth": "8636-8900" }, { "number": 2, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57\n119-166\n206-264\n119-166\n206-264\n119-166\n206-264\n119-166\n206-264", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }, { "number": 3, "elevation_Max": 8000, "elevation_Min": 21, "length": "0-57", "depth": "12700-13462" }] } delegate: Rectangle { implicitWidth: 90 implicitHeight: content.implicitHeight color: tableView.selectedRow === row ? "#052641" : "#394755" MouseArea { anchors.fill: parent onClicked: tableView.selectedRow = row } Text { id: content width: parent.width padding: 10 text: display color: "#ffffff" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.Wrap } } } } }
  • How to make the SplineSeries's appended values permanent?

    Unsolved
    1
    0 Votes
    1 Posts
    127 Views
    No one has replied
  • [SOLVED] Qt 6.2.2 - Drag & Drop broken in Quick?

    Solved
    2
    0 Votes
    2 Posts
    475 Views
    T
    Thank you very much. I'm struggling a lot before I saw that post
  • how to display huge amount data in qml chartview LineSeries?

    Unsolved
    2
    0 Votes
    2 Posts
    464 Views
    fcarneyF
    This is not sustainable. Cache the data to disk and load n points from this cache. Give yourself the ability to scroll through the data that was collected. Maybe a date time lookup. I like to use sqlite databases for stuff like this and then I just do queries using the qdatabase classes.
  • Nodeinstantiator performance issue

    Unsolved
    1
    0 Votes
    1 Posts
    254 Views
    No one has replied
  • How to assign each data point with different color in scatter charts in QML

    Solved
    2
    0 Votes
    2 Posts
    681 Views
    P
    @Praveen-Illa There is currently no way to give each data point in the same series a different colour. As a workaround, you can split your data points into multiple series (for example, 1 point per series). This will allow you to set different colours to each of the points.
  • QML ColorDialog within a Page

    Unsolved
    1
    0 Votes
    1 Posts
    133 Views
    No one has replied
  • Use Delegate in ComboBox

    Unsolved
    2
    0 Votes
    2 Posts
    347 Views
    TassosT
    @chiyuwang Your model should provide a role name for the desired value, let's say value, then you can inform the combobox via its valueRole property. See the example below, copied from Qt documentation ApplicationWindow { width: 640 height: 480 visible: true // Used as an example of a backend - this would usually be // e.g. a C++ type exposed to QML. QtObject { id: backend property int modifier } ComboBox { textRole: "text" valueRole: "value" // When an item is selected, update the backend. onActivated: backend.modifier = currentValue // Set the initial currentIndex to the value stored in the backend. Component.onCompleted: currentIndex = indexOfValue(backend.modifier) model: [ { value: Qt.NoModifier, text: qsTr("No modifier") }, { value: Qt.ShiftModifier, text: qsTr("Shift") }, { value: Qt.ControlModifier, text: qsTr("Control") } ] } }
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • Sending messages from a client to server using network on the same machine

    Unsolved
    31
    0 Votes
    31 Posts
    7k Views
    Q
    @Bob64 The fortune client/server apps are different from (at least) that point of view that the server sends messages to the client by a button on the client. It's way different from mine. Well, these two QML apps are considerably simple but I don't know why we (helpers and me) can't work it out and get them to work! :(
  • 0 Votes
    5 Posts
    1k Views
    G
    @jsulm I wrote the error message
  • How to make this menu ?

    Unsolved
    6
    0 Votes
    6 Posts
    535 Views
    ?
    @lemons working like charm ! @GrecKo thanks i will review
  • Tumbler does not load last element if model is 49, 98, 196, etc. in Qt 5.15

    Unsolved
    2
    0 Votes
    2 Posts
    196 Views
    A
    Hi again. This same behavior is described in this bug report: https://bugreports.qt.io/browse/QTBUG-90479 But how is Tumbler related to PathView? I tried to load the model dynamically, to change the currentIndex dynamically, etc. but I get the same result. Do you have any idea or workaround? Thanks!
  • QML-Map prefetchData()

    Unsolved
    1
    0 Votes
    1 Posts
    174 Views
    No one has replied
  • How do I run a program in QT creator?

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    D
    @DavidIT said in How do I run a program in QT creator?: qt5-qtquickcontrols2. Installed what you wrote. it helped, thank you
  • ListView Model setProperty Work only 1 time

    Solved
    3
    0 Votes
    3 Posts
    195 Views
    dheerendraD
    In addition to what @lemons said, model property is not updated when you changed the check box from UI. Hence the issue. You can try with following piece of code inside the CheckBox. onClicked: { _root.ListView.view.model.setProperty(1, "mystatus",checked) }
  • How to write a QML extension from a custom C++ class?

    Solved qtquick c++ qt extension
    7
    0 Votes
    7 Posts
    1k Views
    G
    when I rerun, I am told that QtWebView cannot contain more than one item, so I guess I cannot save a c++ class in QtWebView, going through the doc I found that the c++ classes I needed had already been extended to the quick module. So, I'm going to use the c++ classes in this module instead. Thank you very much for your help.
  • It was worked for me too

    Unsolved
    1
    0 Votes
    1 Posts
    218 Views
    No one has replied
  • CheckBox Indicator Image bug

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