Honour QSizePolicy::Fixed too

Some widgets, for example QPushButton, instead of having an explicit max size,
they communicate the need for a max size through their size policy
This commit is contained in:
Sergio Martins
2020-06-07 19:53:06 +01:00
parent ab8545e2c2
commit d5797a3aea
8 changed files with 107 additions and 6 deletions

View File

@@ -55,13 +55,14 @@ public:
explicit Widget(QObject *thisObj)
: m_thisObj(thisObj) {}
virtual ~Widget() {}
virtual ~Widget();
virtual void setLayoutItem(Item *) = 0;
// Not strickly necessary, but it's nice conveniance for kddw which is widget based.
virtual QWidget *asQWidget() const { return nullptr; };
virtual QSize sizeHint() const { return {}; }
virtual QSize minSize() const = 0;
virtual QSize maxSizeHint() const = 0;
virtual QRect geometry() const = 0;
@@ -102,6 +103,9 @@ public:
return obj == m_thisObj;
}
protected:
static QSize boundedMaxSize(QSize min, QSize max);
private:
QObject *const m_thisObj;
Q_DISABLE_COPY(Widget)