当前位置: 首页>>代码示例>>C++>>正文


C++ QWidget::d_func方法代码示例

本文整理汇总了C++中QWidget::d_func方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::d_func方法的具体用法?C++ QWidget::d_func怎么用?C++ QWidget::d_func使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidget的用法示例。


在下文中一共展示了QWidget::d_func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: renderToolbar

void QUnifiedToolbarSurface::renderToolbar(QWidget *widget, bool forceFlush)
{
    QWidget *toolbar = widget->d_func()->toolbar_ancestor;

    updateToolbarOffset(toolbar);
    QRect beginPaintRect(toolbar->d_func()->toolbar_offset.x(), toolbar->d_func()->toolbar_offset.y(), toolbar->geometry().width(), toolbar->geometry().height());
    QRegion beginPaintRegion(beginPaintRect);

    beginPaint(beginPaintRegion);
    toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(toolbar->geometry()), QWidget::DrawChildren);
    toolbar->d_func()->flushRequested = true;

    if (forceFlush)
        flush(toolbar);
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:15,代码来源:qunifiedtoolbarsurface_mac.cpp

示例2: invalidateBuffer

void QWSWindowSurface::invalidateBuffer()
{

    QWidget *win = window();
    if (win) {
        win->d_func()->invalidateBuffer(win->rect());
#ifndef QT_NO_QWS_MANAGER
        QTLWExtra *topextra = win->d_func()->extra->topextra;
        QWSManager *manager = topextra->qwsManager;
        if (manager)
            manager->d_func()->dirtyRegion(QDecoration::All,
                                           QDecoration::Normal);
#endif
    }
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:15,代码来源:qwindowsurface_qws.cpp

示例3: region

/*!
    Returns the region (in top-level coordinates) that needs repaint and/or flush.

    If the widget is non-zero, only the dirty region for the widget is returned
    and the region will be in widget coordinates.
*/
QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const
{
    const bool widgetDirty = widget && widget != tlw;
    const QRect tlwRect(tlw->data->crect);
    const QRect surfaceGeometry(windowSurface->geometry());
    if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {
        if (widgetDirty) {
            const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
            const QPoint offset(widget->mapTo(tlw, QPoint()));
            const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset));
            return dirtyWidgetRect.translated(-offset);
        }
        return QRect(QPoint(), tlwRect.size());
    }

    // Calculate the region that needs repaint.
    QRegion r(dirty);
    for (int i = 0; i < dirtyWidgets.size(); ++i) {
        QWidget *w = dirtyWidgets.at(i);
        if (widgetDirty && w != widget && !widget->isAncestorOf(w))
            continue;
        r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint()));
    }

    // Append the region that needs flush.
    r += dirtyOnScreen;

    if (dirtyOnScreenWidgets) { // Only in use with native child widgets.
        for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {
            QWidget *w = dirtyOnScreenWidgets->at(i);
            if (widgetDirty && w != widget && !widget->isAncestorOf(w))
                continue;
            QWidgetPrivate *wd = w->d_func();
            Q_ASSERT(wd->needsFlush);
            r += wd->needsFlush->translated(w->mapTo(tlw, QPoint()));
        }
    }

    if (widgetDirty) {
        // Intersect with the widget geometry and translate to its coordinates.
        const QPoint offset(widget->mapTo(tlw, QPoint()));
        r &= widget->rect().translated(offset);
        r.translate(-offset);
    }
    return r;
}
开发者ID:fluxer,项目名称:katie,代码行数:52,代码来源:qbackingstore.cpp

示例4: recursiveRemoval

