本文整理汇总了Python中PyQt5.QtCore.Qt.Vertical方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Vertical方法的具体用法?Python Qt.Vertical怎么用?Python Qt.Vertical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Vertical方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_inspector
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def set_inspector(self, inspector_widget: inspector.AbstractWebInspector,
position: inspector.Position) -> None:
"""Set the position of the inspector."""
assert position != inspector.Position.window
if position in [inspector.Position.right, inspector.Position.bottom]:
self._main_idx = 0
self._inspector_idx = 1
else:
self._inspector_idx = 0
self._main_idx = 1
self.setOrientation(Qt.Horizontal
if position in [inspector.Position.left,
inspector.Position.right]
else Qt.Vertical)
self.insertWidget(self._inspector_idx, inspector_widget)
self._position = position
self._load_preferred_size()
self._adjust_size()
示例2: buttonsLayout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def buttonsLayout(self):
self.matrix = False
vbox = QVBoxLayout()
interactionModeLayout = QVBoxLayout()
self.interactionModeButton = QtWidgets.QPushButton('visma')
self.interactionModeButton.clicked.connect(self.interactionMode)
interactionModeLayout.addWidget(self.interactionModeButton)
interactionModeWidget = QWidget(self)
interactionModeWidget.setLayout(interactionModeLayout)
interactionModeWidget.setFixedSize(275, 50)
topButtonSplitter = QSplitter(Qt.Horizontal)
topButtonSplitter.addWidget(interactionModeWidget)
permanentButtons = QWidget(self)
topButtonSplitter.addWidget(permanentButtons)
self.bottomButton = QFrame()
self.buttonSplitter = QSplitter(Qt.Vertical)
self.buttonSplitter.addWidget(topButtonSplitter)
self.buttonSplitter.addWidget(self.bottomButton)
vbox.addWidget(self.buttonSplitter)
return vbox
示例3: mousePressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def mousePressEvent(self, e):
cr = self._control_rect()
if e.button() == Qt.LeftButton and not cr.contains(e.pos()):
# Set the value to the minimum
value = self.minimum()
# zmax is the maximum value starting from zero
zmax = self.maximum() - self.minimum()
if self.orientation() == Qt.Vertical:
# Add the current position multiplied for value/size ratio
value += (self.height() - e.y()) * (zmax / self.height())
else:
value += e.x() * (zmax / self.width())
if self.value() != value:
self.setValue(value)
self.sliderJumped.emit(self.value())
e.accept()
else:
e.ignore()
else:
super().mousePressEvent(e)
示例4: doLayout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def doLayout(self, rect, testOnly):
x = rect.x()
y = rect.y()
lineHeight = 0
for item in self.itemList:
wid = item.widget()
spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton,
Qt.Horizontal)
spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton,
Qt.Vertical)
nextX = x + item.sizeHint().width() + spaceX
if nextX - spaceX > rect.right() and lineHeight > 0:
x = rect.x()
y = y + lineHeight + spaceY
nextX = x + item.sizeHint().width() + spaceX
lineHeight = 0
if not testOnly:
item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
x = nextX
lineHeight = max(lineHeight, item.sizeHint().height())
return y + lineHeight - rect.y()
示例5: doLayout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def doLayout(self, rect, testOnly):
x = rect.x()
y = rect.y()
lineHeight = 0
for item in self.itemList:
wid = item.widget()
spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
QSizePolicy.PushButton, Qt.Horizontal)
spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
QSizePolicy.PushButton, Qt.Vertical)
nextX = x + item.sizeHint().width() + spaceX
if nextX - spaceX > rect.right() and lineHeight > 0:
x = rect.x()
y = y + lineHeight + spaceY
nextX = x + item.sizeHint().width() + spaceX
lineHeight = 0
if not testOnly:
item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
x = nextX
lineHeight = max(lineHeight, item.sizeHint().height())
return y + lineHeight - rect.y()
示例6: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def __init__(self, *args, **kwargs):
super(DemoWindow, self).__init__(*args, **kwargs)
self.resize(600, 600)
layout = QFormLayout(self)
self.label1 = QLabel('0', self)
layout.addRow(self.label1, ClickJumpSlider(
Qt.Horizontal, valueChanged=lambda v: self.label1.setText(str(v))))
# 横向-反向显示
self.label2 = QLabel('0', self)
layout.addRow(self.label2, ClickJumpSlider(
Qt.Horizontal, invertedAppearance=True,
valueChanged=lambda v: self.label2.setText(str(v))))
self.label3 = QLabel('0', self)
layout.addRow(self.label3, ClickJumpSlider(
Qt.Vertical, minimumHeight=200, valueChanged=lambda v: self.label3.setText(str(v))))
# 纵向反向显示
self.label4 = QLabel('0', self)
layout.addRow(self.label4, ClickJumpSlider(
Qt.Vertical, invertedAppearance=True,
minimumHeight=200, valueChanged=lambda v: self.label4.setText(str(v))))
示例7: data
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def data(self, index, role=None):
row = index.row()
col = index.column()
if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.ToolTipRole:
if self.orientation == Qt.Horizontal:
if type(self.df.columns) == pd.MultiIndex:
return str(self.df.columns.values[col][row])
else:
return str(self.df.columns.values[col])
elif self.orientation == Qt.Vertical:
if type(self.df.index) == pd.MultiIndex:
return str(self.df.index.values[row][col])
else:
return str(self.df.index.values[row])
# The headers of this table will show the level names of the MultiIndex
示例8: sizeHint
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def sizeHint(self):
# Horizontal HeaderView
if self.orientation == Qt.Horizontal:
# Width of DataTableView
width = self.table.sizeHint().width() + self.verticalHeader().width()
# Height
height = 2 * self.frameWidth() # Account for border & padding
for i in range(self.model().rowCount()):
height += self.rowHeight(i)
# Vertical HeaderView
else:
# Height of DataTableView
height = self.table.sizeHint().height() + self.horizontalHeader().height()
# Width
width = 2 * self.frameWidth() # Account for border & padding
for i in range(self.model().columnCount()):
width += self.columnWidth(i)
return QSize(width, height)
# This is needed because otherwise when the horizontal header is a single row it will add whitespace to be bigger
示例9: initUI
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.m = m = PlotCanvas(self, width=5, height=4)
m.move(0,0)
sld = QSlider(Qt.Vertical, self)
sld.setFocusPolicy(Qt.NoFocus)
sld.setGeometry(500, 40, 100, 90)
sld.valueChanged[int].connect(self.changeValue)
# button.setToolTip('This s an example button')
# button.move(500,0)
# button.resize(140,100)
self.show()
示例10: paintEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def paintEvent(self, e):
"""Extend paintEvent to emit a signal if the scroll position changed.
This is a bit of a hack: We listen to repaint requests here, in the
hope a repaint will always be requested when scrolling, and if the
scroll position actually changed, we emit a signal.
QtWebEngine has a scrollPositionChanged signal, so it's not needed
there.
Args:
e: The QPaintEvent.
Return:
The superclass event return value.
"""
frame = self.page().mainFrame()
new_pos = (frame.scrollBarValue(Qt.Horizontal),
frame.scrollBarValue(Qt.Vertical))
if self._old_scroll_pos != new_pos:
self._old_scroll_pos = new_pos
m = (frame.scrollBarMaximum(Qt.Horizontal),
frame.scrollBarMaximum(Qt.Vertical))
perc = (round(100 * new_pos[0] / m[0]) if m[0] != 0 else 0,
round(100 * new_pos[1] / m[1]) if m[1] != 0 else 0)
self.scroll_pos = perc
self.scroll_pos_changed.emit(*perc)
# Let superclass handle the event
super().paintEvent(e)
示例11: to_perc
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def to_perc(self, x=None, y=None):
if x is None and y == 0:
self.top()
elif x is None and y == 100:
self.bottom()
else:
for val, orientation in [(x, Qt.Horizontal), (y, Qt.Vertical)]:
if val is not None:
frame = self._widget.page().mainFrame()
maximum = frame.scrollBarMaximum(orientation)
if maximum == 0:
continue
pos = int(maximum * val / 100)
pos = qtutils.check_overflow(pos, 'int', fatal=False)
frame.setScrollBarValue(orientation, pos)
示例12: up
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def up(self, count=1):
self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)
示例13: down
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def down(self, count=1):
self._key_press(Qt.Key_Down, count, 'scrollBarMaximum', Qt.Vertical)
示例14: page_up
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def page_up(self, count=1):
self._key_press(Qt.Key_PageUp, count, 'scrollBarMinimum', Qt.Vertical)
示例15: at_bottom
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Vertical [as 别名]
def at_bottom(self):
frame = self._widget.page().currentFrame()
return self.pos_px().y() >= frame.scrollBarMaximum(Qt.Vertical)