Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
51e70a21
Commit
51e70a21
authored
Jul 07, 2011
by
Sebastian Eichelbaum
Browse files
[MERGE]
parents
d6020016
49e792d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
src/qt4gui/qt4/WQtGLWidget.cpp
src/qt4gui/qt4/WQtGLWidget.cpp
+23
-1
src/qt4gui/qt4/WQtGLWidget.h
src/qt4gui/qt4/WQtGLWidget.h
+5
-0
No files found.
src/qt4gui/qt4/WQtGLWidget.cpp
View file @
51e70a21
...
...
@@ -25,8 +25,10 @@
#include <string>
#include <iostream>
#include <QtGui/QKeyEvent>
#include <QtGui/QColorDialog>
#include <QtGui/QFileDialog>
#include <QtGui/QKeyEvent>
#include <QtGui/QPixmap>
#include "WQtGLWidget.h"
#include "WQtGLWidget.moc"
...
...
@@ -249,6 +251,10 @@ void WQtGLWidget::keyReleaseEvent( QKeyEvent* event )
case
Qt
::
Key_2
:
setCameraManipulator
(
TWO_D
);
break
;
// TODO( ebaum ): replace this
case
Qt
::
Key_F12
:
makeScreenshot
();
break
;
}
switch
(
event
->
modifiers
()
)
...
...
@@ -349,3 +355,19 @@ void WQtGLWidget::changeBGColor()
updateViewerBackground
();
}
void
WQtGLWidget
::
makeScreenshot
()
{
// TODO( ebaum ): replace this
// grab content first to avoid making a screenshot of the file dialog :)
QPixmap
q
=
QPixmap
::
grabWindow
(
this
->
winId
()
);
QString
path
=
QDir
::
currentPath
()
+
tr
(
"/screenshot.png"
);
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save As"
),
path
,
tr
(
"PNG Files (*.png);;All Files (*)"
)
);
if
(
!
fileName
.
isEmpty
()
)
{
q
.
save
(
fileName
,
tr
(
"png"
).
toAscii
()
);
WLogger
::
getLogger
()
->
addLogMessage
(
std
::
string
(
"Screenshot saved to "
)
+
fileName
.
toStdString
(),
"QtGLWidgetAll"
,
LL_INFO
);
}
}
src/qt4gui/qt4/WQtGLWidget.h
View file @
51e70a21
...
...
@@ -244,6 +244,11 @@ protected:
*/
WGECamera
::
ProjectionMode
m_initialProjectionMode
;
/**
* Saves a screenshot of the widget's current content, opens a file dialog to get the filename.
*/
void
makeScreenshot
();
private:
/**
* Timer for periodic repaints.
...
...
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