本文整理匯總了Python中PyQt5.Qt.QDoubleSpinBox.move方法的典型用法代碼示例。如果您正苦於以下問題:Python QDoubleSpinBox.move方法的具體用法?Python QDoubleSpinBox.move怎麽用?Python QDoubleSpinBox.move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.Qt.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.move方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TimeInputLine
# 需要導入模塊: from PyQt5.Qt import QDoubleSpinBox [as 別名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import move [as 別名]
class TimeInputLine(QFrame):
WIDTH = 396
HEIGHT = 43
FRAME_WIDTH = 1
FRAME_MARGIN = 2
ICON_SIZE = 35
ICON_BUTTON_WIDTH = 60
LABEL_SIZE_X = 174
INPUT_SIZE_X = 100
BUTTON_BLOCK_X = 278
STEP = 0.5
MIN_VALUE = 0.1
MAX_VALUE = 10
DECIMAL_COUNT = 1
def __init__(self, parent):
super().__init__(parent)
self.initUI()
def initUI(self):
self.resize(TimeInputLine.WIDTH + TimeInputLine.FRAME_MARGIN*2, TimeInputLine.HEIGHT + TimeInputLine.FRAME_MARGIN*2)
self.setFrameStyle(QFrame.StyledPanel)
self.setLineWidth(TimeInputLine.FRAME_WIDTH)
component_stylesheet = """
.QPushButton {
font-weight: bold;
font-size: 13px;
background-color:#E0E0E0;
}
.QPushButton:pressed {
background-color:#CCCCCC;
}
.QDoubleSpinBox {
font-weight: bold;
font-size: 23px;
}
.QLabel {
font-weight: bold;
font-size: 23px;
}
"""
self.label = QLabel("", self)
self.label.resize(TimeInputLine.LABEL_SIZE_X, TimeInputLine.HEIGHT)
self.label.move(TimeInputLine.FRAME_MARGIN, TimeInputLine.FRAME_MARGIN)
self.label.setStyleSheet(component_stylesheet)
self.label.setAlignment(Qt.AlignCenter)
self.label.show()
self.spinbox = QDoubleSpinBox(self)
self.spinbox.setRange(TimeInputLine.MIN_VALUE, TimeInputLine.MAX_VALUE)
self.spinbox.setValue(TimeInputLine.STEP)
self.spinbox.setSingleStep(TimeInputLine.STEP)
self.spinbox.setDecimals(TimeInputLine.DECIMAL_COUNT)
self.spinbox.resize(TimeInputLine.INPUT_SIZE_X, TimeInputLine.HEIGHT)
self.spinbox.move(TimeInputLine.LABEL_SIZE_X + TimeInputLine.FRAME_MARGIN, TimeInputLine.FRAME_MARGIN)
self.spinbox.setStyleSheet(component_stylesheet)
self.spinbox.show()
self.enter = QPushButton("", self)
self.enter.setIcon(assets.enter)
self.enter.setIconSize(QSize(TimeInputLine.ICON_SIZE, TimeInputLine.ICON_SIZE))
self.enter.resize(TimeInputLine.ICON_BUTTON_WIDTH, TimeInputLine.HEIGHT)
self.enter.move(TimeInputLine.BUTTON_BLOCK_X, TimeInputLine.FRAME_MARGIN)
self.enter.setStyleSheet(component_stylesheet)
self.enter.show()
self.cancel = QPushButton("", self)
self.cancel.setIcon(assets.exit)
self.cancel.setIconSize(QSize(TimeInputLine.ICON_SIZE, TimeInputLine.ICON_SIZE))
self.cancel.resize(TimeInputLine.ICON_BUTTON_WIDTH, TimeInputLine.HEIGHT)
self.cancel.move(TimeInputLine.BUTTON_BLOCK_X + TimeInputLine.ICON_BUTTON_WIDTH, TimeInputLine.FRAME_MARGIN)
self.cancel.setStyleSheet(component_stylesheet)
self.cancel.show()
""" listeners which control what happens on accept and on cancel button presses """
def addAcceptListener(self, onAcceptListener):
self.enter.clicked.connect(onAcceptListener)
def addCancelListener(self, onCancelListener):
self.cancel.clicked.connect(onCancelListener)