void QWidget::setWindowState(Qt::WindowStates newstate) { Q_D(QWidget); Qt::WindowStates oldstate = windowState(); if (oldstate == newstate) return; if (isWindow() && !testAttribute(Qt::WA_WState_Created)) create(); data->window_state = newstate; data->in_set_window_state = 1; Qt::WindowState newEffectiveState = effectiveState(newstate); Qt::WindowState oldEffectiveState = effectiveState(oldstate); if (isWindow() && newEffectiveState != oldEffectiveState) { // Ensure the initial size is valid, since we store it as normalGeometry below. if (!testAttribute(Qt::WA_Resized) && !isVisible()) adjustSize(); d->createTLExtra(); if (oldEffectiveState == Qt::WindowNoState) d->topData()->normalGeometry = geometry(); Q_ASSERT(windowHandle()); windowHandle()->setWindowState(newEffectiveState); } data->in_set_window_state = 0; if (newstate & Qt::WindowActive) activateWindow(); QWindowStateChangeEvent e(oldstate); QApplication::sendEvent(this, &e); }
void QWidget::setMask(const QRegion& region) { Q_D(QWidget); d->createExtra(); if (region == d->extra->mask) return; QRegion parentR; if (!isWindow()) parentR = d->extra->mask.isEmpty() ? QRegion(rect()) : d->extra->mask ; d->extra->mask = region; if (isVisible()) { if (isWindow()) { d->data.fstrut_dirty = true; d->invalidateBuffer(rect()); QWindowSurface *surface = d->extra->topextra->backingStore->windowSurface; if (surface) { // QWSWindowSurface::setGeometry() returns without doing anything // if old geom == new geom. Therefore, we need to reset the old value. surface->QWindowSurface::setGeometry(QRect()); surface->setGeometry(frameGeometry()); } } else { parentR += d->extra->mask; parentWidget()->update(parentR.translated(geometry().topLeft())); update(); } } }
void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); d->aboutToDestroy(); if (!isWindow() && parentWidget()) parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); d->deactivateWidgetCleanup(); if (testAttribute(Qt::WA_WState_Created)) { setAttribute(Qt::WA_WState_Created, false); QObjectList childObjects = children(); for (int i = 0; i < childObjects.size(); ++i) { QObject *obj = childObjects.at(i); if (obj->isWidgetType()) static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows); } releaseMouse(); if (qt_pressGrab == this) qt_pressGrab = 0; if (keyboardGrb == this) releaseKeyboard(); if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); else if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); #ifndef QT_NO_IM if (d->ic) { delete d->ic; d->ic =0; } else { // release previous focus information participating with // preedit preservation of qic -- while we still have a winId QInputContext *qic = QApplicationPrivate::inputContext; if (qic) qic->widgetDestroyed(this); } #endif //QT_NO_IM if ((windowType() == Qt::Desktop)) { } else { if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { d->hide_sys(); } if (destroyWindow && isWindow()) { if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); qwsDisplay()->destroyRegion(internalWinId()); } } QT_TRY { d->setWinId(0); } QT_CATCH (const std::bad_alloc &) { // swallow - destructors must not throw } } }
void QWidget::setWindowState(Qt::WindowStates newstate) { Q_D(QWidget); Qt::WindowStates oldstate = windowState(); if (oldstate == newstate) return; if (isWindow() && !testAttribute(Qt::WA_WState_Created)) create(); data->window_state = newstate; data->in_set_window_state = 1; bool needShow = false; Qt::WindowStates newEffectiveState = effectiveState(newstate); Qt::WindowStates oldEffectiveState = effectiveState(oldstate); if (isWindow() && newEffectiveState != oldEffectiveState) { d->createTLExtra(); if (oldEffectiveState == Qt::WindowNoState) { //normal d->topData()->normalGeometry = geometry(); } else if (oldEffectiveState == Qt::WindowFullScreen) { setParent(0, d->topData()->savedFlags); needShow = true; } else if (oldEffectiveState == Qt::WindowMinimized) { needShow = true; } if (newEffectiveState == Qt::WindowMinimized) { //### not ideal... hide(); needShow = false; } else if (newEffectiveState == Qt::WindowFullScreen) { d->topData()->savedFlags = windowFlags(); setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint)); d->setFullScreenSize_helper(); raise(); needShow = true; } else if (newEffectiveState == Qt::WindowMaximized) { createWinId(); d->setMaxWindowState_helper(); } else { //normal QRect r = d->topData()->normalGeometry; if (r.width() >= 0) { d->topData()->normalGeometry = QRect(0,0,-1,-1); setGeometry(r); } } } data->in_set_window_state = 0; if (needShow) show(); if (newstate & Qt::WindowActive) activateWindow(); QWindowStateChangeEvent e(oldstate); QApplication::sendEvent(this, &e); }
void EmbeddedWebView::showEvent(QShowEvent *se) { QWebView::showEvent(se); Qt::ScrollBarPolicy policy = isWindow() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, policy); if (isWindow()) { resize(640,480); } else if (!m_scrollParent) // it would be much easier if the parents were just passed with the constructor ;-) findScrollParent(); }
void QtChatWindow::activate() { if (isWindow()) { QWidget::show(); } emit wantsToActivate(); input_->setFocus(); }
void CustomMailPage::closeTabPage() { if (isWindow()) close(); else emit tabPageClose(); }
void CustomMailPage::assignTabPage() { if (FMessageWidgets && isWindow() && !isVisible()) FMessageWidgets->assignTabWindowPage(this); else emit tabPageAssign(); }
void MainWindow::neovimAttachmentChanged(bool attached) { emit neovimAttached(attached); if (isWindow() && m_shell != NULL) { m_shell->updateGuiWindowState(windowState()); } }
void NormalWindow::closeTabPage() { if (isWindow()) close(); else emit tabPageClose(); }
void QTouchSettingWidget::onChangeLanguage() { if( !isWindow() ) return; QLangRes& Res = QLangManager::instance()->getResource(); setWindowTitle( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("WINDOW_CAPTION")) ); ui->LBSlow1->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_SLOW")) ); ui->LBSlow2->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_SLOW")) ); ui->LBFast1->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_FAST")) ); ui->LBFast2->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_FAST")) ); ui->BtnDefault->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("BTN_CAPTION_DEFAULT")) ); ui->BtnClose->setText( Res.getResString(QString::fromUtf8("COMMON"), QString::fromUtf8("TEXT_CLOSE")) ); ui->TitleTimeSetting->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TITLE_TIME_SETTING")) ); ui->TitleWheelZoomSetting->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TITLE_WHEEL_SENSITIVITY_SETTING")) ); ui->LBTap->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_TAP")) ); ui->LBLongTap->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_LONG_TAP")) ); ui->LBWheel->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_WHEEL")) ); ui->LBZoom->setText( Res.getResString(QString::fromUtf8("TOUCH SETTING"), QString::fromUtf8("TEXT_ZOOM")) ); ui->TitleTouchSensitivity->setText( Res.getResString(QString::fromUtf8("CALIBRATION SETTING"), QString::fromUtf8("TITLE_TOUCH_SENSITIVITY")) ); ui->LBSensitivity->setText( Res.getResString(QString::fromUtf8("CALIBRATION SETTING"), QString::fromUtf8("TEXT_SENSITIVITY")) ); Qt::AlignmentFlag eFlag = Res.isR2L() ? Qt::AlignLeft : Qt::AlignRight; ui->EditTap->setAlignment( eFlag ); ui->EditLongTap->setAlignment( eFlag ); ui->EditWheel->setAlignment( eFlag ); ui->EditZoom->setAlignment( eFlag ); }
void NormalWindow::assignTabPage() { if (isWindow() && !isVisible()) FMessageWidgets->assignTabWindowPage(this); else emit tabPageAssign(); }
void ppc::Desktop::addWindow(WindowInterface* wi){ if (wi == nullptr || wi == this->desktopWindow_) return; //If the Window is already in the Desktop, we merely need //to focus it. if (!isWindow(wi)) { //Otherwise, if wi is not a window in the desktop, //automatically put it at the front, //and focused is set to what was added BorderDecorator* borderOfWi = dynamic_cast<BorderDecorator*>(wi); if (borderOfWi != nullptr) { //The following creates bounds for dragging Windows. sf::FloatRect desktopBounds = desktopWindow_->getBounds(); sf::FloatRect wiBounds = wi->getBounds(); sf::FloatRect bounds(desktopBounds); bounds.left += 5; bounds.top += 34; bounds.width -= wiBounds.width; bounds.height -= wiBounds.height; borderOfWi->setClampBounds(bounds); } focused_ = *(windows_.insert(windows_.begin(), wi)); } }
void NormalWindow::showTabPage() { if (isWindow()) WidgetManager::showActivateRaiseWindow(this); else emit tabPageShow(); }
void ChatWindow::closeTabPage() { if (isWindow()) close(); else emit tabPageClose(); }
QVariantMap ToolWindowManagerWrapper::saveState() { if (layout()->count() > 1) { qWarning("too many children for wrapper"); return QVariantMap(); } if (isWindow() && layout()->count() == 0) { qWarning("empty top level wrapper"); return QVariantMap(); } QVariantMap result; result["geometry"] = saveGeometry().toBase64(); QSplitter* splitter = findChild<QSplitter*>(QString(), Qt::FindDirectChildrenOnly); if (splitter) { result["splitter"] = m_manager->saveSplitterState(splitter); } else { ToolWindowManagerArea* area = findChild<ToolWindowManagerArea*>(); if (area) { result["area"] = area->saveState(); } else if (layout()->count() > 0) { qWarning("unknown child"); return QVariantMap(); } } return result; }
void InitWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { char path[_MAX_PATH]; GetModuleFileName(hInstance, path, _MAX_PATH); char* argv=(char *)path; glutInit ( &nCmdShow, &argv ); // Erm Just Write It =) if(GameSet.AA>0) glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE|GLUT_DEPTH|GLUT_MULTISAMPLE ); // Display Mode else glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE|GLUT_DEPTH ); if(GameSet.AA>0) glutSetOption(GLUT_MULTISAMPLE,GameSet.AA); if(GameSet.isFullScreem) isFullScreem(); else isWindow(); if(GameSet.SYNC) { typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0; wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC) wglGetProcAddress("wglSwapIntervalEXT"); wglSwapIntervalEXT(1); } }
void MainWindow::changeEvent( QEvent *ev) { if (ev->type() == QEvent::WindowStateChange && isWindow()) { m_shell->updateGuiWindowState(windowState()); } QWidget::changeEvent(ev); }
void NormalWindow::showMinimizedTabPage() { if (isWindow() && !isVisible()) showMinimized(); else emit tabPageShowMinimized(); }
void Tooltip::showTip(int x, int y, LPCWSTR tip_text, DWORD duration) { if( !isWindow() ) create(); if( text ) free( text ); text = wcsdup( tip_text ); SIZE size = {0}; HDC dc = GetDC(hwnd); HGDIOBJ old_font = SelectObject( dc, GetStockObject(DEFAULT_GUI_FONT)); GetTextExtentPointW( dc, text, wcslen(text), &size ); SelectObject( dc, old_font ); ReleaseDC(hwnd, dc); SetWindowPos( hwnd, HWND_TOPMOST, x, y, size.cx + 4, size.cy + 4, SWP_NOACTIVATE ); if( IsWindowVisible(hwnd) ) InvalidateRect( hwnd, NULL, TRUE ); else ShowWindow( hwnd, SW_SHOWNA ); if( duration > 0 ) { if(timerID) KillTimer( hwnd, timerID ); timerID = SetTimer( hwnd, 1, duration, NULL ); } }
void UIPopupStack::sltAdjustGeometry() { /* Make sure parent is currently set: */ if (!parent()) return; /* Read parent geometry: */ QRect geo(parentWidget()->geometry()); if (!parentWidget()->isWindow()) geo.moveTo(parentWidget()->mapToGlobal(QPoint(0, 0))); /* Determine size: */ int iWidth = parentWidget()->width(); int iHeight = parentWidget()->height(); /* Subtract menu-bar and status-bar heights: */ iHeight -= (m_iParentMenuBarHeight + m_iParentStatusBarHeight); /* Check if minimum height is even less than current: */ if (m_pScrollViewport) { /* Get minimum viewport height: */ int iMinimumHeight = m_pScrollViewport->minimumSizeHint().height(); /* Subtract layout margins: */ int iLeft, iTop, iRight, iBottom; m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); iMinimumHeight += (iTop + iBottom); /* Compare minimum and current height: */ iHeight = qMin(iHeight, iMinimumHeight); } /* Determine origin: */ int iX = 0; int iY = 0; /* Shift for top-level window: */ if (isWindow()) { iX += geo.x(); iY += geo.y(); } switch (m_orientation) { case UIPopupStackOrientation_Top: { /* Just add menu-bar height: */ iY += m_iParentMenuBarHeight; break; } case UIPopupStackOrientation_Bottom: { /* Shift to bottom: */ iY += (geo.height() - iHeight); /* And subtract status-bar height: */ iY -= m_iParentStatusBarHeight; break; } } /* Adjust geometry: */ setGeometry(iX, iY, iWidth, iHeight); }
void ChatWindow::saveWindowGeometryAndState() { if (isWindow()) { Options::setFileValue(saveState(),"messages.chatwindow.state",tabPageId()); Options::setFileValue(saveGeometry(),"messages.chatwindow.geometry",tabPageId()); } }
void ChatWindow::showTabPage() { assignTabPage(); if (isWindow()) WidgetManager::showActivateRaiseWindow(this); else emit tabPageShow(); }
void ChatWindow::showMinimizedTabPage() { assignTabPage(); if (isWindow() && !isVisible()) showMinimized(); else emit tabPageShowMinimized(); }
void ChatWindow::loadWindowGeometryAndState() { if (isWindow()) { if (!restoreGeometry(Options::fileValue("messages.chatwindow.geometry",tabPageId()).toByteArray())) setGeometry(WidgetManager::alignGeometry(QSize(640,480),this)); restoreState(Options::fileValue("messages.chatwindow.state",tabPageId()).toByteArray()); } }
void NormalWindow::saveWindowGeometryAndState() { if (isWindow()) { Options::setFileValue(saveState(),"messages.messagewindow.state",tabPageId()); Options::setFileValue(saveGeometry(),"messages.messagewindow.geometry",tabPageId()); } Options::setFileValue(ui.sprReceivers->saveState(),"messages.messagewindow.splitter-receivers-state"); }
void QtChatWindow::updateTitleWithUnreadCount() { if (isWindow()) { setWindowTitle(unreadCount_ > 0 ? QString("(%1) %2").arg(unreadCount_).arg(contact_) : contact_); } else { setWindowTitle(contact_); } emit titleUpdated(); }
void EmbeddedWebView::handlePageLoadFinished() { constrainSize(); // We've already set it in our constructor, but apparently it isn't enough (Qt 4.8.0 on X11). // Let's do it again here, it works. Qt::ScrollBarPolicy policy = isWindow() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, policy); page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, policy); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); }
void UIRuntimeMiniToolBar::integrate() { /* Reintegrate if necessary: */ if (m_integrationMode == IntegrationMode_Embedded && isWindow()) { setWindowFlags(Qt::Widget); #ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR setAttribute(Qt::WA_TranslucentBackground, false); #endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */ show(); } else if (m_integrationMode == IntegrationMode_External && !isWindow()) { setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); #ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR setAttribute(Qt::WA_TranslucentBackground, true); #endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */ show(); } }
void QDockWidget::setTitleBarWidget(QWidget *widget) { Q_D(QDockWidget); QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); layout->setWidgetForRole(QDockWidgetLayout::TitleBar, widget); d->updateButtons(); if (isWindow()) { //this ensures the native decoration is drawn d->setWindowState(true /*floating*/, true /*unplug*/); } }