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. Creating QTableWidget Header with multilinetext
Forum Updated to NodeBB v4.3 + New Features

Creating QTableWidget Header with multilinetext

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 7.0k Views
  • 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.
  • D Offline
    D Offline
    doshirushabh
    wrote on 8 Dec 2015, 04:22 last edited by doshirushabh 12 Aug 2015, 04:24
    #1

    Hello
    I was trying to create multiline text in Header of QTableWidget. Nothing worked for me. The Cells can be created with multiline text but header am not sure if there is a simple way. Could anyone help me with this

    Thanks !!

    R 1 Reply Last reply 8 Dec 2015, 05:20
    0
    • D doshirushabh
      8 Dec 2015, 04:22

      Hello
      I was trying to create multiline text in Header of QTableWidget. Nothing worked for me. The Cells can be created with multiline text but header am not sure if there is a simple way. Could anyone help me with this

      Thanks !!

      R Offline
      R Offline
      Renn
      wrote on 8 Dec 2015, 05:20 last edited by Renn 12 Aug 2015, 05:20
      #2

      @doshirushabh Already tried this yet?

      ui->tableWidget->setColumnCount(1);
      ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Something"));

      D 1 Reply Last reply 8 Dec 2015, 06:17
      0
      • R Offline
        R Offline
        Ratzz
        wrote on 8 Dec 2015, 05:49 last edited by Ratzz 12 Aug 2015, 06:11
        #3

        Hi and welcome.
        You can use \n to make header with multi-line text.

        --Alles ist gut.

        1 Reply Last reply
        0
        • R Renn
          8 Dec 2015, 05:20

          @doshirushabh Already tried this yet?

          ui->tableWidget->setColumnCount(1);
          ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Something"));

          D Offline
          D Offline
          doshirushabh
          wrote on 8 Dec 2015, 06:17 last edited by
          #4

          @Renn
          Hello. Thanks but i was able to set single line text like "Something" But Multiline even with \n didnt work.

          R 1 Reply Last reply 8 Dec 2015, 06:24
          0
          • D doshirushabh
            8 Dec 2015, 06:17

            @Renn
            Hello. Thanks but i was able to set single line text like "Something" But Multiline even with \n didnt work.

            R Offline
            R Offline
            Ratzz
            wrote on 8 Dec 2015, 06:24 last edited by
            #5

            @doshirushabh
            I did this way

            table->setColumnCount(1);
            table->setHorizontalHeaderLabels(QString("HEADER 1 \n Header_nextline").split(";"));

            --Alles ist gut.

            D 1 Reply Last reply 9 Dec 2015, 04:04
            0
            • R Ratzz
              8 Dec 2015, 06:24

              @doshirushabh
              I did this way

              table->setColumnCount(1);
              table->setHorizontalHeaderLabels(QString("HEADER 1 \n Header_nextline").split(";"));
              D Offline
              D Offline
              doshirushabh
              wrote on 9 Dec 2015, 04:04 last edited by
              #6

              @Ratzz
              Hello. Thanks for the help. This works . The reason it didnt work is we have some docking undocking and some global settings which didnt make it work when docked. Thanks again !!

              R 1 Reply Last reply 9 Dec 2015, 04:33
              0
              • D doshirushabh
                9 Dec 2015, 04:04

                @Ratzz
                Hello. Thanks for the help. This works . The reason it didnt work is we have some docking undocking and some global settings which didnt make it work when docked. Thanks again !!

                R Offline
                R Offline
                Ratzz
                wrote on 9 Dec 2015, 04:33 last edited by
                #7

                @doshirushabh
                Once your problem is solved please use the Topic Tools button to mark as Solved.
                Thank you!

                --Alles ist gut.

                1 Reply Last reply
                0

                2/7

                8 Dec 2015, 05:20

                5 unread
                • Login

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