Update collapsible expansion logic, and change icons

This commit is contained in:
Dan Paulat 2023-06-27 22:29:23 -05:00
parent 7ff9feba25
commit 04a539b93d
6 changed files with 30 additions and 28 deletions

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M201.4 342.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 274.7 86.6 137.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"/></svg>

Before

Width:  |  Height:  |  Size: 416 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M384 432c8.8 0 16-7.2 16-16l0-320c0-8.8-7.2-16-16-16L64 80c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l320 0zm64-16c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320zM224 352c-6.7 0-13-2.8-17.6-7.7l-104-112c-6.5-7-8.2-17.2-4.4-25.9s12.5-14.4 22-14.4l208 0c9.5 0 18.2 5.7 22 14.4s2.1 18.9-4.4 25.9l-104 112c-4.5 4.9-10.9 7.7-17.6 7.7z"/></svg>

After

Width:  |  Height:  |  Size: 641 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M400 96c0-8.8-7.2-16-16-16L64 80c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l320 0c8.8 0 16-7.2 16-16l0-320zM384 32c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0zM320 256c0 6.7-2.8 13-7.7 17.6l-112 104c-7 6.5-17.2 8.2-25.9 4.4s-14.4-12.5-14.4-22l0-208c0-9.5 5.7-18.2 14.4-22s18.9-2.1 25.9 4.4l112 104c4.9 4.5 7.7 10.9 7.7 17.6z"/></svg>

After

Width:  |  Height:  |  Size: 639 B

View file

@ -15,7 +15,6 @@
<file>res/fonts/din1451alt_g.ttf</file>
<file>res/icons/scwx-256.ico</file>
<file>res/icons/scwx-256.png</file>
<file>res/icons/font-awesome-6/angle-down-solid.svg</file>
<file>res/icons/font-awesome-6/angle-left-solid.svg</file>
<file>res/icons/font-awesome-6/angle-right-solid.svg</file>
<file>res/icons/font-awesome-6/backward-step-solid.svg</file>
@ -29,6 +28,8 @@
<file>res/icons/font-awesome-6/play-solid.svg</file>
<file>res/icons/font-awesome-6/rotate-left-solid.svg</file>
<file>res/icons/font-awesome-6/sliders-solid.svg</file>
<file>res/icons/font-awesome-6/square-caret-down-regular.svg</file>
<file>res/icons/font-awesome-6/square-caret-right-regular.svg</file>
<file>res/icons/font-awesome-6/square-minus-regular.svg</file>
<file>res/icons/font-awesome-6/square-plus-regular.svg</file>
<file>res/palettes/wct/CC.pal</file>

View file

@ -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,
QObject::connect(
self_->ui->titleButton,
&QAbstractButton::toggled,
self_,
[this](bool checked)
{
if (checked)
{
self_->Expand();
}
else
{
self_->Collapse();
}
});
[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

View file

@ -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>