def __init__(self, parent, index):
super(TimestampDialog, self).__init__(parent)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowFlags(dialogwindowflags)
self.setWindowTitle(_("Timestamp"))
self.index = index
self.timestampdialoglayout = QVBoxLayout()
self.groupboxlayout = QHBoxLayout()
self.layout_h = QHBoxLayout()
self.layout_h.setContentsMargins(1, 1, 1, 1)
self.layout_m = QHBoxLayout()
self.layout_m.setContentsMargins(1, 1, 1, 1)
self.layout_s = QHBoxLayout()
self.layout_s.setContentsMargins(1, 1, 1, 1)
self.groupbox_h = QGroupBox(_("Hours"), self)
self.groupbox_m = QGroupBox(_("Minutes"), self)
self.groupbox_s = QGroupBox(_("Seconds"), self)
self.spinbox_h = QSpinBox(self)
self.spinbox_h.setMinimum(0)
self.spinbox_h.setMaximum(99)
self.spinbox_m = QSpinBox(self)
self.spinbox_m.setMinimum(0)
self.spinbox_m.setMaximum(59)
self.spinbox_s = QSpinBox(self)
self.spinbox_s.setMinimum(0)
self.spinbox_s.setMaximum(59)
self.layout_h.addWidget(self.spinbox_h)
self.layout_m.addWidget(self.spinbox_m)
self.layout_s.addWidget(self.spinbox_s)
self.groupbox_h.setLayout(self.layout_h)
self.groupbox_m.setLayout(self.layout_m)
self.groupbox_s.setLayout(self.layout_s)
self.groupboxlayout.addWidget(self.groupbox_h)
self.groupboxlayout.addWidget(self.groupbox_m)
self.groupboxlayout.addWidget(self.groupbox_s)
self.acceptbutton = QPushButton(_("OK"), self)
self.acceptbutton.clicked.connect(self.clickedAcceptButton)
self.timestampdialoglayout.addLayout(self.groupboxlayout)
self.timestampdialoglayout.addWidget(self.acceptbutton)
self.timestampdialoglayout.setAlignment(self.groupboxlayout, Qt.AlignHCenter)
self.timestampdialoglayout.setAlignment(self.acceptbutton, Qt.AlignHCenter)
self.setLayout(self.timestampdialoglayout)
timestamp = commentmodel.item(commentlistview.selectedIndexes()[0].row(), 0).text()
str_h, str_m, str_s = timestamp.split(":")
self.spinbox_h.setValue(int(str_h))
self.spinbox_m.setValue(int(str_m))
self.spinbox_s.setValue(int(str_s))
评论列表
文章目录