r22587 by craig - #15367: Allow more decimal places for drop shadow blur

scribus-commit scribus-commit at lists.scribus.net
Fri Jun 29 21:15:25 UTC 2018


Author: craig
Date: Fri Jun 29 21:15:25 2018
New Revision: 22587

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22587
Log:
#15367: Allow more decimal places for drop shadow blur

Modified:
    trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
    trunk/Scribus/scribus/ui/proptree.cpp

Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22587&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp	(original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp	Fri Jun 29 21:15:25 2018
@@ -27,9 +27,9 @@
 
 PropertiesPalette_Shadow::PropertiesPalette_Shadow( QWidget* parent) : PropTreeWidget(parent)
 {
-	m_ScMW = 0;
-	m_doc = 0;
-	m_item = 0;
+	m_ScMW = nullptr;
+	m_doc = nullptr;
+	m_item = nullptr;
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_unitIndex = 0;
@@ -51,8 +51,8 @@
 
 	softShadowBlurRadius = new PropTreeItem(this, PropTreeItem::DoubleSpinBox, tr( "Blur:"));
 	softShadowBlurRadius->setUnitValue(0);
-	softShadowBlurRadius->setDecimalsValue(1);
-	softShadowBlurRadius->setMinMaxValues(-20.0, 20.0);
+	softShadowBlurRadius->setDecimalsValue(2);
+	softShadowBlurRadius->setMinMaxValues(-200.0, 200.0);
 	softShadowBlurRadius->setDoubleValue(2.0);
 
 	softShadowColor = new PropTreeItem(this, PropTreeItem::ColorComboBox, tr( "Color:"));
@@ -128,8 +128,8 @@
 	softShadowYOffset->setDoubleValue(minXYVal);
 
 	softShadowBlurRadius->setUnitValue(m_unitIndex);
-	softShadowBlurRadius->setDecimalsValue(1);
-	softShadowBlurRadius->setMinMaxValues(0.0, 20.0);
+	softShadowBlurRadius->setDecimalsValue(precision);
+	softShadowBlurRadius->setMinMaxValues(0.0, 200.0);
 	softShadowBlurRadius->setDoubleValue(5);
 
 	softShadowShade->setDecimalsValue(0);
@@ -249,21 +249,20 @@
 
 void PropertiesPalette_Shadow::handleNewValues()
 {
-	if (m_haveItem)
-	{
-		double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
-		double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
-		double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
-		QString color = softShadowColor->valueAsString();
-		if (color == CommonStrings::tr_NoneColor)
-			color = CommonStrings::None;
-		int b = softShadowBlendMode->valueAsInt();
-		double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
-		int s = softShadowShade->valueAsInt();
-		if (m_haveDoc)
-		{
-			m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
-		}
+	if (!m_haveItem)
+		return;
+	double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
+	double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
+	double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
+	QString color = softShadowColor->valueAsString();
+	if (color == CommonStrings::tr_NoneColor)
+		color = CommonStrings::None;
+	int b = softShadowBlendMode->valueAsInt();
+	double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
+	int s = softShadowShade->valueAsInt();
+	if (m_haveDoc)
+	{
+		m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
 	}
 }
 

Modified: trunk/Scribus/scribus/ui/proptree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22587&path=/trunk/Scribus/scribus/ui/proptree.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.cpp	(original)
+++ trunk/Scribus/scribus/ui/proptree.cpp	Fri Jun 29 21:15:25 2018
@@ -452,25 +452,19 @@
 void PropTreeWidget::mousePressEvent(QMouseEvent *event)
 {
 	QTreeWidgetItem *item = itemAt(event->pos());
-	if (item)
-	{
-		if (item->flags() & Qt::ItemIsEditable)
-		{
-			if ((event->button() == Qt::LeftButton) && (header()->logicalIndexAt(event->pos().x()) == 1))
-				QTreeWidget::mousePressEvent(event);
-			else
-				event->ignore();
-		}
-		else
-			QTreeWidget::mousePressEvent(event);
-	}
-	else
+	if (!item)
 		QTreeWidget::mousePressEvent(event);
+	if (!(item->flags() & Qt::ItemIsEditable))
+		QTreeWidget::mousePressEvent(event);
+	if ((event->button() == Qt::LeftButton) && (header()->logicalIndexAt(event->pos().x()) == 1))
+		QTreeWidget::mousePressEvent(event);
+	else
+		event->ignore();
 }
 
 PropTreeItem* PropTreeWidget::indexToItem(const QModelIndex &index)
 {
-	return (PropTreeItem*)itemFromIndex(index);
+	return dynamic_cast<PropTreeItem*>(itemFromIndex(index));
 }
 
 void PropTreeWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const




More information about the scribus-commit mailing list