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)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgetqpainterclippingpaintevent
14 Posts 4 Posters 3.2k 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.
  • dheerendraD dheerendra

    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 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.

    aha_1980A 1 Reply Last reply
    0
    • A arju.ach

      @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.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 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
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on 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
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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
          0
          • aha_1980A aha_1980

            @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 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
            • dheerendraD dheerendra

              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 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
              • SGaistS SGaist

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

                A Offline
                A Offline
                arju.ach
                wrote on 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
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 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 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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 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

                      • Login

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