Relative Content

Tag Archive for c++qtqml

QAbstractListModel: how to create a nested model?

For the context, I have the following application structure in QML: StackLayout with nested Repeater, which has a model and a delegate. This delegate has a few string fields, but also needs another model, because delegate will contain ListView with another fields.

Retrieving data from QStringList

Im doing simple app, I want to take file, read it, fill QStringList in cpp class and show in qml, done before by many, even by me, but now im stuck and cant wrap my head around.
Here is a class

QML: How to use custom model with runtime determined constructor parameters?

I have a board game with numbered tiles positioned in a square grid. The board uses GridView with custom GameBoard model (GameBoardModel as exported to QML) inherited from QAbstractListModel. The game in it’s standard form uses a 4×4 tile grid because that’s how many (16) tiles the default constructor of the model creates. However I thought of making some sort of a combobox that would allow choosing the board size, which will then be generated and the game begins.

QVideoSink in Qt6.7

I was just wondering if it was possible to play a video using QVideoSink in Qt without using the concepts of multimedia in qml i.e Video and VideoOutput because my target device is not supporting multimedia concepts in qml. I checked the below question

How to use spacing inside columnlayout in qml

In below example you can see I have added two RowLayouts inside ColumnLayout, and also added space of 40. If i run this example in qt design studio then i couldn’t see the space between two RowLayouts, Could you please anyone tell me why this is not working? 

need to find min , max, avg in qlist of classes in QT C++

class A { QString id; QSrtring Name; Qstring State; QString marks; }; QList<A> listAClasses; A objA; objA.id=1; objA.Name=”Deepak”; objA.State=”KA”; objA.marks=60; listAClasses.push_back(objA); A objAb; objAb.id=2; objAb.Name=”Suresh”; objAb.State=”AP”; objAb.marks=75; listAClasses.push_back(objAb); A objAc; objAc.id=3; objAc.Name=”Ramesh”; objAc.State=”KA”; objAc.marks=80; listAClasses.push_back(objAc); from the coding i have to find total/Avg/min Marks of state=”KA” using iterators instead of loops, please help me as […]