qpainter

Qpainter.rotate() question - qgis

Hi, I am customising QuantumGIS that uses Qt's Qpainter to draw and paint... I am trying to draw a polyline on the canvas that is coming as a update through message queues..the draw is very fine...but in the polyline or polygon objects that i get as an update also include an angle field that is to be used for rotation of an object. Th...

QPainter colored text (syntax coloring)

I have a custom Qt widget which I used to display disassembly and I am looking to add syntax coloring to it. Currently, I simply set the QPen to a solid color, construct the text I want to display, and render it to the QPainter at the appropriate coordinates. The question is, what is the best approach to adding syntax coloring? I've th...

Qt - creating QPainter

Hello, i'm trying to rewrite method paintEvent in my programm and change it. void MainWindow::paintEvent(QPaintEvent *event) { QRegion reg = this->bgPixmapHandle->rect(); QPainter painter(this); painter.setClipRegion(reg); painter.drawImage(bgPixmapHandle->rect(), bgPixmapHandle); painter.end(); } Here i try to ch...

PyQt4 - Image Watermark

I'm trying to open a PNG image and write some text to it (a watermark) via QImage and QPainter. The code works 100% on Linux but when I run it on Windows XP (haven't tested with any other versions of Windows) the text is never written to the image. I have the code in a try/except block, but no errors are returned. image = QtGui.QImage('...

Qt painting without clearing the background

I'm using a QPainter to get some graphics on a window. Unfortunately every time the .paintEvent is run, the whole window is cleared. How can I draw without clearing? I.e. how do I leave the stuff from previous paint event untouched? I'm using Qt4 ...

QPainter and QTimer

Hi How to use QPainter and QTimer to draw a real time sinusoid like sinus(2*w*t+ phi). thanks. ...

Qt Python - report in toolbox: QTextDocument and QPainter

Hi Everybody, I want to build multiple documents report using toolbox. Two pages is an option get a start. Formatting is ok, and can be worked latter. I tried using QTextDocument in Html, and alternatively QPainter. Of course, to make a test and keep things simple, I just ask in Qt to show the report title displayed on top of the docu...

QPainter fails when calling begin

Hi, I'm trying to paint a PNG file on a QsplashScreen. Im' trying to do it via QPaitner. The reason I want to do it via QPainter is because I want it to minimize smoothly (until it disappear), When I'm just repaiting it it doesn't looks smooth at all. I passed the QSplashScreen to the QPainter constructor. When I call begin() in the QPa...

QWidget's paintEvent() lagging application

i'm studying and modifying the fridge magnets example, and the last thing I've tried to do was to draw a few labels and lines that are supposed to be on the background. After looking around trying to figure out how to draw the labels and lines, I learned that I could override QWidget's paintEvent() to do it. After I did it though, the a...

2d HUD not drawing properly over QGLWidget (using QPainter)

Hi I am trying to display HUD over my 3D game. For starters, I am just trying to display "Hello World", but I haven't had any success yet! The scene freezes / flickers once I am done. I am using Qt/C++ and QGLWdiget / QPainter to get this done. I have used overpainting example as my reference to get started. Here is what I do: overri...

Generic transparent Qt widget that can catch clicks?

I've figured out how to use QPainter to draw rectangles. Now I want to have a drawing area where if the user clicks, a 1x1 rectangle is drawn where the mouse pointer is. To accomplish this, I assume I need a transparent Qt widget that supports the clicked() signal. How do I make such a transparent widget? Or is there something else I ca...

Animated text with QPainter

Is it possible to draw an animated text with QPainter? I only want to change color of text periodically. If possible how to achieve? ...

Qt QPainter error. Rotating an ellipse using horizontalSlider. Help?

Well I have to create a simple box which rotates an ellipse and some text depending upon value from horizontalSlider/spinBox. The widget has to be resizable, And size of the ellipse has to change depending upon that. For now only the ellipse is being painted. The text painting will be added if this works. The problem is that if the windo...

QPainter paints garbage

Fragment of program code: def add_link(Item0Num, Item1Num): global Mw, View # Mw - MainWindow if Item0Num != Item1Num and not link_exists(Item0Num, Item1Num): append( links_to(Item1Num), Item0Num ) append( links_from(Item0Num), Item1Num ) LinkGi = TLinkGi() Mw.Scene.addItem(LinkGi) LinkGi....

Qt4: QPrinter / QPainter only prints the first document

The problem is that my application only prints the first document fine. The second document is empty, only the page number is printed, the rest of the page is empty. In Qt4, I'm initializing the printer in the main.cpp in the following way: mw->printer = new QPrinter(QPrinter::HighResolution); mw->printer->setPaperSize(QPrinter::A5); m...

Qt - draw in a QFrame on clicking a button.

Say there is a QPushButton named "Draw", a QLineEdit and a QFrame. On clicking the button I want to take a number from QLineEdit and draw a circle in a QFrame. How can I do this? Please provide me with the code. P.S. The problem is that draw methods of the QPainter should be called in drawEvent method. ...

what void QPainter::save()/restore() really do ?

i am doing tutorial from trolltech http://doc.trolltech.com/4.0/tutorial-t11.html - it is scorched earth-like "game". You can get ready files from links on the tutorial page. They are using painter.save()/restore() methods - I checked the description of that methods courious what that does.... unfortunately it has only one line expla...

QT c++ draw point qpainter qgraphicscene

Hell-o all, Im new to qt and I am having trouble drawing one single point. I have a big qMainWindow that eventually calls a QgraphicsScene and inside of it I need to draw a single point, one little pixel, that is all I want, I want to use a QPainter but Im having trouble instantiating one. Any ideas?? ...

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...

Kind of QPainter WYSIWYG Editor?

I need to draw a complicated object with Qt primitives using QPainter. The thing is I really need to do this in a such uncomfortable way, because it's part of the task. So, is there a kind of WYSIWYG editor, when you just draw object like you would in Gimp or Paint, and get pre-made code for Qt? The object is pretty complicated to draw m...