- display a label next to the spinbox showing the fraction

Sun, 31 Aug 2014 20:54:56 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 31 Aug 2014 20:54:56 +0300
changeset 871
a860edb4210b
parent 870
9e9e71ebfbe7
child 872
977099f224d0

- display a label next to the spinbox showing the fraction

src/mainWindow.cc file | annotate | diff | comparison | revisions
src/mainWindow.h file | annotate | diff | comparison | revisions
ui/ldforge.ui file | annotate | diff | comparison | revisions
--- a/src/mainWindow.cc	Sun Aug 31 20:42:20 2014 +0300
+++ b/src/mainWindow.cc	Sun Aug 31 20:54:56 2014 +0300
@@ -122,6 +122,9 @@
 	setMinimumSize (300, 200);
 	connect (qApp, SIGNAL (aboutToQuit()), this, SLOT (slot_lastSecondCleanup()));
 	connect (ui->ringToolHiRes, SIGNAL (clicked (bool)), this, SLOT (ringToolHiResClicked (bool)));
+	connect (ui->ringToolSegments, SIGNAL (valueChanged (int)),
+		this, SLOT (circleToolSegmentsChanged()));
+	circleToolSegmentsChanged(); // invoke it manually for initial label text
 }
 
 MainWindow::~MainWindow()
@@ -1086,6 +1089,15 @@
 	}
 }
 
+// =============================================================================
+//
+void MainWindow::circleToolSegmentsChanged()
+{
+	int numerator (ui->ringToolSegments->value());
+	int denominator (ui->ringToolHiRes->isChecked() ? HighResolution : LowResolution);
+	Simplify (numerator, denominator);
+	ui->ringToolSegmentsLabel->setText (format ("%1 / %2", numerator, denominator));
+}
 
 // =============================================================================
 //
--- a/src/mainWindow.h	Sun Aug 31 20:42:20 2014 +0300
+++ b/src/mainWindow.h	Sun Aug 31 20:54:56 2014 +0300
@@ -180,6 +180,7 @@
 	void changeCurrentFile();
 	void closeTab (int tabindex);
 	void ringToolHiResClicked (bool clicked);
+	void circleToolSegmentsChanged();
 	void slot_action();
 	void slot_actionNew();
 	void slot_actionNewFile();
--- a/ui/ldforge.ui	Sun Aug 31 20:42:20 2014 +0300
+++ b/ui/ldforge.ui	Sun Aug 31 20:54:56 2014 +0300
@@ -48,7 +48,7 @@
            <x>0</x>
            <y>0</y>
            <width>237</width>
-           <height>414</height>
+           <height>434</height>
           </rect>
          </property>
          <attribute name="label">
@@ -76,17 +76,17 @@
            <x>0</x>
            <y>0</y>
            <width>237</width>
-           <height>414</height>
+           <height>434</height>
           </rect>
          </property>
          <attribute name="label">
-          <string>Edit Mode Options</string>
+          <string>Tool Options</string>
          </attribute>
          <layout class="QVBoxLayout" name="verticalLayout_4">
           <item>
            <widget class="QGroupBox" name="groupBox">
             <property name="title">
-             <string>Ring Options</string>
+             <string>Circle Tool Options</string>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_5">
              <item>
@@ -106,20 +106,31 @@
                 </widget>
                </item>
                <item row="1" column="1">
-                <widget class="QSpinBox" name="ringToolSegments">
-                 <property name="enabled">
-                  <bool>true</bool>
-                 </property>
-                 <property name="minimum">
-                  <number>1</number>
-                 </property>
-                 <property name="maximum">
-                  <number>16</number>
-                 </property>
-                 <property name="value">
-                  <number>16</number>
-                 </property>
-                </widget>
+                <layout class="QHBoxLayout" name="horizontalLayout_2">
+                 <item>
+                  <widget class="QSpinBox" name="ringToolSegments">
+                   <property name="enabled">
+                    <bool>true</bool>
+                   </property>
+                   <property name="minimum">
+                    <number>1</number>
+                   </property>
+                   <property name="maximum">
+                    <number>16</number>
+                   </property>
+                   <property name="value">
+                    <number>16</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QLabel" name="ringToolSegmentsLabel">
+                   <property name="text">
+                    <string>a / b</string>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
                </item>
               </layout>
              </item>
@@ -183,7 +194,7 @@
      <x>0</x>
      <y>0</y>
      <width>1010</width>
-     <height>26</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">

mercurial