def __init__(self): super(Window, self).__init__() self.setObjectName('MainWindow') self.setWindowFlags(Qt.FramelessWindowHint) self.setWindowIcon(QIcon('resource/format.ico')) self.setWindowTitle("Music") with open('QSS/window.qss', 'r') as f: self.setStyleSheet(f.read()) self.resize(1022, 670) self.header = Header(self) self.navigation = Navigation(self) self.playWidgets = PlayWidgets(self) self.detailSings = DetailSings(self) self.mainContent = MainContent(self) self.nativeMusic = NativeMusic(self) self.searchArea = SearchArea(self) self.mainContents = QTabWidget() self.mainContents.tabBar().setObjectName("mainTab") self.systemTray = SystemTray('resource/logo.png', self) # 加载tab设置。 self.setContents() # 添加各类网站的歌单。 self.addAllPlaylist() # 设置布局小细线。 self.setLines() # 设置布局。 self.setLayouts() # 注册功能。 self.configFeatures()
def setTray(self): self.systemTray = SystemTray(self, 'icons/dictionary.png') self.systemTray.setToolTip("Dictionary!") self.systemTray.activated.connect( lambda: self.show() and self.activateWindow()) closeAction = QAction('退出', self, triggered=self.close) self.systemTray.addAction(closeAction) self.systemTray.show()