9#if QT_CONFIG(toolbutton)
16#include <qpa/qplatformnativeinterface.h>
20#if QT_CONFIG(toolbutton)
71 if (
item->customWidget)
72 widgetAction->releaseWidget(
item->widget());
84 QStyleOptionToolBar
opt;
99 if (!dirty && ((popupMenu ==
nullptr) ==
set))
105 extension->setMenu(
nullptr);
113 popupMenu =
new QMenu(extension);
115 extension->setMenu(popupMenu);
129 qWarning(
"QToolBarLayout::addItem(): please use addAction() instead");
135 if (index < 0 || index >= items.
size())
142 if (index < 0 || index >= items.
size())
150 if (widgetAction !=
nullptr &&
item->customWidget) {
155 item->widget()->deleteLater();
176 for (
int i = 0;
i < items.
size(); ++
i) {
209 return expanding ? Qt::Orientations(
o) : Qt::Orientations{};
221void QToolBarLayout::updateGeomArray()
const
232 QStyleOptionToolBar
opt;
234 const int handleExtent =
movable()
241 that->minSize =
QSize(0, 0);
242 that->hint =
QSize(0, 0);
246 that->expanding =
false;
252 for (
int i = 0;
i < items.
size(); ++
i) {
258 Qt::Orientations exp =
item->expandingDirections();
259 bool empty =
item->isEmpty();
261 that->expanding = expanding || exp &
o;
264 if (
item->widget()) {
266 that->expandFlag =
true;
284 a[
i].maximumSize =
pick(
o, max);
285 a[
i].minimumSize =
pick(
o, min);
286 a[
i].expansive = exp &
o;
288 a[
i].stretch =
item->widget()->sizePolicy().horizontalStretch();
290 a[
i].stretch =
item->widget()->sizePolicy().verticalStretch();
295 that->empty =
count == 0;
297 rpick(
o, that->minSize) += handleExtent;
299 if (items.
size() > 1)
302 rpick(
o, that->hint) += handleExtent;
310 return a !=
nullptr &&
a->defaultWidget() ==
item->widget();
323 if (!mainWindow || !mainWindow->
isWindow() || !mainWindow->unifiedTitleAndToolBarOnMac())
327 if (!nativeInterface)
337 typedef void (*RegisterContentBorderAreaFunction)(
QWindow *
window,
void *identifier,
int upper,
int lower);
352 QStyleOptionToolBar
opt;
362 bool ranOutOfSpace =
false;
413 QStyleOptionToolBar
opt;
415 const int handleExtent =
movable()
421 bool extensionMenuContainsOnlyWidgetActions =
true;
423 int space =
pick(
o,
rect.size()) -
pick(
o, margins) - handleExtent;
430 bool ranOutOfSpace =
false;
434 while (
i < items.
size()) {
443 bool expansiveRow =
false;
444 for (;
i < items.
size(); ++
i) {
449 if (prev != -1 && newSize > space) {
451 ranOutOfSpace =
true;
461 expansiveRow = expansiveRow ||
a[
i].expansive;
471 a[
i].minimumSize = 0;
472 a[
i].expansive =
true;
477 expansiveRow =
false;
482 space - (ranOutOfSpace ? (extensionExtent +
spacing) : 0),
489 if (!
item->widget()->isHidden())
490 hideWidgets <<
item->widget();
508 item->setGeometry(
r);
510 if (
item->widget()->isHidden())
511 showWidgets <<
item->widget();
515 for (
int j =
i;
j < items.
size(); ++
j) {
517 if (!
item->widget()->isHidden())
518 hideWidgets <<
item->widget();
522 extensionMenuContainsOnlyWidgetActions =
false;
537 extension->
setEnabled(popupMenu ==
nullptr || !extensionMenuContainsOnlyWidgetActions);
540 for (
int i = 0;
i < showWidgets.
size(); ++
i)
541 showWidgets.
at(
i)->show();
542 for (
int i = 0;
i < hideWidgets.
size(); ++
i)
543 hideWidgets.
at(
i)->hide();
545 return ranOutOfSpace;
559 QStyleOptionToolBar
opt;
561 const int handleExtent =
movable()
569 for (
int x = 0;
x < items.
size(); ++
x) {
570 if (!geomArray[
x].empty) {
582 int space = total_w/rows +
spacing + extensionExtent;
583 space =
qMax(space, min_w -
pick(
o, margins) - handleExtent);
590 while (
i < items.
size()) {
595 for (;
i < items.
size(); ++
i) {
596 if (geomArray[
i].empty)
601 if (prev != -1 && newSize > space) {
642#if !QT_CONFIG(dockwidget)
652 if (!
path.isEmpty()) {
677 bool customWidget =
false;
678 bool standardButtonWidget =
false;
684 if (
QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action)) {
685 widget = widgetAction->requestWidget(tb);
699 button->setAutoRaise(
true);
707 button->setDefaultAction(action);
710 standardButtonWidget =
true;
715 if (standardButtonWidget)
717 result->customWidget = customWidget;
724#include "moc_qtoolbarlayout_p.cpp"
The QAction class provides an abstraction for user commands that can be added to different user inter...
bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
void hide()
Hides the item (items are visible by default).
static QPlatformNativeInterface * platformNativeInterface()
The QLayoutItem class provides an abstract item that a QLayout manipulates.
virtual QWidget * widget() const
If this item manages a QWidget, returns that widget.
The QLayout class is the base class of geometry managers.
QRect geometry() const override
\reimp
int spacing
the spacing between widgets inside the layout
QSize maximumSize() const override
Returns the maximum size of this layout.
virtual void setSpacing(int)
void invalidate() override
\reimp
QWidget * parentWidget() const
Returns the parent widget of this layout, or \nullptr if this layout is not installed on any widget.
virtual void setGeometry(const QRect &) override
\reimp
QLayout * layout() override
\reimp
virtual int indexOf(const QWidget *) const
Searches for widget widget in this layout (not including child layouts).
void setContentsMargins(int left, int top, int right, int bottom)
qsizetype size() const noexcept
bool isEmpty() const noexcept
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
The QMainWindow class provides a main application window.
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
\inmodule QtCore\reentrant
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
@ PM_ToolBarExtensionExtent
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
Combined button and popup list for selecting options.
@ WA_LayoutUsesWidgetRect
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
QMainWindowLayout * qt_mainwindow_layout(const QMainWindow *window)
qfloat16 qSqrt(qfloat16 f)
static int area(const QSize &s)
void qGeomCalc(QList< QLayoutStruct > &chain, int start, int count, int pos, int space, int spacer)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLfloat GLfloat GLfloat GLfloat h
GLsizei const GLchar *const * path
static constexpr QChar sep
QFuture< QSet< QChar > > set
[10]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent