我正在使用简单的antd table。我试图通过应用CSS来更改宽度/显示的滚动条外观。目前,如果您会看到我在这里准备的小型演示,
您希望滚动条始终显示如下:
我只想在用户将鼠标悬停在桌子上时显示滚动条。这是怎么做的?我正在尝试解决滚动条的行为,但是这样做时并没有任何改变(也在共享链接的index.css中):
class Mywindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(Mywindow, self).__init__(parent)
self.setMinimumSize(QtCore.QSize(1200,800))
self.setWindowTitle('MdiArea')
self.groupone = QtWidgets.QTextEdit()
self.grouptwo = QtWidgets.QListWidget()
self.groupthree = QtWidgets.QTextEdit()
self.groupfour = QtWidgets.QListWidget()
self.V_Splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
self.V_Splitter.addWidget(self.groupone)
self.V_Splitter.addWidget(self.grouptwo)
self.viewSplitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
self.viewSplitter.addWidget(self.groupthree)
self.viewSplitter.addWidget(self.groupfour)
self.mainSplitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
self.mainSplitter.addWidget(self.V_Splitter)
self.mainSplitter.addWidget(self.viewSplitter)
self.setCentralWidget(self.mainSplitter)
self.mainSplitter.setStretchFactor(0, 1)
self.mainSplitter.setStretchFactor(1, 5)
self.viewSplitter.setStretchFactor(0, 1)
self.viewSplitter.setStretchFactor(1, 1)
# Center window
qtRectangle = self.frameGeometry()
centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center()
qtRectangle.moveCenter(centerPoint)
self.move(qtRectangle.topLeft())
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
app.setStyle('Fusion')
sim = Mywindow()
sim.showMaximized()
sys.exit(app.exec_())
当有人将鼠标悬停在桌子上时,我怎么只有滚动条?
为方便起见,我也在这里共享代码:
classification_report(y_true, y_pred, target_names=target_names, output_dict=True)
无效的CSS:
.ant-spin-nested-loading::-webkit-scrollbar {
background-color: unset;
display: block;
width: 0.1px;
}
答案 0 :(得分:0)
此CSS应该可以工作,并且可以在多种浏览器中兼容,而不仅仅是支持Webkit前缀的浏览器。
.ant-table-body{
overflow-y: hidden!important;
}
.ant-table-body:hover{
overflow-y: scroll!important;
}