def __init__(self, parent=None):
QtWidgets.QListWidget.__init__(self, parent)
# Get parent
self.parent = parent
# List font
self.listFont = QtGui.QFont("Caviar Dreams")
self.listFont.setPointSize(14)
self.listFont.setBold(False)
self.listFont.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, 1.0)
# Customize the widgets
self.setFocusPolicy(QtCore.Qt.NoFocus)
self.setFont(self.listFont)
self.horizontalScrollBar().setVisible(False)
self.setIconSize(QtCore.QSize(50, 50))
self.setFlow(QtWidgets.QListView.TopToBottom)
# Design icon
self.designIcon = QtGui.QIcon()
self.designIcon.addPixmap(QtGui.QPixmap(":/resources/design.png"), QtGui.QIcon.Normal)
self.designIcon.addPixmap(QtGui.QPixmap(":/resources/design_selected.png"), QtGui.QIcon.Selected)
"""
# Table?icon
self.tableIcon = QtGui.QIcon()
self.tableIcon.addPixmap(QtGui.QPixmap(":/resources/table.png"), QtGui.QIcon.Normal)
self.tableIcon.addPixmap(QtGui.QPixmap(":/resources/table_selected.png"), QtGui.QIcon.Selected)
"""
# Other icon
self.otherIcon = QtGui.QIcon()
self.otherIcon.addPixmap(QtGui.QPixmap(":/resources/other.png"), QtGui.QIcon.Normal)
self.otherIcon.addPixmap(QtGui.QPixmap(":/resources/other_selected.png"), QtGui.QIcon.Selected)
# Add design items
self.designItem = QtWidgets.QListWidgetItem(self.designIcon, "Design")
# self.tableItem = QtWidgets.QListWidgetItem(self.tableIcon, "Table")
self.otherItem = QtWidgets.QListWidgetItem(self.otherIcon, "Analyze")
# Add items to the list widget
self.addItem(self.designItem)
# self.addItem(self.tableItem)
self.addItem(self.otherItem)
# Stylesheet
self.setStyleSheet("QListWidget{min-width: 100px; border:none; border-top:2px solid #4da8e8; color:#ffffff; margin: 0 0 0 0; padding: 0 0 0 0; text-align:center;} QListWidget::item{border-bottom: 2px solid #4da8e8; padding:15px 25px 15px 25px; margin: 0 0 0 0; text-align: center; background:#399ee5; color:#ffffff;} QListWidget::item:hover{border:none; background:#45c8dc; font-weight:bold;} QListWidget::item:selected{border:none; border-left: 6px solid #fa7064; background:#ffffff; color:#fa7064; font-weight:bold;} QListWidget::icon{margin: 0 0 0 0; padding: 0 20px 0 0;} QLabel{background:transparent; border: none; font-size: 15pt; color:#ffffff; font-family:'Segoe UI';}")
# Action
# Select the tab, change the layout
self.currentRowChanged.connect(self.changeLayout)
# Change color
BATS.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录