qpainter

PyQt5 triggering a paintEvent() with keyPressEvent()

断了今生、忘了曾经 提交于 2020-06-26 06:58:08
问题 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 numbers to a fundamental block (here drawFundBlock() method, which should draw some lines). The code is trying to check if right arrow is pressed-> drawFundamental block and if number is pressed (now trying to simply draw "5"), it will draw that number on a certain area on that fundamental block. But I can

Unable to paint on Qt Widget, shows error “paintEngine: Should no longer be called”

给你一囗甜甜゛ 提交于 2020-06-08 06:17:33
问题 I have created a widget using Qt Creator such a way that it has two sub windows inside a main window and some push buttons to load, save images, set pen width and color to paint on the window. But when i start to paint it gives me error saying QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 QPainter::setPen: Painter not active QPainter::drawPoints: Painter not active Does anyone know what mistake i am doing, i checked threads

Unable to paint on Qt Widget, shows error “paintEngine: Should no longer be called”

百般思念 提交于 2020-06-08 06:17:32
问题 I have created a widget using Qt Creator such a way that it has two sub windows inside a main window and some push buttons to load, save images, set pen width and color to paint on the window. But when i start to paint it gives me error saying QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 QPainter::setPen: Painter not active QPainter::drawPoints: Painter not active Does anyone know what mistake i am doing, i checked threads

QWidget::paintEngine: Should no longer be called in a QTreeWidget derived class [duplicate]

為{幸葍}努か 提交于 2020-01-30 13:14:08
问题 This question already has answers here : paintEvent in QTableView derived class: Paint device returned engine == 0, type: 1 (1 answer) Warning QPainter inside paintEvent [duplicate] (1 answer) Closed 2 years ago . I have a class, MyTree , which derived from QTreeWidget and void MyTree::paintEvent(QPaintEvent *event) { QPainter painter(this); } causes to raise the following issue, QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 Could

QPainter painter object outside paintevent

自作多情 提交于 2020-01-24 20:57:25
问题 I am trying to draw a simple two dimensional figure in a QWidget window. There is a paintEvent defined and a painter object of the QPainter class is also defined. My drawing contains elements which I need to draw more than once at various locations, such as lines, text etc. For this purpose, I am using functions to draw these lines with varying positions. Similarly for text. In order to make the program shorter, also modular. The paintEvent function is calling functions which are used to

PyQt print QWidget

╄→гoц情女王★ 提交于 2020-01-24 10:45:25
问题 Am trying to follow the documentation for printing a QWidet and am getting an error. When I run the following code I get QPaintDevice: Cannot destroy paint device that is being painted . import sys from PyQt4 import QtGui, QtCore class SampleApp(QtGui.QDialog): def __init__(self): super().__init__() layout = QtGui.QVBoxLayout() self.setLayout(layout) text_editor = QtGui.QTextEdit() layout.addWidget(text_editor) button = QtGui.QPushButton("Print") layout.addWidget(button) button.clicked

ECG like waveform painting using QPainter

巧了我就是萌 提交于 2020-01-17 06:30:15
问题 I am able to read ECG signals and plot the wave using QPainter. But the resulting wave is formed by removing the first coordinate and appending the new coordinates as the last point. So this gives a scrolling effect to the wave. I wanted to know if there was any way to paint the wave like how a patient monitoring system does (a black bar running the length of the wave and updating the wave like this). Code examples or snippets will be very helpful.Thanks. 回答1: Here is a quick example in a few

QPainter::rotate disables antialiasing of drawn text

谁说我不能喝 提交于 2020-01-14 07:45:08
问题 I use QPainter::setRenderHint(QPainter::Antialiasing, true) to tell Qt that I want it to antialias any drawing I do (in this case, text drawn with drawText() ). This works fine and the text looks good, until I want to rotate the pixmap I'm drawing to e.g. Painter.translate(0, height()); Painter.rotate(-90); (to rotate the QPainter 90 degrees counterclockwise and bring it back into view) The call to rotate() seems to disable antialiasing for any text drawn - the text is drawn at the correct

How to draw a line with animation in PyQt4

柔情痞子 提交于 2020-01-12 01:58:12
问题 I have a list of points. For example, points = [[160, 75], [115, 567]] . How to draw a line in PyQt4, so it would be something like this: Thanks in advance. EDIT: For the record, I'm trying to implement Bezier Curves, so it looked like this: Here is the code I have at the moment: from PyQt4.QtGui import QWidget, QPolygonF, QPainter, QPen, QBrush, QColor, \ QApplication, QIcon, QVBoxLayout, QSlider, QHBoxLayout, QPushButton, QLCDNumber from PyQt4.QtCore import QObject, SIGNAL, SLOT, QPointF,

Qt drawing a filled rounded rectangle with border

落花浮王杯 提交于 2020-01-09 19:03:07
问题 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). From my observation, Qt provides three methods - fillRect and drawRect and drawRoundedRect . I have tried them, they don't work like I want to. There is no method like fillRoundedRect . Which means that I can draw a rounded rectangle but it won't be filled with the color I want. How do I do it? And