Resizeable QTextEdit in layout
-
I would like to mimic a construct that is seen on some web pages, where a text edit area has it's own resize grip in the corner. Even though it is in a layout, the resizing of that single widget forces the entire area to be layed out again based on the new size of the widget.
Has anyone seen this done of have an idea of how to do it?
Thanks!
-
Do you want resizing like on this page in "Post a reply" window?
If so, you need to inherit you class from QTextEdit, override mousePressEvent()/moveEvent()
and paintEvent(). -
Yep, that was what I was looking for exactly. I assume I can then over-ride the paintEvent() to make the little grab thingy in the corner?
-
@
void BlaBlaBlaClass::paintEvent(QPaintEvent* e)
{
QTextEdit::paintEvent(e);<code_to_draw_you_corner_grip>;
}
@ -
Sweet. Thanks!
-
Okay, I have my custom qtextedit working fine. But, the layout that it is in does not adapt to the new size of the custom qtextedit when I am resizing it. I can't seem to force the layout to readapt itself to the new size of the custom widget.
-
As I understand you have QTextEdit layed in QLayout on QWidget. Then, in mouseReleaseEvent() you call QTextEdit::setGeometry(), but size won't change.
Right? -
May be this help is not too late. To show your size grip you can use
@QAbstractScrollArea::setCornerWidget()@