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. How to prevent widget from inheriting parent CSS ?
Forum Update on Monday, May 27th 2025

How to prevent widget from inheriting parent CSS ?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 315 Views
  • 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I have a number of widgets using CSS style sheet's, I've set a style sheet for a QFrame which has the following:

    QFrame {background-color: #e9efef;
            background-image: url('meshtile_4x4.png');
    	border: 2px solid #cccccc;
    	border-top-left-radius: 8px;
    	border-top-right-radius: 8px;
    	border-bottom-left-radius: 8px;
    	border-bottom-right-radius: 8px;}"
    

    The issue I've got is that every other widget that is contained in the QFrame is inheriting the same style sheet. Is there any way to prevent this inheritance whilst still being able to set stye sheet for child widgets independently?

    Kind Regards,
    Sy

    SPlattenS 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I have a number of widgets using CSS style sheet's, I've set a style sheet for a QFrame which has the following:

      QFrame {background-color: #e9efef;
              background-image: url('meshtile_4x4.png');
      	border: 2px solid #cccccc;
      	border-top-left-radius: 8px;
      	border-top-right-radius: 8px;
      	border-bottom-left-radius: 8px;
      	border-bottom-right-radius: 8px;}"
      

      The issue I've got is that every other widget that is contained in the QFrame is inheriting the same style sheet. Is there any way to prevent this inheritance whilst still being able to set stye sheet for child widgets independently?

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #2

      @SPlatten , Fixed I had a bug which was stripping off the QFrame { part of the CSS, with that fixed its now ok.

      Kind Regards,
      Sy

      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