Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
702a970e
Commit
702a970e
authored
Feb 04, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: locationBar: buttons adjustment
now also the text is not elided if not necessary
parent
6e160dae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
19 deletions
+25
-19
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+22
-17
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+3
-2
No files found.
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
702a970e
...
...
@@ -483,8 +483,9 @@ void LocationBar::setIndex( const QModelIndex &index )
char
*
fb_name
=
input_item_GetTitleFbName
(
item
->
inputItem
()
);
QString
text
=
qfu
(
fb_name
);
free
(
fb_name
);
QToolButton
*
btn
=
new
LocationButton
(
text
,
bold
);
box
->
insertWidget
(
0
,
btn
);
QAbstractButton
*
btn
=
new
LocationButton
(
text
,
bold
,
i
.
isValid
()
);
if
(
bold
)
btn
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
box
->
insertWidget
(
0
,
btn
,
bold
?
1
:
0
);
buttons
.
append
(
btn
);
mapper
->
setMapping
(
btn
,
item
->
id
()
);
...
...
@@ -504,37 +505,41 @@ void LocationBar::invoke( int i_id )
emit
invoked
(
index
);
}
LocationButton
::
LocationButton
(
const
QString
&
text
,
bool
bold
)
LocationButton
::
LocationButton
(
const
QString
&
text
,
bool
bold
,
bool
arrow
)
:
b_arrow
(
arrow
)
{
QFont
font
;
font
.
setBold
(
bold
);
setFont
(
font
);
metrics
=
new
QFontMetrics
(
font
);
setText
(
metrics
->
elidedText
(
text
,
Qt
::
ElideRight
,
150
)
);
setText
(
text
);
}
void
LocationButton
::
paintEvent
(
QPaintEvent
*
event
)
{
QStyleOptionButton
option
;
option
.
initFrom
(
this
);
option
.
rect
=
rect
();
option
.
text
=
text
();
option
.
features
=
QStyleOptionButton
::
Flat
;
//option.rect = rect();
//option.features = QStyleOptionButton::Flat;
option
.
state
|=
QStyle
::
State_Enabled
;
option
.
state
|=
isChecked
()
?
QStyle
::
State_On
:
QStyle
::
State_Off
;
if
(
isDown
()
)
option
.
state
|=
QStyle
::
State_Sunken
;
//
option.state |= isChecked() ? QStyle::State_On : QStyle::State_Off;
//
if( isDown() ) option.state |= QStyle::State_Sunken;
QPainter
p
(
this
);
style
()
->
drawControl
(
QStyle
::
CE_PushButtonBevel
,
&
option
,
&
p
);
option
.
rect
.
setLeft
(
18
);
if
(
underMouse
()
)
style
()
->
drawControl
(
QStyle
::
CE_PushButtonBevel
,
&
option
,
&
p
);
if
(
b_arrow
)
option
.
rect
.
setLeft
(
18
);
else
option
.
rect
.
setLeft
(
6
);
p
.
drawText
(
option
.
rect
,
Qt
::
AlignVCenter
,
metrics
->
elidedText
(
text
(),
Qt
::
ElideRight
,
option
.
rect
.
width
()
-
5
)
);
option
.
rect
=
QRect
(
0
,
0
,
18
,
height
()
);
style
()
->
drawPrimitive
(
QStyle
::
PE_IndicatorArrowRight
,
&
option
,
&
p
);
fontMetrics
().
elidedText
(
text
(),
Qt
::
ElideRight
,
option
.
rect
.
width
()
-
3
)
);
if
(
b_arrow
)
{
option
.
rect
=
QRect
(
0
,
0
,
18
,
height
()
);
style
()
->
drawPrimitive
(
QStyle
::
PE_IndicatorArrowRight
,
&
option
,
&
p
);
}
}
QSize
LocationButton
::
sizeHint
()
const
{
QSize
s
(
metrics
->
boundingRect
(
text
()
).
size
()
);
s
+=
QSize
(
25
,
10
);
QSize
s
(
fontMetrics
().
boundingRect
(
text
()
).
size
()
);
s
+=
QSize
(
b_arrow
?
24
:
12
,
15
);
return
s
;
}
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
702a970e
...
...
@@ -127,14 +127,15 @@ private:
QList
<
QWidget
*>
buttons
;
};
class
LocationButton
:
public
Q
Tool
Button
class
LocationButton
:
public
Q
Push
Button
{
public:
LocationButton
(
const
QString
&
,
bool
bold
);
LocationButton
(
const
QString
&
,
bool
bold
,
bool
arrow
);
private:
void
paintEvent
(
QPaintEvent
*
event
);
QSize
sizeHint
()
const
;
QFontMetrics
*
metrics
;
bool
b_arrow
;
};
#endif
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