Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved Set Headers in Qlistwidget and Qtablewidget

    General and Desktop
    4
    7
    2802
    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.
    • T
      tactical77 last edited by tactical77

      Hi,

      I'm pretty new to qt and have to finish some stuff for school. I figured out how to add items to Qlistwidget and Qtablewidget but I need to have headers similar to the ones in the picture.
      I also have already a cli program from my last homework which should be used to read in data from a text file and store it in objects and then in vectors. Can I just use it and
      export the data into Qlistwidget?

      (https://ibb.co/tc1hFyh)

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        Do you mean the text ? If so, yes, you can use QTableWidget::setVerticalHeaderLabels.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 1
        • T
          tactical77 last edited by

          Thanks it worked. I have another question. I know how to add strings in qlistwidget but I need to add a string and some doubles and integers all in the same row?

          JonB jsulm 2 Replies Last reply Reply Quote 0
          • JonB
            JonB @tactical77 last edited by

            @tactical77
            QListWidgetItems are "typically" used to display text, icon & checkbox. Are you sure you don't mean to use a QTableWidget for "add a string and some doubles and integers all in the same row"?

            T 1 Reply Last reply Reply Quote 0
            • T
              tactical77 @JonB last edited by

              @JonB
              I basically have some client data which is stored in objects and I have to create both a qlistwidget and a qtablewidget. Probably just in order to learn to use both of them. But each one has basically the same data output.

              1 Reply Last reply Reply Quote 0
              • jsulm
                jsulm Lifetime Qt Champion @tactical77 last edited by

                @tactical77 Use https://doc.qt.io/qt-5/qstring.html#number-2 and https://doc.qt.io/qt-5/qstring.html#number-6 and concatenate the strings...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                T 1 Reply Last reply Reply Quote 3
                • T
                  tactical77 @jsulm last edited by

                  @jsulm
                  Thanks it works.

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