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. Change size of QRubber on window scale
Forum Updated to NodeBB v4.3 + New Features

Change size of QRubber on window scale

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 1.2k 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.
  • mandruk1331M Offline
    mandruk1331M Offline
    mandruk1331
    wrote on last edited by
    #1

    How I can change the QRubber on window scale?
    I want the QRubber to scale with the window

    Mandruk1331

    raven-worxR 1 Reply Last reply
    0
    • mandruk1331M mandruk1331

      How I can change the QRubber on window scale?
      I want the QRubber to scale with the window

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

      @mandruk1331

      1. what is QRubber?
      2. what do you mean exactly with "window scale"?

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

      mandruk1331M 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @mandruk1331

        1. what is QRubber?
        2. what do you mean exactly with "window scale"?
        mandruk1331M Offline
        mandruk1331M Offline
        mandruk1331
        wrote on last edited by
        #3

        @raven-worx
        I create a QRubber object, and with it's help I draw a rect on mouse press,move release events, but when I scale the UI form of the main window, the QRubber object(rect) does not scale with it, how I can change that?

        Mandruk1331

        raven-worxR 1 Reply Last reply
        0
        • mandruk1331M mandruk1331

          @raven-worx
          I create a QRubber object, and with it's help I draw a rect on mouse press,move release events, but when I scale the UI form of the main window, the QRubber object(rect) does not scale with it, how I can change that?

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

          @mandruk1331
          you haven't answered my questions, but i think i know what you mean.

          You need to reimplement the resizeEvent() handler of your window. In the QResizeEvent you have the old and new size. Calculate the changed ratio of these (for height and width) and then multiply the height and width of your QRubberBand widget with these ratios.

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

          mandruk1331M 2 Replies Last reply
          3
          • raven-worxR raven-worx

            @mandruk1331
            you haven't answered my questions, but i think i know what you mean.

            You need to reimplement the resizeEvent() handler of your window. In the QResizeEvent you have the old and new size. Calculate the changed ratio of these (for height and width) and then multiply the height and width of your QRubberBand widget with these ratios.

            mandruk1331M Offline
            mandruk1331M Offline
            mandruk1331
            wrote on last edited by
            #5

            @raven-worx yes that's what I was asking for. Thanks)

            Mandruk1331

            1 Reply Last reply
            0
            • raven-worxR raven-worx

              @mandruk1331
              you haven't answered my questions, but i think i know what you mean.

              You need to reimplement the resizeEvent() handler of your window. In the QResizeEvent you have the old and new size. Calculate the changed ratio of these (for height and width) and then multiply the height and width of your QRubberBand widget with these ratios.

              mandruk1331M Offline
              mandruk1331M Offline
              mandruk1331
              wrote on last edited by
              #6

              @raven-worx Is there a way to send a signal when window resize is over?

              Mandruk1331

              raven-worxR 1 Reply Last reply
              0
              • mandruk1331M mandruk1331

                @raven-worx Is there a way to send a signal when window resize is over?

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

                @mandruk1331
                unfortunately not.
                You could optimize it using a QTimer which triggers after a few ms. Then (re-)start the timer on every resizeEvent. If the timer times out you do the calculation.
                This lets you "bundle" some resize events and skips some unnecessary calculations.

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

                • Login

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