Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Impossible to show a dialog box with a title bar under Android



  • Hello,
    Impossible to show a dialog box with a title bar under Android (runs fine on windows, macos, linux) ...

    QDialog *boite = new QDialog(this);
    	boite->setWindowTitle(tr("Help..."));
    	Qt::WindowFlags flags = 0;
    	
    	flags |= Qt::Dialog | Qt::WindowTitleHint |
    		Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
    
    	boite->setWindowFlags(flags);
    
    	QTextEdit *srctext = new QTextEdit(boite);
    	srctext->setAcceptRichText(true);
    	srctext->setText(
    		tr("blalbla"));
    	srctext->setTextBackgroundColor(QColor(50, 50, 50, 200));
    	QScrollBar *scrollbar = new QScrollBar(srctext);
    	scrollbar->setFixedWidth(15);
    	srctext->setVerticalScrollBar(scrollbar);
    	srctext->setReadOnly(true);
    	srctext->setMaximumHeight(300);
    	boite->setFixedWidth(450);
    	boite->setFixedHeight(300);
    	srctext->setMinimumWidth(450);
    	srctext->setMinimumHeight(300);
    
    	boite->setModal(false);
    	boite->showNormal();
    

    How to solve the problem?

    Thanks !


  • Moderators

    Android does not support multiple windows and it's windowing system does not add any title bars. If you want to show a component/ widget with title bar, you need to draw it yourself. Or call native Android calls to show some popup, if your use case is simple enough.



  • Thank siedzio for your response... I'll try to find another solution.


Log in to reply