mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 10:30:06 +00:00 
			
		
		
		
	changed unitAbbreviation_ over to not use pointers
This commit is contained in:
		
							parent
							
								
									54748ce812
								
							
						
					
					
						commit
						801125d87a
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		|  | @ -55,9 +55,9 @@ public: | ||||||
|    std::function<std::string(const T&)> mapFromValue_ {nullptr}; |    std::function<std::string(const T&)> mapFromValue_ {nullptr}; | ||||||
|    std::function<T(const std::string&)> mapToValue_ {nullptr}; |    std::function<T(const std::string&)> mapToValue_ {nullptr}; | ||||||
| 
 | 
 | ||||||
|    double unitScale_ {1}; |    double                     unitScale_ {1}; | ||||||
|    const std::string * unitAbbreviation_ {nullptr}; |    std::optional<std::string> unitAbbreviation_ {}; | ||||||
|    bool unitEnabled_ {false}; |    bool                       unitEnabled_ {false}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| template<class T> | template<class T> | ||||||
|  | @ -483,9 +483,9 @@ template<class T> | ||||||
| void SettingsInterface<T>::SetUnit(const double&      scale, | void SettingsInterface<T>::SetUnit(const double&      scale, | ||||||
|                                    const std::string& abbreviation) |                                    const std::string& abbreviation) | ||||||
| { | { | ||||||
|    p->unitScale_       = scale; |    p->unitScale_        = scale; | ||||||
|    p->unitAbbreviation_ = &abbreviation; |    p->unitAbbreviation_ = abbreviation; | ||||||
|    p->unitEnabled_     = true; |    p->unitEnabled_      = true; | ||||||
|    p->UpdateEditWidget(); |    p->UpdateEditWidget(); | ||||||
|    p->UpdateUnitLabel(); |    p->UpdateUnitLabel(); | ||||||
| } | } | ||||||
|  | @ -604,7 +604,7 @@ void SettingsInterface<T>::Impl::UpdateUnitLabel() | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    unitLabel_->setText(QString::fromStdString(*unitAbbreviation_)); |    unitLabel_->setText(QString::fromStdString(unitAbbreviation_.value_or(""))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<class T> | template<class T> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak