简体   繁体   中英

QInputDialog doesn't show title and border in android application

I've wrote a simple slot function to show an inputdialog. But it appears as below in android emulator. 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. They never have border nor title bar...except QMessageBox.

  • Create and display a QMessageBox -> this shows with title and border
  • Create and display a QInputDialog -> this shows with no title and border
  • Create and display a QDialog -> this shows with no title and border

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. At least controls are not mixed with the main frame controls....

Note: I submitted this 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;

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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