Results 1 to 7 of 7

Thread: problem with tablewidget..

  1. #1
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default problem with tablewidget..

    hello,

    my problem is that i need to remove all the rows of the table and then add new rows..
    al these work at runtime only..

    so i wrote the following code...
    but cant understand where the problem is..

    row=table->rowCount();
    for(int i=0;i<=row;i++)
    table->removeRow(i);
    row=0;
    queryForMem();//this takes input for the new row..

    one row always remains and doesnt get removed..
    new instructions do not work on this table any more...

    like i cannot add a new row through some other functions..

    plz help me out...

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem with tablewidget..

    why do not simply call QTableWidget::clear?
    PS. please, use tags CODE .
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: problem with tablewidget..

    Damn, you are very resistant to advices! USE THE FUCKING CODE TAGS! The last time I'll help you when you are not going to use them:
    QTableWidget::clearContents(), and then reset the dimension.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: problem with tablewidget..

    @spirit: Why are you always some seconds earlier

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem with tablewidget..

    Quote Originally Posted by Lykurg View Post
    @spirit: Why are you always some seconds earlier
    I don't know
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Mar 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: problem with tablewidget..

    do u mean like dis...

    Qt Code:
    1. row=table->rowCount();
    2. for(int i=0;i<=row;i++)
    3. table->removeRow(i);
    4. row=0;
    5. queryForMem();//this takes input for the new row..
    To copy to clipboard, switch view to plain text mode 

    ok.. but clear() doent remove the rows totally...it just removes the contents..

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem with tablewidget..

    Quote Originally Posted by reshma View Post
    do u mean like dis...

    Qt Code:
    1. row=table->rowCount();
    2. for(int i=0;i<=row;i++)
    3. table->removeRow(i);
    4. row=0;
    5. queryForMem();//this takes input for the new row..
    To copy to clipboard, switch view to plain text mode 
    yes

    Quote Originally Posted by reshma View Post
    ok.. but clear() doent remove the rows totally...it just removes the contents..
    set row count to "0" after clear.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  3. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 20:17
  4. again problem in add items in tablewidget
    By jyoti in forum Qt Tools
    Replies: 3
    Last Post: 24th November 2006, 12:03
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.