Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.9.0
-
None
Description
Under Android, using QMessageBox shows native popup's. However, when setting any stylesheet to QApplication, this is broken, the message box show but does not look right: it's background is mixed with parent's background and it is not responsive and cannot be closed. See attached screenshots.
Code to reproduce:
main.cpp
#include <QApplication> #include "mainwindow.h" int main( int argc, char* argv[] ) { QApplication app(argc, argv); app.setStyleSheet("QLineEdit { background-color: yellow }"); MainWindow wnd; wnd.show(); return app.exec(); }
mainframe.h
#pragma once #include <QMainWindow> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget* parent = NULL); public slots: void showMessageBox(); };
mainframe.cpp
#include "mainwindow.h" #include <QDialog> #include <QPushButton> #include <QMessageBox> MainWindow::MainWindow( QWidget* parent ) : QMainWindow(parent) { QPushButton* centralWidget = new QPushButton("Open dialog",this); setCentralWidget(centralWidget); connect( centralWidget, &QPushButton::clicked, this, &MainWindow::showMessageBox); } void MainWindow::showMessageBox() { QMessageBox::information(this, "MessageBox", "Hello world", QMessageBox::Ok); }