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. Take pixmap of pressed button ?
QtWS25 Last Chance

Take pixmap of pressed button ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 616 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
    Dariusz
    wrote on last edited by
    #1

    Hey

    How can I take a pixmap of a pressed button?

    Regards
    Dariusz

    jsulmJ 1 Reply Last reply
    0
    • D Dariusz

      Hey

      How can I take a pixmap of a pressed button?

      Regards
      Dariusz

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

      @Dariusz What do you mean by "take pixmap"?
      What about https://doc.qt.io/qt-5/qabstractbutton.html#icon-prop ?

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

      1 Reply Last reply
      2
      • D Offline
        D Offline
        Dariusz
        wrote on last edited by
        #3

        Well QWidget has a -grab() option if I'm not wrong to get a pixmap of widget. I want to take on of button when being pressed. To on the go generate icons.

        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by Kent-Dorfman
          #4

          so what does QPushbutton::grab() with default parameters do in your case? According to docs, it should do what you seem to want.

          D 1 Reply Last reply
          1
          • Kent-DorfmanK Kent-Dorfman

            so what does QPushbutton::grab() with default parameters do in your case? According to docs, it should do what you seem to want.

            D Offline
            D Offline
            Dariusz
            wrote on last edited by
            #5

            @Kent-Dorfman Grab would return it in natural state, but I need it in pressed state.

            jsulmJ 1 Reply Last reply
            0
            • D Dariusz

              @Kent-Dorfman Grab would return it in natural state, but I need it in pressed state.

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

              @Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.

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

              D 1 Reply Last reply
              3
              • jsulmJ jsulm

                @Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.

                D Offline
                D Offline
                Dariusz
                wrote on last edited by
                #7

                @jsulm said in Take pixmap of pressed button ?:

                @Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.

                Hmm will give it a go. But I need to grab it before UI shows up to display it as icon in other areas.

                jsulmJ 1 Reply Last reply
                0
                • D Dariusz

                  @jsulm said in Take pixmap of pressed button ?:

                  @Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.

                  Hmm will give it a go. But I need to grab it before UI shows up to display it as icon in other areas.

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

                  @Dariusz said in Take pixmap of pressed button ?:

                  But I need to grab it before UI shows

                  I don't think you can do this as there is nothing to grab if nothing is shown. You would need to render to a buffer somehow, but I really don't know how you could do this.

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

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Dariusz
                    wrote on last edited by
                    #9

                    Is there no way to initiate styleDelegate with pressed flag maybe?

                    Regards
                    Dariusz

                    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