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. Set CSS inside a .Qss file for buttons generated in code and populated inside a QFrame

Set CSS inside a .Qss file for buttons generated in code and populated inside a QFrame

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 524 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.
  • K Offline
    K Offline
    Kris Revi
    wrote on last edited by
    #1

    So i have a .Qss file with my entire theme / color scheme for my App

    and i have a QFrame#DeviceListMenu that in code gets populated with buttons?

    how can i style these inside my .Qss file with css?

    The reason im asking this is i have 2 themes (2 .Qss) files that i can switch between and i want to keep ALL css inside the .Qss files

    JonBJ 1 Reply Last reply
    0
    • K Kris Revi

      So i have a .Qss file with my entire theme / color scheme for my App

      and i have a QFrame#DeviceListMenu that in code gets populated with buttons?

      how can i style these inside my .Qss file with css?

      The reason im asking this is i have 2 themes (2 .Qss) files that i can switch between and i want to keep ALL css inside the .Qss files

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Kris-Revi
      Something like QFrame#DeviceListMenu QPushbutton { ... } or QFrame#DeviceListMenu #button1 { ... }?

      K 1 Reply Last reply
      0
      • JonBJ JonB

        @Kris-Revi
        Something like QFrame#DeviceListMenu QPushbutton { ... } or QFrame#DeviceListMenu #button1 { ... }?

        K Offline
        K Offline
        Kris Revi
        wrote on last edited by
        #3

        @JonB QFrame#DeviceListMenu QPushbutton { ... } did not work :/

        And this would not work QFrame#DeviceListMenu #button1 { ... } as buttons in this QFrame can be deleted and /or added

        JonBJ 1 Reply Last reply
        0
        • K Kris Revi

          @JonB QFrame#DeviceListMenu QPushbutton { ... } did not work :/

          And this would not work QFrame#DeviceListMenu #button1 { ... } as buttons in this QFrame can be deleted and /or added

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Kris-Revi said in Set CSS inside a .Qss file for buttons generated in code and populated inside a QFrame:

          as buttons in this QFrame can be deleted and /or added

          Then I would concentrate on getting the first approach to work. I would start with, say, QFrame#DeviceListMenu { background-color: red; } till you are sure that is affecting the menu, then progress from there to see how to address whatever your "buttons" are.

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

            Hi,

            You can also make use of a dynamic property as shown here. That way you can simply mark your buttons and they should get their style applied.

            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
            1

            • Login

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