digiKam
Digikam::ItemVisibilityController Class Reference
+ Inheritance diagram for Digikam::ItemVisibilityController:

Public Types

enum  IncludeFadingOutMode { IncludeFadingOut , ExcludeFadingOut }
 
enum  State { Hidden , FadingIn , Visible , FadingOut }
 

Public Slots

void hide ()
 
void hideAndRemoveItem (QObject *item)
 
void hideItem (QObject *item)
 
void setDirectlyVisible (bool visible)
 
void setItemDirectlyVisible (QObject *item, bool visible)
 
void setItemThatShallBeShown (QObject *item)
 
void setItemVisible (QObject *item, bool visible)
 
void setShallBeShown (bool shallBeShown)
 
void setShallBeShownDirectly (bool shallBeShown)
 
void setVisible (bool visible)
 
void show ()
 
void showItem (QObject *item)
 

Signals

void hiddenAndRemoved (QObject *item)
 
void propertiesAssigned (bool visible)
 
void propertiesAssigned (QObject *item, bool visible)
 

Public Member Functions

void addItem (QObject *object)
 
void clear ()
 
bool hasVisibleItems (IncludeFadingOutMode mode=IncludeFadingOut) const
 
bool isVisible () const
 
QList< QObject * > items () const
 
 ItemVisibilityController (QObject *const parent=nullptr)
 
void removeItem (QObject *object)
 
void setAnimationDuration (int msecs)
 
void setEasingCurve (const QEasingCurve &easing)
 
bool shallBeShown () const
 
State state () const
 
QList< QObject * > visibleItems (IncludeFadingOutMode mode=IncludeFadingOut) const
 
 ~ItemVisibilityController () override
 

Protected Slots

void animationFinished ()
 
void objectDestroyed (QObject *)
 

Protected Member Functions

virtual QPropertyAnimation * createAnimation (QObject *item)
 

Properties

bool shallBeShown
 
bool visible
 

Member Enumeration Documentation

◆ IncludeFadingOutMode

Enumerator
IncludeFadingOut 

In addition to items visible or fading in, return those fading out.

ExcludeFadingOut 

Do not return those items currently fading out (soon to be hidden)

◆ State

This class handles complex visibility situations for items. There is a 3-tiered approach: 1) shallBeShown determines if the items shall at any time be shown. If it is false, items will never be shown. Default is true, so you can ignore this setting. 2) visible determines if the items shall be shown now. Only takes effect if shallBeShown is true. Default is false: Initially, controlled items are hidden. 3) Opacity and individual item visibility: When showing, items are first set to individually visible, then their opacity is increased from 0 to 1. When hiding, opacity is first decreased from 1 to 0, then they are set individually to hidden. Different types of items can be handled:

  • a group of items with an "opacity" and "visible" property
  • a single item with an "opacity" and "visible" property
  • a proxy object with these properties (see above)
Enumerator
Hidden 
FadingIn 
Visible 
FadingOut 

Constructor & Destructor Documentation

◆ ItemVisibilityController()

Digikam::ItemVisibilityController::ItemVisibilityController ( QObject *const  parent = nullptr)
explicit

◆ ~ItemVisibilityController()

Digikam::ItemVisibilityController::~ItemVisibilityController ( )
override

References clear().

Member Function Documentation

◆ addItem()

void Digikam::ItemVisibilityController::addItem ( QObject *  object)

Add and remove objects. The given objects shall provide an "opacity" and a "visible" property. You can, for convenience, use a ItemVisibilityControllerPropertyObject as a value container, if your items do not provide these properties directly. No ownership is taken, so the objects should live as long as this object is used.

References createAnimation().

Referenced by Digikam::AnimatedVisibility::AnimatedVisibility(), Digikam::AssignNameWidgetStates::AssignNameWidgetStates(), Digikam::FaceGroup::slotAddItemMoving(), and Digikam::FocusPointGroup::slotAddItemMoving().

◆ animationFinished

void Digikam::ItemVisibilityController::animationFinished ( )
protectedslot

References propertiesAssigned(), and Visible.

◆ clear()

void Digikam::ItemVisibilityController::clear ( )

◆ createAnimation()

QPropertyAnimation * Digikam::ItemVisibilityController::createAnimation ( QObject *  item)
protectedvirtual

Creates the animation for showing and hiding the given item. The item is given for information only, you do not need to use it. The default implementation creates and animation for "opacity" from 0.0 to 1.0, using default easing curve and duration, which can and will be changed by setEasingCurve and setAnimationDuration.

Referenced by addItem().

◆ hasVisibleItems()

bool Digikam::ItemVisibilityController::hasVisibleItems ( IncludeFadingOutMode  mode = IncludeFadingOut) const

This returns the "result" of isVisible and shallBeShown: Something is indeed visible on the scene. Also returns false if no items are available.

Referenced by Digikam::HidingStateChanger::changeValue(), Digikam::FaceGroup::hasVisibleItems(), and Digikam::FocusPointGroup::hasVisibleItems().

◆ hiddenAndRemoved

void Digikam::ItemVisibilityController::hiddenAndRemoved ( QObject *  item)
signal

