Skip to content

Commit fc790d1

Browse files
committed
Ignore 'hsize_policy' when orientation is horizontal.
1 parent e7aecc2 commit fc790d1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

qtapputils/widgets/statusbar.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def __init__(self, parent=None, iconsize=24, ndots=11,
5959
bottom contents margin. The default is 0 on all sides.
6060
hsize_policy : str, optional
6161
An attribute describing horizontal resizing policy. Valid
62-
values are 'minimum' or 'expanding'.
62+
values are 'minimum' or 'expanding'. This option is ignored
63+
when the orientation of the progress bar is horizontal.
6364
vsize_policy : str, optional
6465
An attribute describing vertical resizing policy. Valid
6566
values are 'minimum', 'expanding', or 'minimum_expanding'.
@@ -81,6 +82,8 @@ def __init__(self, parent=None, iconsize=24, ndots=11,
8182
}
8283

8384
class LabelBrowser(QTextBrowser):
85+
def text(self):
86+
return self.toPlainText()
8487

8588
def minimumSizeHint(self):
8689
return QLabel().minimumSizeHint()
@@ -141,10 +144,8 @@ def sizeHint(self):
141144
layout.setRowStretch(3, 100)
142145
elif vsize_policy == 'expanding':
143146
layout.setRowStretch(1, 100)
144-
if hsize_policy == 'minimum':
145-
layout.setColumnStretch(4, 100)
146-
elif hsize_policy == 'expanding':
147-
layout.setColumnStretch(3, 100)
147+
# We ignore 'hsize_policy' when orientation is horizontal.
148+
layout.setColumnStretch(3, 100)
148149
layout.setSpacing(spacing or 0)
149150
else:
150151
layout.addWidget(self._label, 2, 1)
@@ -241,18 +242,18 @@ def hide(self):
241242
widget = QWidget()
242243
layout = QGridLayout(widget)
243244

244-
pbar = ProcessStatusBar(hsize_policy='expanding')
245+
pbar = ProcessStatusBar()
245246
pbar.show('This is a demo...')
246247

247-
pbar2 = ProcessStatusBar(hsize_policy='expanding')
248+
pbar2 = ProcessStatusBar()
248249
pbar2.show()
249250
pbar2.show_sucess_icon('Success icon demo.')
250251

251-
pbar3 = ProcessStatusBar(hsize_policy='expanding')
252+
pbar3 = ProcessStatusBar()
252253
pbar3.show()
253254
pbar3.show_fail_icon('Fail icon demo.')
254255

255-
pbar4 = ProcessStatusBar(hsize_policy='expanding')
256+
pbar4 = ProcessStatusBar()
256257
pbar4.show()
257258
pbar4.show_update_icon('Update icon demo.')
258259

0 commit comments

Comments
 (0)