qpainter

Drawing shapes using PYQT5

我是研究僧i 提交于 2019-12-08 14:06:45
问题 To begin, define a base class Shape that stores the shape's length, position, and (randomly generated) color. From there, you can inherit these basic properties and further specify additional shapes. At a minimum, your program must support squares, rectangles, triangles, circles, and ellipses. Each shape should define its own class in an inheritance hierarchy based on Shape. Recall that inheritance often spans more than one level, so consider and implement an appropriate inheritance scheme.

Q:PaintEvent IOS pixelating arc

a 夏天 提交于 2019-12-08 09:25:34
问题 So I have a Q::Painter which draws some circle. On windows it paints the circle perfect but on iOS it comes pixelated: and this is non pixelated image: I will be very greatfull if someone could help me with this problem. The code is exact the same but iOS renders it bad ... Here is my code: void CQtPercentCircleWidget::paintEvent(QPaintEvent *pe) { int circleX = parentWidget()->width()/2 - m_iCircleWidth/2; int circleY = m_iPenWidth; QRectF normalCircle(circleX, circleY, m_iCircleWidth, m

QT QGraphicsScene Drawing Arc

荒凉一梦 提交于 2019-12-08 07:02:33
问题 I have a question about drawing specific arc on a scene. I have this information about arc: Starting Koordinates, Start Angle, End Angle , Radius. But I can't use them efficently with QPainter . Actually I tried QPainterPath to use shape to show on QGraphicsScene with addPath("") but I can't use function properly. My questions are about how to use this infortmation to draw arc and how to show it on my graphic scene. 回答1: You can use a QGraphicsEllipseItem to add ellipses, circles, and

PyQt5: painting using events

与世无争的帅哥 提交于 2019-12-08 01:41:43
问题 I am new on PyQt I am working on a project on which I should implement a feature that make the user able to draw a digit using the mouse (digit recognition system). So what I want is when the mouse button is pressed the app will start to draw till the button is released. I made this source code but it is still not working (I think I am struggling with sending a signal to PaintEvent() ). import sys from PyQt5 import QtCore from PyQt5 import QtGui, QtWidgets from PyQt5.QtWidgets import

Sharing OpenGL VAO/VBO/etc. via QGLWidget

我的未来我决定 提交于 2019-12-07 09:18:26
问题 I am using a 3 layer hierarchy of QGLWidgets to share shaders and vertex data between 5 OpenGL viewports in my CAD-like app. The root context is used for compiling application-wide shaders, the per document context is used to share model vertex data, and the viewport contexts are the ones that actually do the rendering (and also contain grid vertex data and other per viewport stuff). The shader sharing seems to work fine, and so does the grid drawing, but when it comes to sharing vertex data

how to merge two images into one using QImage and QPainter in qt? [closed]

二次信任 提交于 2019-12-07 04:18:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Hi I am developing a blackberry10 app. Inside the app I have two images and I just need to merge these two images into a single image. There is no function in Cascades to combine them. When I posted this in the blackberry developer forum I was advised to use QImage and QPainter functions in qt to combine two

CutyCapt issue with SSL URL

僤鯓⒐⒋嵵緔 提交于 2019-12-07 00:35:33
I am having a problem getting CutyCapt to work with SSL URLs, I have the most recent version of CutyCapt ( CutyCapt.cpp 10 2013-07-14 21:57:37Z ), it works perfect with all non-SSL URLs, when I try to grab a URL with SSL using the following command: ./xvfb-run ./CutyCapt --min-width=1280 --min-height=720 --max-wait=6000 \ --url="https://apple.com" --out="testssl.jpg" I get the following error: QPainter::begin: Paint device returned engine == 0, type: 3 QPainter::setRenderHint: Painter must be active to set rendering hints QPainter::setBrush: Painter not active QPainter::pen: Painter not active

Draw a line with QPainter using QGraphicsView subclass

六眼飞鱼酱① 提交于 2019-12-06 14:48:41
问题 Question: I can't make the GraphicsView's paintEvent be called or in other words I don't know how to make QPainter work altogether. I'm using qtcreator's designer to place a QGraphicsView into the main window. I sub-classed QGraphicsView ( class Draw ) overriding the paintEvent and hold an instance of this subclass ( Draw draw ) in the main window (I wanted to move the complicated drawing elsewhere) I created a new QGraphicsScene and assign it to both QGraphicsView's ( ui->graphicsView and

Using QPainter to draw a line between QWidgets

被刻印的时光 ゝ 提交于 2019-12-06 11:04:16
问题 I'm working on an application where I need to be able to draw a line between two QWidget objects. I have tried quite a few things, but my current attempt (which I think is in the right direction I just think I'm missing something) is to have the containing widget (which I called DrawWidget and which holds the QGridLayout that the QWidget objects are added to) override the paintEvent method and call the QPainter::drawLine() function. The issues I'm having are that: No matter how I try to get

PyQt5: painting using events

有些话、适合烂在心里 提交于 2019-12-06 05:49:52
I am new on PyQt I am working on a project on which I should implement a feature that make the user able to draw a digit using the mouse (digit recognition system). So what I want is when the mouse button is pressed the app will start to draw till the button is released. I made this source code but it is still not working (I think I am struggling with sending a signal to PaintEvent() ). import sys from PyQt5 import QtCore from PyQt5 import QtGui, QtWidgets from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog,QGraphicsView,QGraphicsScene,QVBoxLayout from PyQt5