qscrollarea

Custom Widget in QScrollArea Badly Redrawing Only on Scroll

我只是一个虾纸丫 提交于 2019-12-11 12:08:58
问题 I'm trying to get a custom scrolling widget in QT, and I'm getting redraw errors on scroll. Alt-tab or other redrawing events redraw correctly. I'm basing it on the example at http://doc.qt.io/qt-5/qtwidgets-widgets-charactermap-example.html repeatingwidget.cpp (excerpt): QSize RepeatingWidget::sizeHint() const { return QSize(500, itemHeight * displayItems.size() + 1); } void RepeatingWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.fillRect(event->rect(), QBrush(Qt:

Insert a scrollbar in a qt widget using qtcreator

自古美人都是妖i 提交于 2019-12-11 11:59:01
问题 I have created my own widget that I'm going to put into another widget from code. The form widget are created with qtCreator. I have arranged the "subwidgets" into a verticalLayout in order to put one under the other, but since the number of the inserted widget is not fixed I need to have a scrollbar. So I have placed my verticalLayout into a scrollArea, but the scrollbar never appears, why? the structure "father->child" is the following: formWidget->scrollArea->verticalLayout Thanks EDIT:

How to know if QListWidgetItem is hidden by scroll?

删除回忆录丶 提交于 2019-12-11 06:43:12
问题 Well, i'm newbie in Qt and i have a problem. I have a QListWidget in my UI with 7 items, just 4 items are showed and the other are showed after to use scrollbar. I want to show a arrow image above and below QListWidet than will show than there are more items to scroll. Ok, i can to see if a item is hidden, but just if it is hidden by setHidden() function. And when is it hidden by scroll? Can i see this in run time? Because the item is there, but scroll is hiding it, right? I searched some

QLabel::setPixmap() and QScrollArea::setWidget()

送分小仙女□ 提交于 2019-12-10 11:28:55
问题 I've been tracking down a bug that boils down to this - if you show an image label inside a scroll area, the label will not be resized to the image's size if QLabel::setPixmap() is called after QScrollArea::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 QLabel(scrollArea); scrollArea->setWidget(label); label->setPixmap(QPixmap("/path/to/some/image.png

How can i make widgets overflow to make a scrollbar appear in Qt?

99封情书 提交于 2019-12-10 04:24:55
问题 The structure of my widgets is : QWidget customized to be a panel with rounded borders. To contain an area with scrollbar inside the borders with a margin, then I put this inside: QScrollArea with a QVBoxLayout (vertically adding content) Then I add inside of it a series of : QGroupBox with title with spacing 0, and a QFormLayout The formlayout doesn´t work as I thought it would. The widgets inside are the labels + spinboxes, all of them. Here's an image: First. They are not centered. I don´t

QScrollArea not respecting contentMargins setting

旧城冷巷雨未停 提交于 2019-12-08 10:32:06
问题 QScrollArea, for some reason, is ignoring the contentMargins setting when I set QGraphicsView as its widget. Looking at the snippet below, can someone please tell if I'm doing something wrong or it could be a bug in the SDK? Snippet 1 (works perfect): QWidget *appWindow = new QWidget; QScrollArea *sa = new QScrollArea(appWindow); sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); sa->setContentMargins(50, 50, 50, 50); QWidget

GridLayout+ScrollArea widget position after size change

五迷三道 提交于 2019-12-08 07:39:24
问题 I have a scrollArea with a gridlayout inside it, and i add QLabels to it with images. When the application starts it works fine and displays the labels correctly: Note: i calculate how many labels fit on the current layout space. If i maximize it works fine too: But when i hit restore something weird happens: You can see that only 6 labels are added (the same as in the first Screen shot) but here they are all positioned overlapping each other. This is the initialization code for the

QScrollArea not working as expected with QWidget and QVBoxLayout

帅比萌擦擦* 提交于 2019-12-05 11:26:31
So I have this QFrame which is the parent widget (represented by this in the code). In this widget, I want to place a QWidget at 10 px from top (and 10 px from bottom, as a result of which it will have a height of 140px, whereas parent is 160px). The QWidget will have a number of custom buttons inside it in a vertical layout, in a scroll area, so that when the height of the buttons combined exceeds the QWidget's height (140px), scroll sets in automatically. Because the scroll is not for the entire parent widget, but only for a child widget, the scroll should apply only to the child widget here

How can i make widgets overflow to make a scrollbar appear in Qt?

荒凉一梦 提交于 2019-12-05 08:39:18
The structure of my widgets is : QWidget customized to be a panel with rounded borders. To contain an area with scrollbar inside the borders with a margin, then I put this inside: QScrollArea with a QVBoxLayout (vertically adding content) Then I add inside of it a series of : QGroupBox with title with spacing 0, and a QFormLayout The formlayout doesn´t work as I thought it would. The widgets inside are the labels + spinboxes, all of them. Here's an image: First. They are not centered. I don´t know why. Second. They are all given the same fixed size, as I told them, but they are piled anyway,

Show several plots in a scrollable widget with PyQt and matplotlib

蹲街弑〆低调 提交于 2019-12-05 08:03:21
问题 Since I didn't get an answer for this question I tried solving it with PyQt. Apparently, it's not that easy, when QScrollArea is involved... I wrote a small test that basically does what I'm looking for, but it's not showing the scroll area and the plots inside it as I expected: from PyQt4 import QtCore, QtGui import os,sys #import matplotlib from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg