Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
6935eb22
Commit
6935eb22
authored
Apr 19, 2009
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zoom using CTRL+Wheel
parent
9e5d5f7a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
0 deletions
+47
-0
src/gui/MainWindow.cpp
src/gui/MainWindow.cpp
+17
-0
src/gui/MainWindow.h
src/gui/MainWindow.h
+4
-0
src/gui/Timeline.cpp
src/gui/Timeline.cpp
+1
-0
src/gui/TracksView.cpp
src/gui/TracksView.cpp
+20
-0
src/gui/TracksView.h
src/gui/TracksView.h
+5
-0
No files found.
src/gui/MainWindow.cpp
View file @
6935eb22
...
...
@@ -42,10 +42,17 @@ MainWindow::MainWindow( QWidget *parent ) :
m_initializeDockWidgets
();
createStatusBar
();
// Translation
connect
(
this
,
SIGNAL
(
translateDockWidgetTitle
()
),
DockWidgetManager
::
instance
(),
SLOT
(
transLateWidgetTitle
()
)
);
// Zoom
connect
(
m_zoomSlider
,
SIGNAL
(
valueChanged
(
int
)
),
m_timeline
,
SLOT
(
changeZoom
(
int
)
)
);
connect
(
m_timeline
->
tracksView
(),
SIGNAL
(
zoomIn
()
),
this
,
SLOT
(
zoomIn
()
)
);
connect
(
m_timeline
->
tracksView
(),
SIGNAL
(
zoomOut
()
),
this
,
SLOT
(
zoomOut
()
)
);
}
MainWindow
::~
MainWindow
()
...
...
@@ -170,3 +177,13 @@ void MainWindow::on_actionOpen_Project_triggered()
QDir
::
currentPath
(),
tr
(
"VideoLAN Movie Creator file (*.vlmc)"
)
);
}
void
MainWindow
::
zoomIn
()
{
m_zoomSlider
->
setValue
(
m_zoomSlider
->
value
()
-
1
);
}
void
MainWindow
::
zoomOut
()
{
m_zoomSlider
->
setValue
(
m_zoomSlider
->
value
()
+
1
);
}
src/gui/MainWindow.h
View file @
6935eb22
...
...
@@ -41,6 +41,10 @@ public:
explicit
MainWindow
(
QWidget
*
parent
=
0
);
~
MainWindow
();
public
slots
:
void
zoomIn
();
void
zoomOut
();
protected:
virtual
void
changeEvent
(
QEvent
*
e
);
...
...
src/gui/Timeline.cpp
View file @
6935eb22
...
...
@@ -22,6 +22,7 @@
#include <QHBoxLayout>
#include <QScrollBar>
#include <QtDebug>
#include "Timeline.h"
#include "TracksView.h"
#include "TracksScene.h"
...
...
src/gui/TracksView.cpp
View file @
6935eb22
...
...
@@ -22,6 +22,7 @@
#include <QScrollBar>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QtDebug>
#include <cmath>
#include "TracksView.h"
...
...
@@ -134,6 +135,25 @@ void TracksView::mousePressEvent( QMouseEvent* event )
QGraphicsView
::
mousePressEvent
(
event
);
}
void
TracksView
::
wheelEvent
(
QWheelEvent
*
event
)
{
if
(
event
->
modifiers
()
==
Qt
::
ControlModifier
)
{
// CTRL + WHEEL = Zoom
if
(
event
->
delta
()
>
0
)
emit
zoomIn
();
else
emit
zoomOut
();
event
->
accept
();
}
else
{
//TODO should scroll the timeline
event
->
ignore
();
QGraphicsView
::
wheelEvent
(
event
);
}
}
void
TracksView
::
setCursorPos
(
int
pos
)
{
m_cursorPos
=
pos
;
...
...
src/gui/TracksView.h
View file @
6935eb22
...
...
@@ -26,6 +26,7 @@
#include <QWidget>
#include <QGraphicsView>
#include <QGraphicsLineItem>
#include <QWheelEvent>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
...
...
@@ -50,6 +51,7 @@ protected:
virtual
void
drawBackground
(
QPainter
*
painter
,
const
QRectF
&
rect
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
wheelEvent
(
QWheelEvent
*
event
);
virtual
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
virtual
void
dropEvent
(
QDropEvent
*
event
);
virtual
void
dragMoveEvent
(
QDragMoveEvent
*
event
);
...
...
@@ -63,6 +65,9 @@ private:
int
m_fps
;
QGraphicsLineItem
*
m_cursorLine
;
signals:
void
zoomIn
();
void
zoomOut
();
};
#endif // TRACKSVIEW_H
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