Qt 4.8
Classes | Functions
qmainwindowlayout.cpp File Reference
#include "qmainwindowlayout_p.h"
#include "qdockarealayout_p.h"
#include "qdockwidget.h"
#include "qdockwidget_p.h"
#include "qtoolbar_p.h"
#include "qmainwindow.h"
#include "qtoolbar.h"
#include "qtoolbarlayout_p.h"
#include "qwidgetanimator_p.h"
#include "qrubberband.h"
#include "qtabbar_p.h"
#include <qapplication.h>
#include <qstatusbar.h>
#include <qstring.h>
#include <qstyle.h>
#include <qvarlengtharray.h>
#include <qstack.h>
#include <qmap.h>
#include <qtimer.h>
#include <qdebug.h>
#include <private/qapplication_p.h>
#include <private/qlayoutengine_p.h>
#include <private/qcore_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>

Go to the source code of this file.

Classes

class  QMainWindowTabBar
 

Functions

template<typename T >
static QList< T > findChildrenHelper (const QObject *o)
 
static void fixToolBarOrientation (QLayoutItem *item, int dockPos)
 
static QTabBar::Shape tabBarShapeFrom (QTabWidget::TabShape shape, QTabWidget::TabPosition position)
 
static QInternal::DockPosition toDockPos (Qt::ToolBarArea area)
 
static QInternal::DockPosition toDockPos (Qt::DockWidgetArea area)
 
static Qt::DockWidgetArea toDockWidgetArea (QInternal::DockPosition pos)
 
static Qt::DockWidgetArea toDockWidgetArea (int pos)
 
static Qt::ToolBarArea toToolBarArea (QInternal::DockPosition pos)
 
static Qt::ToolBarArea toToolBarArea (int pos)
 
static void validateDockWidgetArea (Qt::DockWidgetArea &area)
 
static void validateToolBarArea (Qt::ToolBarArea &area)
 

Function Documentation

◆ findChildrenHelper()

template<typename T >
static QList<T> findChildrenHelper ( const QObject o)
static

Definition at line 609 of file qmainwindowlayout.cpp.

610 {
611  const QObjectList &list = o->children();
612  QList<T> result;
613 
614  for (int i=0; i < list.size(); ++i) {
615  if (T t = qobject_cast<T>(list[i])) {
616  result.append(t);
617  }
618  }
619 
620  return result;
621 }
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197

◆ fixToolBarOrientation()

static void fixToolBarOrientation ( QLayoutItem item,
int  dockPos 
)
static

Definition at line 1527 of file qmainwindowlayout.cpp.

Referenced by QMainWindowLayout::hover(), QMainWindowLayout::plug(), QMainWindowLayout::revert(), and QMainWindowLayout::unplug().

1528 {
1529 #ifndef QT_NO_TOOLBAR
1530  QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
1531  if (toolBar == 0)
1532  return;
1533 
1534  QRect oldGeo = toolBar->geometry();
1535 
1537  = static_cast<QInternal::DockPosition>(dockPos);
1540  if (o != toolBar->orientation())
1541  toolBar->setOrientation(o);
1542 
1543  QSize hint = toolBar->sizeHint().boundedTo(toolBar->maximumSize())
1544  .expandedTo(toolBar->minimumSize());
1545 
1546  if (toolBar->size() != hint) {
1547  QRect newGeo(oldGeo.topLeft(), hint);
1548  if (toolBar->layoutDirection() == Qt::RightToLeft)
1549  newGeo.moveRight(oldGeo.right());
1550  toolBar->setGeometry(newGeo);
1551  }
1552 
1553 #else
1554  Q_UNUSED(item);
1555  Q_UNUSED(dockPos);
1556 #endif
1557 }
QSize size() const
void moveRight(int pos)
Moves the rectangle horizontally, leaving the rectangle&#39;s right edge at the given x coordinate...
Definition: qrect.h:356
void setOrientation(Qt::Orientation orientation)
Definition: qtoolbar.cpp:750
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition: qsize.h:192
virtual QSize sizeHint() const
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
Qt::LayoutDirection layoutDirection() const
Qt::Orientation orientation() const
orientation of the toolbar
Definition: qtoolbar.cpp:769
QSize maximumSize() const
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QSize minimumSize() const
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
const QRect & geometry() const
Orientation
Definition: qnamespace.h:174
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ tabBarShapeFrom()

static QTabBar::Shape tabBarShapeFrom ( QTabWidget::TabShape  shape,
QTabWidget::TabPosition  position 
)
inlinestatic

Definition at line 1197 of file qmainwindowlayout.cpp.

Referenced by QMainWindowLayout::updateTabBarShapes().

1198 {
1199  const bool rounded = (shape == QTabWidget::Rounded);
1200  if (position == QTabWidget::North)
1202  if (position == QTabWidget::South)
1204  if (position == QTabWidget::East)
1205  return rounded ? QTabBar::RoundedEast : QTabBar::TriangularEast;
1206  if (position == QTabWidget::West)
1207  return rounded ? QTabBar::RoundedWest : QTabBar::TriangularWest;
1208  return QTabBar::RoundedNorth;
1209 }
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)

◆ toDockPos() [1/2]

static QInternal::DockPosition toDockPos ( Qt::ToolBarArea  area)
static

◆ toDockPos() [2/2]

static QInternal::DockPosition toDockPos ( Qt::DockWidgetArea  area)
static

◆ toDockWidgetArea() [1/2]

static Qt::DockWidgetArea toDockWidgetArea ( QInternal::DockPosition  pos)
static

◆ toDockWidgetArea() [2/2]

static Qt::DockWidgetArea toDockWidgetArea ( int  pos)
inlinestatic

Definition at line 1065 of file qmainwindowlayout.cpp.

1066 {
1067  return toDockWidgetArea(static_cast<QInternal::DockPosition>(pos));
1068 }
static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos)

◆ toToolBarArea() [1/2]

static Qt::ToolBarArea toToolBarArea ( QInternal::DockPosition  pos)
static

◆ toToolBarArea() [2/2]

static Qt::ToolBarArea toToolBarArea ( int  pos)
inlinestatic

Definition at line 799 of file qmainwindowlayout.cpp.

800 {
801  return toToolBarArea(static_cast<QInternal::DockPosition>(pos));
802 }
static Qt::ToolBarArea toToolBarArea(QInternal::DockPosition pos)

◆ validateDockWidgetArea()

static void validateDockWidgetArea ( Qt::DockWidgetArea area)
inlinestatic

Definition at line 1024 of file qmainwindowlayout.cpp.

1025 {
1026  switch (area) {
1029  case Qt::TopDockWidgetArea:
1031  break;
1032  default:
1034  }
1035 }
static int area(const QSize &s)
Definition: qicon.cpp:155

◆ validateToolBarArea()

static void validateToolBarArea ( Qt::ToolBarArea area)
inlinestatic

Definition at line 760 of file qmainwindowlayout.cpp.

Referenced by QMainWindowLayout::addToolBar(), and QMainWindowLayout::addToolBarBreak().

761 {
762  switch (area) {
763  case Qt::LeftToolBarArea:
765  case Qt::TopToolBarArea:
767  break;
768  default:
770  }
771 }
static int area(const QSize &s)
Definition: qicon.cpp:155