Results 1 to 5 of 5

Thread: Getting rid of whitespace in a QTableWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    60
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6

    Default Getting rid of whitespace in a QTableWidget

    I have a QTableWidget. The image attached is what it looks like. How do I make it so that when the dialog first starts up, I want it so that the dialog is only wide enough to show the two columns? I also want to make the QTableWidget shorter to get rid of the whitespace underneath the rows. Is there a setting or function I can use for that? This is what I have in the dialog init function. It is in python, but it is fairly equivalent to the C++ code.
    Qt Code:
    1. self.displayText = QTextEdit(self)
    2. self.labelTable = QTableWidget(1, 2, self)
    3.  
    4. self.acceptButton = QPushButton(self)
    5. self.acceptButton.setText("Accept")
    6.  
    7. self.cancelButton = QPushButton(self)
    8. self.cancelButton.setText("Cancel")
    9.  
    10. buttonGridLayout = QGridLayout()
    11. buttonGridLayout.addWidget(self.acceptButton, 0, 0, Qt.AlignLeft)
    12. buttonGridLayout.addWidget(self.cancelButton, 0, 1, Qt.AlignLeft)
    13.  
    14. gridLayout = QGridLayout()
    15. gridLayout.addWidget(self.labelTable, 0, 0)
    16. gridLayout.addWidget(self.displayText, 1, 0)
    17. gridLayout.addLayout(buttonGridLayout, 2, 0)
    18.  
    19. self.setLayout(gridLayout)
    20.  
    21. labels = QStringList()
    22. labels << "Type" << "Name"
    23.  
    24. self.labelTable.setHorizontalHeaderLabels(labels)
    To copy to clipboard, switch view to plain text mode 

    Also, How do I make the cells not editable?
    Attached Images Attached Images

Similar Threads

  1. Replies: 7
    Last Post: 18th September 2009, 10:59
  2. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  3. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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
  •  
Qt is a trademark of The Qt Company.