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