завел в ассистант на диалоге вджет и сделал в ассистант промоте на Zkarta с одной только функцией
тормоза:
void Zkarta::paintEvent(QPaintEvent *event)
{ static int e;
if(++e<22)
return;
printf(" %d ",e++);
QPainter p(this);
QRect r=p.viewport ();
for(int y=r.top();y<=r.bottom();y++)
for(int x=r.left();x<=r.right();x++)
{ p.setPen ( QColor(255*(y-r.bottom())/(r.top()-r.bottom()),255*(x-r.left())/(r.right()-r.left()),0));
p.drawPoint(x,y);
}
p.end();
};
При открытии приход 2 раза стеки ( первый короткий )
0 Zkarta::paintEvent main.cpp 60
1 QWidget::event qwidget.cpp 7687
2 QApplicationPrivate::notify_helper qapplication.cpp 4056
3 QApplication::notify qapplication.cpp 4021
4 QCoreApplication::notifyInternal qcoreapplication.cpp 610
5 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 216
6 QWidgetPrivate::drawWidget qwidget.cpp 5079
7 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5189
8 QWidgetPrivate::drawWidget qwidget.cpp 5124
9 QWidgetBackingStore::sync qbackingstore.cpp 1261
10 QWidgetBackingStore::sync qbackingstore.cpp 1074 <==
11 QWidgetPrivate::syncBackingStore qwidget.cpp 1612
12 QETWidget::translatePaintEvent qapplication_win.cpp 3635
13 QtWndProc qapplication_win.cpp 2031
14 USER32!GetDC C:\WINDOWS\system32\user32.dll 0
15 ?? 0
16 ?? 0
17 ?? 0
0 Zkarta::paintEvent main.cpp 60
1 QWidget::event qwidget.cpp 7687
2 QApplicationPrivate::notify_helper qapplication.cpp 4056
3 QApplication::notify qapplication.cpp 4021
4 QCoreApplication::notifyInternal qcoreapplication.cpp 610
5 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 216
6 QWidgetPrivate::drawWidget qwidget.cpp 5079
7 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5189
8 QWidgetPrivate::drawWidget qwidget.cpp 5124
9 QWidgetBackingStore::sync qbackingstore.cpp 1261
10 QWidgetPrivate::syncBackingStore qwidget.cpp 1603 <==
11 QWidget::event qwidget.cpp 7827
12 QApplicationPrivate::notify_helper qapplication.cpp 4056
13 QApplication::notify qapplication.cpp 4021
14 QCoreApplication::notifyInternal qcoreapplication.cpp 610
15 QCoreApplication::sendEvent qcoreapplication.h 213
16 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1247
17 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 679
18 QGuiEventDispatcherWin32::processEvents qapplication_win.cpp 1182
19 QEventLoop::processEvents qeventloop.cpp 149
20 QEventLoop::exec qeventloop.cpp 201
21 QCoreApplication::exec qcoreapplication.cpp 888
22 QApplication::exec qapplication.cpp 3525
23 main main.cpp 79
Вот коды в местах вызовов
qbackingstore.cpp 1261
#ifdef Q_BACKINGSTORE_SUBSURFACES
чегото
#else
QPoint offset(tlwOffset);
if (w != tlw)
offset += w->mapTo(tlw, QPoint());
wd->drawWidget(windowSurface->paintDevice(), toBePainted, offset, flags, 0, this);
// это 1261
#endif
}
// Paint the rest with composition.
#ifndef Q_BACKINGSTORE_SUBSURFACES
if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
tlw->d_func()->drawWidget(windowSurface->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this);
// и отсюда иногда зовется
}
endPaint(toClean, windowSurface, &beginPaintInfo);
#else
чегото
#endif
widget.cpp 1603
void QWidgetPrivate::syncBackingStore()
{
if (paintOnScreen()) {
repaint_sys(dirty);
dirty = QRegion();
} else if (QWidgetBackingStore *bs = maybeBackingStore()) {
bs->sync();
}
}
При перекратии другим окном тоже 2 QPaintEvent
WinXP красивости отключил, Qt последний, MinGW
Как от двойной перерисовки избавится?