Color setting to a dialog has no effect



  • @void PriceChecker::setBaseUrl()
    {
    QInputDialog dlg;
    dlg.setStyleSheet("background-color:black");
    QString baseUrl = dlg.getText(m_pMainWidget, "Settings", "Enter BaseURL");
    if (!baseUrl.isEmpty())
    {
    m_settings.setValue("baseurl", baseUrl);
    m_settings.sync();
    }
    }
    @

    The dlg has always same color as its parent widget. I tried to change only the color of lineedit by
    @ myDialog->setStyleSheet("QLineEdit { background-color: yellow }");@

    Also I tried
    @qApp->setStyleSheet("QLineEdit { background-color: yellow }");@

    any of this didin't work.



  • Hi, you only set the styleSheet for a QLineEdit - if that is what you want, QLineEdits should be yellow.


  • Lifetime Qt Champion

    Hi,

    Also, calling getText that like will completely ignore the settings you made since it's a static function which creates a QInputDialog


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.