本文整理汇总了C++中QPlatformIntegration类的典型用法代码示例。如果您正苦于以下问题:C++ QPlatformIntegration类的具体用法?C++ QPlatformIntegration怎么用?C++ QPlatformIntegration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPlatformIntegration类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_UNUSED
void QWaylandDisplay::displayHandleGlobal(uint32_t id,
const QByteArray &interface,
uint32_t version)
{
Q_UNUSED(version);
if (interface == "wl_output") {
struct wl_output *output = wl_output_create(mDisplay, id, 1);
wl_output_add_listener(output, &outputListener, this);
} else if (interface == "wl_compositor") {
mCompositor = wl_compositor_create(mDisplay, id, 1);
wl_compositor_add_listener(mCompositor,
&compositorListener, this);
} else if (interface == "wl_shm") {
mShm = wl_shm_create(mDisplay, id, 1);
} else if (interface == "wl_shell") {
mShell = wl_shell_create(mDisplay, id, 1);
wl_shell_add_listener(mShell, &shellListener, this);
} else if (interface == "wl_input_device") {
QWaylandInputDevice *inputDevice =
new QWaylandInputDevice(mDisplay, id);
mInputDevices.append(inputDevice);
} else if (interface == "wl_selection_offer") {
QPlatformIntegration *plat = QApplicationPrivate::platformIntegration();
QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard());
clipboard->createSelectionOffer(id);
}
}
示例2: QLOG_INFO
void DisplayManagerRPI::resetRendering()
{
QGuiApplication *guiApp = (QGuiApplication*)QGuiApplication::instance();
QQuickWindow *window = (QQuickWindow*)guiApp->focusWindow();
if (window)
{
QLOG_INFO() << "Recreating Qt UI renderer";
// destroy the window to reset OpenGL context
window->setPersistentOpenGLContext(false);
window->setPersistentSceneGraph(false);
window->destroy();
// Grab the Platform integration private object and recreate it
// this allows to clean / recreate the dispmanx objects
QGuiApplicationPrivate *privateApp = (QGuiApplicationPrivate *)QGuiApplicationPrivate::get(guiApp);
QPlatformIntegration *integration = privateApp->platformIntegration();
if (integration)
{
integration->destroy();
QThread::msleep(500);
integration->initialize();
}
else
{
QLOG_ERROR() << "Failed to retrieve platform integration";
}
// now recreate the window OpenGL context
window->setScreen(QGuiApplication::primaryScreen());
window->create();
}
}
示例3: qt_widget_private
QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget)
{
QWidget *window = widget->window();
QWidgetPrivate *windowPrivate = qt_widget_private(window);
QTLWExtra * topData = windowPrivate->topData();
QPlatformIntegration *integration =
QApplicationPrivate::platformIntegration();
return integration->screens()[topData->screenIndex];
}
示例4: initTestCase
void tst_QQuickAccessible::initTestCase()
{
QQmlDataTest::initTestCase();
QTestAccessibility::initialize();
QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
if (!pfIntegration->accessibility())
QSKIP("This platform does not support accessibility");
pfIntegration->accessibility()->setActive(true);
}
示例5: screenNumber
int QDesktopWidget::screenNumber(const QPoint &p) const
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
for (int i = 0; i < screens.size(); ++i)
if (screens[i]->geometry().contains(p))
return i;
return primaryScreen(); //even better would be closest screen
}
示例6: screenGeometry
const QRect QDesktopWidget::screenGeometry(int screenNo) const
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
if (screenNo < 0 || screenNo >= screens.size())
return QRect();
else
return screens[screenNo]->geometry();
}
示例7: Q_D
/*!
Factory function for scene graph backends of the distance-field glyph cache.
*/
QSGDistanceFieldGlyphCache *QSGContext::distanceFieldGlyphCache(const QRawFont &font)
{
Q_D(QSGContext);
if (!d->distanceFieldCacheManager)
d->distanceFieldCacheManager = new QSGDistanceFieldGlyphCacheManager;
QSGDistanceFieldGlyphCache *cache = d->distanceFieldCacheManager->cache(font);
if (!cache) {
QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
if (platformIntegration != 0
&& platformIntegration->hasCapability(QPlatformIntegration::SharedGraphicsCache)) {
QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine;
if (!fe->faceId().filename.isEmpty()) {
QByteArray keyName = fe->faceId().filename;
if (font.style() != QFont::StyleNormal)
keyName += QByteArray(" I");
if (font.weight() != QFont::Normal)
keyName += ' ' + QByteArray::number(font.weight());
keyName += QByteArray(" DF");
QPlatformSharedGraphicsCache *sharedGraphicsCache =
platformIntegration->createPlatformSharedGraphicsCache(keyName);
if (sharedGraphicsCache != 0) {
sharedGraphicsCache->ensureCacheInitialized(keyName,
QPlatformSharedGraphicsCache::OpenGLTexture,
QPlatformSharedGraphicsCache::Alpha8);
cache = new QSGSharedDistanceFieldGlyphCache(keyName,
sharedGraphicsCache,
d->distanceFieldCacheManager,
glContext(),
font);
}
}
}
if (!cache)
cache = new QSGDefaultDistanceFieldGlyphCache(d->distanceFieldCacheManager, glContext(), font);
d->distanceFieldCacheManager->insertCache(font, cache);
}
return cache;
}
示例8: while
QWidget *QApplication::topLevelAt(const QPoint &pos)
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
QList<QPlatformScreen *>::const_iterator screen = screens.constBegin();
QList<QPlatformScreen *>::const_iterator end = screens.constEnd();
// The first screen in a virtual environment should know about all top levels
if (pi->isVirtualDesktop()) {
QWidget *w = (*screen)->topLevelAt(pos);
return w;
}
while (screen != end) {
if ((*screen)->geometry().contains(pos))
return (*screen)->topLevelAt(pos);
++screen;
}
return 0;
}
示例9:
/*!
\internal
*/
QPlatformNativeInterface *QApplication::platformNativeInterface()
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
return pi->nativeInterface();
}
示例10: handleSelectionRequest
void QXlibScreen::handleSelectionRequest(XEvent *event)
{
QPlatformIntegration *integration = QApplicationPrivate::platformIntegration();
QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard());
clipboard->handleSelectionRequest(event);
}
示例11: Q_Q
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
if (extra) { // any size restrictions?
w = qMin(w,extra->maxw);
h = qMin(h,extra->maxh);
w = qMax(w,extra->minw);
h = qMax(h,extra->minh);
}
if (q->isWindow() && q->windowHandle()) {
QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
if (!integration->hasCapability(QPlatformIntegration::NonFullScreenWindows)) {
x = 0;
y = 0;
w = q->windowHandle()->width();
h = q->windowHandle()->height();
}
}
QPoint oldp = q->geometry().topLeft();
QSize olds = q->size();
QRect r(x, y, w, h);
bool isResize = olds != r.size();
isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter?
// We only care about stuff that changes the geometry, or may
// cause the window manager to change its state
if (r.size() == olds && oldp == r.topLeft())
return;
if (!data.in_set_window_state) {
q->data->window_state &= ~Qt::WindowMaximized;
q->data->window_state &= ~Qt::WindowFullScreen;
if (q->isWindow())
topData()->normalGeometry = QRect(0, 0, -1, -1);
}
QPoint oldPos = q->pos();
data.crect = r;
bool needsShow = false;
if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) {
q->setAttribute(Qt::WA_OutsideWSRange, true);
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
hide_sys();
data.crect = QRect(x, y, w, h);
} else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
q->setAttribute(Qt::WA_OutsideWSRange, false);
needsShow = true;
}
if (q->isVisible()) {
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && !q->testAttribute(Qt::WA_OutsideWSRange)) {
if (q->windowHandle()) {
if (q->isWindow()) {
q->windowHandle()->setGeometry(q->geometry());
} else {
QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint());
q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size()));
}
const QWidgetBackingStore *bs = maybeBackingStore();
if (bs && bs->store) {
if (isResize)
bs->store->resize(r.size());
}
if (needsShow)
show_sys();
}
if (!q->isWindow()) {
if (isMove && !isResize)
moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y());
else
invalidateBuffer_resizeHelper(oldPos, olds);
}
}
if (isMove) {
QMoveEvent e(q->pos(), oldPos);
QApplication::sendEvent(q, &e);
}
if (isResize) {
QResizeEvent e(r.size(), olds);
QApplication::sendEvent(q, &e);
if (q->windowHandle())
q->update();
}
} else { // not visible
if (isMove && q->pos() != oldPos)
q->setAttribute(Qt::WA_PendingMoveEvent, true);
if (isResize)
q->setAttribute(Qt::WA_PendingResizeEvent, true);
}
}
示例12: numScreens
int QDesktopWidget::numScreens() const
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
return qMax(pi->screens().size(), 1);
}