Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6bd01d08
Commit
6bd01d08
authored
Mar 13, 2012
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: TimeLabel: compute minimal size to avoid 'dancing' with surrounding widgets
parent
d3a13c63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+25
-0
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
6bd01d08
...
...
@@ -595,6 +595,7 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
if
(
pos
==
-
1.
f
)
{
setMinimumSize
(
QSize
(
0
,
0
)
);
if
(
displayType
==
TimeLabel
::
Both
)
setText
(
"--:--/--:--"
);
else
...
...
@@ -607,16 +608,40 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
secstotimestr
(
psz_length
,
length
);
secstotimestr
(
psz_time
,
(
b_remainingTime
&&
length
)
?
length
-
time
:
time
);
// compute the minimum size that will be required for the psz_length
// and use it to enforce a minimal size to avoid "dancing" widgets
QSize
minsize
;
if
(
length
>
0
)
{
QMargins
margins
=
contentsMargins
();
minsize
+=
QSize
(
fontMetrics
().
size
(
0
,
QString
(
psz_length
),
0
,
0
).
width
(),
sizeHint
().
height
()
);
minsize
+=
QSize
(
margins
.
left
()
+
margins
.
right
()
+
8
,
0
);
/* +padding */
if
(
b_remainingTime
)
minsize
+=
QSize
(
fontMetrics
().
size
(
0
,
"-"
,
0
,
0
).
width
(),
0
);
}
switch
(
displayType
)
{
case
TimeLabel
:
:
Elapsed
:
setMinimumSize
(
minsize
);
setText
(
QString
(
psz_time
)
);
break
;
case
TimeLabel
:
:
Remaining
:
if
(
b_remainingTime
)
{
setMinimumSize
(
minsize
);
setText
(
QString
(
"-"
)
+
QString
(
psz_time
)
);
}
else
{
setMinimumSize
(
QSize
(
0
,
0
)
);
setText
(
QString
(
psz_length
)
);
}
break
;
case
TimeLabel
:
:
Both
:
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment