Screenshot Feature attempt #1

This commit is contained in:
Mark Watkins 2011-09-07 18:08:27 +10:00
parent afbcee1a89
commit 4d130e8572
5 changed files with 34 additions and 2 deletions

View File

@ -1215,7 +1215,7 @@ gGraphView::gGraphView(QWidget *parent, gGraphView * shared) :
backlines=new GLBuffer(QColor(0,0,0,0),10000,GL_LINES); // big fat shared line list
quads=new GLBuffer(QColor(0,0,0,0),1024,GL_QUADS); // big fat shared line list
quads->forceAntiAlias(true);
setFocusPolicy(Qt::StrongFocus);
//setFocusPolicy(Qt::StrongFocus);
}
gGraphView::~gGraphView()
{

View File

@ -28,7 +28,7 @@ p,a,td,body { font-size: 14px }
<tr>
<td colspan=2>
<hr>
<p><b>Copyright:</b> &copy;2011 Mark Watkins (jedimark)</p>
<p><b>Copyright:</b> &copy;2011 <a href="http://jedimark64.blogspot.com">Mark Watkins</a> (jedimark)</p>
<p><b>License:</b> This software is released freely under the <a href="http://www.gnu.org/licenses/gpl.html">GNU Public License</a>.<br/>
<p><b>Do NOT rely on this softwares accuracy when making medical decisions. Talk to your doctor.</b></p>
</td></tr>

View File

@ -430,3 +430,22 @@ void MainWindow::replyFinished(QNetworkReply * reply)
}
reply->deleteLater();
}
#include <QPixmap>
#include <QDesktopWidget>
void MainWindow::on_action_Screenshot_triggered()
{
QTimer::singleShot(250,this,SLOT(DelayedScreenshot()));
}
void MainWindow::DelayedScreenshot()
{
QPixmap pixmap = QPixmap::grabWindow(this->winId());
QString a=pref.Get("{home}")+"/Screenshots";
QDir dir(a);
if (!dir.exists()){
dir.mkdir(a);
}
a+="/screenshot-"+QDateTime::currentDateTime().toString(Qt::ISODate)+".png";
pixmap.save(a);
}

View File

@ -86,6 +86,9 @@ private slots:
void on_actionCheck_for_Updates_triggered();
void replyFinished(QNetworkReply*);
void on_action_Screenshot_triggered();
void DelayedScreenshot();
private:
Ui::MainWindow *ui;
Daily * daily;

View File

@ -598,6 +598,8 @@
<addaction name="action_Link_Graphs"/>
<addaction name="separator"/>
<addaction name="action_Fullscreen"/>
<addaction name="action_Screenshot"/>
<addaction name="separator"/>
<addaction name="action_Reset_Graph_Layout"/>
</widget>
<widget class="QMenu" name="menu_Help">
@ -752,6 +754,14 @@
<string>Check for &amp;Updates</string>
</property>
</action>
<action name="action_Screenshot">
<property name="text">
<string>Take &amp;Screenshot</string>
</property>
<property name="shortcut">
<string>F12</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>