mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Update collapsible expansion logic, and change icons
This commit is contained in:
		
							parent
							
								
									7ff9feba25
								
							
						
					
					
						commit
						04a539b93d
					
				
					 6 changed files with 30 additions and 28 deletions
				
			
		|  | @ -15,11 +15,7 @@ public: | |||
|    ~CollapsibleGroupImpl() = default; | ||||
| 
 | ||||
|    void Initialize(); | ||||
| 
 | ||||
|    const QIcon kCollapsedIcon_ { | ||||
|       ":/res/icons/font-awesome-6/angle-right-solid.svg"}; | ||||
|    const QIcon kExpandedIcon_ { | ||||
|       ":/res/icons/font-awesome-6/angle-down-solid.svg"}; | ||||
|    void SetExpanded(bool expanded); | ||||
| 
 | ||||
|    CollapsibleGroup* self_; | ||||
| }; | ||||
|  | @ -52,20 +48,12 @@ void CollapsibleGroupImpl::Initialize() | |||
| { | ||||
|    self_->Expand(); | ||||
| 
 | ||||
|    QObject::connect(self_->ui->titleButton, | ||||
|                     &QAbstractButton::toggled, | ||||
|                     self_, | ||||
|                     [this](bool checked) | ||||
|                     { | ||||
|                        if (checked) | ||||
|                        { | ||||
|                           self_->Expand(); | ||||
|                        } | ||||
|                        else | ||||
|                        { | ||||
|                           self_->Collapse(); | ||||
|                        } | ||||
|                     }); | ||||
|    QObject::connect( | ||||
|       self_->ui->titleButton, | ||||
|       &QAbstractButton::toggled, | ||||
|       self_, | ||||
|       [this](bool checked) { SetExpanded(checked); }, | ||||
|       Qt::DirectConnection); | ||||
| } | ||||
| 
 | ||||
| void CollapsibleGroup::SetContentsLayout(QLayout* layout) | ||||
|  | @ -85,9 +73,6 @@ void CollapsibleGroup::Collapse() | |||
|    { | ||||
|       ui->titleButton->setChecked(false); | ||||
|    } | ||||
| 
 | ||||
|    // Hide the group contents
 | ||||
|    ui->contentsFrame->setVisible(false); | ||||
| } | ||||
| 
 | ||||
| void CollapsibleGroup::Expand() | ||||
|  | @ -97,9 +82,12 @@ void CollapsibleGroup::Expand() | |||
|    { | ||||
|       ui->titleButton->setChecked(true); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|    // Show the group contents
 | ||||
|    ui->contentsFrame->setVisible(true); | ||||
| void CollapsibleGroupImpl::SetExpanded(bool expanded) | ||||
| { | ||||
|    // Update contents visibility
 | ||||
|    self_->ui->contentsFrame->setVisible(expanded); | ||||
| } | ||||
| 
 | ||||
| } // namespace ui
 | ||||
|  |  | |||
|  | @ -17,6 +17,18 @@ | |||
|    <property name="spacing"> | ||||
|     <number>0</number> | ||||
|    </property> | ||||
|    <property name="leftMargin"> | ||||
|     <number>0</number> | ||||
|    </property> | ||||
|    <property name="topMargin"> | ||||
|     <number>0</number> | ||||
|    </property> | ||||
|    <property name="rightMargin"> | ||||
|     <number>0</number> | ||||
|    </property> | ||||
|    <property name="bottomMargin"> | ||||
|     <number>0</number> | ||||
|    </property> | ||||
|    <item> | ||||
|     <widget class="QFrame" name="titleFrame"> | ||||
|      <property name="frameShape"> | ||||
|  | @ -48,8 +60,8 @@ | |||
|         </property> | ||||
|         <property name="icon"> | ||||
|          <iconset resource="../../../../scwx-qt.qrc"> | ||||
|           <normaloff>:/res/icons/font-awesome-6/angle-right-solid.svg</normaloff> | ||||
|           <normalon>:/res/icons/font-awesome-6/angle-down-solid.svg</normalon>:/res/icons/font-awesome-6/angle-right-solid.svg</iconset> | ||||
|           <normaloff>:/res/icons/font-awesome-6/square-caret-right-regular.svg</normaloff> | ||||
|           <normalon>:/res/icons/font-awesome-6/square-caret-down-regular.svg</normalon>:/res/icons/font-awesome-6/square-caret-right-regular.svg</iconset> | ||||
|         </property> | ||||
|         <property name="checkable"> | ||||
|          <bool>true</bool> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat