Public Member Functions | Private Member Functions | Private Attributes | Friends

i_LayoutMngr Class Reference

dGB's layout manager More...

Inheritance diagram for i_LayoutMngr:
NamedObject CallBacker

List of all members.

Public Member Functions

 i_LayoutMngr (QWidget *prnt, const char *name, uiObjectBody &mngbdy)
virtual ~i_LayoutMngr ()
virtual void addItem (QLayoutItem *)
void addItem (i_LayoutItem *)
virtual QSize sizeHint () const
virtual QSize minimumSize () const
virtual QLayoutItem * itemAt (int idx) const
virtual QLayoutItem * takeAt (int idx)
virtual int count () const
virtual void invalidate ()
virtual void updatedAlignment (LayoutMode)
virtual void initChildLayout (LayoutMode)
bool attach (constraintType, QWidget &, QWidget *, int, bool reciprocal=true)
const uiRectcurpos (LayoutMode) const
uiRectcurpos (LayoutMode)
uiRect winpos (LayoutMode) const
void forceChildrenRedraw (uiObjectBody *, bool deep)
void childrenClear (uiObject *)
bool isChild (uiObject *)
int childStretch (bool hor) const
int borderSpace () const
int horSpacing () const
int verSpacing () const
void setHSpacing (int s)
void setVSpacing (int s)
void setBorderSpace (int s)
void setIsMain (bool yn)
void layoutChildren (LayoutMode, bool finalLoop=false)

Private Member Functions

void setGeometry (const QRect &)
void doLayout (LayoutMode m, const QRect &r) const
void doLayout (LayoutMode m, const QRect &)
void itemDel (CallBacker *)
void moveChildrenTo (int, int, LayoutMode)
void fillResizeList (ObjectSet< resizeItem > &, bool)
bool tryToGrowItem (resizeItem &, const int, const int, int, int, const QRect &, int)
void resizeTo (const QRect &)
void childrenCommitGeometrySet (bool)
uiRect childrenRect (LayoutMode)
void startPoptimer ()
void popTimTick (CallBacker *)

Private Attributes

ObjectSet< i_LayoutItemchildrenlist
uiRect layoutpos [nLayoutMode]
QRect prefGeometry
bool minimumDone
bool preferredDone
bool prefposStored
bool ismain
int hspacing
int vspacing
int borderspc
uiObjectBodymanagedBody
Timerpoptimer
bool popped_up
bool timer_running

Friends

class i_LayoutItem
class uiGroupParentBody

Detailed Description

dGB's layout manager

This is our own layout manager for Qt. It manages widgets, etc. using constraints like "rightOf" etc.

Because the i_LayoutMngr is a QLayout, it can be used by QWidgets to automatically add new children to the manager when they are constructed with a QWidget (with layout) as parent.

The actual adding to a manager is is done using QEvents. Whenever a QObject inserts a new child, it posts a ChildInserted event to itself. However, a QLayout constructor installs an event filter on its parent, and it registers itself to the parent as its layouter (setWidgetLayout), so future calls to the parent's sizeHint(), etc. are redirected to this new layoutmanager.

If setAutoAdd() is called on a layoutmanager, and the layout manager is "topLevel", i.e. THE manager for a certain widget, then whenever a new widget is constructed with the manager's parent widget as parent, the new widget is automatically added (by Qt) to the manager by the manager's eventfilter, using 'addItem( new QWidgetItem( w ) )'. Unfortunately, Qt does not call addItem before the main application loop is running. This results to the problem that no attachments can be used until the main loop is running when we let Qt handle the addItem() calls. Therefore, we explicitily call addItem() on the correct layout manager at construction uiObjects. AutoAdd is also enabled in case someone wants to eses native Qt methods. (Multiple insertion is protected. Manager checks if widget already present).


Constructor & Destructor Documentation

i_LayoutMngr::i_LayoutMngr ( QWidget *  prnt,
const char *  name,
uiObjectBody mngbdy 
)
virtual i_LayoutMngr::~i_LayoutMngr (  )  [virtual]

