Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Color setting to a dialog has no effect
Forum Updated to NodeBB v4.3 + New Features

Color setting to a dialog has no effect

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abin
    wrote on last edited by
    #1

    @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.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved