Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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"?
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?
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?
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.