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
037acf63
Commit
037acf63
authored
Mar 04, 2011
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: EPGItem: visual feedback on hover
parent
26582140
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
modules/gui/qt4/components/epg/EPGItem.cpp
modules/gui/qt4/components/epg/EPGItem.cpp
+22
-3
modules/gui/qt4/components/epg/EPGItem.hpp
modules/gui/qt4/components/epg/EPGItem.hpp
+1
-0
No files found.
modules/gui/qt4/components/epg/EPGItem.cpp
View file @
037acf63
...
...
@@ -28,6 +28,9 @@
#include <QDateTime>
#include <QFocusEvent>
#include <QGraphicsScene>
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneHoverEvent>
#include <QStyle>
#include "EPGItem.hpp"
#include "EPGView.hpp"
...
...
@@ -40,6 +43,7 @@ EPGItem::EPGItem( EPGView *view )
m_boundingRect
.
setHeight
(
TRACKS_HEIGHT
);
setFlags
(
QGraphicsItem
::
ItemIsSelectable
|
QGraphicsItem
::
ItemIsFocusable
);
setAcceptHoverEvents
(
true
);
}
QRectF
EPGItem
::
boundingRect
()
const
...
...
@@ -47,8 +51,9 @@ QRectF EPGItem::boundingRect() const
return
m_boundingRect
;
}
void
EPGItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
,
QWidget
*
)
void
EPGItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
)
{
QPen
pen
;
// Draw in view's coordinates
painter
->
setWorldMatrixEnabled
(
false
);
...
...
@@ -62,14 +67,21 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
if
(
m_current
)
{
painter
->
setBrush
(
QBrush
(
QColor
(
244
,
102
,
146
)
)
);
p
ainter
->
setPen
(
QPen
(
QColor
(
244
,
102
,
146
)
)
);
p
en
.
setColor
(
QColor
(
244
,
102
,
146
)
);
}
else
{
painter
->
setBrush
(
QBrush
(
QColor
(
201
,
217
,
242
)
)
);
p
ainter
->
setPen
(
QPen
(
QColor
(
201
,
217
,
242
)
)
);
p
en
.
setColor
(
QColor
(
201
,
217
,
242
)
);
}
pen
.
setColor
(
option
->
state
&
QStyle
::
State_MouseOver
||
hasFocus
()
?
QColor
(
0
,
0
,
0
)
:
QColor
(
192
,
192
,
192
)
);
pen
.
setStyle
(
option
->
state
&
QStyle
::
State_MouseOver
&&
!
hasFocus
()
?
Qt
::
DashLine
:
Qt
::
SolidLine
);
painter
->
setPen
(
pen
);
mapped
.
adjust
(
1
,
2
,
-
1
,
-
2
);
painter
->
drawRoundedRect
(
mapped
,
10
,
10
);
...
...
@@ -162,6 +174,12 @@ void EPGItem::updatePos()
setPos
(
x
,
m_channelNb
*
TRACKS_HEIGHT
);
}
void
EPGItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
event
->
accept
();
update
();
}
void
EPGItem
::
focusInEvent
(
QFocusEvent
*
event
)
{
EPGEvent
*
evEPG
=
new
EPGEvent
(
m_name
);
...
...
@@ -170,4 +188,5 @@ void EPGItem::focusInEvent( QFocusEvent * event )
evEPG
->
start
=
m_start
;
evEPG
->
duration
=
m_duration
;
m_view
->
eventFocused
(
evEPG
);
update
();
}
modules/gui/qt4/components/epg/EPGItem.hpp
View file @
037acf63
...
...
@@ -57,6 +57,7 @@ public:
protected:
virtual
void
focusInEvent
(
QFocusEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
);
private:
EPGView
*
m_view
;
...
...
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