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. remove row from table

remove row from table

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 926 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.
  • S Offline
    S Offline
    Suzy Q
    wrote on last edited by Suzy Q
    #1

    I want to remove row from non sql model but I don't want to use query and removerow command is not working. Any suggestions for different approach on this?

    K 1 Reply Last reply
    0
    • S Suzy Q

      I want to remove row from non sql model but I don't want to use query and removerow command is not working. Any suggestions for different approach on this?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Suzy-Q

      You need to give more details on what Qt classes you are using.
      Probably it is also helpful to provide at least a short code snippet.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Suzy Q
        wrote on last edited by koahnig
        #3

        I have a push button delete which is called when you want to delete a selected row from a table. Here is the function for delete the row

        void frmIzlezniDokumentiPregled::deleteDok()
        {
            if(!m_OutputDocModel->removeRow(m_tableOutputDoc->currentIndex().row()))
                {
                    qWarning()<<m_OutputDocModel->lastError();
                }
                slotFilterTable(); // this is for refreshing the table so I can see that the row is removed.
        }
        

        [edit:koahnig] code tags added

        K 2 Replies Last reply
        0
        • S Suzy Q

          I have a push button delete which is called when you want to delete a selected row from a table. Here is the function for delete the row

          void frmIzlezniDokumentiPregled::deleteDok()
          {
              if(!m_OutputDocModel->removeRow(m_tableOutputDoc->currentIndex().row()))
                  {
                      qWarning()<<m_OutputDocModel->lastError();
                  }
                  slotFilterTable(); // this is for refreshing the table so I can see that the row is removed.
          }
          

          [edit:koahnig] code tags added

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @Suzy-Q

          Does this code give you a warning?
          What does it say?

          What is the model class of m_OutputDocModel (if it is a derived model class what the last Qt class?) ?

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • S Suzy Q

            I have a push button delete which is called when you want to delete a selected row from a table. Here is the function for delete the row

            void frmIzlezniDokumentiPregled::deleteDok()
            {
                if(!m_OutputDocModel->removeRow(m_tableOutputDoc->currentIndex().row()))
                    {
                        qWarning()<<m_OutputDocModel->lastError();
                    }
                    slotFilterTable(); // this is for refreshing the table so I can see that the row is removed.
            }
            

            [edit:koahnig] code tags added

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @Suzy-Q

            void frmIzlezniDokumentiPregled::deleteDok()
            {
                qDebug() << "current index              " << m_tableOutputDoc->currentIndex();
                qDebug() << "current size before    " << m_tableOutputDoc->size(); 
                if(!m_OutputDocModel->removeRow(m_tableOutputDoc->currentIndex().row()))
                    {
                        qWarning()<< "last error " <<  m_OutputDocModel->lastError();
                    }
                qDebug() << "current size before slot filter " << m_tableOutputDoc->size(); 
                slotFilterTable(); // this is for refreshing the table so I can see that the row is removed.
                qDebug() << "current size after slot filter" << m_tableOutputDoc->size(); 
            }
            

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            1

            • Login

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