Skip to content

Commit

Permalink
Disable radio buttons in color dialog if not using first tab
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 30, 2014
1 parent b044d4d commit 6f4a28f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/gui/qgscolordialog.cpp
Expand Up @@ -687,6 +687,18 @@ void QgsColorDialogV2::on_mSampleButton_clicked()
setMouseTracking( true );
}

void QgsColorDialogV2::on_mTabWidget_currentChanged( int index )
{
//disable radio buttons if not using the first tab, as they have no meaning for other tabs
bool enabled = index == 0;
mRedRadio->setEnabled( enabled );
mBlueRadio->setEnabled( enabled );
mGreenRadio->setEnabled( enabled );
mHueRadio->setEnabled( enabled );
mSaturationRadio->setEnabled( enabled );
mValueRadio->setEnabled( enabled );
}

void QgsColorDialogV2::saveSettings()
{
//save changes to scheme
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgscolordialog.h
Expand Up @@ -170,6 +170,7 @@ class GUI_EXPORT QgsColorDialogV2 : public QDialog, private Ui::QgsColorDialogBa
void on_mAddCustomColorButton_clicked();

void on_mSampleButton_clicked();
void on_mTabWidget_currentChanged( int index );

private:

Expand Down
54 changes: 48 additions & 6 deletions src/ui/qgscolordialog.ui
Expand Up @@ -25,9 +25,16 @@
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mHueRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>H</string>
</property>
Expand All @@ -39,9 +46,16 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mSaturationRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>S</string>
</property>
Expand All @@ -53,9 +67,16 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mValueRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>V</string>
</property>
Expand All @@ -67,9 +88,16 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mRedRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>R</string>
</property>
Expand All @@ -81,9 +109,16 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mGreenRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>G</string>
</property>
Expand All @@ -95,9 +130,16 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,1">
<item>
<widget class="QRadioButton" name="mBlueRadio">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>B</string>
</property>
Expand Down

0 comments on commit 6f4a28f

Please sign in to comment.