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. QPainter::setClipping(false) is not working(Qt 4.8)
QtWS25 Last Chance

QPainter::setClipping(false) is not working(Qt 4.8)

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgetqpainterclippingpaintevent
14 Posts 4 Posters 2.8k 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.
  • D Offline
    D Offline
    dheerendra
    Qt Champions 2022
    wrote on 15 Dec 2018, 07:27 last edited by dheerendra
    #4

    Is there a sample to show what you are doing ? Also if you show some image on what you wanted to achieve will also help.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    A 1 Reply Last reply 15 Dec 2018, 08:27
    0
    • D dheerendra
      15 Dec 2018, 07:27

      Is there a sample to show what you are doing ? Also if you show some image on what you wanted to achieve will also help.

      A Offline
      A Offline
      arju.ach
      wrote on 15 Dec 2018, 08:27 last edited by
      #5

      @dheerendra 0_1544862322913_Screen Shot 2018-12-15 at 1.54.34 PM.png
      Thanks.

      I am trying to do like attached image. At a time only one button can be focused and when it gets focused I want to show button's horizontal centre aligned action description below the button. The issue is description can come under another button also and can grow out of buttons bounds.

      A 1 Reply Last reply 15 Dec 2018, 11:33
      0
      • A arju.ach
        15 Dec 2018, 08:27

        @dheerendra 0_1544862322913_Screen Shot 2018-12-15 at 1.54.34 PM.png
        Thanks.

        I am trying to do like attached image. At a time only one button can be focused and when it gets focused I want to show button's horizontal centre aligned action description below the button. The issue is description can come under another button also and can grow out of buttons bounds.

        A Offline
        A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 15 Dec 2018, 11:33 last edited by aha_1980
        #6

        @arju.ach Why don't you just use a QLabel in combination with a QVBoxLayout?

        Or arrange all widgets in a QGridLayout?

        Qt has to stay free or it will die.

        A 1 Reply Last reply 16 Dec 2018, 11:29
        1
        • D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 15 Dec 2018, 13:04 last edited by
          #7

          You are slightly over engineering the task. You don't need the painting or subclassing. As @aha_1980 said, it can be managed with simple visual elements like QLabel & Layouts.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          A 1 Reply Last reply 16 Dec 2018, 11:42
          1
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 15 Dec 2018, 21:35 last edited by
            #8

            Out of curiosity, why it there a need for such a description ?

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

            A 1 Reply Last reply 16 Dec 2018, 15:13
            0
            • A aha_1980
              15 Dec 2018, 11:33

              @arju.ach Why don't you just use a QLabel in combination with a QVBoxLayout?

              Or arrange all widgets in a QGridLayout?

              A Offline
              A Offline
              arju.ach
              wrote on 16 Dec 2018, 11:29 last edited by
              #9

              @aha_1980 said in QPainter::setClipping(false) is not working(Qt 4.8):

              @arju.ach Why don't you just use a QLabel in combination with a QVBoxLayout?

              Can you please explain how to do it?

              1 Reply Last reply
              0
              • D dheerendra
                15 Dec 2018, 13:04

                You are slightly over engineering the task. You don't need the painting or subclassing. As @aha_1980 said, it can be managed with simple visual elements like QLabel & Layouts.

                A Offline
                A Offline
                arju.ach
                wrote on 16 Dec 2018, 11:42 last edited by
                #10

                @dheerendra
                Can you please explain how to do it? Also please note that all the buttons will be dynamic based on some backend response and also spacing between them can change in some scenarios. I tried even this. https://stackoverflow.com/questions/53785115/qpainter-ignores-clipping-inside-paintevent/53785991?noredirect=1#comment94442586_53785991

                1 Reply Last reply
                0
                • S SGaist
                  15 Dec 2018, 21:35

                  Out of curiosity, why it there a need for such a description ?

                  A Offline
                  A Offline
                  arju.ach
                  wrote on 16 Dec 2018, 15:13 last edited by
                  #11

                  @SGaist It is the UX requirement , easiest thing was to put both icon and description inside button.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 16 Dec 2018, 21:05 last edited by
                    #12

                    You could have simple QLabel that you would move as need and from which you update the text when the buttons get their focus changed.

                    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
                    • A Offline
                      A Offline
                      arju.ach
                      wrote on 17 Dec 2018, 04:24 last edited by arju.ach
                      #13

                      @SGaist Yes I tried that only. But first time when we switch into the view it doesn't appear properly. Btw button is inside horizontal layout. We kind of wanted to make it reusable since we have that in many places, so I subclassed QPushButton.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 17 Dec 2018, 22:21 last edited by
                        #14

                        You can make a "container widget" that will handle the showing of the label properly.

                        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

                        13/14

                        17 Dec 2018, 04:24

                        • Login

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