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
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
Show 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 @@
...
@@ -28,6 +28,9 @@
#include <QDateTime>
#include <QDateTime>
#include <QFocusEvent>
#include <QFocusEvent>
#include <QGraphicsScene>
#include <QGraphicsScene>
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneHoverEvent>
#include <QStyle>
#include "EPGItem.hpp"
#include "EPGItem.hpp"
#include "EPGView.hpp"
#include "EPGView.hpp"
...
@@ -40,6 +43,7 @@ EPGItem::EPGItem( EPGView *view )
...
@@ -40,6 +43,7 @@ EPGItem::EPGItem( EPGView *view )
m_boundingRect
.
setHeight
(
TRACKS_HEIGHT
);
m_boundingRect
.
setHeight
(
TRACKS_HEIGHT
);
setFlags
(
QGraphicsItem
::
ItemIsSelectable
|
QGraphicsItem
::
ItemIsFocusable
);
setFlags
(
QGraphicsItem
::
ItemIsSelectable
|
QGraphicsItem
::
ItemIsFocusable
);
setAcceptHoverEvents
(
true
);
}
}
QRectF
EPGItem
::
boundingRect
()
const
QRectF
EPGItem
::
boundingRect
()
const
...
@@ -47,8 +51,9 @@ QRectF EPGItem::boundingRect() const
...
@@ -47,8 +51,9 @@ QRectF EPGItem::boundingRect() const
return
m_boundingRect
;
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
// Draw in view's coordinates
painter
->
setWorldMatrixEnabled
(
false
);
painter
->
setWorldMatrixEnabled
(
false
);
...
@@ -62,14 +67,21 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
...
@@ -62,14 +67,21 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
if
(
m_current
)
if
(
m_current
)
{
{
painter
->
setBrush
(
QBrush
(
QColor
(
244
,
102
,
146
)
)
);
painter
->
setBrush
(
QBrush
(
QColor
(
244
,
102
,
146
)
)
);
p
ainter
->
setPen
(
QPen
(
QColor
(
244
,
102
,
146
)
)
);
p
en
.
setColor
(
QColor
(
244
,
102
,
146
)
);
}
}
else
else
{
{
painter
->
setBrush
(
QBrush
(
QColor
(
201
,
217
,
242
)
)
);
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
);
mapped
.
adjust
(
1
,
2
,
-
1
,
-
2
);
painter
->
drawRoundedRect
(
mapped
,
10
,
10
);
painter
->
drawRoundedRect
(
mapped
,
10
,
10
);
...
@@ -162,6 +174,12 @@ void EPGItem::updatePos()
...
@@ -162,6 +174,12 @@ void EPGItem::updatePos()
setPos
(
x
,
m_channelNb
*
TRACKS_HEIGHT
);
setPos
(
x
,
m_channelNb
*
TRACKS_HEIGHT
);
}
}
void
EPGItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
event
->
accept
();
update
();
}
void
EPGItem
::
focusInEvent
(
QFocusEvent
*
event
)
void
EPGItem
::
focusInEvent
(
QFocusEvent
*
event
)
{
{
EPGEvent
*
evEPG
=
new
EPGEvent
(
m_name
);
EPGEvent
*
evEPG
=
new
EPGEvent
(
m_name
);
...
@@ -170,4 +188,5 @@ void EPGItem::focusInEvent( QFocusEvent * event )
...
@@ -170,4 +188,5 @@ void EPGItem::focusInEvent( QFocusEvent * event )
evEPG
->
start
=
m_start
;
evEPG
->
start
=
m_start
;
evEPG
->
duration
=
m_duration
;
evEPG
->
duration
=
m_duration
;
m_view
->
eventFocused
(
evEPG
);
m_view
->
eventFocused
(
evEPG
);
update
();
}
}
modules/gui/qt4/components/epg/EPGItem.hpp
View file @
037acf63
...
@@ -57,6 +57,7 @@ public:
...
@@ -57,6 +57,7 @@ public:
protected:
protected:
virtual
void
focusInEvent
(
QFocusEvent
*
event
);
virtual
void
focusInEvent
(
QFocusEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
);
private:
private:
EPGView
*
m_view
;
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