qscrollarea

QLabel showing an image inside a QScrollArea

只谈情不闲聊 提交于 2019-12-05 07:18:33
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 there's a QWidget between the QScrollArea and the QLabel: a horizontal layout. Opened the same image,

Show several plots in a scrollable widget with PyQt and matplotlib

倖福魔咒の 提交于 2019-12-03 21:56: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 as NavigationToolbar from matplotlib.figure import Figure qapp = QtGui.QApplication(sys.argv) qwidget =

QSpinBox inside a QScrollArea: How to prevent Spin Box from stealing focus when scrolling?

孤者浪人 提交于 2019-12-03 11:00:49
问题 I have a control with several QSpinBox objects inside a QScrollArea. All works fine when scrolling in the scroll area unless the mouse happens to be over one of the QSpinBoxes. Then the QSpinBox steals focus and the wheel events manipulate the spin box value rather than scrolling the scroll area. I don't want to completely disable using the mouse wheel to manipulate the QSpinBox, but I only want it to happen if the user explicitly clicks or tabs into the QSpinBox. Is there a way to prevent

QSpinBox inside a QScrollArea: How to prevent Spin Box from stealing focus when scrolling?

柔情痞子 提交于 2019-12-03 02:34:27
I have a control with several QSpinBox objects inside a QScrollArea. All works fine when scrolling in the scroll area unless the mouse happens to be over one of the QSpinBoxes. Then the QSpinBox steals focus and the wheel events manipulate the spin box value rather than scrolling the scroll area. I don't want to completely disable using the mouse wheel to manipulate the QSpinBox, but I only want it to happen if the user explicitly clicks or tabs into the QSpinBox. Is there a way to prevent the QSpinBox from stealing the focus from the QScrollArea? As said in a comment to an answer below,

How to make a scroll area hide?

£可爱£侵袭症+ 提交于 2019-12-02 15:32:31
问题 I Am making a user interface for a robot and the scroll area is going to be for a camera I want the scroll area to hide when I click on the options menu tab called Gantry In short what command should I use to make a scroll area hide the same way that it is working for the other widgets I have on this program #include "widget.h" #include "ui_widget.h" #include <QCamera> #include <QCameraViewfinder> #include <QCameraImageCapture> #include <QVBoxLayout> #include <QMenu> #include <QAction>

How to make a scroll area hide?

亡梦爱人 提交于 2019-12-02 09:50:53
I Am making a user interface for a robot and the scroll area is going to be for a camera I want the scroll area to hide when I click on the options menu tab called Gantry In short what command should I use to make a scroll area hide the same way that it is working for the other widgets I have on this program #include "widget.h" #include "ui_widget.h" #include <QCamera> #include <QCameraViewfinder> #include <QCameraImageCapture> #include <QVBoxLayout> #include <QMenu> #include <QAction> #include <QFileDialog> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi

How to create a button for each element in a list and put it in a scroll-area?

点点圈 提交于 2019-12-02 09:26:08
I have a list which gets one element each time user opens a file. I need to create a button with the file's name (element from the list), each time this file is appended to a list, and put this button into a scroll-area. The problem is that I always have only one button, that just changes its name: filenames = [] def addfiles(): fileName = QtGui.QFileDialog.getOpenFileName() fileDirectory = unicode(fileName) global filenames filenames.append(fileDirectory) button = QtGui.QPushButton(os.path.basename(fileDirectory)) window.scrollArea.setWidget(button) I know that the problem is that I add the

PyQt QScrollArea not scrolling

允我心安 提交于 2019-12-02 03:04:55
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.setMaximumSize(600, 400) self.rowAssetWidget = QtGui.QWidget() self.rowAssetLayout = QtGui.QGridLayout() self

How do i resize the contents of a QScrollArea as more widgets are placed inside

孤人 提交于 2019-11-28 23:05:17
I have a QScrollArea Widget, which starts empty; It has a vertical layout, with a QGridLayout, and a vertical spacer to keep it at the top, and prevent it from stretching over the whole scroll area; Elsewhere in the program, there is a QTextEdit, which when changed, has its contents scanned for "species" elements, and then they are added to the QGridLayout. Any species elements which have been removed are removed too. This bit works; I have turned the vertical scrollbar on all the time, so that when it appears it does not sit on top of the other stuff in there. Note that the scroll bar is

QScrollArea missing Scrollbar

柔情痞子 提交于 2019-11-28 12:40:12
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 nevertheless no scrollbar will appear) I Think problems come from a single source :: Size Hints and Layouts (