I override paintEvent function for a QDialog project. After that, in QDialog, I can not put label which load bitmap image any more. If I do so, there is "Segmentation error".
Is that normal?
Thanks
I override paintEvent function for a QDialog project. After that, in QDialog, I can not put label which load bitmap image any more. If I do so, there is "Segmentation error".
Is that normal?
Thanks
would you mind sharing the code with us?
Qt Code:
{ painter.drawLine(27,450,630,450); painter.drawLine(30,50,30,453); painter.drawLine(180,450,180,453); painter.drawLine(330,450,330,453); painter.drawLine(480,450,480,453); }To copy to clipboard, switch view to plain text mode
and in Qt designer, I put a label and load a bitmap.
After successfully compiled, when I run the application, it shows segmentation error.
After I remove the label, it works fine.
Had you promoted you dialog properly ?
Also try calling QDialog:aintEvent(event); before your code.
I think it is crashed when constructor is called.
Qt Code:
myDialog::myDialog() { setupUi(this); currentPoint=0; connect(btnClose,SIGNAL(clicked()),this,SLOT(onClose())); connect(updateTimer,SIGNAL(timeout()),this,SLOT(update())); }To copy to clipboard, switch view to plain text mode
Now instead of adding image in designer, I load image in paintEvent function, it works fine.
I tried put a bitmap button in myDialog using designer, it also crashed.
Is it a bug of Qt? Any ideas?
Can u post a code which reproduces the problem ?
well, paintEvent() is the event called to draw the dialog after all..whenever u call update(), evth is erased and drawing starts from scratch..so if u r reimplementing it, u should do all the drawing there only..it makes sense..u can try it with smth other than QDialog, i believe same thing will happen
Bookmarks