Skip to content

Commit

Permalink
Gui: Initial save of a document doesn't have the expected thumbnail
Browse files Browse the repository at this point in the history
When saving the thumbnail there is a check if the 3D window is the active window. This check fails if a document is saved for the first time because
the appearing file dialog causes the 3D window to not be active any more. Thus, no snapshot of the 3D window will be created and the program logo will be
saved instead. A workaround is to save the document twice.

This PR removes the check for the active window so that the snapshot can be created. The issue might be related to FreeCAD#10937.
  • Loading branch information
wwmayer committed Oct 10, 2023
1 parent 057469c commit 7c33d7d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Gui/Thumbnail.cpp
Expand Up @@ -86,16 +86,14 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
if (!this->viewer)
return;
QImage img;
if (this->viewer->isActiveWindow()) {
if (this->viewer->thread() != QThread::currentThread()) {
qWarning("Cannot create a thumbnail from non-GUI thread");
return;
}

QColor invalid;
this->viewer->imageFromFramebuffer(this->size, this->size, 4, invalid, img);
if (this->viewer->thread() != QThread::currentThread()) {
qWarning("Cannot create a thumbnail from non-GUI thread");
return;
}

QColor invalid;
this->viewer->imageFromFramebuffer(this->size, this->size, 4, invalid, img);

// Get app icon and resize to half size to insert in topbottom position over the current view snapshot
QPixmap appIcon = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str());
QPixmap px = appIcon;
Expand Down

0 comments on commit 7c33d7d

Please sign in to comment.