QInputDialog doesn't show title and border in android application

581 views Asked by At

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

Application window

When Dialog appears in application window

Can someone tell why this happens?

2

There are 2 answers

0
jpo38 On

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

0
t_3 On

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