+ fix problems on unit tests, open transaction when creating distance object, layout warning, ...

This commit is contained in:
wmayer
2015-01-25 14:04:33 +01:00
parent 69605efc46
commit 85bc04f0a0
7 changed files with 38 additions and 24 deletions

View File

@@ -101,22 +101,24 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
}
}
QPixmap px = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str());
px = BitmapFactory().merge(QPixmap::fromImage(img),px,BitmapFactoryInst::BottomRight);
if (!img.isNull()) {
QPixmap px = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str());
px = BitmapFactory().merge(QPixmap::fromImage(img),px,BitmapFactoryInst::BottomRight);
// according to specification add some meta-information to the image
uint mt = QDateTime::currentDateTime().toTime_t();
QString mtime = QString::fromAscii("%1").arg(mt);
img.setText(QLatin1String("Software"), qApp->applicationName());
img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd"));
img.setText(QLatin1String("Thumb::MTime"), mtime);
img.setText(QLatin1String("Thumb::URI"), this->uri.toString());
// according to specification add some meta-information to the image
uint mt = QDateTime::currentDateTime().toTime_t();
QString mtime = QString::fromAscii("%1").arg(mt);
img.setText(QLatin1String("Software"), qApp->applicationName());
img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd"));
img.setText(QLatin1String("Thumb::MTime"), mtime);
img.setText(QLatin1String("Thumb::URI"), this->uri.toString());
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
px.save(&buffer, "PNG");
writer.Stream().write(ba.constData(), ba.length());
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
px.save(&buffer, "PNG");
writer.Stream().write(ba.constData(), ba.length());
}
}
void Thumbnail::RestoreDocFile(Base::Reader &reader)
@@ -127,6 +129,8 @@ void Thumbnail::createThumbnailFromFramebuffer(QImage& img) const
{
// Alternative way of off-screen rendering
QGLFramebufferObject fbo(this->size, this->size,QGLFramebufferObject::Depth);
this->viewer->renderToFramebuffer(&fbo);
img = fbo.toImage();
if (this->viewer->isActiveWindow()) {
this->viewer->renderToFramebuffer(&fbo);
img = fbo.toImage();
}
}