PDA

View Full Version : Resizing any kind of widget runtime



vajindarladdad
10th December 2008, 15:50
Hi I am vajindar laddad Beginner to Qt.
Can we resize each type(kind) of a widget at runtime by stretching it using mouse , Not when the window is resized ?
For Example-
1) Suppose i have a pushButton can i resize it at run time using mouse ?
2) can i resize QLineEdit at runtime using mouse?

tinsuke
10th December 2008, 17:02
Each single component of Qt can be resized at runtime.

One could easily implement QWidget's mousePressEvent() and mouseMoveEvent() event handlers to provide this kind of functionality on EVERY Qt Component. Other approach would be of using event filters (a smarter and scalable approach, IMHO).

Things you should note is that if you would have a QPushButton that way, how would you differ from a click and an attempt to resize it? Other thing, when your widgets are organized under Layouts, you should be aware that some layout configurations wouldn't permit the widget resize.

Best Regards,
Angelo Suzuki