r21860 by jghali - fix SampleItem not performing linebreak correctly due to width/height being setup with incorrect units

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 1 22:39:03 UTC 2017


Author: jghali
Date: Sat Apr  1 22:39:03 2017
New Revision: 21860

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21860
Log:
fix SampleItem not performing linebreak correctly due to width/height being setup with incorrect units

Modified:
    trunk/Scribus/scribus/sampleitem.cpp

Modified: trunk/Scribus/scribus/sampleitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21860&path=/trunk/Scribus/scribus/sampleitem.cpp
==============================================================================
--- trunk/Scribus/scribus/sampleitem.cpp	(original)
+++ trunk/Scribus/scribus/sampleitem.cpp	Sat Apr  1 22:39:03 2017
@@ -290,7 +290,10 @@
 
 	UndoManager::instance()->setUndoEnabled(false); // disable undo
 
-	PageItem_TextFrame *previewItem = new PageItem_TextFrame(m_Doc, 0, 0, width, height, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
+	double frameWidth  = width / PrefsManager::instance()->appPrefs.displayPrefs.displayScale;
+	double frameHeight = height / PrefsManager::instance()->appPrefs.displayPrefs.displayScale;
+
+	PageItem_TextFrame *previewItem = new PageItem_TextFrame(m_Doc, 0, 0, frameWidth, frameHeight, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
 	QImage pm(width, height, QImage::Format_ARGB32);
 	ScPainter *painter = new ScPainter(&pm, width, height, 1.0, 0);
 	painter->setZoomFactor(PrefsManager::instance()->appPrefs.displayPrefs.displayScale);
@@ -311,7 +314,7 @@
 	previewItem->setFillShade(m_bgShade);
 	previewItem->SetRectFrame();
 	previewItem->setSampleItem(true);
-	previewItem->DrawObj(painter, QRect(0, 0, width, height));
+	previewItem->DrawObj(painter, QRect(0, 0, frameWidth, frameHeight));
 	painter->end();
 	delete(painter);
 	delete previewItem;




More information about the scribus-commit mailing list