// We basically undo what we set in recursiveRedirect().
void QUnifiedToolbarSurface::recursiveRemoval(QObject *object)
{
    if (object != 0) {
        if (object->isWidgetType()) {
            QWidget *widget = qobject_cast<QWidget *>(object);

            // If it's a pop-up or something similar, we don't redirect it.
            if (widget->windowType() & Qt::Window)
                return;

            widget->d_func()->unifiedSurface = 0;
            widget->d_func()->isInUnifiedToolbar = false;
            widget->d_func()->toolbar_offset = QPoint();
            widget->d_func()->toolbar_ancestor = 0;
        }

        for (int i = 0; i < object->children().size(); ++i) {
            recursiveRemoval(object->children().at(i));
        }
    }
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:22,代码来源:qunifiedtoolbarsurface_mac.cpp

示例5: recursiveRedirect

void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, QWidget *parent_toolbar, const QPoint &offset)
{
    if (object != 0) {
        if (object->isWidgetType()) {
            QWidget *widget = qobject_cast<QWidget *>(object);

            // We redirect the painting only if the widget is in the same window
            // and is not a window in itself.
            if (!(widget->windowType() & Qt::Window)) {
                widget->d_func()->unifiedSurface = this;
                widget->d_func()->isInUnifiedToolbar = true;
                widget->d_func()->toolbar_offset = offset;
                widget->d_func()->toolbar_ancestor = parent_toolbar;

                for (int i = 0; i < object->children().size(); ++i) {
                    recursiveRedirect(object->children().at(i), parent_toolbar, offset);
                }
            }
        }
    }
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:21,代码来源:qunifiedtoolbarsurface_mac.cpp

示例6: setClipRegion

/*!
    Sets the region currently visible on the screen to be the given \a
    clip region.

    \sa clipRegion()
*/
void QWSWindowSurface::setClipRegion(const QRegion &clip)
{
    if (clip == d_ptr->clip)
        return;

    QRegion expose = (clip - d_ptr->clip);
    d_ptr->clip = clip;

    if (expose.isEmpty() || clip.isEmpty())
        return; // No repaint or flush required.

    QWidget *win = window();
    if (!win)
        return;

    if (isBuffered()) {
        // No repaint required. Flush exposed area via the backing store.
        win->d_func()->syncBackingStore(expose);
        return;
    }

#ifndef QT_NO_QWS_MANAGER
    // Invalidate exposed decoration area.
    if (win && win->isWindow()) {
        QTLWExtra *topextra = win->d_func()->extra->topextra;
        if (QWSManager *manager = topextra->qwsManager) {
            QRegion decorationExpose(manager->region());
            decorationExpose.translate(-win->geometry().topLeft());
            decorationExpose &= expose;
            if (!decorationExpose.isEmpty()) {
                expose -= decorationExpose;
                manager->d_func()->dirtyRegion(QDecoration::All, QDecoration::Normal, decorationExpose);
            }
        }
    }
#endif

    // Invalidate exposed widget area.
    win->d_func()->invalidateBuffer(expose);
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:46,代码来源:qwindowsurface_qws.cpp

示例7: unflushPaint

void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn)
{
    if (widget->d_func()->paintOnScreen() || rgn.isEmpty())
        return;

    QWidget *tlw = widget->window();
    QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
    if (!tlwExtra)
        return;

    const QPoint offset = widget->mapTo(tlw, QPoint());
    qt_flush(widget, rgn, tlwExtra->backingStore->windowSurface, tlw, offset);
}
开发者ID:fluxer,项目名称:katie,代码行数:13,代码来源:qbackingstore.cpp

示例8: setGeometry

void QRasterWindowSurface::setGeometry(const QRect &rect)
{
    QWindowSurface::setGeometry(rect);
    Q_D(QRasterWindowSurface);
    d->inSetGeometry = true;
    if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) {
#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN))

#ifndef Q_WS_WIN
        if (d_ptr->translucentBackground)
#else
        if (!qt_widget_private(window())->isOpaque)
#endif
            prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
        else
#endif
            prepareBuffer(QNativeImage::systemFormat(), window());
    }
    d->inSetGeometry = false;

#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
    QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
    if (mWindow) {
        QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
        QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;

        for (int i = 0; i < toolbarList.size(); ++i) {
            QToolBar* toolbar = toolbarList.at(i);
            if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
                QWidget* tbWidget = (QWidget*) toolbar;
                if (tbWidget->d_func()->unifiedSurface) {
                    tbWidget->d_func()->unifiedSurface->setGeometry(rect);
                }
            }
        }
    }
