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. tableView and disappearing items
Forum Updated to NodeBB v4.3 + New Features

tableView and disappearing items

Scheduled Pinned Locked Moved Unsolved General and Desktop
tableviewdatabase
17 Posts 2 Posters 3.7k 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.
  • L Offline
    L Offline
    Lizard
    wrote on last edited by
    #1

    Hello.
    I'm using tableView to display database data and I can fix this annoying bug.

    I've created a button to refresh data:

    void Przychodnia::on_buttonOdswiez_clicked()
    {
        QSqlTableModel *model = new QSqlTableModel();
        model->setTable("Pacjent");
        model->setEditStrategy(QSqlTableModel::OnManualSubmit);
        model->select();
        ui->tableView->setModel(model);
    }
    

    This is my tableView before fetching data:
    http://imgur.com/h6zq8dW

    This is my tableView after fetching data:
    http://imgur.com/XxU3qS7

    This is my tableview after hovering on items:
    http://imgur.com/Xn7pK1H

    However if I edit data in listView (that also is not showing my items) the results are displayed in table view and they are not disappearing:
    http://imgur.com/dYnqwdt

    I'm working with SAP 16 database on Virtual Machine win7- 64bit with Qt Creator 3.6 based on Qt 5.5.1.

    Best regards!

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

      Hi and welcome to devnet,

      Are you saying the you have your indexes disappearing while hovering them ?

      On a side note you have a "memory leak" here, each time your call on_buttonOdswiez_clicked, you replace the current model with another new one and don't delete the original.

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

      L 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Are you saying the you have your indexes disappearing while hovering them ?

        On a side note you have a "memory leak" here, each time your call on_buttonOdswiez_clicked, you replace the current model with another new one and don't delete the original.

        L Offline
        L Offline
        Lizard
        wrote on last edited by
        #3

        @SGaist
        Yes. They are disappearing when i hover oveer them and then I need to press the button.
        I don't know what can cause this because my friend is using basicly the same code .

        Thank you for memory leak info.

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

          Are you both using the same OS and Qt version ?

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

          L 1 Reply Last reply
          0
          • SGaistS SGaist

            Are you both using the same OS and Qt version ?

            L Offline
            L Offline
            Lizard
            wrote on last edited by
            #5

            @SGaist
            Yes.
            I think the VirtualBox cause the problem since I'm working on it and he is not.

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

              Did you install the VirtualBox guest tools ?

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

              L 1 Reply Last reply
              0
              • SGaistS SGaist

                Did you install the VirtualBox guest tools ?

                L Offline
                L Offline
                Lizard
                wrote on last edited by
                #7

                @SGaist
                Guest Addition tools?
                Yes since I had problems with resolution.
                Tried running Qt without them and with different settings. Nothing worked.

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

                  What version of VirtualBox is it ?

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

                  L 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    What version of VirtualBox is it ?

                    L Offline
                    L Offline
                    Lizard
                    wrote on last edited by
                    #9

                    @SGaist
                    5.0.12

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

                      What is the host OS ?

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

                      L 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        What is the host OS ?

                        L Offline
                        L Offline
                        Lizard
                        wrote on last edited by
                        #11

                        @SGaist
                        Windows 8 64-bit .

                        L 1 Reply Last reply
                        0
                        • L Lizard

                          @SGaist
                          Windows 8 64-bit .

                          L Offline
                          L Offline
                          Lizard
                          wrote on last edited by
                          #12

                          @Lizard

                          Ok so I have done some research and it seems like the problem occur only if there are more then 1 rows in column.
                          The indexes are working fine when there is only one row in table.

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

                            What do you mean by "more then 1 rows in column" ?

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

                            L 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              What do you mean by "more then 1 rows in column" ?

                              L Offline
                              L Offline
                              Lizard
                              wrote on last edited by
                              #14

                              @SGaist
                              Its fine to have one row in tableview but when i add more than one the bug appears.

                              Single row:
                              http://imgur.com/sDniGmW

                              Multirow:
                              http://imgur.com/uIxyxdD

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

                                Do you have any QSqlRelationalDelegate on it ?

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

                                L 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Do you have any QSqlRelationalDelegate on it ?

                                  L Offline
                                  L Offline
                                  Lizard
                                  wrote on last edited by
                                  #16

                                  @SGaist
                                  Not really. I'm new to Qt and I'm still learning how things works.

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

                                    Your two images show two different tables. Are you sure that both tables contains data ?

                                    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
                                    0

                                    • Login

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