Python PyQt5.QtCore.Qt.Vertical() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.Vertical().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: window.py From visma with GNU General Public License v3.0 | 8 votes |
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
Example #2
Source File: flow_layout.py From QssStylesheetEditor with GNU General Public License v3.0 | 7 votes |
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()
Example #3
Source File: webkittab.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
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)
Example #4
Source File: matplotlib_embedded3.py From mmvt with GNU General Public License v3.0 | 6 votes |
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()
Example #5
Source File: dataframe_viewer.py From pandasgui with MIT License | 6 votes |
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
Example #6
Source File: dataframe_viewer.py From pandasgui with MIT License | 6 votes |
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
Example #7
Source File: ClickJumpSlider.py From PyQt with GNU General Public License v3.0 | 6 votes |
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))))
Example #8
Source File: flowlayout.py From PyQt with GNU General Public License v3.0 | 6 votes |
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()
Example #9
Source File: sparrow-wifi.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
def initUI(self): # self.setGeometry(10, 10, 800, 600) self.resize(self.mainWidth, self.mainHeight) self.center() self.setWindowTitle('Sparrow-WiFi Analyzer') self.setWindowIcon(QIcon('wifi_icon.png')) self.createMenu() self.createControls() #self.splitter1 = QSplitter(Qt.Vertical) #self.splitter2 = QSplitter(Qt.Horizontal) #self.splitter1.addWidget(self.networkTable) #self.splitter1.addWidget(self.splitter2) #self.splitter2.addWidget(self.Plot24) #self.splitter2.addWidget(self.Plot5) self.setBlackoutColors() self.setMinimumWidth(800) self.setMinimumHeight(400) self.show() # Set up GPS check timer self.gpsTimer = QTimer() self.gpsTimer.timeout.connect(self.onGPSTimer) self.gpsTimer.setSingleShot(True) self.gpsTimerTimeout = 5000 self.gpsTimer.start(self.gpsTimerTimeout) # Check every 5 seconds
Example #10
Source File: qclickslider.py From linux-show-player with GNU General Public License v3.0 | 6 votes |
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)
Example #11
Source File: qmodels.py From linux-show-player with GNU General Public License v3.0 | 6 votes |
def headerData(self, section, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Horizontal: if section < len(self.columns): return self.columns[section] else: return section + 1 if role == Qt.SizeHintRole and orientation == Qt.Vertical: return 0
Example #12
Source File: webview.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
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)
Example #13
Source File: ObjList.py From KStock with GNU General Public License v3.0 | 6 votes |
def headerData(self, section, orientation, role = Qt.DisplayRole): if role != Qt.DisplayRole: return None if ((orientation == Qt.Horizontal) and self.isRowObjects) or ((orientation == Qt.Vertical) and not self.isRowObjects): # Display property headers. try: return self.properties[section]['header'] # Property header. except (IndexError, KeyError): return None else: # Display object indices (1-based). return (section + 1) if (0 <= section < len(self.objects)) else None
Example #14
Source File: miscwidgets.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
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()
Example #15
Source File: webkittab.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def at_bottom(self): frame = self._widget.page().currentFrame() return self.pos_px().y() >= frame.scrollBarMaximum(Qt.Vertical)
Example #16
Source File: TableView.py From urh with GNU General Public License v3.0 | 5 votes |
def resize_vertical_header(self): num_rows = self.model().rowCount() if self.isVisible() and num_rows > 0: hd = self.model().headerData max_len = np.max([len(str(hd(i, Qt.Vertical, Qt.DisplayRole))) for i in range(num_rows)]) w = (self.font().pointSize() + 2) * max_len # https://github.com/jopohl/urh/issues/182 rh = self.verticalHeader().defaultSectionSize() for i in range(num_rows): self.verticalHeader().resizeSection(i, w) self.setRowHeight(i, rh) if i % 10 == 0: QApplication.instance().processEvents()
Example #17
Source File: TableModel.py From urh with GNU General Public License v3.0 | 5 votes |
def headerData(self, section: int, orientation, role=Qt.DisplayRole): if orientation == Qt.Vertical: if role == Qt.DisplayRole: return self.vertical_header_text[section] elif role == Qt.BackgroundColorRole: return self.vertical_header_colors[section] elif role == Qt.TextColorRole: color = self.vertical_header_colors[section] if color: red, green, blue = color.red(), color.green(), color.blue() return QColor("black") if (red * 0.299 + green * 0.587 + blue * 0.114) > 186 else QColor("white") else: return None return super().headerData(section, orientation, role)
Example #18
Source File: webkittab.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def up(self, count=1): self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)
Example #19
Source File: dataframe_viewer.py From pandasgui with MIT License | 5 votes |
def on_selectionChanged(self): """ Runs when cells are selected in the Header. This selects columns in the data table when the header is clicked, and then calls selectAbove() """ # Check focus so we don't get recursive loop, since headers trigger selection of data cells and vice versa if self.hasFocus(): dataView = self.parent.dataView # Set selection mode so selecting one row or column at a time adds to selection each time if self.orientation == Qt.Horizontal: # This case is for the horizontal header # Get the header's selected columns selection = self.selectionModel().selection() # Removes the higher levels so that only the lowest level of the header affects the data table selection last_row_ix = self.df.columns.nlevels - 1 last_col_ix = self.model().columnCount() - 1 higher_levels = QtCore.QItemSelection(self.model().index(0, 0), self.model().index(last_row_ix - 1, last_col_ix)) selection.merge(higher_levels, QtCore.QItemSelectionModel.Deselect) # Select the cells in the data view dataView.selectionModel().select(selection, QtCore.QItemSelectionModel.Columns | QtCore.QItemSelectionModel.ClearAndSelect) if self.orientation == Qt.Vertical: selection = self.selectionModel().selection() last_row_ix = self.model().rowCount() - 1 last_col_ix = self.df.index.nlevels - 1 higher_levels = QtCore.QItemSelection(self.model().index(0, 0), self.model().index(last_row_ix, last_col_ix - 1)) selection.merge(higher_levels, QtCore.QItemSelectionModel.Deselect) dataView.selectionModel().select(selection, QtCore.QItemSelectionModel.Rows | QtCore.QItemSelectionModel.ClearAndSelect) self.selectAbove() # Take the current set of selected cells and make it so that any spanning cell above a selected cell is selected too # This should happen after every selection change
Example #20
Source File: dataframe_viewer.py From pandasgui with MIT License | 5 votes |
def headerData(self, section, orientation, role=None): if role in [QtCore.Qt.DisplayRole, QtCore.Qt.ToolTipRole]: if self.orientation == Qt.Horizontal and orientation == Qt.Vertical: if type(self.df.columns) == pd.MultiIndex: return str(self.df.columns.names[section]) else: return str(self.df.columns.name) elif self.orientation == Qt.Vertical and orientation == Qt.Horizontal: if type(self.df.index) == pd.MultiIndex: return str(self.df.index.names[section]) else: return str(self.df.index.name) else: return None # These cells should be hidden anyways
Example #21
Source File: webkittab.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def down(self, count=1): self._key_press(Qt.Key_Down, count, 'scrollBarMaximum', Qt.Vertical)
Example #22
Source File: dataframe_viewer.py From pandasgui with MIT License | 5 votes |
def rowCount(self, parent=None): if self.orientation == Qt.Horizontal: return self.df.columns.nlevels elif self.orientation == Qt.Vertical: return self.df.index.shape[0]
Example #23
Source File: dataframe_viewer.py From pandasgui with MIT License | 5 votes |
def columnCount(self, parent=None): if self.orientation == Qt.Horizontal: return self.df.columns.shape[0] else: # Vertical return self.df.index.nlevels
Example #24
Source File: DreamTree.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.setAttribute(Qt.WA_TranslucentBackground, True) # 设置父控件Widget背景透明 self.setWindowFlags(Qt.FramelessWindowHint) # 去掉边框 palette = self.palette() palette.setBrush(QPalette.Base, Qt.transparent) # 父控件背景透明 self.setPalette(palette) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) # QWebSettings.globalSettings().setAttribute( # QWebSettings.DeveloperExtrasEnabled, True)# web开发者工具 self.webView = QWebView(self) # 网页控件 layout.addWidget(self.webView) self.webView.setContextMenuPolicy(Qt.NoContextMenu) # 去掉右键菜单 self.mainFrame = self.webView.page().mainFrame() self.mainFrame.setScrollBarPolicy( Qt.Vertical, Qt.ScrollBarAlwaysOff) # 去掉滑动条 self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) # 最大化 rect = app.desktop().availableGeometry() self.resize(rect.size()) self.webView.resize(rect.size())
Example #25
Source File: PageSwitching.py From PyQt with GNU General Public License v3.0 | 5 votes |
def setOrientation(self, checked): hor = self.sender() == self.radioButtonHor if checked: self.stackedWidget.setOrientation( Qt.Horizontal if hor else Qt.Vertical)
Example #26
Source File: webkittab.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def page_up(self, count=1): self._key_press(Qt.Key_PageUp, count, 'scrollBarMinimum', Qt.Vertical)
Example #27
Source File: PaintQSlider.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.setAttribute(Qt.WA_StyledBackground, True) layout = QVBoxLayout(self) layout.addWidget(PaintQSlider(Qt.Vertical, self, minimumWidth=90)) layout.addWidget(PaintQSlider(Qt.Horizontal, self, minimumHeight=90))
Example #28
Source File: QssQSlider.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.setAttribute(Qt.WA_StyledBackground, True) layout = QVBoxLayout(self) layout.addWidget(QSlider(Qt.Vertical, self)) layout.addWidget(QSlider(Qt.Horizontal, self))
Example #29
Source File: wallet_data_models.py From dash-masternode-tool with MIT License | 5 votes |
def headerData(self, column, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Vertical: idx = self.index(column, 0) if idx.isValid(): idx = self.mapFromSource(idx) return str(idx.row() + 1) else: return ExtSortFilterTableModel.headerData(self, column, orientation, role)
Example #30
Source File: tabmodel_z6.py From python101 with MIT License | 5 votes |
def headerData(self, sekcja, kierunek, rola=Qt.DisplayRole): """ Zwraca nagłówki kolumn """ if rola == Qt.DisplayRole and kierunek == Qt.Horizontal: return self.pola[sekcja] elif rola == Qt.DisplayRole and kierunek == Qt.Vertical: return sekcja + 1 else: return QVariant()