コード例 #1
0
ファイル: FormParams.py プロジェクト: avladev/transit-gui
class RangeDialog(QDialog):

    def __init__(self, title):
        QDialog.__init__(self, None, Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint)

        self.setFixedWidth(220)
        self.setWindowTitle(title)
        self.setModal(True)

        self.ok_button = QPushButton('OK')
        self.ok_button.setDefault(True)
        self.ok_button.clicked.connect(self.accept)

        self.cancel_button = QPushButton('Cancel')
        self.cancel_button.clicked.connect(self.reject)

        frame = QFrame();
        frame.setFrameShape(QFrame.HLine)
        frame.setFrameShadow(QFrame.Sunken)
        frame.setFixedHeight(10)

        hl = QHBoxLayout()
        hl.addWidget(self.ok_button, 1, Qt.AlignLeft)
        hl.addWidget(self.cancel_button, 0, Qt.AlignRight)

        vl = QVBoxLayout()
        vl.addWidget(frame)
        vl.addLayout(hl)

        self.setLayout(vl)

    def display(self):
        self.exec_()
コード例 #2
0
ファイル: FormParams.py プロジェクト: acshu/transit-gui
class RangeDialog(QDialog):
    def __init__(self, title):
        QDialog.__init__(
            self, None,
            Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint)

        self.setFixedWidth(220)
        self.setWindowTitle(title)
        self.setModal(True)

        self.ok_button = QPushButton('OK')
        self.ok_button.setDefault(True)
        self.ok_button.clicked.connect(self.accept)

        self.cancel_button = QPushButton('Cancel')
        self.cancel_button.clicked.connect(self.reject)

        frame = QFrame()
        frame.setFrameShape(QFrame.HLine)
        frame.setFrameShadow(QFrame.Sunken)
        frame.setFixedHeight(10)

        hl = QHBoxLayout()
        hl.addWidget(self.ok_button, 1, Qt.AlignLeft)
        hl.addWidget(self.cancel_button, 0, Qt.AlignRight)

        vl = QVBoxLayout()
        vl.addWidget(frame)
        vl.addLayout(hl)

        self.setLayout(vl)

    def display(self):
        self.exec_()