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. Is possible to use styleSheets for only one QGraphictsItems
Forum Updated to NodeBB v4.3 + New Features

Is possible to use styleSheets for only one QGraphictsItems

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.7k Views 2 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    Hi
    I have a QGraphicsView for QGraphicsScene . I have multiple QGraphicsItems in form of rectangles . In my case I have to make only one rectangle filled with horizontal and vertical lines

    Can some one suggest a solution . is it also possible to use only QStyleSheets for one Qgraphicsitem

    J.HilkJ raven-worxR 2 Replies Last reply
    0
    • Q Qt Enthusiast

      Hi
      I have a QGraphicsView for QGraphicsScene . I have multiple QGraphicsItems in form of rectangles . In my case I have to make only one rectangle filled with horizontal and vertical lines

      Can some one suggest a solution . is it also possible to use only QStyleSheets for one Qgraphicsitem

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Qt-Enthusiast
      yes it is, you can add the objectname as a specification:

      QWidget#ObjectName{my StyleSheet parameter }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        any better solutions

        jsulmJ 1 Reply Last reply
        0
        • Q Qt Enthusiast

          any better solutions

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Qt-Enthusiast What is wrong with what @J-Hilk suggested?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • Q Qt Enthusiast

            Hi
            I have a QGraphicsView for QGraphicsScene . I have multiple QGraphicsItems in form of rectangles . In my case I have to make only one rectangle filled with horizontal and vertical lines

            Can some one suggest a solution . is it also possible to use only QStyleSheets for one Qgraphicsitem

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by raven-worx
            #5

            @Qt-Enthusiast said in Is possible to use styleSheets for only one QGraphictsItems:

            is it also possible to use only QStyleSheets for one Qgraphicsitem

            no, since QtSytleSheets are only applicable for QWidgets (what actually also @J-Hilk example shows). QGraphicsItems do not get polished by QStyle at all.

            The only possible solution is to set a custom style property on the QGraphicsView and use it for painting in the rectangle item. But no direct styling possible.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            2
            • Q Offline
              Q Offline
              Qt Enthusiast
              wrote on last edited by
              #6

              What is the best way to distinguish the a single QGraphicsItem from other QGraphicsitems in the QGraphicsView

              I cannot change he color as well style any other way any one can suggest , Will inserting a image will help

              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