Important: Please read the Qt Code of Conduct -

QGLWidget + QInputDialog

  • (repost from qt-android list..)

    My app is a QGLWidget based fully opengl app which is now running otherwise
    rather smoothly on samsung galaxy s3. The only bit of regular UI in the app is a QInputDialog I'm trying to use for asking forsimple text user input in the following fashion:

    @ QString text = QInputDialog::getText(const_cast<GLWidget*>(this),
    tr("Enter your name"), tr("Enter your name"),
    QLineEdit::Normal, defaultText);
    qDebug() << "QueryUserName(): " << text;@

    the entire screen just goes black. No controls are visible. however when tapping on the screen it
    seems to find the input field since the keyboard appears and it accepts the
    text properly (can see this from the log line). I'm calling this from within QGLWidget::paintGL(), would this be a bad thing?

    the screen never recovers even after the dialog apparently closes, and the
    screen remains all black, even though I resume the opengl rendering (= restart the update timer). :o

    And If I dont stop the opengl rendering, the whole app crashes after some
    seconds after introducing the QInputDialog..

    Tried calling this (found it via googling..):

    @setStyleSheet( "QMenu {background-color: rgba(255,255,255,255);}" );@

    but it doesnt change anything.

    So the question is, what's the proper way to ask for user input in a
    QGLWidget app? I realize I'm a bit of a noob when it comes to mobile UI stuff with Qt..

    • M

  • Wonder if this is outdated or should I use this approach and skip the QInputDialog?

Log in to reply