mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:40:06 +00:00 
			
		
		
		
	Add QCheckBox to SettingsInterface
This commit is contained in:
		
							parent
							
								
									602be75222
								
							
						
					
					
						commit
						289b7620a9
					
				
					 1 changed files with 26 additions and 0 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| #include <scwx/qt/settings/settings_variable.hpp> | ||||
| 
 | ||||
| #include <QAbstractButton> | ||||
| #include <QCheckBox> | ||||
| #include <QComboBox> | ||||
| #include <QCoreApplication> | ||||
| #include <QLineEdit> | ||||
|  | @ -94,6 +95,24 @@ void SettingsInterface<T>::SetEditWidget(QWidget* widget) | |||
|                              // Attempt to stage the value
 | ||||
|                              p->stagedValid_ = p->variable_->StageValue(value); | ||||
|                              p->UpdateResetButton(); | ||||
| 
 | ||||
|                              // TODO: Display invalid status
 | ||||
|                           }); | ||||
|       } | ||||
|    } | ||||
|    else if (QCheckBox* checkBox = dynamic_cast<QCheckBox*>(widget)) | ||||
|    { | ||||
|       if constexpr (std::is_same_v<T, bool>) | ||||
|       { | ||||
|          QObject::connect(checkBox, | ||||
|                           &QCheckBox::toggled, | ||||
|                           p->context_.get(), | ||||
|                           [this](bool checked) | ||||
|                           { | ||||
|                              // Attempt to stage the value
 | ||||
|                              p->stagedValid_ = | ||||
|                                 p->variable_->StageValue(checked); | ||||
|                              p->UpdateResetButton(); | ||||
|                           }); | ||||
|       } | ||||
|    } | ||||
|  | @ -248,6 +267,13 @@ void SettingsInterface<T>::Impl::UpdateEditWidget() | |||
|          } | ||||
|       } | ||||
|    } | ||||
|    else if (QCheckBox* checkBox = dynamic_cast<QCheckBox*>(editWidget_)) | ||||
|    { | ||||
|       if constexpr (std::is_same_v<T, bool>) | ||||
|       { | ||||
|          checkBox->setChecked(currentValue); | ||||
|       } | ||||
|    } | ||||
|    else if (QComboBox* comboBox = dynamic_cast<QComboBox*>(editWidget_)) | ||||
|    { | ||||
|       if constexpr (std::is_same_v<T, std::string>) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat