[qet] [4044] Qet shape item properties widget : remove the scale widget

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4044
Author:   blacksun
Date:     2015-07-12 12:28:59 +0200 (Sun, 12 Jul 2015)
Log Message:
-----------
Qet shape item properties widget : remove the scale widget

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/qetshapeitem.cpp
    trunk/sources/qetgraphicsitem/qetshapeitem.h
    trunk/sources/ui/shapegraphicsitempropertieswidget.cpp
    trunk/sources/ui/shapegraphicsitempropertieswidget.h
    trunk/sources/ui/shapegraphicsitempropertieswidget.ui

Modified: trunk/sources/qetgraphicsitem/qetshapeitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/qetshapeitem.cpp	2015-07-11 18:58:32 UTC (rev 4043)
+++ trunk/sources/qetgraphicsitem/qetshapeitem.cpp	2015-07-12 10:28:59 UTC (rev 4044)
@@ -64,19 +64,6 @@
 }
 
 /**
- * @brief QetShapeItem::scale
- * Scale this item by (factor / 100 ).
- * @param factor
- */
-void QetShapeItem::previewScale(int factor) {
-	if (factor >= 1 && factor <= 200) {
-		qreal new_scale = factor;
-		new_scale /= 100;
-		setScale(new_scale);
-	}
-}
-
-/**
  * @brief QetShapeItem::setP2
  * Set the second point of this item.
  * If this item is a polyline,

Modified: trunk/sources/qetgraphicsitem/qetshapeitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/qetshapeitem.h	2015-07-11 18:58:32 UTC (rev 4043)
+++ trunk/sources/qetgraphicsitem/qetshapeitem.h	2015-07-12 10:28:59 UTC (rev 4044)
@@ -84,9 +84,6 @@
 	private:
 		void changeGraphicsItem (const ShapeType &newtype);
 
-	private slots:
-		void previewScale(int factor);
-
 		///ATTRIBUTES
 	private:
 		ShapeType    m_shapeType;

Modified: trunk/sources/ui/shapegraphicsitempropertieswidget.cpp
===================================================================
--- trunk/sources/ui/shapegraphicsitempropertieswidget.cpp	2015-07-11 18:58:32 UTC (rev 4043)
+++ trunk/sources/ui/shapegraphicsitempropertieswidget.cpp	2015-07-12 10:28:59 UTC (rev 4044)
@@ -19,7 +19,6 @@
 #include "ui_shapegraphicsitempropertieswidget.h"
 #include "qetshapeitem.h"
 #include "diagram.h"
-#include "itemresizercommand.h"
 #include "changeshapestylecommand.h"
 
 /**
@@ -57,17 +56,12 @@
 	if (shape == m_shape) return;
 
 	if (m_shape)
-	{
-		disconnect(m_shape, &QGraphicsObject::scaleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
 		disconnect(m_shape, &QetShapeItem::styleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
-	}
 
 	m_shape = shape;
-	connect(m_shape, &QGraphicsObject::scaleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
 	connect(m_shape, &QetShapeItem::styleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
 
 	m_old_pen_style = m_shape->penStyle();
-	m_old_scale = m_shape->scale();
 	updateUi();
 }
 
@@ -79,23 +73,16 @@
 void ShapeGraphicsItemPropertiesWidget::apply()
 {
 	if (m_live_edit)
-	{
-		disconnect(m_shape, &QGraphicsObject::scaleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
 		disconnect(m_shape, &QetShapeItem::styleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
-	}
 
 	if (m_shape->diagram())
 		if (QUndoCommand *undo = associatedUndo())
 			m_shape->diagram()->undoStack().push(undo);
 
 	m_old_pen_style = m_shape->penStyle();
-	m_old_scale = m_shape->scale();
 
 	if (m_live_edit)
-	{
-		connect(m_shape, &QGraphicsObject::scaleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
 		connect(m_shape, &QetShapeItem::styleChanged, this, &ShapeGraphicsItemPropertiesWidget::updateUi);
-	}
 }
 
 /**
@@ -105,34 +92,21 @@
 void ShapeGraphicsItemPropertiesWidget::reset()
 {
 	m_shape->setStyle(m_old_pen_style);
-	m_shape->setScale(m_old_scale);
 	updateUi();
 }
 
 /**
  * @brief ShapeGraphicsItemPropertiesWidget::associatedUndo
  * @return an undo command that represent the change edited by this widget.
- * The returned undo command can be a ChangeShapeStyleCommand, ItemResizerCommand or
- * a ChangeShapeStyleCommand with a ItemResizerCommand as child.
+ * The returned undo command is a ChangeShapeStyleCommand.
  * If there isn't change, return nullptr
  */
 QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
 {
-	QUndoCommand *undo = nullptr;
 	Qt::PenStyle new_style = Qt::PenStyle(ui->m_style_cb->currentIndex() + 1);
-	if (new_style != m_old_pen_style) undo = new ChangeShapeStyleCommand(m_shape, m_old_pen_style, new_style);
+	if (new_style != m_old_pen_style) return (new ChangeShapeStyleCommand(m_shape, m_old_pen_style, new_style));
 
-	qreal value = ui->m_scale_slider->value();
-	value /= 100;
-	if (value != m_old_scale)
-	{
-		if (undo)
-			new ItemResizerCommand(m_shape, m_old_scale, value, tr("une shape"), undo);
-		else
-			undo = new ItemResizerCommand(m_shape, m_old_scale, value, tr("une shape"));
-	}
-
-	return undo;
+	return nullptr;
 }
 
 /**
@@ -142,7 +116,6 @@
 {
 	ui->m_style_cb->setCurrentIndex(static_cast<int>(m_shape->penStyle()) - 1);
 	ui->m_lock_pos_cb->setChecked(!m_shape->isMovable());
-	ui->m_scale_slider->setValue(m_shape->scale() * 100);
 }
 
 /**
@@ -156,26 +129,13 @@
 	m_live_edit = live_edit;
 
 	if (m_live_edit)
-	{
-		connect (ui->m_scale_slider, &QSlider::sliderReleased, this, &ShapeGraphicsItemPropertiesWidget::apply);
-		connect (ui->m_scale_sb, &QSpinBox::editingFinished, this, &ShapeGraphicsItemPropertiesWidget::apply);
 		connect (ui->m_style_cb, SIGNAL(activated(int)), this, SLOT(apply()));
-	}
 	else
-	{
-		disconnect (ui->m_scale_slider, &QSlider::sliderReleased, this, &ShapeGraphicsItemPropertiesWidget::apply);
-		disconnect (ui->m_scale_sb, &QSpinBox::editingFinished, this, &ShapeGraphicsItemPropertiesWidget::apply);
 		disconnect (ui->m_style_cb, SIGNAL(activated(int)), this, SLOT(apply()));
-	}
 
 	return true;
 }
 
-void ShapeGraphicsItemPropertiesWidget::on_m_scale_slider_valueChanged(int value) {
-	qreal scale = value;
-	m_shape->setScale(scale / 100);
-}
-
 void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked() {
 	m_shape->setMovable(!ui->m_lock_pos_cb->isChecked());
 }

Modified: trunk/sources/ui/shapegraphicsitempropertieswidget.h
===================================================================
--- trunk/sources/ui/shapegraphicsitempropertieswidget.h	2015-07-11 18:58:32 UTC (rev 4043)
+++ trunk/sources/ui/shapegraphicsitempropertieswidget.h	2015-07-12 10:28:59 UTC (rev 4044)
@@ -50,7 +50,6 @@
 		virtual bool setLiveEdit(bool live_edit);
 
 	private slots:
-		void on_m_scale_slider_valueChanged(int value);
 		void on_m_lock_pos_cb_clicked();
 
 	private:
@@ -58,7 +57,6 @@
 		QetShapeItem *m_shape;
 
 		Qt::PenStyle m_old_pen_style;
-		qreal m_old_scale;
 };
 
 #endif // SHAPEGRAPHICSITEMPROPERTIESWIDGET_H

Modified: trunk/sources/ui/shapegraphicsitempropertieswidget.ui
===================================================================
--- trunk/sources/ui/shapegraphicsitempropertieswidget.ui	2015-07-11 18:58:32 UTC (rev 4043)
+++ trunk/sources/ui/shapegraphicsitempropertieswidget.ui	2015-07-12 10:28:59 UTC (rev 4044)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>175</width>
-    <height>174</height>
+    <width>195</width>
+    <height>183</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -15,42 +15,44 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Type de trait</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <widget class="QComboBox" name="m_style_cb">
-        <item>
-         <property name="text">
-          <string>Normal</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Tiret</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Pointillé</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Traits et points</string>
-         </property>
-        </item>
-        <item>
-         <property name="text">
-          <string>Traits points points</string>
-         </property>
-        </item>
-       </widget>
-      </item>
-     </layout>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Type de trait</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="m_style_cb">
+       <item>
+        <property name="text">
+         <string>Normal</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Tiret</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Pointillé</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Traits et points</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Traits points points</string>
+        </property>
+       </item>
+      </widget>
+     </item>
+    </layout>
    </item>
    <item>
     <widget class="QCheckBox" name="m_lock_pos_cb">
@@ -60,41 +62,6 @@
     </widget>
    </item>
    <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="title">
-      <string>Échelle</string>
-     </property>
-     <property name="checkable">
-      <bool>false</bool>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout">
-      <item>
-       <widget class="QSlider" name="m_scale_slider">
-        <property name="minimum">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <number>200</number>
-        </property>
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QSpinBox" name="m_scale_sb">
-        <property name="minimum">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <number>200</number>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -110,38 +77,5 @@
   </layout>
  </widget>
  <resources/>
- <connections>
-  <connection>
-   <sender>m_scale_slider</sender>
-   <signal>valueChanged(int)</signal>
-   <receiver>m_scale_sb</receiver>
-   <slot>setValue(int)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>174</x>
-     <y>234</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>355</x>
-     <y>234</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>m_scale_sb</sender>
-   <signal>valueChanged(int)</signal>
-   <receiver>m_scale_slider</receiver>
-   <slot>setValue(int)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>355</x>
-     <y>234</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>174</x>
-     <y>234</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/