PDA

View Full Version : Grab idea from Amarok



jiveaxe
6th November 2007, 16:11
I'm working on a database application. In one of the dialog i use a qlistview to display the output of a query; it works good so.

Today, opening amarok I noticed the look of songs' list of a playlist; below the image:

http://img159.imageshack.us/img159/6717/amarokslicehj7.png

it seems like a qlistview with multicolumn; am i right? And if yes, any idea on how make it?

Thanks

DeepDiver
6th November 2007, 16:13
Lokks like a QTableView to me.

marcel
6th November 2007, 16:15
Yes, a QTableView or QTableWidget with alternating row colors.

jiveaxe
6th November 2007, 16:23
But if I click the column's header in amarok it changes the order, while in qtableview it selects the entire column; the rows in amarok are thin; using tableView->setRowHeight(1,15) on a sample app gives me all equals rows (with standard height).

Bye

jpn
6th November 2007, 16:33
But if I click the column's header in amarok it changes the order, while in qtableview it selects the entire column
QTableView::setSortingEnabled()

wysota
6th November 2007, 16:38
To me it's a QTreeView (Qt4) or a QListView (Qt3) with top level children only.

jiveaxe
6th November 2007, 16:40
If I want to populate a qtableview with data from a database I have to write:


QSqlTableModel *model = new QSqlTableModel;
model->setTable("mytable");
model->select();
tableView->setModel(model);

Is it possible populate it with the result of a query ('select filed1,field2 of mytable')? How ?

Regards

wysota
6th November 2007, 16:42
Use QSqlQueryModel.

Brandybuck
6th November 2007, 19:11
To me it's a QTreeView (Qt4) or a QListView (Qt3) with top level children only.
It looks that way to me too. QTableView could have been used, but it is meant more for tables where all cells are all conceptually the same type. QTreeView is much better when you have rows of data with different fields.