OpendTect  7.0
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
i_LayoutMngr Class Reference

dGB's layout manager More...

Inheritance diagram for i_LayoutMngr:
[legend]

Public Member Functions

 i_LayoutMngr (QWidget *prnt, const char *name, uiObjectBody &mngbdy)
 
virtual ~i_LayoutMngr ()
 
void addItem (i_LayoutItem *)
 
void addItem (QLayoutItem *) override
 
bool attach (constraintType, QWidget &, QWidget *, int, bool reciprocal=true)
 
int borderSpace () const
 
void childrenClear (uiObject *)
 
int childStretch (bool hor) const
 
int count () const override
 
uiRectcurpos (LayoutMode)
 
const uiRectcurpos (LayoutMode) const
 
void forceChildrenRedraw (uiObjectBody *, bool deep)
 
int horSpacing () const
 
virtual void initChildLayout (LayoutMode)
 
void invalidate () override
 
bool isChild (uiObject *)
 
QLayoutItem * itemAt (int idx) const override
 
void layoutChildren (LayoutMode, bool finalLoop=false)
 
QSize minimumSize () const override
 
void setBorderSpace (int s)
 
void setHSpacing (int s)
 
void setIsMain (bool yn)
 
void setVSpacing (int s)
 
QSize sizeHint () const override
 
QLayoutItem * takeAt (int idx) override
 
virtual void updatedAlignment (LayoutMode)
 
int verSpacing () const
 
uiRect winpos (LayoutMode) const
 
- Public Member Functions inherited from NamedCallBacker
 NamedCallBacker (const char *nm=0)
 
 NamedCallBacker (const NamedCallBacker &)
 
virtual Notifier< NamedCallBacker > & objectToBeDeleted () const
 
bool operator== (const NamedCallBacker &oth) const
 
bool operator== (const NamedObject &oth) const
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (const NotifierAccess &, const CallBack &, bool onlyifnew=false) const
 
bool attachCB (const NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) const
 
void detachAllNotifiers () const
 Call from the destructor of your inherited object. More...
 
void detachCB (const NotifierAccess &, const CallBack &) const
 
void detachCB (const NotifierAccess *notif, const CallBack &cb) const
 
virtual bool isCapsule () const
 
bool isNotifierAttached (const NotifierAccess *) const
 Only for debugging purposes, don't use. More...
 
void stopReceivingNotifications () const
 
virtual CallBackertrueCaller ()
 
- Public Member Functions inherited from NamedObject
 NamedObject (const char *nm=nullptr)
 
 NamedObject (const NamedObject &oth)
 
virtual ~NamedObject ()
 
virtual BufferString getName () const
 
bool getNameFromPar (const IOPar &)
 
const name_typename () const override
 
NamedObjectoperator= (const NamedObject &)
 
bool operator== (const NamedObject &oth) const
 
virtual void setName (const char *nm)
 
- Public Member Functions inherited from ObjectWithName
virtual ~ObjectWithName ()
 
bool hasName (const char *nm) const
 
bool hasName (const name_type &nm) const
 
void putNameInPar (IOPar &) const
 

Private Member Functions

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

Private Attributes

int borderspc_ = 0
 
ObjectSet< i_LayoutItemchildrenlist_
 
int hspacing_ = -1
 
bool ismain_ = false
 
uiRect layoutpos_ [nLayoutMode]
 
uiObjectBodymanagedbody_
 
bool minimumdone_ = false
 
bool poppedup_ = false
 
Timerpoptimer_
 
bool preferreddone_ = false
 
QRect prefgeometry_
 
bool prefposstored_ = false
 
bool timerrunning_ = false
 
int vspacing_ = 2
 

Friends

class i_LayoutItem
 
class uiGroupParentBody
 

Additional Inherited Members

- Public Types inherited from ObjectWithName
typedef OD::String name_type
 
- Static Public Member Functions inherited from CallBacker
static void createReceiverForCurrentThread ()
 
static void removeReceiverForCurrentThread ()
 
- Protected Member Functions inherited from NamedCallBacker
void sendDelNotif () const
 
- Protected Attributes inherited from NamedCallBacker
Threads::Atomic< bool > delalreadytriggered_
 
Notifier< NamedCallBackerdelnotif_
 
- Protected Attributes inherited from NamedObject
BufferString name_
 

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::i_LayoutMngr ( QWidget *  prnt,
const char *  name,
uiObjectBody mngbdy 
)

◆ ~i_LayoutMngr()

virtual i_LayoutMngr::~i_LayoutMngr ( )
virtual

Member Function Documentation

◆ addItem() [1/2]

void i_LayoutMngr::addItem ( i_LayoutItem )

◆ addItem() [2/2]

void i_LayoutMngr::addItem ( QLayoutItem *  )
override

◆ attach()

bool i_LayoutMngr::attach ( constraintType  ,
QWidget &  ,
QWidget *  ,
int  ,
bool  reciprocal = true 
)

◆ borderSpace()

int i_LayoutMngr::borderSpace ( ) const
inline

◆ childrenClear()

void i_LayoutMngr::childrenClear ( uiObject )

