creating own qml table view with all functionality - qt

Does anybody knows how to create a table view using QML(Qt Quick 1.0)?
Tell me all ideas you have, my ended, I'm writing on PySide so unfortunately I can't use QtQuick 2

Depending on your requirement, you can use one or combination of :
Qml Grid view
Combination of Qml Row and Column
List View

Related

Nested ListView in PyQt5 and QML

I need to create nested ListView. For example,
->Item1
-->Subitem1
-->Subitem2
->Item2
-->Subitem1
I have a dictionary data inside Python side. I need to display this data from QML ListView.
So, I should take the model from python and I should design collapsable ListView inside QML. I searched about this but I couldn't find example about it. I tried to create my own model but it didn't work.
Can someone help me?
Take a look at sections in ListView
https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-listview.html#section-prop

Qt Quick Controls 2 and QAbstractTableModel

I have a model based on QAbstractTableModel that I would like to use to display its content in a list in QML.
Actually, I need to display the first column only.
TableView does not exist in Qt Quick Controls 2 and suffers from performance issue and rendering issues on HiDPI devices.
There is suggestion in this question to use a ListView. But I fail to see how I can tell the model that I need to display the first column only.
Is there any solution for this ?
This is automatically done in QML by ListView: the first column from the model is taken for any requested role.

QML Nested List View with separators

I'm trying to implement a tree view that represent structure of buildings/floors/rooms. All rooms should be classified by floor and building ( thus header for each building and floor is required.
First I implemented it with Repeater, Row and Grid elements. However i need a selection behaviour so i need to use ListView and GridView. However I have problems displaying nested list views.
Here's my code so far: http://pastie.org/private/3seqntgvskbyxnmnuluaua
Expected Result( when using Grid and Repeater instead of GridView and List View ):
Haven't tried it myself, but here is how to implementation a tree view in QML.
http://www.codeproject.com/Articles/632795/QML-TreeModel-and-TreeView
There is still no official tree view component in Qt (as of version 5.2). However, see the solution provided by jens on this thread
http://qt-project.org/forums/viewthread/30521
This is by far the best tree view that I have come across. It should provide a good basis for what you are trying to do.
Looks like Qt Company is releasing a QML TreeView in Qt5.5. Alpha release should be coming out in February.
http://blog.qt.io/blog/2015/02/05/licensing-of-new-modules-in-qt-5-5/

How to display drop-down in column of QTableView and filter based on drop-down

I am newbie to Qt. I have to display a chunk of data in a QTableView and filter it column wise. For this I have used QSortFilterProxyModel, but as per requirement each column of the QTableView should have a drop-down list which shows unique values in that column. On selection of any of these values in the drop-down, only the rows having that particular value in the column should be displayed in the QTableView (Like you can do in Excel).
How would I implement this?
I had the same issue a week ago
I found a tutorial explaining how to do it. see link below
http://programmingexamples.net/wiki/Qt/Delegates/ComboBoxDelegate
Now my problem is how to retrieve the value of a specific combobox.
I think it is such a complex things to do in C++ and Qt display a combobox into a tableView.
For being a web developer at first I can tell that web language are better suited to do thoses kind of things.
But still some time performance matter and I tried to do it in C++ with Qt but it is not as easy as it seems to be in Web language.
This is very general question, and if I try to explain it all it will take pages, so it's better if you read the Qt model/view architecture documentation.
You can create your own class inherited from QTableView to create your customized table view. You have to use delegates for drop down functions and all. so read the QItemDelegate class documentation and documentation on subclassing delegates as well.
If you want to display it always and not just when editing, I would suggest setting a widget for the specific column like described in this thread: Qt - QTableView - Clickable button in table row

How to Customize ListView in QT

HI..
i am new to QT,i want to know how to customize the listview in QT i.e i want to add multiple icon in single row.. etc.. i tried lot i am not getting how to do that..
i tried with Qlistwidget, in tat i can only insert single row with one image.. i am not able to place multiple icon with desired locations..
please assist me, which control is good listview or listwidget.
and how to customize the same according to my view
if you have any sample examples. please provide me the link.
Thanks
You can implement a delegate to customize the rendering of the items in your view.
From the model/view programming docs: delegates are responsible for rendering individual items in the views.
See the pixelator sample for example usage.
Take a look at QTableView or QTableWidget. You can insert the icons in the first two columns and the text in the third column. Or any other way you like it.
I guess you can use some delegates.
Have a look at http://qt.nokia.com/doc/4.6/model-view-delegate.html
Hope it helps !

Resources