#endif // Q_WS_MAC && QT_MAC_USE_COCOA

}
开发者ID:wpbest,项目名称:copperspice,代码行数:39,代码来源:qwindowsurface_raster.cpp

示例9: reportGeometryChange

void QApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
{
    // This operation only makes sense after the QApplication constructor runs
    if (QCoreApplication::startingUp())
        return;

    QApplication::desktop()->d_func()->updateScreenList();

    // signal anything listening for screen geometry changes
    QDesktopWidget *desktop = QApplication::desktop();
    emit desktop->resized(e->index);

    // make sure maximized and fullscreen windows are updated
    QWidgetList list = QApplication::topLevelWidgets();
    for (int i = list.size() - 1; i >= 0; --i) {
        QWidget *w = list.at(i);
        if (w->isFullScreen())
            w->d_func()->setFullScreenSize_helper();
        else if (w->isMaximized())
            w->d_func()->setMaxWindowState_helper();
    }
}
开发者ID:TriggeredMessaging,项目名称:phantomjs,代码行数:22,代码来源:qapplication_qpa.cpp

示例10:

QGesture *QWinNativePanGestureRecognizer::create(QObject *target)
{
    if (!target)
        return new QPanGesture; // a special case
    if (!target->isWidgetType())
        return 0;
    if (qobject_cast<QGraphicsObject *>(target))
        return 0;

    QWidget *q = static_cast<QWidget *>(target);
    QWidgetPrivate *d = q->d_func();
    d->nativeGesturePanEnabled = true;
    d->winSetupGestures();

    return new QPanGesture;
}
开发者ID:maxxant,项目名称:qt,代码行数:16,代码来源:qwinnativepangesturerecognizer_win.cpp

示例11: staticContents

/*!
    Returns the static content inside the \a parent if non-zero; otherwise the static content
    for the entire backing store is returned. The content will be clipped to \a withinClipRect
    if non-empty.
*/
QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const
{
    if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {
        const QRect surfaceGeometry(windowSurface->geometry());
        QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
        if (!withinClipRect.isEmpty())
            surfaceRect &= withinClipRect;
        return QRegion(surfaceRect);
    }

    QRegion region;
    if (parent && parent->d_func()->children.isEmpty())
        return region;

    const bool clipToRect = !withinClipRect.isEmpty();
    const int count = staticWidgets.count();
    for (int i = 0; i < count; ++i) {
        QWidget *w = staticWidgets.at(i);
        QWidgetPrivate *wd = w->d_func();
        if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty()
            || !w->isVisible() || (parent && !parent->isAncestorOf(w))) {
            continue;
        }

        QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height());
        const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint());
        if (clipToRect)
            rect &= withinClipRect.translated(-offset);
        if (rect.isEmpty())
            continue;

        rect &= wd->clipRect();
        if (rect.isEmpty())
            continue;

        QRegion visible(rect);
        wd->clipToEffectiveMask(visible);
        if (visible.isEmpty())
            continue;
        wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true);

        visible.translate(offset);
        region += visible;
    }

    return region;
}
开发者ID:fluxer,项目名称:katie,代码行数:52,代码来源:qbackingstore.cpp

示例12: dirtyWidget_sys

