Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | Static Public Variables | List of all members
QLayoutPrivate Class Reference

#include <qlayout_p.h>

Inheritance diagram for QLayoutPrivate:
QObjectPrivate QObjectData QBoxLayoutPrivate QFormLayoutPrivate QGridLayoutPrivate QStackedLayoutPrivate

Public Types

typedef QSpacerItem *(* QSpacerItemFactoryMethod) (const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy)
 
typedef QWidgetItem *(* QWidgetItemFactoryMethod) (const QLayout *layout, QWidget *widget)
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Public Functions

void doResize (const QSize &)
 
void getMargin (int *result, int userMargin, QStyle::PixelMetric pm) const
 
 QLayoutPrivate ()
 
void reparentChildWidgets (QWidget *mw)
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Static Public Functions

static QSpacerItemcreateSpacerItem (const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy=QSizePolicy::Minimum, QSizePolicy::Policy vPolicy=QSizePolicy::Minimum)
 
static QWidgetItemcreateWidgetItem (const QLayout *layout, QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Public Variables

uint activated: 1
 
uint autoNewChild: 1
 
QLayout::SizeConstraint constraint
 
uint enabled: 1
 
int insideSpacing
 
QWidgetmenubar
 
QRect rect
 
uint topLevel: 1
 
int userBottomMargin
 
int userLeftMargin
 
int userRightMargin
 
int userTopMargin
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Static Public Variables

static QSpacerItemFactoryMethod spacerItemFactoryMethod = 0
 
static QWidgetItemFactoryMethod widgetItemFactoryMethod = 0
 

Detailed Description

Definition at line 65 of file qlayout_p.h.

Typedefs

◆ QSpacerItemFactoryMethod

typedef QSpacerItem*(* QLayoutPrivate::QSpacerItemFactoryMethod) (const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy)

Definition at line 71 of file qlayout_p.h.

◆ QWidgetItemFactoryMethod

typedef QWidgetItem*(* QLayoutPrivate::QWidgetItemFactoryMethod) (const QLayout *layout, QWidget *widget)

Definition at line 70 of file qlayout_p.h.

Constructors and Destructors

◆ QLayoutPrivate()

QLayoutPrivate::QLayoutPrivate ( )

Definition at line 161 of file qlayout.cpp.

163  userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false),
165 {
166 }
QWidget * menubar
Definition: qlayout_p.h:96
uint activated
Definition: qlayout_p.h:92
int userRightMargin
Definition: qlayout_p.h:88
QObjectPrivate(int version=QObjectPrivateVersion)
Definition: qobject.cpp:133
uint autoNewChild
Definition: qlayout_p.h:93
int userTopMargin
Definition: qlayout_p.h:87
QLayout::SizeConstraint constraint
Definition: qlayout_p.h:94
int insideSpacing
Definition: qlayout_p.h:85
int userBottomMargin
Definition: qlayout_p.h:89
int userLeftMargin
Definition: qlayout_p.h:86

Functions

◆ createSpacerItem()

QSpacerItem * QLayoutPrivate::createSpacerItem ( const QLayout layout,
int  w,
int  h,
QSizePolicy::Policy  hPolicy = QSizePolicy::Minimum,
QSizePolicy::Policy  vPolicy = QSizePolicy::Minimum 
)
static

Definition at line 198 of file qlayout.cpp.

Referenced by QBoxLayout::addStrut(), QBoxLayout::insertSpacing(), and QBoxLayout::insertStretch().

199 {
201  if (QSpacerItem *si = (*spacerItemFactoryMethod)(layout, w, h, hPolicy, vPolicy))
202  return si;
203  return new QSpacerItem(w, h, hPolicy, vPolicy);
204 }
static QSpacerItemFactoryMethod spacerItemFactoryMethod
Definition: qlayout_p.h:83
The QSpacerItem class provides blank space in a layout.
Definition: qlayoutitem.h:96

◆ createWidgetItem()

QWidgetItem * QLayoutPrivate::createWidgetItem ( const QLayout layout,
QWidget widget 
)
static

Definition at line 190 of file qlayout.cpp.

Referenced by QGridLayout::addWidget(), QLayout::addWidget(), QStackedLayout::insertWidget(), QBoxLayout::insertWidget(), QGridBox::QGridBox(), QFormLayoutPrivate::setWidget(), and QLayout::widgetEvent().

191 {
193  if (QWidgetItem *wi = (*widgetItemFactoryMethod)(layout, widget))
194  return wi;
195  return new QWidgetItemV2(widget);
196 }
static QWidgetItemFactoryMethod widgetItemFactoryMethod
Definition: qlayout_p.h:82
The QWidgetItem class is a layout item that represents a widget.
Definition: qlayoutitem.h:122

◆ doResize()

void QLayoutPrivate::doResize ( const QSize r)

Definition at line 702 of file qlayout.cpp.

