WIP V3: remove redundant test.py
This commit is contained in:
parent
813588e8e9
commit
9b682564ee
33
test.py
33
test.py
@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
from PyQt5 import QtGui, QtWidgets
|
|
||||||
|
|
||||||
|
|
||||||
class TabBar(QtWidgets.QTabBar):
|
|
||||||
def paintEvent(self, event):
|
|
||||||
painter = QtWidgets.QStylePainter(self)
|
|
||||||
option = QtWidgets.QStyleOptionTab()
|
|
||||||
for index in range(self.count()):
|
|
||||||
self.initStyleOption(option, index)
|
|
||||||
bgcolor = QtGui.QColor(self.tabText(index))
|
|
||||||
option.palette.setColor(QtGui.QPalette.Window, bgcolor)
|
|
||||||
painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, option)
|
|
||||||
painter.drawControl(QtWidgets.QStyle.CE_TabBarTabLabel, option)
|
|
||||||
|
|
||||||
|
|
||||||
class Window(QtWidgets.QTabWidget):
|
|
||||||
def __init__(self):
|
|
||||||
QtWidgets.QTabWidget.__init__(self)
|
|
||||||
self.setTabBar(TabBar(self))
|
|
||||||
for color in "tomato orange yellow lightgreen skyblue plum".split():
|
|
||||||
self.addTab(QtWidgets.QWidget(self), color)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import sys
|
|
||||||
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
|
||||||
window = Window()
|
|
||||||
window.resize(420, 200)
|
|
||||||
window.show()
|
|
||||||
sys.exit(app.exec_())
|
|
||||||
Loading…
Reference in New Issue
Block a user