PDA

View Full Version : Is there a widget to enable the user to resize a widget at runtime like ms paint



eve
20th June 2012, 16:39
Hello at all!

I'm working with Qt 4 in c++ for a few weeks and I really love it!
Now I have a question and I hope somebody can help me with that.

In Qt Designer, the user can resize widgets with the mouse. Also you
can resize your graphics in many other programs, like webapplications
or MS Word and Paint.
Is there a widget in Qt 4 that can contain another widget and enable
the user to resize the contained widget with the mouse?

7879

Thank you very much! :)

amleto
20th June 2012, 16:50
I dont think there is anything in-built that does that.

eve
20th June 2012, 18:20
Thank you for your reply!

Do you have an idea how I could easily implement such a functionality myself?
I tried a QScrollArea with a QDialog Widget in it because it has the setSizeGripEnabled(bool) function,
but of course that did not work :D
I don't really want the user to enter the widget size in a dialog, that is inconvenient...

wysota
20th June 2012, 18:34
You need to create your own widget or graphics item (as you should probably use Graphics View and not widgets).

eve
20th June 2012, 18:57
Thanks for your reply!

I have a custom PaintArea that extends from QWidget.
With the QGraphicsView, I can only display QGraphicsScene Objects and not the PaintArea, right?

wysota
20th June 2012, 19:02
It's a matter of choosing the base class for your PaintArea. You can derive it from QGraphicsWidget instead of QWidget.