703 {
704  Q_Q(QLayout);
705  int mbh = menuBarHeightForWidth(menubar, r.width());
706  QWidget *mw = q->parentWidget();
707  QRect rect = mw->testAttribute(Qt::WA_LayoutOnEntireRect) ? mw->rect() : mw->contentsRect();
708  rect.setTop(rect.top() + mbh);
709  q->setGeometry(rect);
710 #ifndef QT_NO_MENUBAR
711  if (menubar)
712  menubar->setGeometry(0,0,r.width(), mbh);
713 #endif
714 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QWidget * menubar
Definition: qlayout_p.h:96
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static int menuBarHeightForWidth(QWidget *menubar, int w)
Definition: qlayout.cpp:58
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
#define Q_Q(Class)
Definition: qglobal.h:2483
int width() const
Returns the width.
Definition: qsize.h:126
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ getMargin()

void QLayoutPrivate::getMargin ( int *  result,
int  userMargin,
QStyle::PixelMetric  pm 
) const

Definition at line 168 of file qlayout.cpp.

169 {
170  if (!result)
171  return;
172 
173  Q_Q(const QLayout);
174  if (userMargin >= 0) {
175  *result = userMargin;
176  } else if (!topLevel) {
177  *result = 0;
178  } else if (QWidget *pw = q->parentWidget()) {
179  *result = pw->style()->pixelMetric(pm, 0, pw);
180  } else {
181  *result = 0;
182  }
183 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90

◆ reparentChildWidgets()

void QLayoutPrivate::reparentChildWidgets ( QWidget mw)

Definition at line 1005 of file qlayout.cpp.

1006 {
1007  Q_Q(QLayout);
1008  int n = q->count();
1009 
1010 #ifndef QT_NO_MENUBAR
1011  if (menubar && menubar->parentWidget() != mw) {
1012  menubar->setParent(mw);
1013  }
1014 #endif
1015  bool mwVisible = mw && mw->isVisible();
1016  for (int i = 0; i < n; ++i) {
1017  QLayoutItem *item = q->itemAt(i);
1018  if (QWidget *w = item->widget()) {
1019  QWidget *pw = w->parentWidget();
1020 #ifdef QT_DEBUG
1021  if (pw && pw != mw && layoutDebug()) {
1022  qWarning("QLayout::addChildLayout: widget %s \"%s\" in wrong parent; moved to correct parent",
1023  w->metaObject()->className(), w->objectName().toLocal8Bit().data());
1024  }
1025 #endif
1026  bool needShow = mwVisible && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
1027  if (pw != mw)
1028  w->setParent(mw);
1029  if (needShow)
1030  QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection); //show later
1031  } else if (QLayout *l = item->layout()) {
1032  l->d_func()->reparentChildWidgets(mw);
1033  }
1034  }
1035 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QWidget * menubar
Definition: qlayout_p.h:96
bool isVisible() const
Definition: qwidget.h:1005
static bool layoutDebug()
Definition: qlayout.cpp:995
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_Q(Class)
Definition: qglobal.h:2483
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
Q_CORE_EXPORT void qWarning(const char *,...)
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
QFactoryLoader * l
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.

Properties

◆ activated

uint QLayoutPrivate::activated

Definition at line 92 of file qlayout_p.h.

◆ autoNewChild

uint QLayoutPrivate::autoNewChild

Definition at line 93 of file qlayout_p.h.

◆ constraint

QLayout::SizeConstraint QLayoutPrivate::constraint

Definition at line 94 of file qlayout_p.h.

Referenced by QLayout::setSizeConstraint().

◆ enabled

uint QLayoutPrivate::enabled

Definition at line 91 of file qlayout_p.h.

◆ insideSpacing

int QLayoutPrivate::insideSpacing

Definition at line 85 of file qlayout_p.h.

◆ menubar

QWidget* QLayoutPrivate::menubar

Definition at line 96 of file qlayout_p.h.

Referenced by doResize(), and reparentChildWidgets().

◆ rect

QRect QLayoutPrivate::rect

Definition at line 95 of file qlayout_p.h.

Referenced by doResize().

◆ spacerItemFactoryMethod

QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0
static

Definition at line 83 of file qlayout_p.h.

Referenced by createSpacerItem(), and getMargin().

◆ topLevel

uint QLayoutPrivate::topLevel

Definition at line 90 of file qlayout_p.h.

Referenced by getMargin().

◆ userBottomMargin

int QLayoutPrivate::userBottomMargin

Definition at line 89 of file qlayout_p.h.

◆ userLeftMargin

int QLayoutPrivate::userLeftMargin

Definition at line 86 of file qlayout_p.h.

◆ userRightMargin

int QLayoutPrivate::userRightMargin

Definition at line 88 of file qlayout_p.h.

◆ userTopMargin

int QLayoutPrivate::userTopMargin

Definition at line 87 of file qlayout_p.h.

◆ widgetItemFactoryMethod

QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0
static

Definition at line 82 of file qlayout_p.h.

Referenced by createWidgetItem(), and getMargin().


The documentation for this class was generated from the following files: