Qt 4.8
Functions
qtoolbararealayout.cpp File Reference
#include <QWidgetItem>
#include <QToolBar>
#include <QStyleOption>
#include <QApplication>
#include <qdebug.h>
#include "qtoolbararealayout_p.h"
#include "qmainwindowlayout_p.h"
#include "qwidgetanimator_p.h"
#include "qtoolbarlayout_p.h"
#include "qtoolbar_p.h"

Go to the source code of this file.

Functions

static int getInt (QDataStream &stream, Qt::Orientation o, bool pre43)
 
static void packRect (uint *geom0, uint *geom1, const QRect &rect, bool floating)
 
QMainWindowLayoutqt_mainwindow_layout (const QMainWindow *mainWindow)
 
static QRect unpackRect (uint geom0, uint geom1, bool *floating)
 

Function Documentation

◆ getInt()

static int getInt ( QDataStream stream,
Qt::Orientation  o,
bool  pre43 
)
inlinestatic

Definition at line 1296 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::restoreState().

1297 {
1298  if (pre43) {
1299  QPoint p;
1300  stream >> p;
1301  return pick(o, p);
1302  } else {
1303  int x;
1304  stream >> x;
1305  return x;
1306  }
1307 }
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static int pick(bool vertical, const QSize &size)

◆ packRect()

static void packRect ( uint geom0,
uint geom1,
const QRect rect,
bool  floating 
)
static

Definition at line 1220 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::saveState().

1221 {
1222  *geom0 = 0;
1223  *geom1 = 0;
1224 
1225  if (!floating)
1226  return;
1227 
1228  // The 0x7FFF is half of 0xFFFF. We add it so we can handle negative coordinates on
1229  // dual monitors. It's subtracted when unpacking.
1230 
1231  *geom0 |= qMax(0, rect.width()) & 0x0000ffff;
1232  *geom1 |= qMax(0, rect.height()) & 0x0000ffff;
1233 
1234  *geom0 <<= 16;
1235  *geom1 <<= 16;
1236 
1237  *geom0 |= qMax(0, rect.x() + 0x7FFF) & 0x0000ffff;
1238  *geom1 |= qMax(0, rect.y() + 0x7FFF) & 0x0000ffff;
1239 
1240  // yeah, we chop one bit off the width, but it still has a range up to 32512
1241 
1242  *geom0 <<= 1;
1243  *geom0 |= 1;
1244 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252

◆ qt_mainwindow_layout()

QMainWindowLayout* qt_mainwindow_layout ( const QMainWindow mainWindow)

Definition at line 111 of file qmainwindow.cpp.

Referenced by QToolBarAreaLayout::apply().

112 {
113  return QMainWindowPrivate::mainWindowLayout(mainWindow);
114 }
static QMainWindowLayout * mainWindowLayout(const QMainWindow *mainWindow)

◆ unpackRect()

static QRect unpackRect ( uint  geom0,
uint  geom1,
bool *  floating 
)
static

Definition at line 1200 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::restoreState().

1201 {
1202  *floating = geom0 & 1;
1203  if (!*floating)
1204  return QRect();
1205 
1206  geom0 >>= 1;
1207 
1208  int x = (int)(geom0 & 0x0000ffff) - 0x7FFF;
1209  int y = (int)(geom1 & 0x0000ffff) - 0x7FFF;
1210 
1211  geom0 >>= 16;
1212  geom1 >>= 16;
1213 
1214  int w = geom0 & 0x0000ffff;
1215  int h = geom1 & 0x0000ffff;
1216 
1217  return QRect(x, y, w, h);
1218 }
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58