qgraphicsview

QGraphicsView/QGraphicsScene rendering question

I am using QGraphicsScene/QGraphicsView pair in my application. I had subclassed them for my purpose. The code snippet that generate the pair is below: itsScene = new QGraphicsScene; itsView = new QGraphicsView; itsView->setParent(itsCanvas); itsView->setGeometry(20,20,1700,720); itsView->setBackgroundBrush(Qt::black); itsView->setAlig...

How to use Qt Model/View framework with the Graphics View framework

I am working on a mapping application and need to display the data objects using a table, a form and as graphical objects in the map. I'm using PyQt, but that's not really important as this is a Qt question not a Python question. If I only needed the table and form views this would be easy, I'd just use the Qt Model/View framework. Howe...

GIF animation in Qt

I have used QGraphicsView, QGraphicsScene classes in order to show a picture in a widget like this: m_Scene->addPixmap(QPixmap(fileName)); m_View->setScene(m_Scene); How I can show .gif animation in the same scene? ...

Text in a QGraphicsScene

How to write text in a certain cordinate in QGraphicsScene? I was trying to do like this, but with no success. Text has blck borders but inside the letters it is white, and I can't make it be black. QPainterPath path; QFont font; font.setPixelSize(50); path.addText(100, 50, font, tr("Hello World!!!")); path.setFillRule(); m_graphSce...

setting button focus in graphcisview

HI, I have placed few button in Qgraphicsscene, but I don’t know how to navigate the button from keyboard. I don’t know how to set the focus to button. Can anyone provide me the idea about how to do that ...

QT: help with QGraphicsView, QGraphicsScene, QGraphicsItem positioning

Hello, I am trying to use the QGraphicsview, but I have lot of trouble with it. My goal is very simple (for the moment): I want to create a basic pianokeyboard component, where you can set the number of keys, and where the keys automatically stretch when you resize the keyboard. I am a newbie in QT, so maybe I am wrong in the design t...

A real top level window with Qt ?

Hello, i use the last Qt version for a projet and the QProcess : http://doc.qt.nokia.com/4.6/qprocess.html. I have a question - i want to lauch program from my application by using QProcess . I want to display a QGraphicsView transparent on full screen over the launched program. For the moment: i hide the view, launch the program, slee...

Handling MouseEvents in Qt c++

Hi, Sorry for my beginner's question... What is the easiest way to define procedures, which are executed when MousePressEvent or MouseReleaseEvent occurs? For now I am defining my own class (MyGraphicsView class), which inherits QGraphicsView and I am reimplementing mouse events (which are virtual functions). It works fine but is ther...

QGraphicsView noobie question

Trying to add text to QGraphicsView: Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); QGraphicsScene scene; scene.addText("Hello, world!"); ui->graphicsView->setScene(&scene); } But when the project running, there is nothing on the QGraphicsView. ...

Event does not work after drag and drop operation

I developing some kind of builder for our project. I want to use both drag and drop support and context menu in my application. Currently I use drag and drop support but no luck with context menu. Below is my builders gui. Left side my gui is toolbox. I am draging and droping widgets to the right side(QGraphicsScene) and I also want to...

PyQt QGraphicsView fails to setWindowIcon

I'm using sub-classed QGraphicsView's in an MDIArea I want to be able to change the icon of the window from 'within' the object, but it just seems to ignore me... no errors or warnings... it just doesn't do it. if self.world.is_dirty: self.setWindowIcon( QtGui.QIcon ( 'images/dirty.png' ) ) self.setWindowTitle('dirty') else: ...

restrict movable area of qgraphicsitem

Is there a way to restrict the area where a QGraphicsItem like QRect can be moved when setFlag(ItemIsMovable) is set? I'm new to pyqt and trying to find a way to move an item with the mouse, and the restrict it to only vertically/horizontally. Thanks! ...

Pyqt: How-to set item always in the center of a QGraphicsView when scrolling is possible?

Hi, I have a QGraphicsView. To that I added a QGraphicsScene and to that a added an QPixmap(*.jpeg) and QGraphicsEllipseItem(a circle). The QPixmap is much more bigger than the QGraphicsView, so scrolling is enabled. The problem is that both QPixmap and QGraphicsEllipseItem are moving. But I want a fixed position for the QGraphicsEllip...

QGraphicsView not displaying QGraphicsItems

Using PyQt4. My goal is to load in "parts" of a .png, assign them to QGraphicsItems, add them to the scene, and have the QGraphicsView display them. (Right now I don't care about their coordinates, all I care about is getting the darn thing to work). Currently nothing is displayed. At first I thought it was a problem with items being a...

How to anchor QGraphicsWidget/Item (make them static) on QGraphicsView

Hi, I want to make something like a hud. I have a QGraphicsScene with a huge QPixmap, that I added to a much smaller QGraphicsView. Now I need to add some control elements, like QLabel, QPushButton and QGraphicsEllipseItem. That's, I think, is not a problem. I found this helpful page Graphics View Classes. But how do I anchor this cont...

How to draw an ellipse/circle over QGraphicsScene in a QGraphicsView

Hi, I have a QGraphicsView with a QGraphicsScene. That QGraphicsScene contains a QPixmap. It is possible to drag the scene. On top of that scene I have a HUD with QLabels, QPushButtons and other stuff. When I drag the scene around, the HUD elements never change their position. So far it works all perfect. But now I need to add a new el...

How to add an arc to the foreground of a QGraphicsView

Hi, how is it possible to add an QPainter arc to the QGraphicsView foreground. I found QGraphicsView.drawForeground (self, QPainter, QRectF), but I don't understand how to use it. I am new to qt. I also know that it is possible to add an art to the QGraphicsScene, but I need the scene for something else. Or is there an easier way to a...

How do I create a rotating cube effect in Qt?

I have a QGraphicsView and a slide show of QGraphicsScenes, at the moment when the user switches to the next slide I just change the Scene that the View is looking at and it changes instantly to reflect that. What I would like to do it create some transition effects, such as the rotating cube or the slide in/out. However looking at the...

How to print content of a QGraphicsView

How can I print the content of a QGraphicsView in Qt? Thanks a lot. ...

How to select multiple items without pressing Ctrl key within QGraphicsScene ?

In Qt's QGraphicsScene, if I wanna one item, just click it, and click another selectable item will make the selected item to be unselected. If I want to select multiple items, I'd use Ctrl key. But this maybe not convenient for some cases, then how to select multiple items without pressing Ctrl key within QGraphicsScene ? ...