![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Types | |
enum | IncludeFadingOutMode { IncludeFadingOut , ExcludeFadingOut } |
enum | State { Hidden , FadingIn , Visible , FadingOut } |
This class handles complex visibility situations for items. More... | |
Public Slots | |
void | hide () |
void | hideAndRemoveItem (QObject *item) |
Hide the item, and then remove it. | |
void | hideItem (QObject *item) |
void | setDirectlyVisible (bool visible) |
void | setItemDirectlyVisible (QObject *item, bool visible) |
void | setItemThatShallBeShown (QObject *item) |
Sets a single item to be shown. | |
void | setItemVisible (QObject *item, bool visible) |
void | setShallBeShown (bool shallBeShown) |
Adjusts the first condition - the items are shown if shallBeShown is true and isVisible is true. | |
void | setShallBeShownDirectly (bool shallBeShown) |
void | setVisible (bool visible) |
void | show () |
Adjusts the main condition. | |
void | showItem (QObject *item) |
Shows or hides a single item. | |
Public Member Functions | |
ItemVisibilityController (QObject *const parent=nullptr) | |
void | addItem (QObject *const object) |
Add and remove objects. | |
void | clear () |
Remove all animations. | |
bool | hasVisibleItems (IncludeFadingOutMode mode=IncludeFadingOut) const |
This returns the "result" of isVisible and shallBeShown: Something is indeed visible on the scene. | |
bool | isVisible () const |
QList< QObject * > | items () const |
Returns all items under control. | |
void | removeItem (QObject *const object) |
void | setAnimationDuration (int msecs) |
void | setEasingCurve (const QEasingCurve &easing) |
Allows to change the default parameters of all animations. | |
bool | shallBeShown () const |
State | state () const |
QList< QObject * > | visibleItems (IncludeFadingOutMode mode=IncludeFadingOut) const |
Returns all currently visible items. | |
Protected Slots | |
void | animationFinished () |
void | objectDestroyed (QObject *) |
Protected Member Functions | |
virtual QPropertyAnimation * | createAnimation (QObject *item) |
Creates the animation for showing and hiding the given item. | |
Properties | |
bool | shallBeShown |
bool | visible |
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:
void Digikam::ItemVisibilityController::addItem | ( | QObject *const | object | ) |
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.
|
protectedvirtual |
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.
bool Digikam::ItemVisibilityController::hasVisibleItems | ( | IncludeFadingOutMode | mode = IncludeFadingOut | ) | const |
Also returns false if no items are available.
|
slot |
When finished, hiddenAndRemoved() is emitted.
|
slot |
Calling setVisible() will effectively effect only this single item, as if calling setItemVisible(). Reset by calling with 0 or setShallBeShown().
|
slot |
All items are affected. If any items were shown or hidden separately, they will be resynchronized. "Directly" means no animation is employed.
|
slot |
The item's status is changed individually. The next call to the "global" method will take precedence again. "Directly" means no animation is employed.