Skip to content

Commit 6f4a28f

Browse files
committedSep 30, 2014
Disable radio buttons in color dialog if not using first tab
1 parent b044d4d commit 6f4a28f

File tree

3 files changed

+61
-6
lines changed

3 files changed

+61
-6
lines changed
 

‎src/gui/qgscolordialog.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,18 @@ void QgsColorDialogV2::on_mSampleButton_clicked()
687687
setMouseTracking( true );
688688
}
689689

690+
void QgsColorDialogV2::on_mTabWidget_currentChanged( int index )
691+
{
692+
//disable radio buttons if not using the first tab, as they have no meaning for other tabs
693+
bool enabled = index == 0;
694+
mRedRadio->setEnabled( enabled );
695+
mBlueRadio->setEnabled( enabled );
696+
mGreenRadio->setEnabled( enabled );
697+
mHueRadio->setEnabled( enabled );
698+
mSaturationRadio->setEnabled( enabled );
699+
mValueRadio->setEnabled( enabled );
700+
}
701+
690702
void QgsColorDialogV2::saveSettings()
691703
{
692704
//save changes to scheme

‎src/gui/qgscolordialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class GUI_EXPORT QgsColorDialogV2 : public QDialog, private Ui::QgsColorDialogBa
170170
void on_mAddCustomColorButton_clicked();
171171

172172
void on_mSampleButton_clicked();
173+
void on_mTabWidget_currentChanged( int index );
173174

174175
private:
175176

‎src/ui/qgscolordialog.ui

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@
2525
<item row="0" column="1">
2626
<layout class="QVBoxLayout" name="verticalLayout">
2727
<item>
28-
<layout class="QHBoxLayout" name="horizontalLayout_4">
28+
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1">
2929
<item>
3030
<widget class="QRadioButton" name="mHueRadio">
31+
<property name="text">
32+
<string/>
33+
</property>
34+
</widget>
35+
</item>
36+
<item>
37+
<widget class="QLabel" name="label_5">
3138
<property name="text">
3239
<string>H</string>
3340
</property>
@@ -39,9 +46,16 @@
3946
</layout>
4047
</item>
4148
<item>
42-
<layout class="QHBoxLayout" name="horizontalLayout_5">
49+
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
4350
<item>
4451
<widget class="QRadioButton" name="mSaturationRadio">
52+
<property name="text">
53+
<string/>
54+
</property>
55+
</widget>
56+
</item>
57+
<item>
58+
<widget class="QLabel" name="label_6">
4559
<property name="text">
4660
<string>S</string>
4761
</property>
@@ -53,9 +67,16 @@
5367
</layout>
5468
</item>
5569
<item>
56-
<layout class="QHBoxLayout" name="horizontalLayout_6">
70+
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,1">
5771
<item>
5872
<widget class="QRadioButton" name="mValueRadio">
73+
<property name="text">
74+
<string/>
75+
</property>
76+
</widget>
77+
</item>
78+
<item>
79+
<widget class="QLabel" name="label_7">
5980
<property name="text">
6081
<string>V</string>
6182
</property>
@@ -67,9 +88,16 @@
6788
</layout>
6889
</item>
6990
<item>
70-
<layout class="QHBoxLayout" name="horizontalLayout">
91+
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
7192
<item>
7293
<widget class="QRadioButton" name="mRedRadio">
94+
<property name="text">
95+
<string/>
96+
</property>
97+
</widget>
98+
</item>
99+
<item>
100+
<widget class="QLabel" name="label_8">
73101
<property name="text">
74102
<string>R</string>
75103
</property>
@@ -81,9 +109,16 @@
81109
</layout>
82110
</item>
83111
<item>
84-
<layout class="QHBoxLayout" name="horizontalLayout_2">
112+
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1">
85113
<item>
86114
<widget class="QRadioButton" name="mGreenRadio">
115+
<property name="text">
116+
<string/>
117+
</property>
118+
</widget>
119+
</item>
120+
<item>
121+
<widget class="QLabel" name="label_9">
87122
<property name="text">
88123
<string>G</string>
89124
</property>
@@ -95,9 +130,16 @@
95130
</layout>
96131
</item>
97132
<item>
98-
<layout class="QHBoxLayout" name="horizontalLayout_3">
133+
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,1">
99134
<item>
100135
<widget class="QRadioButton" name="mBlueRadio">
136+
<property name="text">
137+
<string/>
138+
</property>
139+
</widget>
140+
</item>
141+
<item>
142+
<widget class="QLabel" name="label_10">
101143
<property name="text">
102144
<string>B</string>
103145
</property>

0 commit comments

Comments
 (0)
Please sign in to comment.