mirror of https://github.com/EspoTek/Labrador.git
Exporting the current oscilloscope view as image
This commit is contained in:
parent
7164791e1b
commit
d9f05e3ec5
|
@ -1966,6 +1966,47 @@ void MainWindow::openFileDialog(QString *fileName){
|
|||
*(fileName) = temp;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExportImage_triggered()
|
||||
{
|
||||
qDebug() << "on_actionExportImage_triggered()";
|
||||
|
||||
QFileDialog dialog;
|
||||
|
||||
dialog.setDefaultSuffix("pdf");
|
||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
dialog.setDirectory(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
|
||||
dialog.setFileMode(QFileDialog::AnyFile);
|
||||
dialog.setNameFilter("PDF files (*.pdf);;JPEG files (*.jpg);;PNG files (*.png);;BMP files (*.bmp)");
|
||||
|
||||
int retVal = dialog.exec();
|
||||
|
||||
if(!retVal){
|
||||
return; //User did not select a file!
|
||||
}
|
||||
|
||||
QStringList tempList = dialog.selectedFiles();
|
||||
qDebug() << tempList.first();
|
||||
|
||||
// Avoiding an if () cascade
|
||||
switch (dialog.nameFilters().indexOf( dialog.selectedNameFilter() ) )
|
||||
{
|
||||
case 0:
|
||||
ui->scopeAxes->savePdf(tempList.first());
|
||||
break;
|
||||
case 1:
|
||||
ui->scopeAxes->saveJpg(tempList.first());
|
||||
break;
|
||||
case 2:
|
||||
ui->scopeAxes->savePng(tempList.first());
|
||||
break;
|
||||
case 3:
|
||||
ui->scopeAxes->saveBmp(tempList.first());
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Wrong file type for exporting image to";
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSnapshot_CH1_triggered()
|
||||
{
|
||||
qDebug() << "on_actionSnapshot_CH1_triggered()";
|
||||
|
|
|
@ -150,6 +150,8 @@ private slots:
|
|||
|
||||
void on_actionSingle_ep_async_triggered();
|
||||
|
||||
void on_actionExportImage_triggered();
|
||||
|
||||
void on_actionSnapshot_CH1_triggered();
|
||||
|
||||
void on_actionSnapshot_CH2_triggered();
|
||||
|
|
|
@ -1310,7 +1310,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="pause_LA">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
|
@ -1507,7 +1507,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1493</width>
|
||||
<height>20</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -1532,6 +1532,7 @@
|
|||
<addaction name="menuRecord"/>
|
||||
<addaction name="actionOpen_DAQ_File"/>
|
||||
<addaction name="menuTake_Snapshot"/>
|
||||
<addaction name="actionExportImage"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuOscilloscope_2">
|
||||
|
@ -1614,8 +1615,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>170</width>
|
||||
<height>115</height>
|
||||
<width>160</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
|
@ -2422,6 +2423,11 @@
|
|||
<string>single-&ep-async</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExportImage">
|
||||
<property name="text">
|
||||
<string>&Export Current View</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSnapshot_CH1">
|
||||
<property name="text">
|
||||
<string>&CH1</string>
|
||||
|
|
Loading…
Reference in New Issue