add screenshot function
This commit is contained in:
parent
77ffe7baf4
commit
930c49e9c7
@ -20,10 +20,11 @@ private:
|
||||
QByteArray m_fileInfo;
|
||||
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void openFile();
|
||||
void aboutFile();
|
||||
void aboutTool();
|
||||
void takeScreenShot();
|
||||
|
||||
public slots:
|
||||
void printMessage(QString message, int severity);
|
||||
|
@ -8,6 +8,7 @@
|
||||
</qresource>
|
||||
<qresource prefix="/files">
|
||||
<file>about.txt</file>
|
||||
<file>stylesheet.txt</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images/toolbar">
|
||||
<file>placeholder.png</file>
|
||||
@ -17,5 +18,6 @@
|
||||
<file>X.png</file>
|
||||
<file>Y.png</file>
|
||||
<file>Z.png</file>
|
||||
<file>screenshot.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
QtMeshViewer/Resources/screenshot.png
Normal file
BIN
QtMeshViewer/Resources/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
@ -54,6 +54,10 @@ void MainWindow::setupWidgets()
|
||||
connect(openFile, &QAction::triggered, this, &MainWindow::openFile);
|
||||
ui->mainToolBar->addAction(openFile);
|
||||
|
||||
QAction *screenShot = new QAction(QIcon(":/images/toolbar/screenshot.png"), "Screenshot", this);
|
||||
connect(screenShot, &QAction::triggered, this, &MainWindow::takeScreenShot);
|
||||
ui->mainToolBar->addAction(screenShot);
|
||||
|
||||
ui->mainToolBar->addSeparator();
|
||||
|
||||
QSignalMapper* signalMapper = new QSignalMapper(this);
|
||||
@ -130,6 +134,15 @@ void MainWindow::aboutTool()
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void MainWindow::takeScreenShot()
|
||||
{
|
||||
QString destination = QFileDialog::getSaveFileName(this, "Save as...", "", "PNG (*.png);; BMP (*.bmp);;TIFF (*.tiff, *.tif);;JPEG (*.jpg *jpeg)");
|
||||
|
||||
OglViewerWidget* viewer = dynamic_cast<OglViewerWidget*>(centralWidget());
|
||||
if (!destination.isEmpty() && viewer != NULL)
|
||||
viewer->grab().save(destination);
|
||||
}
|
||||
|
||||
void MainWindow::setFileInfo(QString name, QStringList textures, int vertices, int triangle)
|
||||
{
|
||||
m_fileInfo = QByteArray("Filename: ");
|
||||
|
Loading…
Reference in New Issue
Block a user