47 #include "private/qlayoutengine_p.h" 221 index =
qMin(index,
d->list.count());
223 index =
d->list.count();
225 d->list.insert(index, wi);
230 if (index <= d->index)
245 return d->list.value(index);
267 if (index <0 || index >=
d->list.size())
270 if (index ==
d->index) {
272 if (
d->list.count() > 0 ) {
273 int newIndex = (index ==
d->list.count()) ? index-1 : index;
278 }
else if (index < d->index) {
303 if (!next || next == prev)
306 bool reenableUpdates =
false;
310 reenableUpdates =
true;
315 const bool focusWasOnOldPage = fw && (prev && prev->
isAncestorOf(fw));
331 if (focusWasOnOldPage) {
338 while ((i = i->nextInFocusChain()) != fw) {
340 && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled()
377 qWarning(
"QStackedLayout::setCurrentWidget: Widget %p not contained in stack", widget);
393 return d->index >= 0 ?
d->list.at(
d->index)->widget() : 0;
405 if (index < 0 || index >=
d->list.size())
407 return d->list.at(index)->widget();
422 return d->list.size();
436 qWarning(
"QStackedLayout::addItem: Only widgets can be added");
447 int n =
d->list.count();
449 for (
int i = 0; i < n; ++i)
468 int n =
d->list.count();
470 for (
int i = 0; i < n; ++i)
482 switch (
d->stackingMode) {
488 if (
const int n =
d->list.count())
489 for (
int i = 0; i < n; ++i)
531 return d->stackingMode;
537 if (
d->stackingMode == stackingMode)
541 const int n =
d->list.count();
545 switch (
d->stackingMode) {
548 for (
int i = 0; i < n; ++i)
556 for (
int i = 0; i < n; ++i)
void setCurrentWidget(QWidget *w)
Sets the current widget to be the specified widget.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
static bool qt_wasDeleted(const QWidget *w)
void setCurrentIndex(int index)
Policy horizontalPolicy() const
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
~QStackedLayout()
Destroys this QStackedLayout.
void widgetRemoved(int index)
This signal is emitted whenever a widget is removed from the layout.
void invalidate()
Reimplemented Function
void currentChanged(int index)
This signal is emitted whenever the current widget in the layout changes.
void setStackingMode(StackingMode stackingMode)
The QStackedLayout class provides a stack of widgets where only one widget is visible at a time...
QWidget * parentWidget() const
Returns the parent widget of this layout, or 0 if this layout is not installed on any widget...
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
int count() const
the number of widgets contained in the layout
virtual int indexOf(QWidget *) const
Searches for widget widget in this layout (not including child layouts).
The QLayout class is the base class of geometry managers.
QSize sizeHint() const
Reimplemented Function
int addWidget(QWidget *w)
Adds the given widget to the end of this layout and returns the index position of the widget...
Q_CORE_EXPORT void qWarning(const char *,...)
StackingMode stackingMode() const
static QWidgetItem * createWidgetItem(const QLayout *layout, QWidget *widget)
QSize minimumSize() const
Reimplemented Function
#define Q_DECLARE_PUBLIC(Class)
QStackedLayout::StackingMode stackingMode
void addChildWidget(QWidget *w)
This function is called from addWidget() functions in subclasses to add w as a managed widget of a la...
QObject * parent() const
Returns a pointer to the parent object.
int insertWidget(int index, QWidget *w)
Inserts the given widget at the given index in this QStackedLayout.
Policy verticalPolicy() const
The QRect class defines a rectangle in the plane using integer precision.
StackingMode
This enum specifies how the layout handles its child widgets regarding their visibility.
QLayoutItem * takeAt(int)
Reimplemented Function
QScopedPointer< QObjectData > d_ptr
void setGeometry(const QRect &rect)
Reimplemented Function
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
The QSize class defines the size of a two-dimensional object using integer point precision.
void addItem(QLayoutItem *item)
Reimplemented Function
QRect geometry() const
Reimplemented Function
QLayoutItem * itemAt(int) const
Reimplemented Function
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
QWidget * currentWidget() const
Returns the current widget, or 0 if there are no widgets in this layout.
QList< QLayoutItem * > list
The QList class is a template class that provides lists.
QStackedLayout()
Constructs a QStackedLayout with no parent.