本文整理汇总了C++中QWindow类的典型用法代码示例。如果您正苦于以下问题:C++ QWindow类的具体用法?C++ QWindow怎么用?C++ QWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
{
switch (variable) {
case NPNVxDisplay:
*reinterpret_cast<void**>(value) = x11Display();
*result = NPERR_NO_ERROR;
return true;
case NPNVxtAppContext:
*result = NPERR_GENERIC_ERROR;
return true;
case NPNVnetscapeWindow: {
QWebPageClient* client = platformPageClient();
QWindow* window = client ? client->ownerWindow() : 0;
*reinterpret_cast<XID*>(value) = window ? window->winId() : 0;
*result = NPERR_NO_ERROR;
return true;
}
case NPNVToolkit:
if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
*((uint32_t *)value) = 2;
*result = NPERR_NO_ERROR;
return true;
}
return false;
default:
return false;
}
}
示例2: handleFocusEvent
/* Compress activation events. If the next focus window is already known
* at the time the current one receives focus-out, pass that to
* QWindowSystemInterface instead of sending 0 and ignore its consecutive
* focus-in event.
* This helps applications that do handling in focus-out events. */
void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
QWindowsWindow *platformWindow)
{
QWindow *nextActiveWindow = 0;
if (et == QtWindows::FocusInEvent) {
QWindow *topWindow = QWindowsWindow::topLevelOf(platformWindow->window());
QWindow *modalWindow = 0;
if (QGuiApplicationPrivate::instance()->isWindowBlocked(topWindow, &modalWindow) && topWindow != modalWindow) {
modalWindow->requestActivate();
return;
}
// QTBUG-32867: Invoking WinAPI SetParent() can cause focus-in for the
// window which is not desired for native child widgets.
if (platformWindow->testFlag(QWindowsWindow::WithinSetParent)) {
QWindow *currentFocusWindow = QGuiApplication::focusWindow();
if (currentFocusWindow && currentFocusWindow != platformWindow->window()) {
currentFocusWindow->requestActivate();
return;
}
}
nextActiveWindow = platformWindow->window();
} else {
// Focus out: Is the next window known and different
// from the receiving the focus out.
if (const HWND nextActiveHwnd = GetFocus())
if (QWindowsWindow *nextActivePlatformWindow = findClosestPlatformWindow(nextActiveHwnd))
if (nextActivePlatformWindow != platformWindow)
nextActiveWindow = nextActivePlatformWindow->window();
}
if (nextActiveWindow != d->m_lastActiveWindow) {
d->m_lastActiveWindow = nextActiveWindow;
QWindowSystemInterface::handleWindowActivated(nextActiveWindow);
}
}
示例3: translateMouseButton
bool MouseTouchAdaptor::handleButtonRelease(WId windowId, uint32_t detail, uint32_t, int x, int y)
{
Qt::MouseButton button = translateMouseButton(detail);
// Don't eat the event if it wasn't a left mouse press
if (button != Qt::LeftButton)
return false;
QWindow *targetWindow = findQWindowWithXWindowID(windowId);
QPoint windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
false /* autoCommit */);
touchEvent.release(0 /* touchId */, windowPos);
if (m_triPressModifier) {
touchEvent.release(1, windowPos);
touchEvent.release(2, windowPos);
}
if (m_quadPressModifier) {
touchEvent.release(1, windowPos);
touchEvent.release(2, windowPos);
touchEvent.release(3, windowPos);
}
touchEvent.commit(false /* processEvents */);
m_leftButtonIsPressed = false;
m_triPressModifier = false;
m_quadPressModifier = false;
return true;
}
示例4: inputItemChanged
void QMeeGoPlatformInputContext::inputItemChanged()
{
if (!d->valid)
return;
QInputPanel *panel = qApp->inputPanel();
QObject *input = panel->inputItem();
QWindow *window = panel->inputWindow();
d->imState["focusState"] = input != 0;
if (input) {
if (window)
d->imState["winId"] = static_cast<qulonglong>(window->winId());
if (!d->active) {
d->active = true;
d->server->activateContext();
// ### react to orientation changes, too
if (window)
d->server->appOrientationChanged(orientationAngle(window->screen()->currentOrientation()));
}
}
d->sendStateUpdate(/*focusChanged*/true);
if (input && window && d->visibility == InputPanelShowRequested)
showInputPanel();
}
示例5: dumpGlInfo
void dumpGlInfo(QTextStream &str, bool listExtensions)
{
QOpenGLContext context;
if (context.create()) {
# ifdef QT_OPENGL_DYNAMIC
str << "Dynamic GL ";
# endif
switch (context.openGLModuleType()) {
case QOpenGLContext::LibGL:
str << "LibGL";
break;
case QOpenGLContext::LibGLES:
str << "LibGLES";
break;
}
QWindow window;
window.setSurfaceType(QSurface::OpenGLSurface);
window.create();
context.makeCurrent(&window);
QOpenGLFunctions functions(&context);
str << " Vendor: " << reinterpret_cast<const char *>(functions.glGetString(GL_VENDOR))
<< "\nRenderer: " << reinterpret_cast<const char *>(functions.glGetString(GL_RENDERER))
<< "\nVersion: " << reinterpret_cast<const char *>(functions.glGetString(GL_VERSION))
<< "\nShading language: " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))
<< "\nFormat: " << context.format();
if (listExtensions) {
QList<QByteArray> extensionList = context.extensions().toList();
std::sort(extensionList.begin(), extensionList.end());
str << " \nFound " << extensionList.size() << " extensions:\n";
foreach (const QByteArray &extension, extensionList)
str << " " << extension << '\n';
}
} else {
示例6: presentBuffer
void QEglFSKmsIntegration::presentBuffer(QPlatformSurface *surface)
{
QWindow *window = static_cast<QWindow *>(surface->surface());
QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(window->screen()->handle());
screen->flip();
}
示例7: QVBoxLayout
void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
{
QTabWidget tab;
QWidget *w = new QWidget;
tab.addTab(w, "Tab1");
QVBoxLayout *vl = new QVBoxLayout(w);
QLabel *lbl = new QLabel("HELLO1");
lbl->setObjectName("label1");
vl->addWidget(lbl);
w = new QWidget;
tab.addTab(w, "Tab2");
vl = new QVBoxLayout(w);
lbl = new QLabel("HELLO2");
lbl->setAttribute(Qt::WA_NativeWindow);
lbl->setObjectName("label2");
vl->addWidget(lbl);
tab.show();
QVERIFY(QTest::qWaitForWindowExposed(&tab));
QWindow *win = tab.windowHandle();
win->destroy();
QWindowPrivate *p = qt_window_private(win);
p->create(true);
win->show();
tab.setCurrentIndex(1);
}
示例8: setDefaultFormat
void KisOpenGL::initialize()
{
if (initialized) return;
setDefaultFormat();
// we need a QSurface active to get our GL functions from the context
QWindow surface;
surface.setSurfaceType( QSurface::OpenGLSurface );
surface.create();
QOpenGLContext context;
context.create();
context.makeCurrent( &surface );
QOpenGLFunctions *funcs = context.functions();
funcs->initializeOpenGLFunctions();
qDebug() << "OpenGL Info";
qDebug() << " Vendor: " << reinterpret_cast<const char *>(funcs->glGetString(GL_VENDOR));
qDebug() << " Renderer: " << reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
qDebug() << " Version: " << reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
qDebug() << " Shading language: " << reinterpret_cast<const char *>(funcs->glGetString(GL_SHADING_LANGUAGE_VERSION));
qDebug() << " Requested format: " << QSurfaceFormat::defaultFormat();
qDebug() << " Current format: " << context.format();
glMajorVersion = context.format().majorVersion();
glMinorVersion = context.format().minorVersion();
supportsDeprecatedFunctions = (context.format().options() & QSurfaceFormat::DeprecatedFunctions);
initialized = true;
}
示例9: transientParent
void QQuickMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
{
QWindow *pw = transientParent();
if (!pw && parentItem())
pw = parentItem()->window();
if (!pw)
pw = this;
QRect g = pw->screen()->availableVirtualGeometry();
if (posx + w > g.right()) {
if (qobject_cast<QQuickMenuPopupWindow *>(transientParent())) {
// reposition submenu window on the parent menu's left side
int submenuOverlap = pw->x() + pw->width() - posx;
posx -= pw->width() + w - 2 * submenuOverlap;
} else {
posx = g.right() - w;
}
} else {
posx = qMax(posx, g.left());
}
posy = qBound(g.top(), posy, g.bottom() - h);
QQuickWindow::setGeometry(posx, posy, w, h);
}
示例10: window
void QHaikuWindow::propagateSizeHints()
{
QWindow *win = window();
QSize minimumSize = win->minimumSize();
QSize maximumSize = win->maximumSize();
// QSize baseSize = win->baseSize();
// QSize sizeIncrement = win->sizeIncrement();
float minW, maxW, minH, maxH;
m_window->GetSizeLimits(&minW, &maxW, &minH, &maxH);
// qDebug() << "G: " << minW << maxW << minH << maxH;
if (minimumSize.width() > 0)
minW = minimumSize.width();
if (minimumSize.height() > 0)
minH = minimumSize.height();
if (maximumSize.width() < QWINDOWSIZE_MAX)
maxW = maximumSize.width();
if (maximumSize.height() < QWINDOWSIZE_MAX)
maxH = maximumSize.height();
// qDebug() << "S: " << minW << maxW << minH << maxH;
m_window->SetSizeLimits(minW, maxW, minH, maxH);
}
示例11: dbg
void QHimePlatformInputContext::setFocusObject(QObject* object)
{
dbg("QHimePlatformInputContext::setFocusObject\n");
QWindow *window = qApp->focusWindow();
if (!window) {
dbg("no window, focus out\n");
focused_win = 0;
char *rstr = NULL;
hime_im_client_focus_out2(hime_ch, &rstr);
if (rstr) {
send_str(rstr);
} else {
dbg("no str in preedit\n");
}
return;
}
WId win = window->winId();
if (focused_win && win != focused_win) {
if (hime_ch) {
hime_im_client_focus_out(hime_ch);
}
}
focused_win = win;
if (hime_ch) {
hime_im_client_set_window(hime_ch, win);
hime_im_client_focus_in(hime_ch);
cursorMoved();
}
}
示例12: Q_Q
void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
QWindow *window = q->windowHandle();
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
q->setAttribute(Qt::WA_Mapped, false);
if (q->isWindow() && q->windowModality() != Qt::NonModal && window) {
// remove our window from the modal window list
QGuiApplicationPrivate::hideModalWindow(window);
}
// do not return here, if window non-zero, we must hide it
}
deactivateWidgetCleanup();
if (!q->isWindow()) {
QWidget *p = q->parentWidget();
if (p &&p->isVisible()) {
invalidateBuffer(q->rect());
}
} else {
invalidateBuffer(q->rect());
}
if (window)
window->setVisible(false);
}
示例13: QObject
MnemonicAttached::MnemonicAttached(QObject *parent)
: QObject(parent)
{
QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent);
if (parentItem) {
if (parentItem->window()) {
m_window = parentItem->window();
m_window->installEventFilter(this);
}
connect(parentItem, &QQuickItem::windowChanged, this,
[this](QQuickWindow *window) {
if (m_window) {
QWindow *renderWindow = QQuickRenderControl::renderWindowFor(m_window);
if (renderWindow) {
renderWindow->removeEventFilter(this);
} else {
m_window->removeEventFilter(this);
}
}
m_window = window;
if (m_window) {
QWindow *renderWindow = QQuickRenderControl::renderWindowFor(m_window);
//renderWindow means the widget is rendering somewhere else, like a QQuickWidget
if (renderWindow && renderWindow != m_window) {
renderWindow->installEventFilter(this);
} else {
m_window->installEventFilter(this);
}
}
});
}
}
示例14: __adjustResizeWindow
void Wpp::__adjustResizeWindow()
{
int kbHeight = 280*wpp::qt::Wpp::getInstance().dp2px();
QWindow *window = QGuiApplication::focusWindow();
window->setHeight( window->height() - kbHeight );
qDebug() << __FUNCTION__ << ":resize-ok-to:" << window->size();
}
示例15: app
void tst_QX11Info::appTime()
{
int argc = 0;
QApplication app(argc, 0);
// No X11 event received yet
QCOMPARE(QX11Info::appTime(), 0ul);
QCOMPARE(QX11Info::appUserTime(), 0ul);
// Trigger some X11 events
QWindow window;
window.show();
QTest::qWait(100);
QVERIFY(QX11Info::appTime() > 0);
unsigned long t0 = QX11Info::appTime();
unsigned long t1 = t0 + 1;
QX11Info::setAppTime(t1);
QCOMPARE(QX11Info::appTime(), t1);
unsigned long u0 = QX11Info::appUserTime();
unsigned long u1 = u0 + 1;
QX11Info::setAppUserTime(u1);
QCOMPARE(QX11Info::appUserTime(), u1);
}