[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Forcing width==height ??
From:       Josef Spillner <dr_maux () maux ! de>
Date:       2001-04-26 5:53:34
[Download RAW message or body]

On Thursday, 26. April 2001 00:25, Rob Kaper wrote:
> Is it possible to force a QWidget to have the same width as height?

You could use the following:
void Board::resizeEvent(QResizeEvent *e)
{
	int q;
	q = e->size().width() > e->size().height() ?
		e->size().height() :e->size().width();
	//m_board->resize(q, q); //looks rather ugly
	m_board->setGeometry((width() - q) / 2, (height() - q) / 2, q, q);
}

I'm not sure whether QGridLayout manages this on its own, probably you should 
play around with the stretch factors (haven't used it yet). But when drawing 
a monopoly game board you'll have to do much work on your own anyway.

Josef Spillner
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic