Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QListWidget. How to set column count.
Forum Updated to NodeBB v4.3 + New Features

QListWidget. How to set column count.

Scheduled Pinned Locked Moved General and Desktop
7 Posts 5 Posters 31.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anticross
    wrote on last edited by
    #1

    I want to my QListWidget have more than one column and it's item can hold a number of data in that columns(like in table). How can I do that ?

    1 Reply Last reply
    1
    • R Offline
      R Offline
      raaghuu
      wrote on last edited by
      #2

      Use a "QTableWidget":http://qt-project.org/doc/qt-4.8/qtablewidget.html instead?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anticross
        wrote on last edited by
        #3

        I need list. In tree widget I can add some columns, is there any way to add suck columns in QListWidget ?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          No, because QListWidget is a single dimension widget.

          If you need multiple columns you will have to use, as already suggested, QTableWidget.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mario84
            wrote on last edited by
            #5

            In my opinion the QTreeWidget is a better choice to display a multi-column list.
            Just set the root decoration to false and add your Items only as top-level items...

            1 Reply Last reply
            1
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              QTableWidget (well, QTableView) is much more efficient in item layout than QTreeWidget (QTreeView), because that layout is much easier. A table can be made to look just like QTreeWidget does, so I don't see the point of using QTreeWidget instead.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mario84
                wrote on last edited by
                #7

                Because a QTreeWidget behaves more like a List than QTableWidget. For example you do not have to care about hiding the gridlines (which you normally do not want to see in a list). Also in a tree you have one Item per Row, in a QTableWidget there's one Item per Cell... but in a usual list, you work row-based.
                As you said, a table can of course be configured to look like a list, but a tree can be configured to look like a list with less coding and behaves more like it is expected (at least by me) from a list...

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved