Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82452

Issue with comments in stylesheet file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.7
    • Widgets: Style Sheets
    • None
    • Windows

    Description

      Hi Qt-Bug teams,

      The following are questions from customer INC-1341247

      “We are noticing strange thing with below styling rule behaviour.

      QLineEdit:hover:!disabled
      /QLineEdit:hover:!read-only/
      {
      border-color: #dbdbdb;
      background-color: #525252;
      }

      QLineEdit:focus:!disabled
      /QLineEdit:focus:!read-only/
      {
      border-color: #dbdbdb;
      background-color: #3b3b3b;
      }

      Above stylesheet rule does not show correct border color for lineedit. If we
      remove the commented lines, it works fine.

      When I try same stylesheet in Qt designer, it shows stylesheet is valid but
      shows same behavior as explained above. Can you explain why it behaves like
      this? If stylesheet is valid, it should work, else it should report if there
      is typo or invalid stylesheet format. ”

       

      according to my study, the qtcreator can identifie the below styling rule behaviour is valid, 
      but the qtcreator just convert these into strings and give them to
       setStyleSheet()
      The position of the comment cannot be analysis.

      > That mean the blew behaviour is wrong comment position.
      > please move the comment up a line, like below, then it works.
      > /QLineEdit:hover:!read-only/
      > QLineEdit:hover:!disabled
      >

      { > border-color: #dbdbdb; > background-color: #525252; > }

      >
      > /QLineEdit:focus:!read-only/
      > QLineEdit:focus:!disabled
      >

      { > border-color: #dbdbdb; > background-color: #3b3b3b; > }

      One more thing, just notice the position of "{" and the "/...../", the below
      styling rule also works:
      QLineEdit:hover:!disabled

      { /*QLineEdit:hover:!read-only*/ border-color: #dbdbdb; background-color: #525252; }

      QLineEdit:focus:!disabled

      {/*QLineEdit:focus:!read-only*/ border-color: #dbdbdb; background-color: #3b3b3b; }

      Both the customer and I think it's really a bug:

      "Considering that - there is no clue to treat this as error - not reported by
      Qt setStylesheet() API which actually parsing it and ignoring it OR by Qt
      designer, which has no capability to detect this - I would like to request you
      to file a bug and add error so that user know about something that Qt does not
      like it."

       

      Kindly need your support, Thanks~

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            sawang Sam Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes