|
Krita Source Code Documentation
|
#include <kis_size_group.h>
Inheritance diagram for KisSizeGroup:Public Types | |
| enum | mode { KIS_SIZE_GROUP_NONE = 0 , KIS_SIZE_GROUP_HORIZONTAL = 1 << 0 , KIS_SIZE_GROUP_VERTICAL = 1 << 1 , KIS_SIZE_GROUP_BOTH = (KIS_SIZE_GROUP_HORIZONTAL | KIS_SIZE_GROUP_VERTICAL) } |
Public Member Functions | |
| void | addWidget (QWidget *widget) |
| KisSizeGroup::mode | getMode () const |
| Returns the current mode of the group size. | |
| bool | isIgnoreHidden () const |
| Returns whether the group ignores not visible widgets. | |
| KisSizeGroup (QObject *parent=0, KisSizeGroup::mode mode=KisSizeGroup::KIS_SIZE_GROUP_HORIZONTAL, bool ignoreHidden=false) | |
| void | removeWidget (QWidget *widget) |
| Removes a widget from the size group. | |
| void | setIgnoreHidden (bool ignoreHidden) |
| Sets whether the group will ignore not visible widgets. | |
| void | setMode (KisSizeGroup::mode mode) |
| Changes the group size mode. | |
| ~KisSizeGroup () override | |
Private Attributes | |
| KisSizeGroupPrivate *const | d |
KisSizeGroup provides a mechanism to group widgets together so they all request the same amount of space. Also, the widgets will share the same amount of minimum space. The mode of KisSizeGroup determines the direction of the space that are affected by the size group.
All widgets inside of KisSizeGroup will use the same size hint value, computed as the maximum of all of his size hint values. The same value is used for the minimum size of all widgets. When KisSizeGroup ignore hidden widgets, the size of widgets that are not visible don't count in the computation of the current size value. When one of these widgets becomes visible again, a new size value is computed and applied to all visible widgets.
KisSizeGroup cannot share the same widget with other size groups, so one widget can be in one, and only one, KisSizeGroup at time.
NOTE: Added widgets in size groups must be laid out inside of a valid layout. The current implementation supports widgets laid out inside of QGridLayout, QFormLayout and QBoxLayout. If the parent widget layout is not one of them, then the group size will not affect the widget size.
Definition at line 37 of file kis_size_group.h.
| enum KisSizeGroup::mode |
Determines the direction in which the size group affects the requested and minimum sizes of his component widgets.
| Enumerator | |
|---|---|
| KIS_SIZE_GROUP_NONE | |
| KIS_SIZE_GROUP_HORIZONTAL | group has no effect |
| KIS_SIZE_GROUP_VERTICAL | group affects horizontal size |
| KIS_SIZE_GROUP_BOTH | group affects vertical size |
Definition at line 46 of file kis_size_group.h.
|
explicit |
Creates a new size group.
By default, the mode of the size group is KIS_SIZE_GROUP_HORIZONTAL and the group will not ignore hidden widgets.
Definition at line 11 of file kis_size_group.cpp.
|
override |
| void KisSizeGroup::addWidget | ( | QWidget * | widget | ) |
Adds a new widget to the group. WARNING: adding the same widget to multiple size groups is not supported!
Definition at line 47 of file kis_size_group.cpp.
References KisSizeGroupPrivate::addWidget(), d, and KisSizeGroupPrivate::scheduleSizeUpdate().
| KisSizeGroup::mode KisSizeGroup::getMode | ( | ) | const |
Returns the current mode of the group size.
Definition at line 29 of file kis_size_group.cpp.
References d, and KisSizeGroupPrivate::m_mode.
| bool KisSizeGroup::isIgnoreHidden | ( | ) | const |
Returns whether the group ignores not visible widgets.
Definition at line 42 of file kis_size_group.cpp.
References d, and KisSizeGroupPrivate::m_ignoreHidden.
| void KisSizeGroup::removeWidget | ( | QWidget * | widget | ) |
Removes a widget from the size group.
Definition at line 53 of file kis_size_group.cpp.
References d, KisSizeGroupPrivate::removeWidget(), and KisSizeGroupPrivate::scheduleSizeUpdate().
| void KisSizeGroup::setIgnoreHidden | ( | bool | ignoreHidden | ) |
Sets whether the group will ignore not visible widgets.
Definition at line 34 of file kis_size_group.cpp.
References d, KisSizeGroupPrivate::m_ignoreHidden, and KisSizeGroupPrivate::scheduleSizeUpdate().
| void KisSizeGroup::setMode | ( | KisSizeGroup::mode | mode | ) |
Changes the group size mode.
Definition at line 21 of file kis_size_group.cpp.
References d, KisSizeGroupPrivate::m_mode, and KisSizeGroupPrivate::scheduleSizeUpdate().
|
private |
Definition at line 86 of file kis_size_group.h.