本文整理汇总了C++中QWindow::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::setVisible方法的具体用法?C++ QWindow::setVisible怎么用?C++ QWindow::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWindowFlags
void QQuickViewInspector::setWindowFlags(Qt::WindowFlags flags)
{
QWindow *w = getMasterWindow(m_view);
w->setFlags(flags);
// make flags are applied
w->setVisible(false);
w->setVisible(true);
}
示例2: hide_sys
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);
}
示例3: show_sys
void QWidgetPrivate::show_sys()
{
Q_Q(QWidget);
QWindow *window = q->windowHandle();
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
invalidateBuffer(q->rect());
q->setAttribute(Qt::WA_Mapped);
if (q->isWindow() && q->windowModality() != Qt::NonModal && window) {
// add our window to the modal window list
QGuiApplicationPrivate::showModalWindow(window);
}
return;
}
QApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));
if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))
return;
if (window) {
if (q->isWindow())
fixPosIncludesFrame();
QRect geomRect = q->geometry();
if (!q->isWindow()) {
QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint());
geomRect.moveTopLeft(topLeftOfWindow);
}
const QRect windowRect = window->geometry();
if (windowRect != geomRect) {
if (q->testAttribute(Qt::WA_Moved))
window->setGeometry(geomRect);
else
window->resize(geomRect.size());
}
if (QBackingStore *store = q->backingStore()) {
if (store->size() != geomRect.size()) {
store->resize(geomRect.size());
}
}
#ifndef QT_NO_CURSOR
qt_qpa_set_cursor(q, false); // Needed in case cursor was set before show
#endif
invalidateBuffer(q->rect());
window->setVisible(true);
// Was the window moved by the Window system or QPlatformWindow::initialGeometry() ?
if (window->isTopLevel()) {
const QPoint crectTopLeft = q->data->crect.topLeft();
const QPoint windowTopLeft = window->geometry().topLeft();
if (crectTopLeft == QPoint(0, 0) && windowTopLeft != crectTopLeft)
q->data->crect.moveTopLeft(windowTopLeft);
}
}
}
示例4: create_sys
void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
{
Q_Q(QWidget);
Q_UNUSED(window);
Q_UNUSED(initializeWindow);
Q_UNUSED(destroyOldWindow);
Qt::WindowFlags flags = data.window_flags;
if (!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow())
return; // we only care about real toplevels
QWindow *win = topData()->window;
// topData() ensures the extra is created but does not ensure 'window' is non-null
// in case the extra was already valid.
if (!win) {
createTLSysExtra();
win = topData()->window;
}
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved))
win->setGeometry(q->geometry());
else
win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
if (q->testAttribute(Qt::WA_TranslucentBackground)) {
QSurfaceFormat format;
format.setAlphaBufferSize(8);
win->setFormat(format);
}
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
win->setTransientParent(nativeParent->windowHandle());
win->setParent(0);
} else {
win->setTransientParent(0);
win->setParent(nativeParent->windowHandle());
}
}
}
qt_window_private(win)->positionPolicy = topData()->posIncludesFrame ?
QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;
win->create();
// Enable nonclient-area events for QDockWidget and other NonClientArea-mouse event processing.
if ((flags & Qt::Desktop) == Qt::Window)
win->handle()->setFrameStrutEventsEnabled(true);
data.window_flags = win->flags();
QBackingStore *store = q->backingStore();
if (!store) {
if (win && q->windowType() != Qt::Desktop)
q->setBackingStore(new QBackingStore(win));
else
q->setAttribute(Qt::WA_PaintOnScreen, true);
}
setWindowModified_helper();
setWinId(win->winId());
// Check children and create windows for them if necessary
q_createNativeChildrenAndSetParent(q);
if (extra && !extra->mask.isEmpty())
setMask_sys(extra->mask);
// If widget is already shown, set window visible, too
if (q->isVisible())
win->setVisible(true);
}