Emitted when hideAndRemoveItem has finished

◆ hide

void Digikam::ItemVisibilityController::hide ( )
slot

◆ hideAndRemoveItem

void Digikam::ItemVisibilityController::hideAndRemoveItem ( QObject *  item)
slot

Hide the item, and then remove it. When finished, hiddenAndRemoved() is emitted.

Referenced by Digikam::FaceGroup::slotRejected().

◆ hideItem

void Digikam::ItemVisibilityController::hideItem ( QObject *  item)
slot

References setItemVisible().

◆ isVisible()

bool Digikam::ItemVisibilityController::isVisible ( ) const

◆ items()

QList< QObject * > Digikam::ItemVisibilityController::items ( ) const

Returns all items under control

Referenced by visibleItems().

◆ objectDestroyed

void Digikam::ItemVisibilityController::objectDestroyed ( QObject *  item)
protectedslot

References removeItem().

◆ propertiesAssigned [1/2]

void Digikam::ItemVisibilityController::propertiesAssigned ( bool  visible)
signal

Emitted when the (main) transition has finished

Referenced by animationFinished(), and Digikam::HidingStateChanger::HidingStateChanger().

◆ propertiesAssigned [2/2]

void Digikam::ItemVisibilityController::propertiesAssigned ( QObject *  item,
bool  visible 
)
signal

Emitted when a transition for a single item finished (see setItemVisible())

◆ removeItem()

void Digikam::ItemVisibilityController::removeItem ( QObject *  object)

Referenced by objectDestroyed().

◆ setAnimationDuration()

void Digikam::ItemVisibilityController::setAnimationDuration ( int  msecs)

◆ setDirectlyVisible

void Digikam::ItemVisibilityController::setDirectlyVisible ( bool  visible)
slot

References visible.

Referenced by setShallBeShownDirectly().

◆ setEasingCurve()

void Digikam::ItemVisibilityController::setEasingCurve ( const QEasingCurve &  easing)

Allows to change the default parameters of all animations.

◆ setItemDirectlyVisible

void Digikam::ItemVisibilityController::setItemDirectlyVisible ( QObject *  item,
bool  visible 
)
slot

◆ setItemThatShallBeShown

void Digikam::ItemVisibilityController::setItemThatShallBeShown ( QObject *  item)
slot

Sets a single item to be shown. Calling setVisible() will effectively effect only this single item, as if calling setItemVisible(). Reset by calling with 0 or setShallBeShown().

References setVisible().

Referenced by Digikam::FocusPointGroup::setVisibleItem(), Digikam::FaceGroup::setVisibleItem(), and Digikam::FocusPointGroup::slotAddItemMoving().

◆ setItemVisible

void Digikam::ItemVisibilityController::setItemVisible ( QObject *  item,
bool  visible 
)
slot

References visible.

Referenced by hideItem(), and showItem().

◆ setShallBeShown

void Digikam::ItemVisibilityController::setShallBeShown ( bool  shallBeShown)
slot

Adjusts the first condition - the items are shown if shallBeShown is true and isVisible is true

References setVisible(), and shallBeShown.

Referenced by Digikam::FaceGroup::FaceGroup(), Digikam::FocusPointGroup::FocusPointGroup(), Digikam::FaceGroup::setVisible(), and Digikam::FocusPointGroup::setVisible().

◆ setShallBeShownDirectly

void Digikam::ItemVisibilityController::setShallBeShownDirectly ( bool  shallBeShown)
slot

◆ setVisible

void Digikam::ItemVisibilityController::setVisible ( bool  visible)
slot

◆ shallBeShown()

bool Digikam::ItemVisibilityController::shallBeShown ( ) const

◆ show

void Digikam::ItemVisibilityController::show ( )
slot

Adjusts the main condition. All items are affected. If any items were shown or hidden separately, they will be resynchronized. "Directly" means no animation is employed.

References setVisible().

Referenced by Digikam::FaceGroup::itemStateChanged(), Digikam::FocusPointGroup::itemStateChanged(), Digikam::FaceGroup::load(), Digikam::FocusPointGroup::load(), and Digikam::HidingStateChanger::slotPropertiesAssigned().

◆ showItem

void Digikam::ItemVisibilityController::showItem ( QObject *  item)
slot

Shows or hides a single item. The item's status is changed individually. The next call to the "global" method will take precedence again. "Directly" means no animation is employed.

References setItemVisible().

Referenced by Digikam::FaceGroup::slotAddItemMoving(), and Digikam::FocusPointGroup::slotAddItemMoving().

◆ state()

ItemVisibilityController::State Digikam::ItemVisibilityController::state ( ) const

References Hidden.

◆ visibleItems()

QList< QObject * > Digikam::ItemVisibilityController::visibleItems ( IncludeFadingOutMode  mode = IncludeFadingOut) const

Returns all currently visible items.

References items().

Referenced by Digikam::FaceGroup::itemHoverMoveEvent().

Property Documentation

◆ shallBeShown

◆ visible

bool Digikam::ItemVisibilityController::visible
readwrite

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