Questions tagged [paintevent]

An event that is triggered when a GUI component needs to be repainted

A PaintEvent is an event that is triggered when a GUI component needs to be repainted. This is usually a result of a change to the underlying data behind the GUI component, so the GUI display needs to be repainted to reflect the change.

154 questions
21
votes
1 answer

When does a Qt widget get a paintEvent?

I am wondering in which cases does a widget receive its paint event, and how does it vary with the OS. Qt documentation for paintEvent says only A paint event is a request to repaint all or part of a widget. It can happen for one of the following…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
9
votes
2 answers

How do I paint custom borders on .Net WinForms controls

I've been trying to paint custom borders for existing .Net WinForms controls. I've attempted this by creating a class which from the control I want to change the border color of, and then try several things during painting. I've tried the…
Codecat
  • 2,213
  • 3
  • 28
  • 39
5
votes
1 answer

Why QPainter might reject to work inside paintEvent?

I have: class QTextEditEnter : public QTextEdit { Q_OBJECT public: QTextEditEnter( QWidget *_parent ) : QTextEdit(_parent) { this -> setFrameStyle( QFrame::Sunken ); // Sunken! } protected: virtual void…
pavelkolodin
  • 2,859
  • 3
  • 31
  • 74
4
votes
3 answers

How to subclass a widget to add more elements to it?

I'm trying to make a subclass of QTableView that has an embedded QLineEdit at the top for filtering the results as-you-type. I need my table to have the same API as a normal QTableView, so I want to subclass it rather than subclassing QWidget and…
swiss_miss
4
votes
1 answer

How to draw a line over widget in Qt5

I have a mainwindow and more than two widget on mainwindow. I wanna draw lines on the whole mainwindow and when the line should be over the widgets not behind these widgets. I've tried overwrite paintevent function of mainwindow and draw a line…
Asuka
  • 301
  • 4
  • 16
3
votes
1 answer

Problems overriding paintEvent with PySide

I've subclassed the QPlainTextEdit class and have tried to override the paintEvent function so that I can draw a line number area onto it. def paintEvent(self, e): super(CodeEditor, self).paintEvent(e) qp = QtGui.QPainter() …
Lolecule
  • 33
  • 2
  • 5
3
votes
1 answer

Qt Custom Animated Button

I am trying to create custom animated button I found this page: Buttons Example I liked 3 & 19 on this website. I did try to make 3 but it is not the same. Can someone help me? My Code for 3rd button on website: # -*- coding: utf-8 -*- import sys,…
Dream59
  • 101
  • 6
3
votes
1 answer

Show Scrollbars if the height of a shape is greater than the Form's height

I just need to show scrollbars on forms if my shape height is greater than the form height. That way, when the user scrolls down, it can show the end of the shape. This is my code: public partial class Form1: Form { public Form1() { …
3
votes
1 answer

Java repaint() not calling paintComponent()

In an attempt to make a very simple bullet-hell game to learn about java, I ran into a roadblock: repaint() wasn't calling paintComponent(). Here is the entire program, which for now simply draws an image I created 50 times per second onto a JPanel,…
Nematodes
  • 33
  • 1
  • 5
3
votes
1 answer

Pan & Zoom all QWidget children

I would like to have a QWidget which has the possiblity to pan and zoom inside it. Scenario : When the user uses his mouse middle button to scroll-up/down, all children are scaled from the center of the widget. If the user holds Alt pressed, and…
jbltx
  • 1,255
  • 2
  • 19
  • 34
3
votes
1 answer

Qt paintEvent crashes

Im trying to draw simple board on my widget. When I'm trying to automatize this, my paintEvent crashes. I think it is caused by for loop inside, am I right? How to paint it in other way? void Widget::paintEvent(QPaintEvent *event) { QPixmap myPix(…
Tatarinho
  • 754
  • 2
  • 11
  • 31
3
votes
1 answer

How to change color of SWT progress bar?

Is it possible to change progress bar color using the paint listner? I don't want just an inital foreground and a background color, but want it to work just like how a normal green color progress bar works on Windows but with my own foreground and…
Abbas
  • 3,144
  • 2
  • 25
  • 45
3
votes
1 answer

How re-paint in Panel smooth in windows form

How can I repaint a panel in smooth? I am using a timer that is invalidating the panel(panel1.Invalidate();) every 300ms, and then with the panel1_Paint event I am adding images to that panel the issue is that it looks like is jumping and I need to…
Devsined
  • 3,363
  • 6
  • 30
  • 48
3
votes
1 answer

Windows Form Paint equivalent event in WPF

I have used the PAINT event to draw a wave on a Panel in Winows Form Application. But when using it WPF, I didn't find any such element equivalent to a Panel which has a Paint Event. Googled a lot too but no great use. Well, I need to draw a…
abhi154
  • 43
  • 1
  • 3
  • 10
3
votes
2 answers

How to add a circle to a widget in Qt without needlessly repainting everything?

I'm learning about QPainter, and I've created a simple widget where each time the user clicks on the widget, a new circle appears at that point. But Qt doesn't allow painting outside paintEvent, so each time I want to draw a new circle, I need to…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
1
2 3
10 11