qscrollarea

How to use QScrollArea to make scrollbars appear

青春壹個敷衍的年華 提交于 2021-01-19 08:02:19
问题 I am trying to create a scroll area with a vertical layout using pyqt5, and I am putting inside some labels. I know that even if it is a vertical layout it is supposed to scroll horizontally if the text does not fit. But no matter what I try it does not let me scroll. This is the code I am using: class window(QMainWindow): def __init__(self): super(window, self).__init__() self.setGeometry(300, 300, 803, 520) self.init_ui() def init_ui(self): self.teacher_box = QScrollArea(self) self.teacher

PyQt5 QScrollArea widget with dynamically created GroupBoxes

时光总嘲笑我的痴心妄想 提交于 2020-12-26 13:58:44
问题 I'm trying to make a toolbox widget that will do various different things. But I'm having trouble with the layout management regarding the QScrollArea. Following the stripped version of the code I have: from PyQt5 import QtWidgets import sys class MyScrollWidget(QtWidgets.QWidget): def __init__(self): super(MyScrollWidget, self).__init__() scrollArea = QtWidgets.QScrollArea(self) top_widget = QtWidgets.QWidget() top_layout = QtWidgets.QVBoxLayout() for i in range(10): group_box = QtWidgets

PyQt5 QScrollArea widget with dynamically created GroupBoxes

送分小仙女□ 提交于 2020-12-26 13:39:23
问题 I'm trying to make a toolbox widget that will do various different things. But I'm having trouble with the layout management regarding the QScrollArea. Following the stripped version of the code I have: from PyQt5 import QtWidgets import sys class MyScrollWidget(QtWidgets.QWidget): def __init__(self): super(MyScrollWidget, self).__init__() scrollArea = QtWidgets.QScrollArea(self) top_widget = QtWidgets.QWidget() top_layout = QtWidgets.QVBoxLayout() for i in range(10): group_box = QtWidgets

How to hide scrollbar in QScrollArea?

不打扰是莪最后的温柔 提交于 2020-06-09 05:24:12
问题 How can one hide the scrollbars in a QScrollArea ? Currently I use the hide() method on the scrollbars returned by QScrollArea::horizontalScrollBar() and QScrollArea::verticalScrollBar() but the space reserved for scrollbars still remains. Obviously this looks very ugly and is not space efficient. If I remove the scrollbars altogether I can no longer easily scroll to a specific point using QScrollBar::setValue() . 回答1: Use this code: QAbstractScrollArea::setHorizontalScrollBarPolicy( Qt:

How to hide scrollbar in QScrollArea?

橙三吉。 提交于 2020-05-05 17:10:10
问题 How can one hide the scrollbars in a QScrollArea ? Currently I use the hide() method on the scrollbars returned by QScrollArea::horizontalScrollBar() and QScrollArea::verticalScrollBar() but the space reserved for scrollbars still remains. Obviously this looks very ugly and is not space efficient. If I remove the scrollbars altogether I can no longer easily scroll to a specific point using QScrollBar::setValue() . 回答1: Use this code: QAbstractScrollArea::setHorizontalScrollBarPolicy( Qt:

PyQt5: QScrollArea Keep Pixmap Aspect Ratio

て烟熏妆下的殇ゞ 提交于 2020-02-06 11:22:27
问题 I've created a set of pixmap buttons (PicButton) using QAbstractButton based on this https://stackoverflow.com/a/2714554/6859682 and want to add them in a scroll area such that the user can scroll horizontally. However, I need Aspect ratio of the pixmap buttons to be constant The pixmap buttons should always occupy the full height of the window upto 200 px. The issue with my current code is that the pixmap buttons get squeezed when the height becomes too much. I was able to get the aspect

How to change the size of a QScrollBar's arrows?

丶灬走出姿态 提交于 2020-01-16 06:08:24
问题 Some time ago I posted this question trying to understand how could I change the size of a QScrollBar. I was able, at the end, to do what I wanted with the stylesheet code: setStyleSheet("QScrollBar:vertical { width: 30px; };"); The problem is that, although the width of the scroll bar do change with the code above, the height of the up and down arrow widgets continues to be the same; they don't adjust automatically with the increase in width. So what I get now are two very flat up and down

PyQt QScrollArea no scrollarea

情到浓时终转凉″ 提交于 2020-01-07 09:24:48
问题 I have class View(QtWidgets.QLabel): def __init__(self): super(View,self).__init__() self.cropLabel = QtWidgets.QLabel(self) self.label = QtWidgets.QLabel(self) self.ogpixmap = QtGui.QPixmap() fileName = r'C:/Users/user11.HPO-SAMAT/Pictures/Lake.jpg' image = QtGui.QImage(fileName) self.pixmap = QtGui.QPixmap.fromImage(image) self.label.setPixmap(self.pixmap) self.label.adjustSize() and then I call this class: class Viewer(QtWidgets.QMainWindow): def __init__(self): super().__init__() self

QScrollArea in Qml: Flickable + QQuickPaintedItem

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 10:33:39
问题 I'm trying to realize something similiar to QScrollArea (in widgets world) with the help of Qml. I decided to probe Flickable plus QQuickPaintedItem based item (named Drawer in my case): Flickable { ... onContentXChanged(): { drawer.update() } Drawer { id: drawer ... } Drawer's render target is set to FrameBufferObject . Its paint function looks like this: void Drawer::paint(QPainter *painter) { // Some function to compute rect which is needed to be redrawn QRect updateRect =

QScrollArea in Qml: Flickable + QQuickPaintedItem

☆樱花仙子☆ 提交于 2020-01-02 10:33:29
问题 I'm trying to realize something similiar to QScrollArea (in widgets world) with the help of Qml. I decided to probe Flickable plus QQuickPaintedItem based item (named Drawer in my case): Flickable { ... onContentXChanged(): { drawer.update() } Drawer { id: drawer ... } Drawer's render target is set to FrameBufferObject . Its paint function looks like this: void Drawer::paint(QPainter *painter) { // Some function to compute rect which is needed to be redrawn QRect updateRect =