Qt textedit with bookmark in scrollbar
I wanted to create the bookmarks for my text editor while searching for a word in the text, the scrollbar should colored the bar in green like in the qt editor.I need help guys!! do you have an idea to...
View ArticleGet visible area of QPainter
I have an owner-drawn QWidget inside a QScrollArea, so when painting, and I want to paint only the parts that are visible. To do so, I need to have the rectangle of the visible area of the QPainter.The...
View ArticleHow to draw a picture instead of the slider of a QSlider?
I have created a class that inherits from QSlider and I want to draw a picture on the slider (grabber) instead of showing the plain one.How to do it?
View ArticlepaintEvent is not called after an update() in mouseMoveEvent
I am using a QAbstractScrollArea and a custom QWidget derivative widget as "the" widget(having sizeHint() overriden).The application needs to constantly update the QWidget content during mouseMove...
View ArticlePyQt6, drawing shapes over loaded PDF file
My goal is to create a PDF viewer that allows to draw a rectangle in front of the text. Right now the viewer part is done as well as the drawing rectangles part. The problem is, they don't work...
View ArticleHow to draw a gradient color wheel correctly using paint event without jagged...
I use the rotate method to draw the circle, but this creates gradual irregularities (visible on the outside of the circle).Furthermore, I can only get this result if I iterate ten times the hue value...
View ArticleHow to set QPdfView's viewport background color
I'm trying to set a QPdfView's viewport background color, but unlike QAbstractScrollArea (from which QPdfView's derived), using stylesheet does not work.Here's how I tried to do that:#include...
View ArticlePyqt6 draw double and triple bonds around an atom
I'm trying to draw possible bonds around a selected atom.I am using cos and sin to find the positions of the possible new atoms in steps of 45° so I get 8 different positions , which works fine. When...
View ArticleQt6 - Svg file image drawn using delegate paint method has scaling issue
I see that the checkbox svg image drawn using the delegate paint method (subclassed from QStyledItemDelegate) in a QTreeView column looks different than drawn using the css file. I mean the borders...
View ArticleHow to get Bezier points from a curve
I am drawing a Bezier curve in Qt using the inbuilt Qt functions:void OpacityCurveWidget::paintEvent(QPaintEvent* event) { QPainter painter(this); painter.fillRect(0, 0, width(), height(), Qt::white);...
View Articleproblem with multiple qquickwindow for render 2d using qnanopainter [closed]
my project is about rendering some 2d on qml .for this i use qnanopainter that work with qt quick scene graph.qnanopainter is a library in github for painting, instead of qpainter it works with opengl...
View ArticleQPainter::begin: Paint device returned engine == 0, type: 2
I'm trying to print Qtablewidget but it just print a blank page and application output showQPrinter::metric: Invalid metric commandQPainter::begin: Paint device returned engine == 0, type:...
View ArticleWhy is there extra spacing for some characters which cause QPainter::drawText...
I'm trying to use QPainter::drawText() to render some Chinese characters. But in certain fonts, there is extra top spacing when drawing the text. Why is this happening to some characters only?Tested on...
View Articledraw with QPaint on loaded QPixmap does not work
I can draw a Line on my Qlabel by doing this: QPixmap *myPixmap; myPixmap = new QPixmap(); myPixmap->fill(Qt::red); QPainter painter(myPixmap); painter.setPen(Qt::blue); painter.drawLine(1, 1, 50,...
View ArticleChange appearance of selective column/row separator lines in QTableWidget
I want to separate specific columns/rows in a QTableWidget using a bold colored line.I could easily achieve a separation by drawing lines on both sides of the the cells adjacent to the column...
View ArticleQOpenGLWidget with Qpainter: OpenGL drawing only visible after first paintGL...
I would like to use a QOpenGLWidget in QT to create fast line plots. These plots are to be provided with some labels, for which I am currently using QPainter with drawText(). In various examples, the...
View ArticleHow to get precise mouse pointer location/coordinate in PyQt5 QPainter?
I am trying to draw rectangle in real time in pyqt5 Using QPainter class.The problem here is that visually the mouse pointer location and the start and end points of the rectangle being drawn are...
View ArticleHow to draw a rectangle and adjust its shape by drag and drop in PyQt5
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: When...
View ArticleProviding a list to a function
I've never come across this problem until now and can't think how to proceed.I would like to know how to provide each element of a tuple to a function that wants individual parameters:myTuple =...
View Articlequestion regarding drawing squares on uploaded image
import sysfrom PyQt5.QtGui import QPixmap, QPainter, QPen, QColor, QImagefrom PyQt5.QtWidgets import ( QApplication, QWidget, QPushButton, QLabel, QVBoxLayout, QHBoxLayout, QFileDialog,)from...
View Article