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. QTableView model
Qt 6.11 is out! See what's new in the release blog

QTableView model

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 5.6k Views 2 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.
  • SGaistS SGaist

    Hi and welcome to devnet,

    Do you mean setStretchLastSection ?

    P Offline
    P Offline
    PowerMosts
    wrote on last edited by PowerMosts
    #3

    @SGaist Yes, When I do the first select, the table is all right.
    alt text
    In the second Select is as follows:
    alt text
    In the middle column extends over the entire width of the window.
    I'm trying to make the switch between the tables in the database.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Did you change the table in between ?

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

      P 1 Reply Last reply
      0
      • SGaistS SGaist

        Did you change the table in between ?

        P Offline
        P Offline
        PowerMosts
        wrote on last edited by
        #5

        @SGaist No

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Ok, can you show the code that triggers that behavior ?

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

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            Ok, can you show the code that triggers that behavior ?

            P Offline
            P Offline
            PowerMosts
            wrote on last edited by
            #7

            @SGaist link text

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              I can't reproduce the error. Can you give a step by step set of instruction to trigger the problem ?

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

              P 1 Reply Last reply
              0
              • SGaistS SGaist

                I can't reproduce the error. Can you give a step by step set of instruction to trigger the problem ?

                P Offline
                P Offline
                PowerMosts
                wrote on last edited by
                #9

                @SGaist, Run the application.
                Double click by database "decanat".
                alt text
                Double click by table"ball".
                alt text
                Double click by table"dis".
                alt text
                Again double click by table"ball".
                alt text
                Result:
                alt text

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  Sorry, can't reproduce it here. Which version of Qt + Windows are you using ?

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

                  P 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Sorry, can't reproduce it here. Which version of Qt + Windows are you using ?

                    P Offline
                    P Offline
                    PowerMosts
                    wrote on last edited by PowerMosts
                    #11

                    @SGaist said in QTableView model:

                    Sorry, can't reproduce it here. Which version of Qt + Windows are you using ?

                    Qt 5.5.1 mingw x86
                    Windows 8.1 x64

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      Ok, I'm on more recent version.

                      What about MySQL ?

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

                      P 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Ok, I'm on more recent version.

                        What about MySQL ?

                        P Offline
                        P Offline
                        PowerMosts
                        wrote on last edited by
                        #13

                        @SGaist MySQL Server 5.5

                        1 Reply Last reply
                        0
                        • P PowerMosts

                          when I do a re-select of model of database, then the last visible column extends the entire width of the window

                          model->setTable("table1");
                          model->select();
                          ui->tableView->setModel(model);

                          M Offline
                          M Offline
                          mjsurette
                          wrote on last edited by
                          #14

                          @PowerMosts
                          Have you tried this? It may be more to your liking.

                          ui->tableView->resizeColumnsToContents();
                          

                          Mike

                          P 1 Reply Last reply
                          0
                          • M mjsurette

                            @PowerMosts
                            Have you tried this? It may be more to your liking.

                            ui->tableView->resizeColumnsToContents();
                            

                            Mike

                            P Offline
                            P Offline
                            PowerMosts
                            wrote on last edited by
                            #15

                            @mjsurette said in QTableView model:

                            Have you tried this? It may be more to your liking.
                            ui->tableView->resizeColumnsToContents();

                            Mike

                            it did not help me

                            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