简体   繁体   English

QInputDialog在Android应用程序中不显示标题和边框

[英]QInputDialog doesn't show title and border in android application

I've wrote a simple slot function to show an inputdialog. 我编写了一个简单的slot函数来显示输入对话框。 But it appears as below in android emulator. 但它在Android模拟器中显示如下。 The code is : 代码是:

void PriceChecker::showSettings()
{
    QInputDialog UrlDialog;
    QString baseUrl = UrlDialog.getText(m_pMainWidget, "Settings", "Enter BaseURL");    
}

申请窗口

当对话框出现在应用程序窗口中时

Can someone tell why this happens? 有人可以告诉为什么会这样吗?

It does this for all QDialog-based widget being displayed. 它针对所有正在显示的基于QDialog的小部件执行此操作。 They never have border nor title bar...except QMessageBox. 他们从来没有边框或标题栏...除了QMessageBox。

  • Create and display a QMessageBox -> this shows with title and border 创建并显示一个QMessageBox >显示标题和边框
  • Create and display a QInputDialog -> this shows with no title and border 创建并显示一个QInputDialog >显示没有标题和边框
  • Create and display a QDialog -> this shows with no title and border 创建并显示一个QDialog >显示没有标题和边框

I workarounded the problem by catching QEvent::ShowToParent event in QApplication::notify and making dialog about to be displayed size fit main frame size, it then covers the whole screen. 我通过在QApplication::notify捕获QEvent::ShowToParent事件并使对话框即将显示的大小适合主框架大小来解决该问题,然后覆盖整个屏幕。 At least controls are not mixed with the main frame controls.... 至少控件不与主机控件混在一起。...

Note: I submitted this Qtbug: https://bugreports.qt-project.org/browse/QTBUG-39623 注意:我提交了这个Qtbug: https ://bugreports.qt-project.org/browse/QTBUG-39623

... either it's a problem of the customized style of my host application (since i'm doing a plugin), or it's the same on windows; ...或者这是我的宿主应用程序的自定义样式的问题(因为我在做插件),或者在Windows上是相同的;

anyway it can be easily worked around by explicitly setting the window flags like: 无论如何,可以通过显式设置以下窗口标志来轻松解决:

QInputDialog d;
Qt::WindowFlags f = d.windowFlags();
f |= Qt::Dialog;
d.setWindowFlags(f);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM