qpainter Questions

4

Solved

I'm trying to make an app where you can draw with your finger on a canvas. To achieve this, I'm subclassing QWidget as MFCanvas, registered the class in QML with qmlRegisterType<>(), implemen...
Crypto asked 11/9, 2014 at 7:15

3

Solved

is there a way to draw fixed text that has subscripts. My goal is to have something like: "K_max=K_2 . 3" QString equation="K_max=K_2 . 3"; painter.drawText( QRect(x, y , width, y+height), Qt::Ali...
Hesione asked 27/4, 2015 at 9:43

4

Solved

I would like to rotate the text 45 degrees? QFont font; font.setPixelSize(12); //grid for(int i = 0; i < 10; i++){ painter->drawLine(100, 100 + i * 800/9, 900, 100 + i * 800/9); str = QSt...
Bimetallic asked 23/7, 2013 at 20:29

3

Solved

I'm using Qt charts module to draw a pie chart directly on a PDF file. Here's the problem: For some unknown reason, the chart needs to be displayed with show() before it's rendered to the PDF ...
Dowzall asked 17/12, 2014 at 16:36

3

I want to draw text using QPainter, and I want to use QPainterPath first (because ultimately I want to rotate the text in all sorts of ways). However, I find that the text produced by QPainterPath ...
Vercingetorix asked 24/7, 2013 at 11:32

4

I am trying to fade in and fade out a QLabel or for that matter any QWidget subclass. I have tried with QGraphicsEffect, but unfortunately it works well only on Windows and not on Mac. The only o...
Gowk asked 30/9, 2013 at 6:36

2

Solved

I want to draw a rectangle with rounded corners (border radius same for all 4 corners) with a specific color filling the entire rectangle, and a separate border color (say border is 1 px wide). Fr...
Septemberseptembrist asked 22/3, 2015 at 16:5

2

Solved

I draw in my Qt program on a QPainter the text and various elements round it. I need to get the sizes in pixels which will be occupied by this text. Can I get somehow the sizes in pixels, knowing ...
Jermaine asked 2/6, 2013 at 1:56

2

QPainter is very easy to use and to draw a line one would simply do this: QPainter painter(&image); QPen pen; pen.setWidth(5); pen.setColor("black"); painter.setPen(pen); painter.drawLine(QPoi...
Edgerton asked 4/1, 2020 at 14:53

2

Solved

Given a QPainterPath how can I stroke the path only on the inside or outside edge of the path (or left- or right-side for non-closed paths)? QPainter::strokePath() centers the pen along the path a...
Rhodian asked 1/3, 2013 at 20:56

2

Solved

I want to set text drawing alignment using one point as coordinate, not a rectangle. As far as I understand QPainter::drawText allows to set text alignment only when I pass coordinates as rectangl...
Publicspirited asked 18/7, 2014 at 18:23

2

Solved

I want to know how Qt does a border when using QPainter's drawRect. The reason for this is I am trying to draw three rectangles next to each other, but I'm having trouble getting them to touch perf...
Subaudition asked 12/2, 2012 at 15:10

4

I'm using Qt 4.7 QPainter to draw some polygons, etc into a widget. I am hoping to alter the coordinate system so that (0,0) is at the center of my widget, and the x/y axis behave in a standard "Ca...
Subjoinder asked 10/12, 2010 at 21:43

2

Solved

Many of you Qt (4.6 specifically) users will be familiar with the Overpainting example supplied in the OpenGL tutorials, I'm trying to do something very similar but using shaders for the pure OpenG...
Pother asked 30/11, 2010 at 16:39

1

Solved

I have written application that draws two smiling faces: First one is painted directly on QWidget: void DirectFace::paintEvent(QPaintEvent *ev) { QPainter painter(this); paintFace(painter); }...
Poppo asked 2/2, 2017 at 20:8

1

Solved

I am trying to learn PyQt vector painting. Currently I am stuck in trying to pass information to paintEvent() method which I guess, should call other methods: I am trying to paint different number...
Commissar asked 25/10, 2017 at 14:2

3

Solved

This is what I tried, it gave me no output. Where am I going wrong? // Start point of bottom line qreal startPointX1 = 600.0; qreal startPointY1 = 600.0; // End point of bottom line qreal e...
Pinkney asked 14/10, 2013 at 9:0

1

Solved

I'm trying to draw a rectangle on GUI created by PyQt5 by drag and drop. I managed to do that, but the rectangle is drawn when the mouse left key is released. What I want to do is like this link: ...
Porosity asked 10/6, 2017 at 1:51

3

Solved

I would like---with Python and Qt4---to rotate a QPushButton (or at least its text) so it can stand vertically. I've seen some documentation online, but I couldn't make much sense out of it---it's ...
Chintz asked 7/9, 2011 at 19:45

1

Solved

I'm working on a new project in Qt, using QPainter to draw a QWidget. The problem is, when I try to rotate QPainter the text I want to draw rotates out of my QWidget. I know how to solve the proble...
Sphericity asked 29/7, 2016 at 16:19

2

Solved

I'm trying to paint some points of my image and I don't know why it doesn't work. I have defined a QImage and I want to modify some points. QImage *cou= new QImage(height,largeur,QImage::Format_Mo...
Illconditioned asked 24/4, 2013 at 12:32

4

Solved

I would like to draw icons (only one color) in different colors. To do so, I would like to import a single alpha-texture and then combine this with a given color in the application. The result sh...
Hamulus asked 24/7, 2014 at 20:50

1

Solved

I'm trying to draw an icon(.png) inside a QWidget with QPainter::drawPixmap() : QPixmap _source = "/.../.png"; painter.setRenderHint(QPainter::HighQualityAntialiasing); painter.drawPixmap(rect(),...
Kweichow asked 27/4, 2016 at 15:26

2

Solved

I'm attempting to create a widget that consists of of a single horizontal black line. This widget will be placed in a QGridLayout such that it takes up the entire row, thus acting as a separator. A...
Suwannee asked 19/6, 2012 at 19:17

1

I am writing a screenshot utility with PyQt, and the idea is take a screenshot of the whole desktop, then display it in a QLabel, make the window full screen and user selects a region by mouse. Is...
Kaifeng asked 11/12, 2015 at 9:37

© 2022 - 2024 — McMap. All rights reserved.