qgraphicsview

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

Interactively editing an existing rectangle on a QPixmap?

[亡魂溺海] 提交于 2019-12-08 05:00:47
问题 I'm trying to creat a Dicom GUI Toolkit where the user selects some dicom images and the image of first dicom image from the selected ones will be shown. Then the user clicks on the image and the image pops out with bigger image window. In this shown bigger image, the image will consist of a red colored rectangle that contains necessary regions of the Dicom image while the unnecessary region is outside the rectangle. The user should then have the option to change the rectangle by mouse. Until

QWheelEvent not working when using N.2 QGraphicsView in the same UI

牧云@^-^@ 提交于 2019-12-08 03:45:24
问题 I am building a user interface that has N.2 QGraphicsView and I am only able to zoom in-out on one QGraphicsView. I am using QWheelEvent + CTRL for one QGraphicsView and QWheelEvent + ALT for the second QGraphicsView. I read very useful articles to develop this procedure such as this and this but all of them are for zooming in-out for only one QGraphicsView. So sorry for writing with this problem again but I have been struggling a lot in the past days since I am trying to do it for two

Why do I have trouble changing mouse cursors in my implementation of an interactive QGraphicsView in Qt?

梦想与她 提交于 2019-12-08 03:14:52
问题 I need to display MDI windows containing images in my application. I wanted to be able to drag-scroll the images using the right mouse button, zoom them using the mouse wheel, and also create polygon-shaped area-of-interest masks over them. To this end, I created a custom QGraphicsView-derived class (ImageView) which reimplements some mouse events. I also have a QGraphicsPixmapItem-derived class (ImageItem) for implementing hover events which update a cursor pixel-position indicator in the

PyQt: Mouse events in QGraphicsView

社会主义新天地 提交于 2019-12-07 21:37:23
问题 I would like to write a simple program in Python with PyQt. I have a QGraphicsScene and I would like to do the following: There are 2 options using two RadioButtons: For generating points. This way if someone clicks on the scene an ellipse will appear. For selecting points. This way if someone clicks on a point the selected point will be returned. I'm kinda new at PyQt and also at GUI programming. My main problem is that I don't really understand how mouse events work in Qt. If someone was so

Qt update() doesn't work

为君一笑 提交于 2019-12-07 16:48:16
问题 I have a problem , that update() function in QGraphicsItem doesn't work. What I want to do is , when I move circle , other QGraphicsItem ( in the mean time roundrect ) changes color. This is a example, what I want to do: circle.cpp: void CircleItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { // RoundRect Object RectItem->SetBackGround(); QGraphicsItem::mouseMoveEvent( event ); } RoundRect.cpp: void RoundRectItem::SetBackGround() { ChangeBackground = true; update(); } void RoundRectItem

calling Qt's QGraphicsView::setViewport with a custom QGLWidget

做~自己de王妃 提交于 2019-12-07 08:35:44
问题 I've derived from QGLWidget before, like so: class MyGLWidget : public QGLWidget { public: // stuff... virtual void initializeGL() { /* my custom OpenGL initialization routine */ } // more stuff... }; However, I find that if I try to initialize a QGraphicsView with my custom QGLWidget as the viewport, initializeGL doesn't get called (setting a breakpoint within the Qt library, neither does QGLWidget::initializeGL() when created plain). // initializeGL, resizeGL, paintGL not called ui

How to make qt qgraphicsview scale to not affect stipple pattern?

孤者浪人 提交于 2019-12-07 03:54:30
问题 I draw few rectangles inside the QGraphicsView ; I use custom stipple pattern for these by creating a QBrush with my QPixmap . This gets displayed with the default zoom level as expected. When I call view->scale() , the rectangles show up bigger or smaller as I expected. However Qt has scaled the individual bits of the stipple pattern which is not expected; I expected it to draw the larger or smaller rectangle again with the brush. Eg. If I had used a stipple pattern with one pixel dot and

How to enable antialiasing for QOpenGLWidget in QGraphicsView?

拈花ヽ惹草 提交于 2019-12-07 02:39:46
问题 I have added QOpenGLWidget to QGraphicsView (don't use setviewport) via QGraphicsProxyWidget: QSurfaceFormat format= QSurfaceFormat(); format->setSamples(4); //<== widget show black screen if samples =4, 1 is ok but not antialiasing m_glWidget->setFormat(format); MyGraphicsProxyWidget* proxy= new MyGraphicsProxyWidget(); proxy->setWidget(m_glWidget); //add to scene scene->addItem(proxy); I've tried some ways but not work: glwidget show black screen if samples =4, but samples = 1 is ok but not

Why do I have trouble changing mouse cursors in my implementation of an interactive QGraphicsView in Qt?

别说谁变了你拦得住时间么 提交于 2019-12-06 15:31:58
I need to display MDI windows containing images in my application. I wanted to be able to drag-scroll the images using the right mouse button, zoom them using the mouse wheel, and also create polygon-shaped area-of-interest masks over them. To this end, I created a custom QGraphicsView-derived class (ImageView) which reimplements some mouse events. I also have a QGraphicsPixmapItem-derived class (ImageItem) for implementing hover events which update a cursor pixel-position indicator in the application's interface. Here's the outline (doesn't yet implement the mask polygons): class ImageView :