Results 1 to 4 of 4

Thread: My QTableWidget doesn't want to let me add a title to a new row with the button

  1. #1
    Join Date
    Mar 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Unhappy My QTableWidget doesn't want to let me add a title to a new row with the button

    I am creating a stock controlling system,but when I add the new row I can edit the product numbers and everything, except for the new product,please help.
    Thank you in advance

    my code :

    Qt Code:
    1. int row;
    2. row = ui->tableWidget->rowCount();
    3. ui->tableWidget->setRowCount(row +1);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,513
    Thanks
    13
    Thanked 1,574 Times in 1,503 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: My QTableWidget doesn't want to let me add a title to a new row with the button

    Can you post a minimal program that demonstrates the problem?

  3. #3
    Join Date
    Mar 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: My QTableWidget doesn't want to let me add a title to a new row with the button

    Quote Originally Posted by ChrisW67 View Post
    Can you post a minimal program that demonstrates the problem?

    Qt Code:
    1. void BPW::on_pushButton_clicked(){
    2.  
    3. int row;
    4. row = ui->tableWidget->rowCount();
    5. ui->tableWidget->setRowCount(row + 1)
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    I hope this is what you needed..

    Basically looks like the table below,but column 0 is not editable,from column 1 I can edit though

    |____|____|____|
    |____|____|____|
    |____|____|____|
    |____|____|____|

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,925
    Thanks
    228
    Thanked 614 Times in 604 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: My QTableWidget doesn't want to let me add a title to a new row with the button

    Basically looks like the table below,but column 0 is not editable,from column 1 I can edit though
    Your code is adding a new row, so why are you complaining about columns?

    The code you posted is basically no different from the code in your original post, and does nothing except add a new row to the table. Where is the complete code that fails when you try to do whatever it is you are trying to do with coolumns and titles?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Force dialog to have WhatsThis title bar button
    By hvengel in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2013, 23:39
  2. Show maximize button in the title bar of a QDialog under GNOME
    By lalesculiviu in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 08:46
  3. How can I add a custom button to a QWidget's title bar
    By JPNaude in forum Qt Programming
    Replies: 4
    Last Post: 22nd February 2010, 11:40
  4. Replies: 5
    Last Post: 21st April 2008, 08:54
  5. No restore button in QDockWidget title bar
    By trskel in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2007, 10:59

Tags for this Thread

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.