QDialog Exec occurs QWidget::paintEngine: Should no longer be called
Solved
General and Desktop
-
Hello everyone,
I've ported my Qt 4.3 application to Qt 5.5 on Mac OS 10.10 using Qt Creator.
When opening a QDialog from an other QDialog, I've the following error
QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1
I've searched and this error occurs when drawing an image or a QWidget but this is not my case. There's my code to display the dialog :
void frmListeOrdo::addPatient() { frmPatient *w = new frmPatient(this,0,0); if(w->exec()) // it craches at this line { int patient = w->currentPatient(); if(patient != 0) { showPatients(""); QAbstractItemModel* model = tabPatient->model(); QModelIndex start(model->index(0,0,QModelIndex())); QModelIndexList list = model->match(start, Qt::DisplayRole, patient); if(!list.isEmpty()) { tabPatient->setCurrentIndex(list[0]); tabPatient->scrollTo(model->index(list[0].row(), 1, QModelIndex())); } } } }
The child dialog constuctor
frmPatient::frmPatient(QWidget *parent, Qt::WindowFlags f, int codePa):QDialog(parent, f), codePatient(codePa)
{
setupUi(this);// the following lines were commented to ensure that the problem doe's not come from them
//initFiche(); //initialisation des champs de la fiche patient //initData(codePatient); //init(); //lnNumDos->setFocus(Qt::MouseFocusReason); //lbBackColor->setStyleSheet("font-weight:bold;background-color:lightgray");
}
Here's what Qt Creator threads display
0 QPaintEngine::syncState() QPaintEngine::syncState() 0x100eff919 1 (anonymous namespace)::QMacCGContext::QMacCGContext(QPainter *) (anonymous namespace)::QMacCGContext::QMacCGContext(QPainter*) 0x10060e08d 2 QMacStyle::drawComplexControl(QStyle::ComplexControl, QStyleOptionComplex const *, QPainter *, QWidget const *) const QMacStyle::drawComplexControl(QStyle::ComplexControl, QStyleOptionComplex const*, QPainter*, QWidget const*) const 0x100620712 3 QGroupBox::paintEvent(QPaintEvent *) QGroupBox::paintEvent(QPaintEvent*) 0x1007691bb 4 QWidget::event(QEvent *) QWidget::event(QEvent*) 0x1006751bb 5 QGroupBox::event(QEvent *) QGroupBox::event(QEvent*) 0x100769495 6 QApplicationPrivate::notify_helper(QObject *, QEvent *) QApplicationPrivate::notify_helper(QObject*, QEvent*) 0x1006364bb 7 QApplication::notify(QObject *, QEvent *) QApplication::notify(QObject*, QEvent*) 0x10063989e 8 QCoreApplication::notifyInternal(QObject *, QEvent *) QCoreApplication::notifyInternal(QObject*, QEvent*) 0x10148a983 9 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066e970 10 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f2ba 11 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 12 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 13 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 14 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 15 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 16 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066f140 17 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *) QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 0x10066ed26 18 QWidgetBackingStore::doSync() QWidgetBackingStore::doSync() 0x100642d06 19 QWidgetBackingStore::sync(QWidget *, QRegion const&) QWidgetBackingStore::sync(QWidget*, QRegion const&) 0x100641c66
Can anyone tell me where's the problem ?