Krita Source Code Documentation
Loading...
Searching...
No Matches
workflow_buttons.flow_layout.FlowLayout Class Reference
+ Inheritance diagram for workflow_buttons.flow_layout.FlowLayout:

Public Member Functions

 __del__ (self)
 
 __init__ (self, parent=None)
 
 addItem (self, item)
 
 count (self)
 
 expandingDirections (self)
 
 hasHeightForWidth (self)
 
 heightForWidth (self, width)
 
 itemAt (self, index)
 
 minimumSize (self)
 
 setGeometry (self, rect)
 
 sizeHint (self)
 
 takeAt (self, index)
 

Protected Member Functions

 _do_layout (self, rect, test_only)
 

Protected Attributes

 _item_list
 

Detailed Description

Definition at line 14 of file flow_layout.py.

Constructor & Destructor Documentation

◆ __init__()

workflow_buttons.flow_layout.FlowLayout.__init__ ( self,
parent = None )

Definition at line 15 of file flow_layout.py.

15 def __init__(self, parent=None):
16 super().__init__(parent)
17
18 if parent is not None:
19 self.setContentsMargins(QMargins(0, 0, 0, 0))
20
21 self._item_list = []
22

References workflow_buttons.flow_layout.FlowLayout.__init__(), KisPipeBrushParasite.dim, KisSpinBoxUnitManager.dim, FlattenSpec.dim, and xcfLayer.dim.

◆ __del__()

workflow_buttons.flow_layout.FlowLayout.__del__ ( self)

Definition at line 23 of file flow_layout.py.

23 def __del__(self):
24 item = self.takeAt(0)
25 while item:
26 item = self.takeAt(0)
27

References SectionLayout.takeAt(), KoToolBoxLayout.takeAt(), KisWrappableHBoxLayout.takeAt(), and workflow_buttons.flow_layout.FlowLayout.takeAt().

Member Function Documentation

◆ _do_layout()

workflow_buttons.flow_layout.FlowLayout._do_layout ( self,
rect,
test_only )
protected

Definition at line 72 of file flow_layout.py.

72 def _do_layout(self, rect, test_only):
73 x = rect.x()
74 y = rect.y()
75 line_height = 0
76 spacing = self.spacing()
77
78 for item in self._item_list:
79 style = item.widget().style()
80 layout_spacing_x = style.layoutSpacing(
81 QSizePolicy.ControlType.PushButton, QSizePolicy.ControlType.PushButton, Qt.Orientation.Horizontal
82 )
83 layout_spacing_y = style.layoutSpacing(
84 QSizePolicy.ControlType.PushButton, QSizePolicy.ControlType.PushButton, Qt.Orientation.Vertical
85 )
86 space_x = spacing + layout_spacing_x
87 space_y = spacing + layout_spacing_y
88 next_x = x + item.sizeHint().width() + space_x
89 if next_x - space_x > rect.right() and line_height > 0:
90 x = rect.x()
91 y = y + line_height + space_y
92 next_x = x + item.sizeHint().width() + space_x
93 line_height = 0
94
95 if not test_only:
96 item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
97
98 x = next_x
99 line_height = max(line_height, item.sizeHint().height())
100
101 return y + line_height - rect.y()

References workflow_buttons.flow_layout.FlowLayout._item_list, KisBrush::Private.spacing, KisBrush.spacing(), GimpBrushHeader.spacing, KisBrushModel::CommonData.spacing, KoSvgText::TextOnPathInfo.spacing, KoSvgText::FontFeatureNumeric.spacing, KisDistanceInformation.spacing, GridConfig.spacing(), KisGridConfig.spacing(), KisSpacingSelectionWidget.spacing(), KisWidgetConnectionUtils::SpacingState.spacing, KisColorSelectorComboBoxPrivate.spacing, KisShadeSelectorLineComboBoxPopup.spacing, KisBrushExportOptions.spacing, KisBrushBasedPaintOpSettings.spacing(), KisRoundMarkerOpOptionData.spacing, KisSprayOpOptionData.spacing, and KisLiquifyProperties.spacing().

◆ addItem()

workflow_buttons.flow_layout.FlowLayout.addItem ( self,
item )

Definition at line 28 of file flow_layout.py.

28 def addItem(self, item):
29 self._item_list.append(item)
30

References workflow_buttons.flow_layout.FlowLayout._item_list.

◆ count()

workflow_buttons.flow_layout.FlowLayout.count ( self)

Definition at line 31 of file flow_layout.py.

31 def count(self):
32 return len(self._item_list)
33

References workflow_buttons.flow_layout.FlowLayout._item_list.

◆ expandingDirections()

workflow_buttons.flow_layout.FlowLayout.expandingDirections ( self)

Definition at line 46 of file flow_layout.py.

46 def expandingDirections(self):
47 return Qt.Orientation(0)
48

◆ hasHeightForWidth()

workflow_buttons.flow_layout.FlowLayout.hasHeightForWidth ( self)

Definition at line 49 of file flow_layout.py.

49 def hasHeightForWidth(self):
50 return True
51

◆ heightForWidth()

workflow_buttons.flow_layout.FlowLayout.heightForWidth ( self,
width )

Definition at line 52 of file flow_layout.py.

52 def heightForWidth(self, width):
53 height = self._do_layout(QRect(0, 0, width, 0), True)
54 return height
55

References workflow_buttons.flow_layout.FlowLayout._do_layout().

◆ itemAt()

workflow_buttons.flow_layout.FlowLayout.itemAt ( self,
index )

Definition at line 34 of file flow_layout.py.

34 def itemAt(self, index):
35 if 0 <= index < len(self._item_list):
36 return self._item_list[index]
37
38 return None
39

References workflow_buttons.flow_layout.FlowLayout._item_list.

◆ minimumSize()

workflow_buttons.flow_layout.FlowLayout.minimumSize ( self)

Definition at line 63 of file flow_layout.py.

63 def minimumSize(self):
64 size = QSize()
65
66 for item in self._item_list:
67 size = size.expandedTo(item.minimumSize())
68
69 size += QSize(2 * self.contentsMargins().top(), 2 * self.contentsMargins().top())
70 return size
71

References workflow_buttons.flow_layout.FlowLayout._item_list, KisPipeBrushParasite.dim, KisSpinBoxUnitManager.dim, FlattenSpec.dim, and xcfLayer.dim.

◆ setGeometry()

workflow_buttons.flow_layout.FlowLayout.setGeometry ( self,
rect )

Definition at line 56 of file flow_layout.py.

56 def setGeometry(self, rect):
57 super(FlowLayout, self).setGeometry(rect)
58 self._do_layout(rect, False)
59

References workflow_buttons.flow_layout.FlowLayout._do_layout(), and workflow_buttons.flow_layout.FlowLayout.setGeometry().

◆ sizeHint()

workflow_buttons.flow_layout.FlowLayout.sizeHint ( self)

◆ takeAt()

workflow_buttons.flow_layout.FlowLayout.takeAt ( self,
index )

Definition at line 40 of file flow_layout.py.

40 def takeAt(self, index):
41 if 0 <= index < len(self._item_list):
42 return self._item_list.pop(index)
43
44 return None
45

References workflow_buttons.flow_layout.FlowLayout._item_list.

Member Data Documentation

◆ _item_list

workflow_buttons.flow_layout.FlowLayout._item_list
protected

Definition at line 21 of file flow_layout.py.


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