Results 1 to 4 of 4

Thread: Need Listbox with Columns - which component?

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Need Listbox with Columns - which component?

    I have numerous applications for a simple columnated listbox, but cannot figure out which QT4 component is best for this purpose (preferably one that I can place using QT Designer).

    For example, I want to show a box like:

    NAME ADDRESS PHONE
    John Smith 123 First St 123-1341
    Fred Smoot 234 Second St 234-4567

    etc.

    I have looked at some components such as TableWidget but not quite clear that is designed for my purpose (which does NOT involve the user needing to edit individual fields like a spreadsheet). I would like the user to be able to click on (and probably highlight) a line of his choice, however.

    Thanks.


    Victor

  2. #2
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    82
    Thanked 11 Times in 11 Posts

    Default Re: Need Listbox with Columns - which component?

    I'm not a Qt expert, but I don't think what you want is possible. If the data in a line is going to be separated, it would have to be edited separately because it would be stored in separate widgets.
    Why do you need the data in columns, is it just for the visible effect? If that is the case, then you could use QTextEdit and separate the data programatically into the appearance of columns.

    Maybe a real Qt expert will have a better answer.

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Need Listbox with Columns - which component?

    Well, primarily for visual effect, but also functional. The items in a single line belong together, in this example, and I do not need to edit them separately.

    Using Delphi/Lazarus/FreePascal, I accomplished this function with a user designed TListBox component that would draw separate items in the separate columns (with an attached header to give the "names" of the columns at the top).

    I was hoping to handle this with a single component under QT. It looks like a TableView widget has some of the capabilities I need, and there is mention of a "QStringListModel" which seems to suit my need for multiple strings in a line. However, it looks like it implements individual cells which is not really needed for my purpose.

    I would be happy to have a component that could do the following, with 3 separate columns:

    NAME ADDRESS PHONE
    John Smith 123 First Street 132-1234

    (Preferably having the column headers and the data columns from the list lined up automatically).

  4. #4
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2
    Thanked 26 Times in 23 Posts

    Default Re: Need Listbox with Columns - which component?

    You can still use QListView (or QListWidget) and make "columns" by justifying your strings and header

Similar Threads

  1. Replies: 8
    Last Post: 14th August 2008, 16:48
  2. Listbox widget
    By awanish_jmi in forum Newbie
    Replies: 1
    Last Post: 25th July 2008, 06:41
  3. ListBox view
    By mithra in forum Newbie
    Replies: 6
    Last Post: 9th January 2007, 12:57
  4. Listbox Autoscroll is not happening?
    By mahe2310 in forum Qt Programming
    Replies: 4
    Last Post: 9th March 2006, 10:13
  5. How to implement a ListBox with background image
    By andyyeh75 in forum Qt Programming
    Replies: 3
    Last Post: 8th March 2006, 09:55

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.