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?
Related
I'm using QListWidget with setItemWidget and when adding items to the list and scrolling down to the bottom I get this result:
So there's an area which is completely blank at the bottom (not selectable, in the image above the last item in the list has been selected)
How can I get rid of this blank area at the bottom of the list?
Please note that the height of the rows can be different within a list
Grateful for help and with kind regards,
Tord
It's possible to change the type of vertical scrolling that is done for list by using setVerticalScrollMode for the QListWidget so that the scrolling is done per pixel (instead of per item which is the default):
self.list_widget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
The result is that rows that are in the top-most part of the QListWidget box can be drawn only in part, which in turn means that the blank area that exists when scrolling per item will disappear:
Reference documentation:
https://doc.qt.io/qt-5/qabstractitemview.html#verticalScrollMode-prop
I'm using exactly the same approach and I get rid of the blank area by creating a widget that contains my QListWidget and use :
listwidget.setFixedSize(widget.width(), listwidget.sizeHintForRow(0) * listwidget.count() + 2 * listwidget.frameWidth())
listwidget is you QListWidget object
widget is the widget that contains your QListWidget object
I have a problem with showing multiple tables(without their own scrollbars) under one scrollbar. Is there any workaround or a good way to resolve this issue in Qt?
I've tried to do what you ask, and found this. So, here is a solution:
add QScrollArea to a form
set the property widgetResizable to true
put QWidget to scroll area
right click on widget -> Set ancestor -> [your scroll area]
add vertical layout to a widget
scroll area will collapse, epand it with a mouse
insert into the widget as many tables as you want
set vertical size policy for each table to Minimum and set minimal vertical size.
Here is how it looks:
I'd like to know if there is a way to reserve space for a vertical scrollbar in a grid panel with ExtJS 4.1.1. I remember that I was able to do this with ExtJS 3, but maybe this feature was removed?
The grid has a fixed height so a scrollbar appears when the amount of rows exceeds the height of the grid. There is also a "delete" action that allows to remove each row one by one. The problem is that the action moves to the right when the scrollbar is not required anymore. This is the behaviour I'd like to avoid.
I think you're looking for reserveScrollbar
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.layout.container.Auto-cfg-reserveScrollbar
Add overflowY: 'scroll' as a config param for your grid. See docs here: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Component-cfg-overflowY.
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 .
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)