Change size of QRubber on window scale
-
How I can change the QRubber on window scale?
I want the QRubber to scale with the window -
- what is QRubber?
- what do you mean exactly with "window scale"?
-
@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
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.
-
@raven-worx yes that's what I was asking for. Thanks)
-
@raven-worx Is there a way to send a signal when window resize is over?
-
@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.