Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • How to bring all the application windows on top?

    Unsolved
    2
    0 Votes
    2 Posts
    198 Views
    M
    I got the following solution connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, [this](QWindow* focusWindow) { if (!focusWindow) { return; } auto windowList = QGuiApplication::allWindows(); windowList.removeIf([focusWindow](QWindow* w) { return !w->isVisible() || w->transientParent() || w == focusWindow; }); // Attempt to restore windows in the order in which they were opened. std::sort(windowList.begin(), windowList.end(), [](QWindow* l, QWindow* r) { return l->property(FOCUS_TIME_PROPERTY).value<qint64>() < r->property(FOCUS_TIME_PROPERTY).value<qint64>(); }); for (auto window : windowList) { qDebug() << "Raise" << window->title(); window->raise(); } focusWindow->raise(); focusWindow->setProperty(FOCUS_TIME_PROPERTY, QDateTime::currentMSecsSinceEpoch()); });
  • Get the child items of the qquckwaylanditem on the wayland server

    Unsolved
    1
    0 Votes
    1 Posts
    152 Views
    No one has replied
  • Import of module in Javascript does not respect qmldir->prefer

    Unsolved
    1
    0 Votes
    1 Posts
    185 Views
    No one has replied
  • GridLayout Layout.rowSpan and uniformCellHeights

    Unsolved
    3
    0 Votes
    3 Posts
    287 Views
    P
    @ankou29666 Thank you, will contact support. Workaround meanwhile is to implement my own GridLayout based on the following: https://stackoverflow.com/a/61804867 Surprisingly simple and effective. I then added support for rowSpacing and columnSpacing to that.
  • Using C++ model for MonthGrid in calendar

    Unsolved
    5
    0 Votes
    5 Posts
    439 Views
    B
    Thank you, it's an interesting idea! I will give it a try.
  • accessing elements of structs in a list

    Solved
    17
    0 Votes
    17 Posts
    1k Views
    J.HilkJ
    @mzimmers correct, you can give your QML ListView literally anything as a model :D if it is an actuall Qt based ItemModel of some kind, you can access data via the roles of the model: ListView { model: myModel delegate: Item { Text { text: model.someCustomRole // Access data via custom role } } } for all other cases it is via modelData ListView { model: ["a", "b", "c"] delegate: Item { Text { text: modelData // Access data for this specific index } } } or manual index lookup property var myModel: ["a", "b", "c"] ListView { model: myModel delegate: Item { Text { text: myModel[index] } } } So, I think the answer is is that I don't necessarily need a proper model for access to the struct, as long as I've created Q_PROPERTY to its elements? yes, it doesn't have to be a full blown QObject base class either, Q_GADET is enough, prevents you from using signals though.
  • QML Controls Custom

    Unsolved
    1
    1 Votes
    1 Posts
    225 Views
    No one has replied
  • QML how to call Shift+Tab behavior without using keyboard?

    Unsolved
    3
    1 Votes
    3 Posts
    255 Views
    K
    It worked perfectly! Thank you
  • Yellow exclamation marks next to my kits

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    alexander.sageA
    Would love help on this.
  • QML TreeView in QT6 and how to porting from QT5 to QT6

    Unsolved
    2
    0 Votes
    2 Posts
    342 Views
    gfxxG
    I have a similar problem whit treeview and opcua in qt6.7.2 ... no solutions for now.
  • How to register a class inherited from QQmlPropertyValueSource?

    Solved
    7
    0 Votes
    7 Posts
    552 Views
    jsulmJ
    @Anton1978 said in How to register a class inherited from QQmlPropertyValueSource?: build error - :-1: ninja: build stopped: subcommand failed. Just a tipp: what you posted is not the actual error, in such cases you should look above that to find the real error message.
  • How can I put a column from a SQLite table into the options of a Combobox?

    Solved
    8
    0 Votes
    8 Posts
    618 Views
    GrecKoG
    @MaximBozek If you just want to change the text you can do so by setting an explicit displayText property. If you want to change how it is displayed you can do so by changing the contentItem.
  • windeployqt fails to install qml library

    Unsolved
    2
    0 Votes
    2 Posts
    186 Views
    R
    No one has a clue on how to achieve this?
  • How can I edit the text in my combobox?

    Unsolved
    2
    0 Votes
    2 Posts
    178 Views
    A
    Well, change your contentItem to an input control like TextField. Look how ComboBox is implemented for Material style: https://github.com/qt/qtdeclarative/blob/dev/src/quickcontrols/material/ComboBox.qml
  • Change hover state on my button

    Unsolved
    5
    0 Votes
    5 Posts
    428 Views
    GrecKoG
    You could use a Button instead. It has a clicked signal and a hovered property already. You can display an image on it by customizing the contentItem. Customized the background color by changing the color or use a custom background Rectangle
  • Simple TreeView based on a ListModel & a separator

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    JonBJ
    @Bob64 If you have leaf /path/to/leaf to be split on /s at some level you will have to create/return/treat as existing nodes /, /path and /path/to as well as leaf /path/to/leaf in order to keep Qt tree model/view code happy. You have two basic approaches: Actually split all your strings into necessary nodes & leaves into their own model (e.g. a QStandardItemModel can be thus populated and is ready for you to use). This obviously means a separate representation/storage for the tree model compared to wherever you store the strings/list model. You could do it with a proxy model which has the strings as the underlying data but you would have to parse them each time, do the splitting temporarily/dynamically in memory and return the appropriate nodes, leaves and counts of children as Qt queries the model. That would mean only the strings were permanently maintained. The second case might be wanted if the strings change frequently or you want changes in the tree model to reflect directly to underlying strings. But the second case is probably easier to write and works fine if the tree model/strings not not change.
  • libqtquickcontrols2plugin.dylib is not a valid Mach-O binary (file too small)

    Unsolved
    4
    0 Votes
    4 Posts
    336 Views
    SGaistS
    6.8.0 not being released yet, it's a good idea to try 6.7.2. If it works, then there might be a bug with the 6.8.0 package. You should report it then.
  • m3u8 video stream (HLS) does not play well.

    Unsolved
    2
    0 Votes
    2 Posts
    387 Views
    M
    Created https://bugreports.qt.io/browse/QTBUG-128908 for this.
  • Misplaced Cursor in TextField While Typing(On KDE).

    Unsolved
    1
    0 Votes
    1 Posts
    105 Views
    No one has replied
  • updating a list model object based on another model?

    Solved
    3
    0 Votes
    3 Posts
    266 Views
    mzimmersM
    @dheerendra yes, you are correct. I needed to make one model aware of the other, in order to connect signals and slots. The rest was straightforward. Thanks.