Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, January 2008
Re: [vlc-devel] QDockWidget and resizing.


Message 1 in thread

Jean-Baptiste Kempf wrote:
> On Mon, Dec 17, 2007, Andrew Medico wrote :
>> On Dec 16, 2007 3:09 PM, Benjamin Sergeant <bsergean@xxxxxxxxx> wrote:
>>> Just trying to guess:
>>>
>>> What you could try: overwrite resizeEvent and tell it to don't resize
>>> horizontally.
>>> http://doc.trolltech.com/4.3/qwidget.html#resizeEvent
>> >From the documentation:
>> "When resizeEvent() is called, the widget already has its new geometry."
>>
>> Overriding QWidget::resizeEvent() to prevent resizing won't work,
>> because, per above, the widget has already been resized when the
> Yeah, I couln't find yet a solution, I am a bit stucked on that part...
> 
> Best Regards,
> 
i don't know if anyone's still following this thread, but i have run 
into a nearly identical situation to the one described here. i have a 
central widget which i always want to remain the same size, and dock 
widgets that i want to stretch as the QMainWindow resizes

i have set the fixed size of the central widget accordingly and set the 
sizePolicy and the vertical/horizontal stretch on the QDockWidgets to 
every imaginable configuration and still when the QMainWindow is resized 
it (at best) creates what i can only imagine to be dead space between 
the central widget and the dock widgets (screenshot 1).

also of note is that when the dock widgets are then resized 
(specifically when they are made smaller), the painting of the slider 
bar as it moves through the large gray area seems to be buggy, as though 
the background in that area is not being repainted (screenshot 2).

anyway, i'm hoping to not have to do anything too messy to fix this, 
since it seems like a reasonable thing to want the QMainWindow to do, 
but i'm pretty much open to any solution at this point.


thanks in advance,
jeff.

PNG image

PNG image

PNG image


Message 2 in thread

On Thu, Jan 31, 2008, Jeff Fisher wrote :
> anyway, i'm hoping to not have to do anything too messy to fix this, 
> since it seems like a reasonable thing to want the QMainWindow to do, 
> but i'm pretty much open to any solution at this point.
I wasn't able to fix it, so I am going to ditch this QDockWidget, I
think :D

Best Regards,

-- 
 [ signature omitted ] 

Message 3 in thread

Jean-Baptiste Kempf wrote:
> On Thu, Jan 31, 2008, Jeff Fisher wrote :
>> anyway, i'm hoping to not have to do anything too messy to fix this, 
>> since it seems like a reasonable thing to want the QMainWindow to do, 
>> but i'm pretty much open to any solution at this point.
> I wasn't able to fix it, so I am going to ditch this QDockWidget, I
> think :D
> 
> Best Regards,
> 

ditching the QDockWidget sounds pretty nice, but unfortunately i think 
i'm pretty stuck with using it in my application. it will eventually 
need to display a whole lot of information, and having it all dockable 
and closeable would make it much easier to organize and help to keep the 
clutter down.

for anyone who's interested, here's a pretty basic demonstration of the 
problem:

#include <QApplication>
#include <QDockWidget>
#include <QGroupBox>
#include <QMainWindow>
#include <QTextEdit>

int main(int argc, char **argv)
{
	QApplication a(argc, argv);

	// Main window
	QMainWindow *mw = new QMainWindow;

	// Dock widget
	QDockWidget *d0 = new QDockWidget("Dock widget");
	QWidget *w = new QWidget;
	d0->setWidget(w);
	d0->setMinimumSize(200, 200);
	d0->setSizePolicy(QSizePolicy::Expanding,
		QSizePolicy::Expanding);
	mw->addDockWidget(Qt::RightDockWidgetArea, d0);

	// Central widget
	QTextEdit *te = new QTextEdit("Central widget", mw);
	te->setFixedSize(400, 400);
	mw->setCentralWidget(te);

	mw->show();

	return a.exec();
}

--
 [ signature omitted ]