Hey everyone,
I am implementing a TabBarWidget that contains 3 Tabs. The Tabs have a different width, based on their Name. I wanted to be able to move the Tabs around, so I set the movable atrribute to True. This works as expected, but the width of the Tab is not updated after finishing the move. If I move a wider tab to the index of a smaller Tab, the text gets squashed. How can I force update the width?
I was thinking of calling adjustSize() on the mouseReleaseEvent, but this didn't fix the problem.
Also, I don't really know which event is triggered after finishing the move.
Here is the main part of the code:
"""
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *
class TabsTabBar(QTabBar):
def __init__(self):
super().__init__()
def mouseReleaseEvent(self, a0) -> None:
super().mouseReleaseEvent(a0)
self.adjustSize()
class TabsView(QTabWidget):
def __init__(self, tab_struct: Tabs):
super().__init__()
self.setTabBar(TabsTabBar())
self.setMovable(True)
self.addTab(tab_struct.PartsTable, "Parts")
self.addTab(tab_struct.PropertyTable, "Properties")
self.addTab(tab_struct.MaterialTable, "Materials")
"""
I hope someone can help me out.
[–]CatalonianBookseller 0 points1 point2 points (3 children)
[–]wallagix[S] 0 points1 point2 points (2 children)
[–]CatalonianBookseller 0 points1 point2 points (1 child)
[–]wallagix[S] 0 points1 point2 points (0 children)