42 #include <QWidgetItem> 44 #include <QStyleOption> 45 #include <QApplication> 155 int extra =
qMax(0, space - min);
163 tblayout->checkUsePopupMenu();
170 const int extraSpace =
qMin(item.
size - itemMin, extra);
171 item.
size = itemMin + extraSpace;
206 : dockPos(pos), dirty(false)
273 if ((reverse && i < 0) || (!reverse && i ==
lines.
count()))
295 i += reverse ? -1 : 1;
389 lines[j - 1].toolBarItems +=
lines[j].toolBarItems;
412 int previousIndex = -1;
417 int newPos = current.
pos;
419 if (previousIndex >= 0) {
421 if (pos < current.
pos) {
422 newPos =
qMax(pos, minPos);
432 newPos =
qMin(pos, maxPos);
436 int extra = newPos - current.
pos;
455 for(
int l = previousIndex;
l >=0; --
l) {
459 const int margin = item.
size - minPreferredSize;
460 if (margin < extra) {
461 item.
resize(line.
o, minPreferredSize);
477 }
else if (!current.
skip()) {
488 int p =
pick(
o, pos);
506 if (p > item.
pos + size)
508 if (p > item.
pos + size/2)
521 if (dist >= 0 && *minDistance > dist) {
536 int j = path.
first();
541 const int k = path.
at(1);
548 for(
int p = k - 1 ; p >= 0; --p) {
550 if (!previous.
skip()) {
553 int previousExtraSpace = previous.
size - previousSizeHint;
555 if (previousExtraSpace > 0) {
558 previous.
size = previousSizeHint;
560 gap_item.
resize(
o, previousExtraSpace);
670 QSize result = centerMin;
693 QSize result = centerHint;
723 right_hint.
width()*coef, bottom_hint.
height()*coef);
735 for (
int j = 0; j < dock.
lines.
count(); ++j) {
755 for (
int j = 0; j < dock.
lines.
count(); ++j) {
759 if ((*x)++ ==
index) {
777 for (
int j = 0; j < dock.
lines.
count(); ++j) {
795 for (
int j = 0; j < dock.
lines.
count(); ++j) {
800 return static_cast<QInternal::DockPosition>(i);
862 if (
docks[pos].lines.isEmpty())
886 for (
int j = 0; j < dock.
lines.
count(); ++j) {
912 if (
QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
944 for (
int j = 0; j < dock.
lines.
count(); ++j) {
949 return j > 0 && k == 0;
962 for (
int j = 0; j < dock.
lines.
count(); ++j) {
1001 for (
int j = 0; j < dock.
lines.
count(); ++j) {
1032 int minDistance = 80;
1053 for (
int j = 0; j < dock.
lines.
count(); ++j) {
1059 result << i << j << k;
1071 const int i = path.
first();
1087 for (
int j = 0; j < dock.
lines.
count(); ++j) {
1126 const int i = path.
first();
1158 if (item->size !=
pick(line.
o, item->realSizeHint())) {
1161 int newExtraSpace = 0;
1164 for (
int i = path.
at(2) - 1; i >= 0; --i) {
1166 if (!previous.
skip()) {
1184 for (
int i = path.
at(2) - 1; i >= 0; --i) {
1186 if (!previous.
skip()) {
1197 return item->widgetItem;
1202 *floating = geom0 & 1;
1208 int x = (int)(geom0 & 0x0000ffff) - 0x7FFF;
1209 int y = (int)(geom1 & 0x0000ffff) - 0x7FFF;
1214 int w = geom0 & 0x0000ffff;
1215 int h = geom1 & 0x0000ffff;
1217 return QRect(x, y, w, h);
1231 *geom0 |=
qMax(0, rect.
width()) & 0x0000ffff;
1232 *geom1 |=
qMax(0, rect.
height()) & 0x0000ffff;
1237 *geom0 |=
qMax(0, rect.
x() + 0x7FFF) & 0x0000ffff;
1238 *geom1 |=
qMax(0, rect.
y() + 0x7FFF) & 0x0000ffff;
1254 lineCount +=
docks[i].lines.count();
1256 stream << lineCount;
1261 for (
int j = 0; j < dock.
lines.
count(); ++j) {
1271 qWarning(
"QMainWindow::saveState(): 'objectName' not set for QToolBar %p '%s'",
1274 stream << objectName;
1279 if (
QToolBar * tb= qobject_cast<QToolBar*>(widget)) {
1281 shownOrientation |= 2;
1283 stream << shownOrientation;
1290 stream << geom0 << geom1;
1318 for (
int j = 0; j < lines; ++j) {
1330 for (
int k = 0; k < cnt; ++k) {
1334 stream >> objectName;
1349 bool floating =
false;
1351 geom0 =
getInt(stream, dock.
o, pre43);
1353 geom1 =
getInt(stream, dock.
o, pre43);
1358 for (
int x = 0; x < toolBars.
count(); ++x) {
1360 toolBar = toolBars.
takeAt(x);
1368 if (applyingLayout) {
1379 if (applyingLayout) {
1391 if (!
docks[i].lines.isEmpty())
1399 #endif // QT_NO_TOOLBAR
T qobject_cast(QObject *object)
Status status() const
Returns the status of the data stream.
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 ...
void setHeight(int h)
Sets the height of the rectangle to the given height.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
static mach_timebase_info_data_t info
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)
QPointer< QWidget > widget
static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
Returns the given logicalPosition converted to screen coordinates based on the specified direction...
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate...
virtual bool isEmpty() const =0
Implemented in subclasses to return whether this item is empty, i.
static C reverse(const C &l)
Policy horizontalPolicy() const
void moveRight(int pos)
Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate...
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
void insert(int i, const T &t)
Inserts value at index position i in the list.
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
Q_DECL_CONSTEXPR T qAbs(const T &t)
void moveBottom(int pos)
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate...
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QList< T > mid(int pos, int length=-1) const
Returns a list whose elements are copied from this list, starting at position pos.
void setWidth(int w)
Sets the width to the given width.
int width() const
Returns the width.
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
void moveTopRight(const QPoint &p)
Moves the rectangle, leaving the top-right corner at the given position.
void prepend(const T &t)
Inserts value at the beginning of the list.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
void clear()
Removes all items from the list.
static int startDragDistance()
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
T & first()
Returns a reference to the first item in the list.
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool unifiedTitleAndToolBarOnMac
whether the window uses the unified title and toolbar look on Mac OS X
int top() const
Returns the y-coordinate of the rectangle's top edge.
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...
int right() const
Returns the x-coordinate of the rectangle's right edge.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
T & last()
Returns a reference to the last item in the list.
The QMainWindow class provides a main application window.
int & rheight()
Returns a reference to the height.
void setWidth(int w)
Sets the width of the rectangle to the given width.
Policy verticalPolicy() const
QString objectName() const
int height() const
Returns the height.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
T takeAt(int i)
Removes the item at index position i and returns it.
int y() const
Returns the y coordinate of this point.
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
QWidgetAnimator widgetAnimator
The QSize class defines the size of a two-dimensional object using integer point precision.
The QDataStream class provides serialization of binary data to a QIODevice.
int x() const
Returns the x coordinate of this point.
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
int & rwidth()
Returns a reference to the width.
void removeAt(int i)
Removes the item at index position i.