mirror of https://github.com/vitalif/openscad
Add "Export to Clipboard" to copy the current 3d view to the system clipboard.
parent
89371f60cf
commit
591c98e979
|
@ -196,6 +196,7 @@ private slots:
|
||||||
void actionExportSVG();
|
void actionExportSVG();
|
||||||
void actionExportCSG();
|
void actionExportCSG();
|
||||||
void actionExportImage();
|
void actionExportImage();
|
||||||
|
void actionExportToClipboard();
|
||||||
void actionFlushCaches();
|
void actionFlushCaches();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -274,6 +274,7 @@
|
||||||
<addaction name="fileActionExportCSG"/>
|
<addaction name="fileActionExportCSG"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="fileActionExportImage"/>
|
<addaction name="fileActionExportImage"/>
|
||||||
|
<addaction name="fileActionExportClipboard"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="fileActionNew"/>
|
<addaction name="fileActionNew"/>
|
||||||
<addaction name="fileActionOpen"/>
|
<addaction name="fileActionOpen"/>
|
||||||
|
@ -1261,6 +1262,11 @@
|
||||||
<string>&Cheat Sheet</string>
|
<string>&Cheat Sheet</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="fileActionExportClipboard">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export to Clipboard</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -294,11 +294,12 @@ void QGLView::mouseReleaseEvent(QMouseEvent*)
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGLView::grabFrame()
|
const QImage & QGLView::grabFrame()
|
||||||
{
|
{
|
||||||
// Force reading from front buffer. Some configurations will read from the back buffer here.
|
// Force reading from front buffer. Some configurations will read from the back buffer here.
|
||||||
glReadBuffer(GL_FRONT);
|
glReadBuffer(GL_FRONT);
|
||||||
this->frame = grabFrameBuffer();
|
this->frame = grabFrameBuffer();
|
||||||
|
return this->frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGLView::save(const char *filename)
|
bool QGLView::save(const char *filename)
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
float getDPI() { return this->devicePixelRatio(); }
|
float getDPI() { return this->devicePixelRatio(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void grabFrame();
|
const QImage & grabFrame();
|
||||||
bool save(const char *filename);
|
bool save(const char *filename);
|
||||||
void resetView();
|
void resetView();
|
||||||
void viewAll();
|
void viewAll();
|
||||||
|
|
|
@ -362,6 +362,7 @@ MainWindow::MainWindow(const QString &filename)
|
||||||
connect(this->fileActionExportSVG, SIGNAL(triggered()), this, SLOT(actionExportSVG()));
|
connect(this->fileActionExportSVG, SIGNAL(triggered()), this, SLOT(actionExportSVG()));
|
||||||
connect(this->fileActionExportCSG, SIGNAL(triggered()), this, SLOT(actionExportCSG()));
|
connect(this->fileActionExportCSG, SIGNAL(triggered()), this, SLOT(actionExportCSG()));
|
||||||
connect(this->fileActionExportImage, SIGNAL(triggered()), this, SLOT(actionExportImage()));
|
connect(this->fileActionExportImage, SIGNAL(triggered()), this, SLOT(actionExportImage()));
|
||||||
|
connect(this->fileActionExportClipboard, SIGNAL(triggered()), this, SLOT(actionExportToClipboard()));
|
||||||
connect(this->designActionFlushCaches, SIGNAL(triggered()), this, SLOT(actionFlushCaches()));
|
connect(this->designActionFlushCaches, SIGNAL(triggered()), this, SLOT(actionFlushCaches()));
|
||||||
|
|
||||||
// View menu
|
// View menu
|
||||||
|
@ -2184,6 +2185,13 @@ void MainWindow::actionExportImage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::actionExportToClipboard()
|
||||||
|
{
|
||||||
|
const QImage & image = qglview->grabFrame();
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
clipboard->setImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::actionFlushCaches()
|
void MainWindow::actionFlushCaches()
|
||||||
{
|
{
|
||||||
GeometryCache::instance()->clear();
|
GeometryCache::instance()->clear();
|
||||||
|
|
Loading…
Reference in New Issue