Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    how can i add more column in QListWidget ListMode?

    General and Desktop
    2
    6
    2538
    Loading More Posts
    • 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.
    • O
      opengpu2 last edited by

      how can i add more column in QListWidget ListMode?
      i want to add more info more than the file name
      thank you

      p3c0 1 Reply Last reply Reply Quote 0
      • p3c0
        p3c0 Moderators @opengpu2 last edited by

        @opengpu2 You can't. QListWidget is a single dimension widget as the lists itself are.
        Use QTableWidget or QTreeWidget to have more that one column.

        157

        1 Reply Last reply Reply Quote 0
        • O
          opengpu2 last edited by

          thank you, iknow QTable can do this.
          but i want to switch between the IconMode and the ListMode, while the data set actually should be view as QListWidget.
          the column after the 1st one is just the custom data of the 1st one, eg. 1st one is fileName, after that i can show it's created time, file type, etc.
          thank you

          p3c0 1 Reply Last reply Reply Quote 0
          • p3c0
            p3c0 Moderators @opengpu2 last edited by

            @opengpu2 AFAIK Using QListWidget that cannot be done. It has only one column.

            157

            1 Reply Last reply Reply Quote 0
            • O
              opengpu2 last edited by

              i want to use QListWidget because i want to preview in IconMode. Meanwhile, i want to dynamically preview in ListMode but with multi-column(confilicts here, because the QListWidget only support 1 column).

              1 solution is when IconMode i use QListWidget, when "ListMode" i use QTree/QTableWidget, but this is very ugly...and not elegant at all...

              can i preview as IconMode in QTree/QTableWidget ?

              p3c0 1 Reply Last reply Reply Quote 0
              • p3c0
                p3c0 Moderators @opengpu2 last edited by

                @opengpu2 In QTreeWidget or QTableWidget you can add your own widgets. For eg. to simulate IconMode you can create a widget consisting of QLabels for text and icon OR use QToolButton with toolButtonStyle as ToolButtonTextUnderIcon and then add this widget to QTreeWidget using setItemWidget OR setCellWidget for QTableWidget.

                157

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post