A.J
A.J

Reputation: 735

SetStyleSheet not working in qt

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.

Upvotes: 2

Views: 1481

Answers (2)

OMG_Soruce
OMG_Soruce

Reputation: 106

qApp->setStyleSheet("QLineEdit { background-color: yellow ;};");

 }  between )      ";"  input?

Upvotes: -2

perencia
perencia

Reputation: 1552

QDialogs are a bit restricted in css properties applicable to them.

As stated in QDialog css properties

Supports only the background, background-clip and background-origin properties.

Upvotes: 1

Related Questions