void QWidgetPrivate::dirtyWidget_sys(const QRegion &rgn, bool updateImmediately)
{
    Q_Q(QWidget);
    QWidget *tlw = q->window();

    QTLWExtra *tlwExtra = tlw->d_func()->topData();
    QWidgetBackingStore *wbs = tlwExtra->backingStore;
    QRegion wrgn(rgn);

    if (tlw != q) {
        QPoint offs(q->mapTo(tlw, QPoint()));
        wrgn.translate(offs);
    }

    QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface);
    if (surface) {
        surface->d_ptr->updateImmediately = updateImmediately;
        if (tlwExtra->proxyWidget) {
            // Add the existing dirty region to the current update region before
            // we reset QWSWindowSurface::dirty. We do this in order to always
            // send an update event on sub-sequent updates/repaints.
            wrgn += surface->d_ptr->dirty;
            surface->d_ptr->dirty = QRegion(); // XXX: hw: Make sure we post/send update requests.
            surface->d_ptr->clip = wrgn;
        }
        surface->setDirty(wrgn);

        // re-get, since setDirty may recreate the surface
        surface = static_cast<QWSWindowSurface*>(wbs->windowSurface);

        surface->d_ptr->updateImmediately = false;

#ifdef Q_BACKINGSTORE_SUBSURFACES
        // dirty on all subsurfaces...

        QList<QWindowSurface*> subSurfaces = wbs->subSurfaces;
        // XXX: hw: only if region intersects any of the subsurfaces
        for (int i = 0; i < subSurfaces.size(); ++i) {
            QWSWindowSurface *s = static_cast<QWSWindowSurface*>(subSurfaces.at(i));
            QPoint p = s->window()->mapTo(tlw, QPoint()); // must use widget?
            s->d_ptr->updateImmediately = updateImmediately;
            s->setDirty(wrgn.translated(-p));
            s->d_ptr->updateImmediately = false;
        }
#endif // Q_BACKINGSTORE_SUBSURFACES
    }
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:47,代码来源:qwidget_qws.cpp

示例13: cleanWidget_sys

void QWidgetPrivate::cleanWidget_sys(const QRegion& rgn)
{
    Q_Q(QWidget);
    QWidget *tlw = q->window();
    QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
    if (!tlwExtra || !tlwExtra->proxyWidget || tlwExtra->backingStore)
        return;

    QRegion wrgn(rgn);
    if (tlw != q) {
        QPoint offs(q->mapTo(tlw, QPoint()));
        wrgn.translate(offs);
    }

    if (QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(tlwExtra->backingStore->windowSurface))
        surface->d_ptr->dirty -= wrgn;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:17,代码来源:qwidget_qws.cpp

示例14: DrawNow

void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &)
{
    QWidget *window = widget->window();
    Q_ASSERT(window);
    QTLWExtra *topExtra = window->d_func()->maybeTopData();
    Q_ASSERT(topExtra);
    QRect qr = region.boundingRect();
    if (!topExtra->inExpose) {
        topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again
        TRect tr = qt_QRect2TRect(qr);
        widget->winId()->DrawNow(tr);
        topExtra->inExpose = false;
    } else {
        // This handles the case when syncBackingStore updates content outside of the
        // original drawing rectangle. This might happen if there are pending update()
        // events at the same time as we get a Draw() from Symbian.
        QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect());
        if (!drawRect.contains(qr))
            widget->winId()->DrawDeferred();
    }
}
开发者ID:BGmot,项目名称:Qt,代码行数:21,代码来源:qwindowsurface_s60.cpp

示例15: flush

/*!
    Flushes the contents of the backing store into the top-level widget.
    If the \a widget is non-zero, the content is flushed to the \a widget.
    If the \a surface is non-zero, the content of the \a surface is flushed.
*/
void QWidgetBackingStore::flush(QWidget *widget, QWindowSurface *surface)
{
    if (!dirtyOnScreen.isEmpty()) {
        QWidget *target = widget ? widget : tlw;
        QWindowSurface *source = surface ? surface : windowSurface;
        qt_flush(target, dirtyOnScreen, source, tlw, tlwOffset);
        dirtyOnScreen = QRegion();
    }

    if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty())
        return;

    for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {
        QWidget *w = dirtyOnScreenWidgets->at(i);
        QWidgetPrivate *wd = w->d_func();
        Q_ASSERT(wd->needsFlush);
        qt_flush(w, *wd->needsFlush, windowSurface, tlw, tlwOffset);
        *wd->needsFlush = QRegion();
    }
    dirtyOnScreenWidgets->clear();
}
开发者ID:fluxer,项目名称:katie,代码行数:26,代码来源:qbackingstore.cpp


注:本文中的QWidget::d_func方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。