43 #ifndef QT_NO_STATUSBAR 56 #ifndef QT_NO_ACCESSIBILITY 60 #include <private/qlayoutengine_p.h> 61 #include <private/qwidget_p.h> 73 :
s(stretch),
w(widget),
p(permanent) {}
85 #ifndef QT_NO_SIZEGRIP 98 int i = items.
size() - 1;
101 if (!(item && item->
p))
107 #ifndef QT_NO_SIZEGRIP 112 showSizeGrip =
false;
131 int right = q->width() - 12;
133 #ifndef QT_NO_SIZEGRIP 142 for (
int i=0; i<
items.size(); ++i) {
151 right =
qMin(right, item->
w->
x() - 2);
156 return QRect(left, 0, right-left, q->height());
251 #ifndef QT_NO_SIZEGRIP 253 d->showSizeGrip =
false;
254 setSizeGripEnabled(
true);
290 #ifndef QT_NO_SIZEGRIP 305 while (!
d->items.isEmpty())
306 delete d->items.takeFirst();
328 insertWidget(d_func()->indexToLastNonPermanentWidget() + 1, widget, stretch);
361 int idx =
d->indexToLastNonPermanentWidget();
362 if (index < 0 || index >
d->items.size() || (idx >= 0 && index > idx + 1)) {
363 qWarning(
"QStatusBar::insertWidget: Index out of range (%d), appending widget", index);
366 d->items.insert(index, item);
368 if (!
d->tempItem.isEmpty())
429 int idx =
d->indexToLastNonPermanentWidget();
430 if (index < 0 || index >
d->items.size() || (idx >= 0 && index <= idx)) {
431 qWarning(
"QStatusBar::insertPermanentWidget: Index out of range (%d), appending widget", index);
432 index =
d->items.size();
434 d->items.insert(index, item);
461 for (
int i=0; i<
d->items.size(); ++i) {
462 item =
d->items.at(i);
465 if (item->
w == widget) {
466 d->items.removeAt(i);
476 #if defined(QT_DEBUG) 478 qDebug(
"QStatusBar::removeWidget(): Widget not found.");
496 #ifdef QT_NO_SIZEGRIP 506 #ifdef QT_NO_SIZEGRIP 510 if (!enabled != !
d->resizer) {
514 d->resizer->installEventFilter(
this);
515 d->showSizeGrip =
true;
519 d->showSizeGrip =
false;
523 d->tryToShowSizeGrip();
542 #ifndef QT_NO_SIZEGRIP 545 d->box->setMargin(0);
547 d->box->addLayout(vbox);
552 d->box->setMargin(0);
564 for (i=0,item=0; i<
d->items.size(); ++i) {
565 item =
d->items.at(i);
566 if (!item || item->
p)
570 maxH =
qMax(maxH, itemH);
575 for (item=0; i<
d->items.size(); ++i) {
576 item =
d->items.at(i);
581 maxH =
qMax(maxH, itemH);
583 #ifndef QT_NO_SIZEGRIP 585 maxH =
qMax(maxH,
d->resizer->sizeHint().height());
586 d->box->addSpacing(1);
591 d->savedStrut = maxH;
615 d->tempItem = message;
622 d->timer->start(timeout);
623 }
else if (
d->timer) {
640 if (
d->tempItem.isEmpty())
702 bool haveMessage = !
d->tempItem.isEmpty();
705 for (
int i=0; i<
d->items.size(); ++i) {
706 item =
d->items.at(i);
707 if (!item || item->
p)
719 #ifndef QT_NO_ACCESSIBILITY 732 #ifndef QT_NO_SIZEGRIP 734 if (
d->resizer &&
d->showSizeGrip)
735 d->tryToShowSizeGrip();
749 bool haveMessage = !
d->tempItem.isEmpty();
756 for (
int i=0; i<
d->items.size(); ++i) {
758 if (item && item->
w->
isVisible() && (!haveMessage || item->
p)) {
793 || e->
type() == QEvent::LayoutHint
800 for (
int i=0; i<
d->items.size(); ++i) {
801 item =
d->items.at(i);
805 maxH =
qMax(maxH, itemH);
808 #ifndef QT_NO_SIZEGRIP 810 maxH =
qMax(maxH,
d->resizer->sizeHint().height());
813 if (maxH !=
d->savedStrut)
820 for (
int i=0; i<
d->items.size(); ++i) {
821 item =
d->items.at(i);
825 d->items.removeAt(i);
841 if (
parent() == 0 || qobject_cast<QMainWindow *>(
parent()) == 0 ||
842 qobject_cast<QMainWindow *>(
parent())->unifiedTitleAndToolBarOnMac() ==
false )
857 d->dragStart = mouseEvent->
pos();
862 QPoint delta = (pos -
d->dragStart);
The QPainter class performs low-level painting on widgets and other paint devices.
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QBoxLayout class lines up child widgets horizontally or vertically.
#define QT_END_NAMESPACE
This macro expands to.
The QSizeGrip class provides a resize handle for resizing top-level windows.
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
QPointer< QWidget > widget
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QStyle::State state
the style flags that are used when drawing the control
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
void reformat()
Changes the status bar's appearance to account for item changes.
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...
The QString class provides a Unicode character string.
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
virtual ~QStatusBar()
Destroys this status bar and frees any allocated resources and child widgets.
void clearMessage()
Removes any temporary message being shown.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
The QStatusBar class provides a horizontal bar suitable for presenting status information.
Q_CORE_EXPORT void qDebug(const char *,...)
void addStretch(int stretch=0)
Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end...
void resizeEvent(QResizeEvent *)
Reimplemented Function
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QStyleOption class stores the parameters used by QStyle functions.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void initFrom(const QWidget *w)
const T & at(int i) const
Returns the item at index position i in the list.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void addStrut(int)
Limits the perpendicular dimension of the box (e.g.
The QShowEvent class provides an event that is sent when a widget is shown.
SBItem(QWidget *widget, int stretch, bool permanent)
Qt::MouseButton button() const
Returns the button that caused the event.
QString currentMessage() const
Returns the temporary message currently shown, or an empty string if there is no such message...
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
int indexToLastNonPermanentWidget() const
The QMouseEvent class contains parameters that describe a mouse event.
The QChildEvent class contains event parameters for child object events.
int insertPermanentWidget(int index, QWidget *widget, int stretch=0)
Inserts the given widget at the given index permanently to this status bar, reparenting the widget if...
QPalette palette
the palette that should be used when painting the control
#define Q_DECLARE_PUBLIC(Class)
void qDeleteInEventHandler(QObject *o)
void paintEvent(QPaintEvent *)
Reimplemented FunctionShows the temporary message, if appropriate, in response to the paint event...
QStatusBar(QWidget *parent=0)
Constructs a status bar with a size grip and the given parent.
QRect messageRect() const
void removeWidget(QWidget *widget)
Removes the specified widget from the status bar.
void addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout...
bool event(QEvent *)
Reimplemented Function
void setSpacing(int spacing)
Reimplements QLayout::setSpacing().
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
The QHBoxLayout class lines up widgets horizontally.
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
void showEvent(QShowEvent *)
Reimplemented Function
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
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 setSizeGripEnabled(bool)
The QVBoxLayout class lines up widgets vertically.
The QTimer class provides repetitive and single-shot timers.
const QRect & rect() const
Returns the rectangle that needs to be updated.
int height() const
Returns the height of the font.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
void messageChanged(const QString &text)
This signal is emitted whenever the temporary status message changes.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void hideOrShow()
Ensures that the right widgets are visible.
QRect rect
the area that should be used for various calculations and painting
bool isSizeGripEnabled() const
int insertWidget(int index, QWidget *widget, int stretch=0)
Inserts the given widget at the given index to this status bar, reparenting the widget if it isn't al...
The QList class is a template class that provides lists.
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 ...