various cleanups

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-05-26 14:26:06 +00:00
parent 84083e7906
commit afc6650f34
2 changed files with 11 additions and 34 deletions

View file

@ -753,10 +753,9 @@ void QWidget::setAutoFillBackground(bool enabled)
is no need to write double-buffering code in paintEvent() to avoid
flicker.
Since Qt 4.1, the Qt::WA_ContentsPropagated widget attribute has been
deprecated. Instead, the contents of parent widgets are propagated by
default to each of their children as long as Qt::WA_PaintOnScreen is not
set. Custom widgets can be written to take advantage of this feature by
Since Qt 4.1, the contents of parent widgets are propagated by default
to each of their children as long as Qt::WA_PaintOnScreen is not set.
Custom widgets can be written to take advantage of this feature by
updating irregular regions (to create non-rectangular child widgets), or
painting with colors that have less than full alpha component. The
following diagram shows how attributes and properties of a custom widget
@ -8734,8 +8733,8 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil
void QWidgetPrivate::updateGeometry_helper(bool forceUpdate)
{
Q_Q(QWidget);
QWidget *parent;
if (forceUpdate || !extra || extra->minw != extra->maxw || extra->minh != extra->maxh) {
QWidget *parent;
if (!q->isWindow() && !q->isHidden() && (parent = q->parentWidget())) {
if (parent->d_func()->layout)
parent->d_func()->layout->invalidate();

View file

@ -765,27 +765,15 @@ void QPaintEngine::drawLines(const QLineF *lines, int lineCount)
*/
void QPaintEngine::drawLines(const QLine *lines, int lineCount)
{
struct PointF {
qreal x;
qreal y;
};
struct LineF {
PointF p1;
PointF p2;
};
Q_ASSERT(sizeof(PointF) == sizeof(QPointF));
Q_ASSERT(sizeof(LineF) == sizeof(QLineF));
LineF fl[256];
QLineF fl[256];
while (lineCount) {
int i = 0;
while (i < lineCount && i < 256) {
fl[i].p1.x = lines[i].x1();
fl[i].p1.y = lines[i].y1();
fl[i].p2.x = lines[i].x2();
fl[i].p2.y = lines[i].y2();
fl[i].setP1(lines[i].p1());
fl[i].setP2(lines[i].p2());
++i;
}
drawLines((QLineF *)(void *)fl, i);
drawLines(fl, i);
lines += i;
lineCount -= i;
}
@ -801,24 +789,14 @@ void QPaintEngine::drawLines(const QLine *lines, int lineCount)
*/
void QPaintEngine::drawRects(const QRect *rects, int rectCount)
{
struct RectF {
qreal x;
qreal y;
qreal w;
qreal h;
};
Q_ASSERT(sizeof(RectF) == sizeof(QRectF));
RectF fr[256];
QRectF fr[256];
while (rectCount) {
int i = 0;
while (i < rectCount && i < 256) {
fr[i].x = rects[i].x();
fr[i].y = rects[i].y();
fr[i].w = rects[i].width();
fr[i].h = rects[i].height();
fr[i] = QRectF(rects[i]);
++i;
}
drawRects((QRectF *)(void *)fr, i);
drawRects(fr, i);
rects += i;
rectCount -= i;
}