tab widget arrows disabled for seemingly no reason
-
Hi,
Please provide a minimal runnable script that shows this behavior.
PySide/PyQt version and OS would be nice to know as well. -
I am using PySide6 on windows 10
generated PySide6 code from qtDesigner: "frmSetupDialog_copy_ui.py"# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'frmSetupDialog_copy.ui' ## ## Created by: Qt User Interface Compiler version 6.7.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt) from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QGradient, QIcon, QImage, QKeySequence, QLinearGradient, QPainter, QPalette, QPixmap, QRadialGradient, QTransform) from PySide6.QtWidgets import (QApplication, QDialog, QFrame, QGridLayout, QHBoxLayout, QLayout, QPushButton, QSizePolicy, QTabWidget, QWidget) class Ui_SetupDialog(object): def setupUi(self, SetupDialog): if not SetupDialog.objectName(): SetupDialog.setObjectName(u"SetupDialog") SetupDialog.setWindowModality(Qt.WindowModal) SetupDialog.resize(1024, 560) SetupDialog.setMinimumSize(QSize(1024, 560)) SetupDialog.setMaximumSize(QSize(1024, 560)) SetupDialog.setStyleSheet(u"#setup_frame{ border: 2px solid black; }") self.gridLayout = QGridLayout(SetupDialog) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setContentsMargins(0, 0, 0, 0) self.setup_frame = QFrame(SetupDialog) self.setup_frame.setObjectName(u"setup_frame") sizePolicy = QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.setup_frame.sizePolicy().hasHeightForWidth()) self.setup_frame.setSizePolicy(sizePolicy) self.setup_frame.setMaximumSize(QSize(16777215, 650)) self.setup_frame.setFrameShape(QFrame.StyledPanel) self.setup_frame.setFrameShadow(QFrame.Raised) self.gridLayout_24 = QGridLayout(self.setup_frame) self.gridLayout_24.setObjectName(u"gridLayout_24") self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setSizeConstraint(QLayout.SetDefaultConstraint) self.btn_ok = QPushButton(self.setup_frame) self.btn_ok.setObjectName(u"btn_ok") sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.btn_ok.sizePolicy().hasHeightForWidth()) self.btn_ok.setSizePolicy(sizePolicy1) self.btn_ok.setMaximumSize(QSize(16777215, 45)) font = QFont() font.setPointSize(27) self.btn_ok.setFont(font) self.horizontalLayout_12.addWidget(self.btn_ok) self.btn_cancel = QPushButton(self.setup_frame) self.btn_cancel.setObjectName(u"btn_cancel") sizePolicy1.setHeightForWidth(self.btn_cancel.sizePolicy().hasHeightForWidth()) self.btn_cancel.setSizePolicy(sizePolicy1) self.btn_cancel.setMaximumSize(QSize(16777215, 45)) font1 = QFont() font1.setPointSize(24) self.btn_cancel.setFont(font1) self.horizontalLayout_12.addWidget(self.btn_cancel) self.gridLayout_24.addLayout(self.horizontalLayout_12, 0, 0, 1, 1) self.tabWidget = QTabWidget(self.setup_frame) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setMinimumSize(QSize(0, 9)) self.tabWidget.setMaximumSize(QSize(16777215, 16777215)) font2 = QFont() font2.setPointSize(20) self.tabWidget.setFont(font2) self.tabWidget.setStyleSheet(u"QTabBar::scroller { /* the width of the scroll buttons */\n" " width: 130px;\n" "}\n" "\n" "/*QTabBar QToolButton { /* the scroll buttons are tool buttons */\n" "/* width: 15px;\n" " border-width: 2px;\n" "}\n" "") self.tab_8 = QWidget() self.tab_8.setObjectName(u"tab_8") self.gridLayout_20 = QGridLayout(self.tab_8) self.gridLayout_20.setObjectName(u"gridLayout_20") self.tabWidget.addTab(self.tab_8, "") self.tab_3 = QWidget() self.tab_3.setObjectName(u"tab_3") self.gridLayout_7 = QGridLayout(self.tab_3) self.gridLayout_7.setObjectName(u"gridLayout_7") self.tabWidget.addTab(self.tab_3, "") self.tab_2 = QWidget() self.tab_2.setObjectName(u"tab_2") self.gridLayout_12 = QGridLayout(self.tab_2) self.gridLayout_12.setObjectName(u"gridLayout_12") self.tabWidget.addTab(self.tab_2, "") self.tab_6 = QWidget() self.tab_6.setObjectName(u"tab_6") self.gridLayout_22 = QGridLayout(self.tab_6) self.gridLayout_22.setObjectName(u"gridLayout_22") self.tabWidget.addTab(self.tab_6, "") self.tab_7 = QWidget() self.tab_7.setObjectName(u"tab_7") self.gridLayout_11 = QGridLayout(self.tab_7) self.gridLayout_11.setObjectName(u"gridLayout_11") self.tabWidget.addTab(self.tab_7, "") self.tab_9 = QWidget() self.tab_9.setObjectName(u"tab_9") self.gridLayout_8 = QGridLayout(self.tab_9) self.gridLayout_8.setObjectName(u"gridLayout_8") self.tabWidget.addTab(self.tab_9, "") self.tab_5 = QWidget() self.tab_5.setObjectName(u"tab_5") self.gridLayout_15 = QGridLayout(self.tab_5) self.gridLayout_15.setObjectName(u"gridLayout_15") self.tabWidget.addTab(self.tab_5, "") self.tab_4 = QWidget() self.tab_4.setObjectName(u"tab_4") self.gridLayout_19 = QGridLayout(self.tab_4) self.gridLayout_19.setObjectName(u"gridLayout_19") self.tabWidget.addTab(self.tab_4, "") self.tab = QWidget() self.tab.setObjectName(u"tab") self.tabWidget.addTab(self.tab, "") self.gridLayout_24.addWidget(self.tabWidget, 1, 0, 1, 1) self.gridLayout.addWidget(self.setup_frame, 0, 0, 1, 1) self.retranslateUi(SetupDialog) self.tabWidget.setCurrentIndex(8) QMetaObject.connectSlotsByName(SetupDialog) # setupUi def retranslateUi(self, SetupDialog): SetupDialog.setWindowTitle(QCoreApplication.translate("SetupDialog", u"Dialog", None)) self.btn_ok.setText(QCoreApplication.translate("SetupDialog", u"Save", None)) self.btn_cancel.setText(QCoreApplication.translate("SetupDialog", u"Cancel", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_8), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_9), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QCoreApplication.translate("SetupDialog", u"example tab", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("SetupDialog", u"example tab", None)) # retranslateUi
PySide6 code for running application:
from frmSetupDialog_copy_ui import Ui_SetupDialog from PySide6.QtWidgets import QWidget, QApplication from PySide6.QtCore import Qt class MinimalSetup(QWidget): def __init__(self, tab_select='Admin_Access'): super().__init__() self.ui = Ui_SetupDialog() self.ui.setupUi(self) self.setWindowModality(Qt.ApplicationModal) for tab in range(9): self.ui.tabWidget.setTabVisible(tab, False) if tab_select == 'View_Only': self.ui.tabWidget.setTabVisible(4, True) self.ui.btn_ok.setVisible(False) self.ui.btn_cancel.setText('Close') elif tab_select == 'User_Access': self.ui.tabWidget.setTabVisible(0, True) self.ui.tabWidget.setTabVisible(1, True) self.ui.tabWidget.setTabVisible(3, True) self.ui.tabWidget.setTabVisible(4, True) self.ui.tabWidget.setTabVisible(6, True) self.ui.tabWidget.setTabVisible(7, True) self.ui.tabWidget.setCurrentIndex(0) elif tab_select == 'Admin_Access': self.ui.tabWidget.setTabVisible(0, True) self.ui.tabWidget.setTabVisible(1, True) self.ui.tabWidget.setTabVisible(3, True) self.ui.tabWidget.setTabVisible(4, True) self.ui.tabWidget.setTabVisible(5, True) self.ui.tabWidget.setTabVisible(6, True) self.ui.tabWidget.setTabVisible(7, True) self.ui.tabWidget.setCurrentIndex(0) self.show() app = QApplication([]) window = MinimalSetup() app.exec()
-
Which version of PySide6 ?
On macOS with 6.7.2 it's working fine (provided I enabled the scroll buttons with setUsesScrollButtons)
-
version 6.7.2. Are you running it from the file with the MinimalSetup class? Running just the Desginer generated code works for me, but when I use the MinimalSetup class to make all tabs invisible then certain tabs visible, I get the disabled scroll buttons. I even tried changing MinimalSetup to just make certain tabs invisible, and that didn't fix it either.
-
I think that at some point you have just the right amount of tabs which does not necessitate their use. Or are you just at the limit of that ?