@@ -81,7 +81,8 @@ def __init__(
81
81
"`pip install superqt[iconify]` extra."
82
82
)
83
83
super ().__init__ ()
84
- self .addKey (* key , color = color , flip = flip , rotate = rotate , dir = dir )
84
+ if key :
85
+ self .addKey (* key , color = color , flip = flip , rotate = rotate , dir = dir )
85
86
86
87
def addKey (
87
88
self ,
@@ -93,7 +94,7 @@ def addKey(
93
94
size : QSize | None = None ,
94
95
mode : QIcon .Mode = QIcon .Mode .Normal ,
95
96
state : QIcon .State = QIcon .State .Off ,
96
- ) -> None :
97
+ ) -> QIconifyIcon :
97
98
"""Add an icon to this QIcon.
98
99
99
100
This is a variant of `QIcon.addFile` that uses an iconify icon keys and
@@ -123,6 +124,11 @@ def addKey(
123
124
Mode specified for the icon, passed to `QIcon.addFile`.
124
125
state : QIcon.State, optional
125
126
State specified for the icon, passed to `QIcon.addFile`.
127
+
128
+ Returns
129
+ -------
130
+ QIconifyIcon
131
+ This QIconifyIcon instance, for chaining.
126
132
"""
127
133
try :
128
134
path = svg_path (* key , color = color , flip = flip , rotate = rotate , dir = dir )
@@ -135,6 +141,8 @@ def addKey(
135
141
else :
136
142
self .addFile (str (path ), size or QSize (), mode , state )
137
143
144
+ return self
145
+
138
146
def _draw_text_fallback (self , key : tuple [str , ...]) -> None :
139
147
if style := QApplication .style ():
140
148
pixmap = style .standardPixmap (style .StandardPixmap .SP_MessageBoxQuestion )
0 commit comments