Removing index numbers in QTablewidget - qt

How can I remove the column with index numbers in QTableWidget ?

Not quite obvious, there are two views the vertical and the horizontal header, they are defined in QTableView, as any widget you can hide them so its
myTableWidget->verticalHeader()->setVisible(false);

PyQt6
self.tableWidget.verticalHeader().setVisible(False)
self.tableWidget.horizontalHeader().setVisible(False)

Related

How to add horizontal scrollbar to only one column in QTreeView

I've did some digging but didn't found an answer anywhere.
How could I add horizontal scrollbar for only one column out of 3 existing in QTreeView?

QTreeWidget that contains widgets and set row height issue

Setting row height is more or less trivial via inherit from QItemDelegate.
The problem is that I can make the row size bigger but I cannot make it smaller if I add a widget inside.
Any tip on this?
Thank you in advance.
Maybe your widget QWidget::minimumSize().height() is bigger than you want to set in your row height?
Also, maybe you will post some related code?

How to remove column from QTreeWidget

I have QTreeWidget containing 5 columns. I want to remove column from the tree when user uses remove column menu. How can I remove column from the tree?
If it's purely for UI purposes you can hide the corresponding section in the QHeaderView used by your tree view:
treeview->header()->hideSection(4)
I know this is an old one, but the solution was rather simple.
QTreeWidget::setColumnCount( 0 );
They reload the headerLabels using
QTreeWidget::setHeaderLabels
This will make sure the the "removed" column is actually removed

How can I get rid of vertical spacing of empty rows in a QGridLayout in Qt?

So I have a dialog that consists of one QGridLayout that has two columns of widgets (labels and comboboxes). Depending on the selections of the comboboxes some rows might be hidden.
I figured out that having the dialog call self.layout().setSizeConstraint(QLayout.SetFixedSize) as it shows/hides the comboboxes would make the dialog change size accordingly.
But then I realized that the layout was still showing the vertical spacing of empty rows, thus making the dialog show too much space here and there.
How can I get rid of this? Is there a way to have the layout resize to show only vertical spacing of rows that have visible widgets?
I think I found the solution. Using QVBoxLayout instead of QGridLayout somehow makes widgets and their vertical spacing go away when a widget is hidden.
You might need to use QLayout::takeAt ( int index ) to take out the item, once the visibility is set to false & use QLayout::addItem ( QLayoutItem * item ) when you need it back in your layout.
Keep in mind that if an item is removed, other items will be renumbered. So you have to plan what you do accordingly. Refer the documentation .

Flex remove header horizontal separator from Datagrid

Is it possible to remove the horizontal separator which divides the headers with the data? I managed to remove the vertical ones with mx.skins.Programmatic skin, but could not find a way to remove the horizontal separator.
Found it... set headerBackgroundSkin="mx.skins.ProgrammaticSkin"

Resources