本文整理汇总了C++中QWindow::showNormal方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::showNormal方法的具体用法?C++ QWindow::showNormal怎么用?C++ QWindow::showNormal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::showNormal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
void CanvasQt::keyPressEvent(QKeyEvent* keyEvent) {
#ifdef USE_QWINDOW
QWindow* parent = this->parent();
#else
QWidget* parent = this->parentWidget();
#endif
if (parent && keyEvent->key() == Qt::Key_F && keyEvent->modifiers() == Qt::ShiftModifier){
if(parent->windowState() == Qt::WindowFullScreen) {
parent->showNormal();
} else {
parent->showFullScreen();
}
}
KeyboardEvent pressKeyEvent(EventConverterQt::getKeyButton(keyEvent),
EventConverterQt::getModifier(keyEvent),
KeyboardEvent::KEY_STATE_PRESS);
Canvas::keyPressEvent(&pressKeyEvent);
if(pressKeyEvent.hasBeenUsed()) {
keyEvent->accept();
} else {
QGLWindow::keyPressEvent(keyEvent);
}
}
示例2: onOpenWindow
void Nexus::onOpenWindow(QObject* object)
{
QWindow* window = static_cast<QWindow*>(object);
if (window->windowState() & QWindow::Minimized)
window->showNormal();
window->raise();
window->requestActivate();
}
示例3: moveToForeground
void moveToForeground()
{
QWindowList l = QGuiApplication::allWindows();
if (l.size() > 0 && l.at(0) != nullptr) {
QWindow* w = l.at(0);
w->requestActivate();
if (w->windowState() & Qt::WindowMinimized) {
w->showNormal();
}
}
}
示例4: realOnKeyboardVisibleChanged
void Wpp::realOnKeyboardVisibleChanged()
{
#if defined(Q_OS_IOS) || defined(Q_OS_ANDROID)
qDebug() << __FUNCTION__;
//#ifdef Q_OS_IOS
QScreen *screen = QGuiApplication::primaryScreen();
QWindow *window = QGuiApplication::focusWindow();
QInputMethod *inputMethod = QGuiApplication::inputMethod();
if ( inputMethod->isVisible() )
{
if ( m_softInputMode == ADJUST_RESIZE && window != 0 && screen != 0 )
{
#ifdef Q_OS_IOS
QRectF kbRect = inputMethod->keyboardRectangle();
#endif
#ifdef Q_OS_ANDROID
/*
Rect r = new Rect();
View rootview = this.getWindow().getDecorView(); // this = activity
rootview.getWindowVisibleDisplayFrame(r);
*/
QAndroidJniObject visibleFrameRect("android/graphics/Rect","()V");
qDebug() << __FUNCTION__ << "visibleFrameRect.isValid()=" << visibleFrameRect.isValid();
QAndroidJniObject activity = QtAndroid::androidActivity();
qDebug() << __FUNCTION__ << "activity.isValid()=" << activity.isValid();
QAndroidJniObject androidWindow = activity.callObjectMethod(
"getWindow","()Landroid/view/Window;");
qDebug() << __FUNCTION__ << "androidWindow.isValid()=" << androidWindow.isValid();
QAndroidJniObject rootview = androidWindow.callObjectMethod(
"getDecorView","()Landroid/view/View;");
qDebug() << __FUNCTION__ << "rootview.isValid()=" << rootview.isValid();
//rootview.callMethod<void>("getWindowVisibleDisplayFrame","(Landroid/graphics/Rect;)V",visibleFrameRect.object<jobject>());
rootview.callMethod<jboolean>("getLocalVisibleRect","(Landroid/graphics/Rect;)Z",visibleFrameRect.object<jobject>());
qDebug() << __FUNCTION__ << "rootview.isValid()=" << rootview.isValid();
qDebug() << __FUNCTION__ << "visibleFrameRect.isValid()=" << visibleFrameRect.isValid();
jint visibleFrameTop = visibleFrameRect.getField<jint>("top");
qDebug() << __FUNCTION__ << "visibleFrameRect.visibleFrameTop=" << visibleFrameTop;
jint visibleFrameLeft = visibleFrameRect.getField<jint>("left");
qDebug() << __FUNCTION__ << "visibleFrameRect.visibleFrameLeft=" << visibleFrameLeft;
jint visibleFrameWidth = visibleFrameRect.callMethod<jint>("width","()I");
qDebug() << __FUNCTION__ << "visibleFrameRect.width()=" << visibleFrameWidth;
jint visibleFrameHeight = visibleFrameRect.callMethod<jint>("height","()I");
qDebug() << __FUNCTION__ << "visibleFrameRect.height()=" << visibleFrameHeight;
int keyboardHeight = 0;
if ( screen != 0 )
{
qDebug() << __FUNCTION__ << "screen.height()=" << screen->size().height();
keyboardHeight = screen->size().height() - visibleFrameHeight;
qDebug() << __FUNCTION__ << "keyboardHeight=" << keyboardHeight;
}
QRectF kbRect(0, visibleFrameHeight, visibleFrameWidth, keyboardHeight);//assume keyboard from bottom side
#endif
qDebug() << __FUNCTION__ << "kbRect=" << kbRect;
window->showNormal();
if ( window->height() == screen->size().height() )
{
qDebug() << __FUNCTION__ << ":origSize=" << window->size();
Q_ASSERT( kbRect.width() == (qreal)window->width() );//assume keyboard appears from bottom side of app window
window->setHeight( window->height() - kbRect.height() );
qDebug() << __FUNCTION__ << ":resize-ok-to:" << window->size();
}
}
}
else
{
if ( m_softInputMode == ADJUST_RESIZE && window != 0 && screen != 0 )
{
window->setHeight( screen->size().height() );
qDebug() << __FUNCTION__ << ":resize-ok-to:" << screen->size();
}
window->showNormal();
}
//#endif
#endif
}