Results 1 to 3 of 3

Thread: I need a widget that can display lists of column-aligned strings

  1. #1
    Join Date
    Jun 2016
    Location
    Southwest Virginia
    Posts
    4
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default I need a widget that can display lists of column-aligned strings

    Hello! I'm trying to display a list of items, each item represented by 3 strings. I was thinking of going with a QListWidget and tab separating the strings for alignment, but they're not all nominal length and I ended up with some offset strings. I noticed QTableView/QTableWidget and thought about using that, but I don't like the table lines separating the items.

    Also, about the QTable things, what is the difference between QTableView and QTableWidget? Why would you use one over the other? Is one inherited from the other and only one should be used in user code while the other one is used internally or something? It's not obvious from the names of the classes, and even more confusing when trying to read through the docs on http://doc.qt.io/qt-5/qtableview.html and http://doc.qt.io/qt-5/qtablewidget.html how they should be used.

    I hope that's enough to start with. Please do ask for clarification if I left anything out. If it helps, I'm running PyQt5.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: I need a widget that can display lists of column-aligned strings

    QTableView::setShowGrid()
    QTableView is a generic table widget that displays data from a user-supplied QAbstractItemModel. QTableWidget is convenience subclass of QTableView that has an internal data model and a public API for manipulating items in that model. Which you use depends on your program data source and design.

    Look for "Model/View Programming" in the Qt docs.

  3. #3
    Join Date
    Jun 2016
    Location
    Southwest Virginia
    Posts
    4
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: I need a widget that can display lists of column-aligned strings

    Oh, this is so helpful!! Thanks so much!

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 10:12
  2. Replies: 7
    Last Post: 28th April 2013, 01:46
  3. Replies: 3
    Last Post: 14th May 2010, 10:45
  4. display lists
    By rick_st3 in forum Newbie
    Replies: 3
    Last Post: 23rd June 2008, 00:09
  5. Replies: 5
    Last Post: 15th February 2008, 03:54

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.