◆ childrenCommitGeometrySet()

void i_LayoutMngr::childrenCommitGeometrySet ( bool  )
private

◆ childrenRect()

uiRect i_LayoutMngr::childrenRect ( LayoutMode  )
private

◆ childStretch()

int i_LayoutMngr::childStretch ( bool  hor) const

◆ count()

int i_LayoutMngr::count ( ) const
override

◆ curpos() [1/2]

uiRect& i_LayoutMngr::curpos ( LayoutMode  )

◆ curpos() [2/2]

const uiRect& i_LayoutMngr::curpos ( LayoutMode  ) const

◆ doLayout() [1/2]

void i_LayoutMngr::doLayout ( LayoutMode  m,
const QRect &  r 
) const
inlineprivate

◆ doLayout() [2/2]

void i_LayoutMngr::doLayout ( LayoutMode  ,
const QRect &   
)
private

◆ fillResizeList()

void i_LayoutMngr::fillResizeList ( ObjectSet< ResizeItem > &  ,
bool   
)
private

◆ forceChildrenRedraw()

void i_LayoutMngr::forceChildrenRedraw ( uiObjectBody ,
bool  deep 
)

◆ horSpacing()

int i_LayoutMngr::horSpacing ( ) const

◆ initChildLayout()

virtual void i_LayoutMngr::initChildLayout ( LayoutMode  )
virtual

◆ invalidate()

void i_LayoutMngr::invalidate ( )
override

◆ isChild()

bool i_LayoutMngr::isChild ( uiObject )

◆ isMainWinFinalized()

bool i_LayoutMngr::isMainWinFinalized ( ) const
private

◆ itemAt()

QLayoutItem* i_LayoutMngr::itemAt ( int  idx) const
override

◆ itemDel()

void i_LayoutMngr::itemDel ( CallBacker )
private

◆ layoutChildren()

void i_LayoutMngr::layoutChildren ( LayoutMode  ,
bool  finalLoop = false 
)

◆ minimumSize()

QSize i_LayoutMngr::minimumSize ( ) const
override

◆ moveChildrenTo()

void i_LayoutMngr::moveChildrenTo ( int  ,
int  ,
LayoutMode   
)
private

◆ popTimTick()

void i_LayoutMngr::popTimTick ( CallBacker )
private

◆ resizeTo()

void i_LayoutMngr::resizeTo ( const QRect &  )
private

◆ setBorderSpace()

void i_LayoutMngr::setBorderSpace ( int  s)
inline

◆ setGeometry()

void i_LayoutMngr::setGeometry ( const QRect &  )
overrideprivate

◆ setHSpacing()

void i_LayoutMngr::setHSpacing ( int  s)
inline

◆ setIsMain()

void i_LayoutMngr::setIsMain ( bool  yn)
inline

◆ setVSpacing()

void i_LayoutMngr::setVSpacing ( int  s)
inline

◆ sizeHint()

QSize i_LayoutMngr::sizeHint ( ) const
override

◆ startPoptimer()

void i_LayoutMngr::startPoptimer ( )
private

◆ takeAt()

QLayoutItem* i_LayoutMngr::takeAt ( int  idx)
override

◆ tryToGrowItem()

bool i_LayoutMngr::tryToGrowItem ( ResizeItem &  ,
int  ,
int  ,
int  ,
int  ,
const QRect &  ,
int   
)
private

◆ updatedAlignment()

virtual void i_LayoutMngr::updatedAlignment ( LayoutMode  )
virtual

◆ verSpacing()

int i_LayoutMngr::verSpacing ( ) const
inline

◆ winpos()

uiRect i_LayoutMngr::winpos ( LayoutMode  ) const

Friends And Related Function Documentation

◆ i_LayoutItem

i_LayoutItem
friend

◆ uiGroupParentBody

friend class uiGroupParentBody
friend

Member Data Documentation

◆ borderspc_

int i_LayoutMngr::borderspc_ = 0
private

◆ childrenlist_

ObjectSet<i_LayoutItem> i_LayoutMngr::childrenlist_
private

◆ hspacing_

int i_LayoutMngr::hspacing_ = -1
private

◆ ismain_

bool i_LayoutMngr::ismain_ = false
private

◆ layoutpos_

uiRect i_LayoutMngr::layoutpos_[nLayoutMode]
private

◆ managedbody_

uiObjectBody& i_LayoutMngr::managedbody_
private

◆ minimumdone_

bool i_LayoutMngr::minimumdone_ = false
private

◆ poppedup_

bool i_LayoutMngr::poppedup_ = false
private

◆ poptimer_

Timer& i_LayoutMngr::poptimer_
private

◆ preferreddone_

bool i_LayoutMngr::preferreddone_ = false
private

◆ prefgeometry_

QRect i_LayoutMngr::prefgeometry_
private

◆ prefposstored_

bool i_LayoutMngr::prefposstored_ = false
private

◆ timerrunning_

bool i_LayoutMngr::timerrunning_ = false
private

◆ vspacing_

int i_LayoutMngr::vspacing_ = 2
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024