Member Function Documentation

virtual void i_LayoutMngr::addItem ( QLayoutItem *   )  [virtual]
void i_LayoutMngr::addItem ( i_LayoutItem  ) 
bool i_LayoutMngr::attach ( constraintType  ,
QWidget &  ,
QWidget *  ,
int  ,
bool  reciprocal = true 
)
int i_LayoutMngr::borderSpace (  )  const [inline]
void i_LayoutMngr::childrenClear ( uiObject  ) 
void i_LayoutMngr::childrenCommitGeometrySet ( bool   )  [private]
uiRect i_LayoutMngr::childrenRect ( LayoutMode   )  [private]
int i_LayoutMngr::childStretch ( bool  hor  )  const
virtual int i_LayoutMngr::count (  )  const [virtual]
const uiRect& i_LayoutMngr::curpos ( LayoutMode   )  const
uiRect& i_LayoutMngr::curpos ( LayoutMode   ) 
void i_LayoutMngr::doLayout ( LayoutMode  m,
const QRect &  r 
) const [inline, private]
void i_LayoutMngr::doLayout ( LayoutMode  m,
const QRect &   
) [private]
void i_LayoutMngr::fillResizeList ( ObjectSet< resizeItem > &  ,
bool   
) [private]
void i_LayoutMngr::forceChildrenRedraw ( uiObjectBody ,
bool  deep 
)
int i_LayoutMngr::horSpacing (  )  const
virtual void i_LayoutMngr::initChildLayout ( LayoutMode   )  [virtual]
virtual void i_LayoutMngr::invalidate (  )  [virtual]
bool i_LayoutMngr::isChild ( uiObject  ) 
virtual QLayoutItem* i_LayoutMngr::itemAt ( int  idx  )  const [virtual]
void i_LayoutMngr::itemDel ( CallBacker  )  [private]
void i_LayoutMngr::layoutChildren ( LayoutMode  ,
bool  finalLoop = false 
)
virtual QSize i_LayoutMngr::minimumSize (  )  const [virtual]
void i_LayoutMngr::moveChildrenTo ( int  ,
int  ,
LayoutMode   
) [private]
void i_LayoutMngr::popTimTick ( CallBacker  )  [private]
void i_LayoutMngr::resizeTo ( const QRect &   )  [private]
void i_LayoutMngr::setBorderSpace ( int  s  )  [inline]
void i_LayoutMngr::setGeometry ( const QRect &   )  [private]
void i_LayoutMngr::setHSpacing ( int  s  )  [inline]
void i_LayoutMngr::setIsMain ( bool  yn  )  [inline]
void i_LayoutMngr::setVSpacing ( int  s  )  [inline]
virtual QSize i_LayoutMngr::sizeHint (  )  const [virtual]
void i_LayoutMngr::startPoptimer (  )  [private]
virtual QLayoutItem* i_LayoutMngr::takeAt ( int  idx  )  [virtual]
bool i_LayoutMngr::tryToGrowItem ( resizeItem &  ,
const   int,
const   int,
int  ,
int  ,
const QRect &  ,
int   
) [private]
virtual void i_LayoutMngr::updatedAlignment ( LayoutMode   )  [virtual]
int i_LayoutMngr::verSpacing (  )  const [inline]
uiRect i_LayoutMngr::winpos ( LayoutMode   )  const

Friends And Related Function Documentation

friend class i_LayoutItem [friend]
friend class uiGroupParentBody [friend]

Member Data Documentation

int i_LayoutMngr::borderspc [private]
int i_LayoutMngr::hspacing [private]
bool i_LayoutMngr::ismain [private]
uiRect i_LayoutMngr::layoutpos[nLayoutMode] [private]
bool i_LayoutMngr::minimumDone [private]
bool i_LayoutMngr::popped_up [private]
QRect i_LayoutMngr::prefGeometry [private]
int i_LayoutMngr::vspacing [private]