33 static const char offsetProperty[15] {
"positionOffset"};
102 void OverlayStackLayout::doLayout()
const 104 const int n =
count();
107 for (
int i=0; i < n; ++i) {
125 wRect.setWidth(rect.
width() - offset.x());
129 wRect.setHeight(rect.
height() - offset.y());
133 if (rect.
width() > wRect.width() - offset.x()) {
136 wRect.moveLeft(rect.
x() + (rect.
width() - wRect.width()) / 2);
139 wRect.moveRight(rect.
right());
143 wRect.moveLeft(rect.
left());
147 if (rect.
height() > wRect.height() - offset.y()) {
150 wRect.moveTop(rect.
y() + (rect.
height() - wRect.height()) / 2);
153 wRect.moveBottom(rect.
bottom());
157 wRect.moveTop(rect.
top());
162 if (!offset.isNull())
163 wRect.moveTopLeft(wRect.topLeft() + offset);
173 #include "moc_OverlayStackLayout.cpp"
QObject * sender() const const
void setSenderAlignment(Qt::Alignment align)
Convenience slot to set the layout alignment on a signal from a QWidget::sender().
void setOffset(QWidget *widget, const QPoint &offset) const
Set the layout position offset coordinates for given widget.
virtual QRect geometry() const const override
QVariant property(const char *name) const const
QRect contentsRect() const const
void setStackingMode(StackingMode mode)
Re-implemented (shadowing) QStackedLayout::setStackingMode() to ensure proper child visibility.
void setSenderOffset(const QPoint &offset) const
Convenience slot to set the layout position offset on a signal from a QWidget::sender().
int insertWidget(int index, QWidget *widget, Qt::Alignment alignment)
Insert widget into the stack at index position with specified alignment.
QStackedLayout::StackingMode stackingMode() const const
bool setAlignment(QWidget *w, Qt::Alignment alignment)
void setGeometry(const QRect &geo) override
QPoint topLeft() const const
virtual QLayoutItem * itemAt(int index) const const override
Qt::Alignment alignment() const const
bool isValid() const const
QPoint toPoint() const const
bool setProperty(const char *name, const QVariant &value)
OverlayStackLayout(QWidget *parent=nullptr)
Constructs a new OverlayStackLayout with the optional parent widget.
virtual void setGeometry(const QRect &r) override
virtual int count() const const override