PDA

View Full Version : QTCreator / Designer and scrollarea content widget



Talei
9th February 2011, 17:29
Hello,
I have problem with QScrollArea in Designer.

The problem is that when I place QScrollArea on form it comes with QWidget (this is a container/viewport widget for widgets) and the problem with this is that I subclass this QScrollArea (I use "promote to" functionality - I have complex layout and it's easier for me to do it that way) and inside myQScrollArea constructor I setWidget( container ); but the problem with this is that in ui_classname.h I have after constructor setWidget(QWdiget) that erase widgets placed in my subclassed QScrollArea.

A "code" snippet describing situation



myqscrolarea:
QWidget *container = new QWidget();
this->setWidget( container ); <-- my Container with what I want in it

ui_classname:
myqscrolarea*scrollArea = new myqscrolarea(page);
QWidget *widget = new QWidget();
scrollArea->setWidget(widget); <- "UI container" that override my Container


So I want to ask is there a way (and how to) to get ride of that QWidget added to QScrllArea by QDesigner? Because right now I need to //QWidget container on every UI recompile, or rewrite a lot of UI code, that I don't really want do (<- probably best solution).

Thanx in advance

wysota
9th February 2011, 23:53
Have you tried promoting also the widget inside QScollArea? If that fails, promote you widget not from QScrollArea but from one of its superclasses, this is bound to work.

Talei
10th February 2011, 10:42
It will works, but I wanted to keep it simple as possible, without any container class but in this case QWidget do the job.
Regards