Results 1 to 9 of 9

Thread: Grab idea from Amarok

  1. #1
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Grab idea from Amarok

    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:



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

    Thanks
    Giuseppe CalÃ

  2. #2
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Grab idea from Amarok

    Lokks like a QTableView to me.

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Grab idea from Amarok

    Yes, a QTableView or QTableWidget with alternating row colors.

  4. #4
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Grab idea from Amarok

    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
    Giuseppe CalÃ

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Grab idea from Amarok

    Quote Originally Posted by jiveaxe View Post
    But if I click the column's header in amarok it changes the order, while in qtableview it selects the entire column
    QTableView::setSortingEnabled()
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    jiveaxe (6th November 2007)

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Grab idea from Amarok

    To me it's a QTreeView (Qt4) or a QListView (Qt3) with top level children only.

  8. #7
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Grab idea from Amarok

    If I want to populate a qtableview with data from a database I have to write:

    Qt Code:
    1. model->setTable("mytable");
    2. model->select();
    3. tableView->setModel(model);
    To copy to clipboard, switch view to plain text mode 

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

    Regards
    Giuseppe CalÃ

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Grab idea from Amarok

    Use QSqlQueryModel.

  10. The following user says thank you to wysota for this useful post:

    jiveaxe (6th November 2007)

  11. #9
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Grab idea from Amarok

    Quote Originally Posted by wysota View Post
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.