@SGaist
Cheers,
So I made a simple test and it looks to be a Centos issue. In this example im using PySide2, 5.15.2.1 with windows 10 and Centos 7.
qt_win_centos.jpg
Is this something native to the Centos desktop? In any case the addition of
self.setStyleSheet('QComboBox {combobox-popup: 0;}')
in the example removes the two top and bottom arrows. Id just like to understand what exactly is going on here...
Here is the simple example if you have access to linux:
import sys
from PySide2.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QComboBox
from PySide2 import QtCore
class ComboBoxPop(QComboBox):
def showPopup(self):
item_count = self.count()
super().showPopup()
container = self.view().parentWidget()
if item_count > 20:
self.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
container.setFixedHeight(150)
gp = self.mapToGlobal(self.rect().bottomLeft())
container.move(gp)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(100, 100, 400, 200)
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
self.layout = QVBoxLayout()
self.central_widget.setLayout(self.layout)
self.comboBox = ComboBoxPop()
self.comboBox.addItems([f'item_{i}' for i in range(40)])
self.layout.addWidget(self.comboBox)
# linux style to remove scrolling
self.setStyleSheet('QComboBox {combobox-popup: 0;}')
def main():
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()