14#if QT_CONFIG(sizegrip)
17#if QT_CONFIG(mainwindow)
21#if QT_CONFIG(accessibility)
25#include <private/qlayoutengine_p.h>
26#include <private/qwidget_p.h>
55#if QT_CONFIG(sizegrip)
67 if (!
item.isPermanent())
73#if QT_CONFIG(sizegrip)
74 void tryToShowSizeGrip()
97 int right =
q->width() - 12;
99#if QT_CONFIG(sizegrip)
198#if QT_CONFIG(sizegrip)
199 d->resizer =
nullptr;
200 setSizeGripEnabled(
true);
263 int idx =
d->indexToLastNonPermanentWidget();
264 if (
Q_UNLIKELY(index < 0 || index >
d->items.size() || (idx >= 0 &&
index > idx + 1))) {
265 qWarning(
"QStatusBar::insertWidget: Index out of range (%d), appending widget",
index);
270 if (!
d->tempItem.isEmpty())
327 int idx =
d->indexToLastNonPermanentWidget();
328 if (
Q_UNLIKELY(index < 0 || index >
d->items.size() || (idx >= 0 &&
index <= idx))) {
329 qWarning(
"QStatusBar::insertPermanentWidget: Index out of range (%d), appending widget",
index);
357 if (
d->items.removeIf([
widget](
const auto &
item) { return item.widget == widget; })) {
363 qDebug(
"QStatusBar::removeWidget(): Widget not found.");
378#if !QT_CONFIG(sizegrip)
388#if !QT_CONFIG(sizegrip)
396 d->resizer->installEventFilter(
this);
397 d->showSizeGrip =
true;
400 d->resizer =
nullptr;
401 d->showSizeGrip =
false;
405 d->tryToShowSizeGrip();
424#if QT_CONFIG(sizegrip)
429 d->box->addLayout(vbox);
445 for (
i = 0;
i <
d->items.size(); ++
i) {
446 const auto &
item =
d->items.at(
i);
447 if (
item.isPermanent())
451 maxH =
qMax(maxH, itemH);
456 for (;
i <
d->items.size(); ++
i) {
457 const auto &
item =
d->items.at(
i);
460 maxH =
qMax(maxH, itemH);
462#if QT_CONFIG(sizegrip)
464 maxH =
qMax(maxH,
d->resizer->sizeHint().height());
465 d->box->addSpacing(1);
470 d->savedStrut = maxH;
500 }
else if (
d->timer) {
520 if (
d->tempItem.isEmpty())
561 bool haveMessage = !
d->tempItem.isEmpty();
563 for (
const auto &
item : std::as_const(
d->items)) {
564 if (
item.isPermanent())
576#if QT_CONFIG(accessibility)
577 if (QAccessible::isActive()) {
578 QAccessibleEvent
event(
this, QAccessible::NameChanged);
579 QAccessible::updateAccessibility(&
event);
591#if QT_CONFIG(sizegrip)
593 if (
d->resizer &&
d->showSizeGrip)
594 d->tryToShowSizeGrip();
608 bool haveMessage = !
d->tempItem.isEmpty();
615 for (
const auto &
item : std::as_const(
d->items)) {
617 QRect ir =
item.widget->geometry().adjusted(-2, -1, 2, 1);
618 if (
event->rect().intersects(ir)) {
654 for (
const auto &
item : std::as_const(
d->items)) {
656 maxH =
qMax(maxH, itemH);
659#if QT_CONFIG(sizegrip)
661 maxH =
qMax(maxH,
d->resizer->sizeHint().height());
664 if (maxH !=
d->savedStrut)
671 for (
int i = 0;
i <
d->items.size(); ++
i) {
672 const auto &
item =
d->items.at(
i);
674 d->items.removeAt(
i);
686#include "moc_qstatusbar.cpp"
The QBoxLayout class lines up child widgets horizontally or vertically.
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void addStrut(int)
Limits the perpendicular dimension of the box (e.g.
void addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout.
void addStretch(int stretch=0)
Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end...
void setSpacing(int spacing) override
Reimplements QLayout::setSpacing().
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
QObject * child() const
Returns the child object that was added or removed.
int height() const
Returns the height of the font.
void show()
Shows the item (items are visible by default).
qreal x() const
This convenience function is equivalent to calling pos().x().
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
void hide()
Hides the item (items are visible by default).
The QHBoxLayout class lines up widgets horizontally.
qsizetype size() const noexcept
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
\inmodule QtCore\reentrant
The QResizeEvent class contains event parameters for resize events.
The QShowEvent class provides an event that is sent when a widget is shown.
The QSizeGrip class provides a resize handle for resizing top-level windows.
constexpr int height() const noexcept
Returns the height.
QRect messageRect() const
int indexToLastNonPermanentWidget() const
The QStatusBar class provides a horizontal bar suitable for presenting status information.
int insertWidget(int index, QWidget *widget, int stretch=0)
int insertPermanentWidget(int index, QWidget *widget, int stretch=0)
QStatusBar(QWidget *parent=nullptr)
Constructs a status bar with a size grip and the given parent.
void showMessage(const QString &text, int timeout=0)
Hides the normal status indications and displays the given message for the specified number of milli-...
void resizeEvent(QResizeEvent *) override
\reimp
QString currentMessage() const
Returns the temporary message currently shown, or an empty string if there is no such message.
void addWidget(QWidget *widget, int stretch=0)
Adds the given widget to this status bar, reparenting the widget if it isn't already a child of this ...
bool isSizeGripEnabled() const
void addPermanentWidget(QWidget *widget, int stretch=0)
Adds the given widget permanently to this status bar, reparenting the widget if it isn't already a ch...
void clearMessage()
Removes any temporary message being shown.
virtual ~QStatusBar()
Destroys this status bar and frees any allocated resources and child widgets.
void showEvent(QShowEvent *) override
\reimp
void messageChanged(const QString &text)
This signal is emitted whenever the temporary status message changes.
bool event(QEvent *) override
\reimp
void removeWidget(QWidget *widget)
Removes the specified widget from the status bar.
void setSizeGripEnabled(bool)
void reformat()
Changes the status bar's appearance to account for item changes.
void paintEvent(QPaintEvent *) override
\reimp
void hideOrShow()
Ensures that the right widgets are visible.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QVBoxLayout class lines up widgets vertically.
Combined button and popup list for selecting options.
@ WA_WState_ExplicitShowHide
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
void qDeleteInEventHandler(QObject *o)
GLbitfield GLuint64 timeout
[4]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLdouble GLdouble GLdouble GLdouble q
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent