Important: Please read the Qt Code of Conduct -

Color setting to a dialog has no effect

  • @void PriceChecker::setBaseUrl()
    QInputDialog dlg;
    QString baseUrl = dlg.getText(m_pMainWidget, "Settings", "Enter BaseURL");
    if (!baseUrl.isEmpty())
    m_settings.setValue("baseurl", baseUrl);

    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


    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