mirror of https://github.com/vitalif/openscad
Merge pull request #1339 from openscad/export-to-clipboard
Add "Export to Clipboard" to copy the current 3d view to the system clipboard.master
commit
42d6629156
|
@ -196,6 +196,7 @@ private slots:
|
|||
void actionExportSVG();
|
||||
void actionExportCSG();
|
||||
void actionExportImage();
|
||||
void actionCopyViewport();
|
||||
void actionFlushCaches();
|
||||
|
||||
public:
|
||||
|
|
|
@ -302,6 +302,8 @@
|
|||
<addaction name="editActionCopy"/>
|
||||
<addaction name="editActionPaste"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="editActionCopyViewport"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="editActionIndent"/>
|
||||
<addaction name="editActionUnindent"/>
|
||||
<addaction name="editActionComment"/>
|
||||
|
@ -1261,6 +1263,14 @@
|
|||
<string>&Cheat Sheet</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="editActionCopyViewport">
|
||||
<property name="text">
|
||||
<string>Copy Viewport</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+C</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();
|
||||
|
|
|
@ -325,6 +325,7 @@ MainWindow::MainWindow(const QString &filename)
|
|||
connect(this->editActionCut, SIGNAL(triggered()), editor, SLOT(cut()));
|
||||
connect(this->editActionCopy, SIGNAL(triggered()), editor, SLOT(copy()));
|
||||
connect(this->editActionPaste, SIGNAL(triggered()), editor, SLOT(paste()));
|
||||
connect(this->editActionCopyViewport, SIGNAL(triggered()), this, SLOT(actionCopyViewport()));
|
||||
connect(this->editActionIndent, SIGNAL(triggered()), editor, SLOT(indentSelection()));
|
||||
connect(this->editActionUnindent, SIGNAL(triggered()), editor, SLOT(unindentSelection()));
|
||||
connect(this->editActionComment, SIGNAL(triggered()), editor, SLOT(commentSelection()));
|
||||
|
@ -2184,6 +2185,13 @@ void MainWindow::actionExportImage()
|
|||
return;
|
||||
}
|
||||
|
||||
void MainWindow::actionCopyViewport()
|
||||
{
|
||||
const QImage & image = qglview->grabFrame();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setImage(image);
|
||||
}
|
||||
|
||||
void MainWindow::actionFlushCaches()
|
||||
{
|
||||
GeometryCache::instance()->clear();
|
||||
|
|
Loading…
Reference in New Issue