[Qt-interest] Aspect Ratio with QWidget::heightForWidth(int)
Huseyin Kozan
huseyinkozan at gmail.com
Wed Jul 22 11:54:22 CEST 2009
Hi,
I tried to make a widget (and frame) which have a fixed ratio (I mean like
square) . I write something like this:
class FixedRatioWidget : public QFrame
{
public:
FixedRatioWidget(QWidget* parent);
virtual int heightForWidth(int w) const;
};
FixedRatioWidget::FixedRatioWidget(QWidget* parent) : QFrame(parent)
{ sizePolicy().setHeightForWidth(true); }
int FixedRatioWidget::heightForWidth(int w) const
{ return w; }
And made a GUI project, and add a frame and promote from this class.
I added the project.
There is a quarterly document here:
http://doc.trolltech.com/qq/qq04-height-for-width.html
But I couldnt work it.
What is the correct way to do this ?
Hüseyin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/4db11ad0/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DataPlotter.zip
Type: application/zip
Size: 2379 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/4db11ad0/attachment.zip
More information about the Qt-interest-old
mailing list