self.tree = QTreeWidget() self.tree.setColumnCount(5) self.tree.setHeaderLabels(['基金代码','基金名称','买入金额','预估涨幅','预估时间'])
#window系统提供的模式 model=QDirModel() #创建一个QTreeView的控件 tree=QTreeView() #为控件添加模式 tree.setModel(model)
setStyleSheet("QTreeView::branch::hover{background-color:red;} QTreeView::item::hover{background-color:red;} QTreeView::branch::selected{background-color:green;} QTreeView::item::selected{background-color:green;} ");