qscrollarea

Qt - draw inside QScrollArea in a QDialog

假如想象 提交于 2019-12-25 04:24:20
问题 In Qt 5, I have a QDialog window on which I have drawn a circle as follows: void MyDialog::paintEvent(QPaintEvent *pe) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing,true); QPen pen(Qt::blue,2); painter.setPen(pen); QRect r=QRect(0,0,100,100); painter.drawEllipse(r); } If I draw a larger circle, for example by using QRect(0,0,500,500); , the circle being greater than the dialog window is clipped. So I dragged a QScrollArea onto the the dialog window and decide to draw

QLabel showing an image inside a QScrollArea

旧巷老猫 提交于 2019-12-22 05:29:27
问题 I've successfully implemented a Image Viewer (for DICOM) in Qt. I can see the image and I can zoom in and out correctly. Now, I want to see scroll bars if the image is too big to show when I zoom in. I've used the UI. I placed a QScrollArea . Inside, the QLabel . The verticalScrollBarPolicy is ScrollBarAsNeeded . The horizontalScrollBarPolicy is ScrollBarAsNeeded . The problem is: it doesn't work. I zoom in, but no scrollbar appears. Second try: using a layout inside the QScrollArea. So now

How can I make a PyQt widget resizable by dragging?

[亡魂溺海] 提交于 2019-12-22 04:06:31
问题 I have a QScrollArea containing a widget with a QVBoxLayout. Inside this layout are several other widgets. I want the user to be able to drag the lower borders of those widgets to resize them in the vertical direction. When they are resized, I don't want them to "steal" size from the other widgets in the scrolling area; instead I want the entire scrolled "page" to change its size. So if you enlarge one of the widgets, it should push the other widgets down (out of the viewport of the scroll

PyQt QScrollArea not scrolling

元气小坏坏 提交于 2019-12-20 05:15:41
问题 I want to put some elements of my UI in a scroll area as there can be a lot of them. I tried the following peice of code, but the area just keeps growing as I put more elements on it. In the first part I set up a scroll area, a widget and a layout. I apply the layout to the widget and I set the widget to the scrollarea. Then I fill in my layout in an external function. The button under all of it allows to fill more elements in the layout. scrollRow = QtGui.QScrollArea() scrollRow

QScrollArea missing Scrollbar

馋奶兔 提交于 2019-12-17 20:37:14
问题 I think it is the same problem as : QScrollArea resizing QWidget but there are not solution. so let me expose the problem. test 2 inherited from QWidget: composed : vector of QSpinBox QScrollArea QVBoxLayout test2 (QWidget) <- QScrollArea <- QVBoxLayout <- Spinbox Problems : There are no scrollbar [FIXED] The inside of the scrollbar is shrinked to fit so little space nothing can be read (the window can be resized during execution that will cause the inside to get bigger and be readable

qt widen QScrollBar when hover using StyleSheet

徘徊边缘 提交于 2019-12-13 20:10:26
问题 I'm trying to change the width of a vertical QScrollBar with a custom stylesheet like QScrollBar:vertical { border: 2px solid grey; background: #32CC99; width: 10px; margin: 22px 0 22px 0;" } QScrollBar:vertical:hover { background: red; width: 25px ; } It doesn't work. Did I make any mistake? Can't we change the width of widget in run-time? 回答1: I don't think there is a way of doing this by using the stylesheets alone. You could create your own scrollbar and override the enterEvent and

Have tabs keep focus on mousewheel over them in a PyQt5 scrollarea?

家住魔仙堡 提交于 2019-12-13 03:56:07
问题 With the code below, I get a tabbed widget inside a scroll area. The tabs are quite long horizontally, forcing the user to use scrollbar to get to the right, and then click on the rightmost tab chooser, in order to get from tab 1 to, say, tab 5 - I'd like to avoid this with mousewheel. However, I get the following behavior: ... that is: When I use mousewheel over an area of the "page", it scrolls up and down, as expected (and wanted) When I use mousewheel "down" over the area of the tabs,

Qt - QScrollArea - align added widgets to top

纵然是瞬间 提交于 2019-12-12 00:54:34
问题 I have a 150x450 QScrollArea with a VBoxLayout in it. I have to dynamically (while a video is being played, frame by frame) add an unspecified amount of QLabels, ranging from none to hundreds. When I start adding, QLabels start appearing exactly in the middle. Then when another appears, they shift so the middle is exactly between them. So on and so on. How can I make them appear from the very top and just go down? Without shifting positions and wiggling? 回答1: Having hundreds of labels in the

Why is the QScrollArea restricted in size?

血红的双手。 提交于 2019-12-11 14:07:45
问题 To my custom widget, inherited from QWidget , I have added a QScrollArea like this: MainWindow::MainWindow(QWidget *parent) : QWidget(parent)//MainWindow is a QWidget { auto *scrollArea = new QScrollArea(this); auto *widget = new QWidget(this); widget->setStyleSheet("background-color:green"); scrollArea->setWidget(widget); scrollArea->setWidgetResizable(true); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); QVBoxLayout *parentLayout = new QVBoxLayout(widget); this-

QScrollArea::ensureVisible() and QScrollArea::setWidget()

跟風遠走 提交于 2019-12-11 12:18:10
问题 I encountered another problem with QScrollArea , after I got help for the previous one, which was somewhat similar. The problem now is that ensureVisible() does nothing if you create a scroll area and a label, set the label to be the scroll area's widget, and then load an image into the label - after setWidget() : This example illustrates the problem, just replace /path/to/some/image.png with some real image on your computer: QScrollArea *scrollArea = new QScrollArea; QLabel *label = new