mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
No need to compute size of an icon if not using GUI.
This also avoids crash while calling Qimage() without GUI.
This commit is contained in:
parent
d12920d437
commit
fd7e4f2dbb
@ -10,7 +10,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "InsetInfo.h"
|
#include "InsetInfo.h"
|
||||||
|
#include "LyX.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
@ -419,10 +419,12 @@ void InsetInfo::updateInfo()
|
|||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
break;
|
break;
|
||||||
int percent_scale = 100;
|
int percent_scale = 100;
|
||||||
int imgsize = QImage(toqstr(file.absFileName())).width();
|
if (use_gui) {
|
||||||
if (imgsize > 0) {
|
int imgsize = QImage(toqstr(file.absFileName())).width();
|
||||||
int iconsize = Length(1, Length::EM).inPixels(1);
|
if (imgsize > 0) {
|
||||||
percent_scale = (100 * iconsize + imgsize / 2)/imgsize;
|
int iconsize = Length(1, Length::EM).inPixels(1);
|
||||||
|
percent_scale = (100 * iconsize + imgsize / 2)/imgsize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
InsetGraphics * inset = new InsetGraphics(buffer_);
|
InsetGraphics * inset = new InsetGraphics(buffer_);
|
||||||
InsetGraphicsParams igp;
|
InsetGraphicsParams igp;
|
||||||
|
Loading…
Reference in New Issue
Block a user