Hello,
I'm trying to override the minimumSize-Function of a widget
(so it can't be resized smaller than this size)
public:
QSize minimumSizeHint
() const { qDebug() << "minSizeHint";
}
QSize minimumSize
() const {
qDebug() << "minSize";
}
};
int main(int argc, char* argv[])
{
//l.setMinimumSize(200, 200); //works!
l.show();
return app.exec();
}
class test : public QLabel {
public:
test(QString s, QWidget* p=0): QLabel(s, p) {}
QSize minimumSizeHint() const {
qDebug() << "minSizeHint";
return QSize(300, 200);
}
QSize minimumSize () const
{
qDebug() << "minSize";
return QSize(300, 200);
}
};
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
test l(QString("foo"));
//l.setMinimumSize(200, 200); //works!
l.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
The functions minimumSize and minimumSizeHint are never called
If I use setMinimumSize it works.
What do I make wrong?
thanks,
niko
Bookmarks