Fixed handling of dock area removal in floating dock container, added close-button.svg icon to enable display of disabled close button

This commit is contained in:
Uwe Kindler 2018-10-31 00:50:18 +01:00
parent 6617cf6f19
commit 1dfabb3bef
6 changed files with 321 additions and 22 deletions

View File

@ -93,15 +93,9 @@ void DockAreaTitleBarPrivate::createButtons()
CloseButton = new tTileBarButton();
CloseButton->setObjectName("closeButton");
CloseButton->setFlat(true);
QPixmap ClosePixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
QIcon CloseIcon;
QStyleOptionButton option;
option.initFrom(CloseButton);
QPixmap ClosePixmapDisabled = _this->style()->generatedIconPixmap(QIcon::Disabled, ClosePixmap, &option);
CloseIcon.addPixmap(ClosePixmap, QIcon::Active);
CloseIcon.addPixmap(ClosePixmapDisabled, QIcon::Disabled);
QIcon CloseIcon(":/ads/close-button.svg");
CloseIcon.addFile(":/ads/close-button-disabled.svg", QSize(), QIcon::Disabled);
CloseButton->setIcon(CloseIcon);
//CloseButton->setIcon(QIcon(":/ads/close.svg"));
CloseButton->setToolTip(QObject::tr("Close"));
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
TopLayout->addWidget(CloseButton, 0);

View File

@ -460,19 +460,7 @@ void CFloatingDockContainer::moveFloating()
//============================================================================
bool CFloatingDockContainer::isClosable() const
{
auto OpenDockAreas = d->DockContainer->openedDockAreas();
for (auto DockArea : OpenDockAreas)
{
auto OpenDockWidgets = DockArea->openedDockWidgets();
for (auto DockWidget : OpenDockWidgets)
{
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetClosable))
{
return false;
}
}
}
return true;
return d->DockContainer->features().testFlag(CDockWidget::DockWidgetClosable);
}
@ -482,7 +470,7 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
if (d->DockContainer->visibleDockAreaCount() == 1)
{
d->SingleDockArea = topLevelDockWidget()->dockAreaWidget();
d->SingleDockArea = d->DockContainer->openedDockAreas()[0];
this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
SLOT(onDockAreaCurrentChanged(int)));

View File

@ -2,5 +2,7 @@
<qresource prefix="/ads">
<file>stylesheets/default.css</file>
<file>close.svg</file>
<file>close-button.svg</file>
<file>close-button-disabled.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="512"
height="512"
viewBox="0 0 512 512"
xml:space="preserve"
sodipodi:docname="close-button-disabled.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata897"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs895" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview893"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.85862966"
inkscape:cx="345.29142"
inkscape:cy="32.731258"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<g
id="g860"
transform="matrix(0.71708683,0,0,0.71708683,128,128)"
style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081">
<g
id="close"
style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081">
<polygon
points="357,321.3 214.2,178.5 357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 "
id="polygon857"
style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081" />
</g>
</g>
<g
id="g862"
transform="translate(0,155)">
</g>
<g
id="g864"
transform="translate(0,155)">
</g>
<g
id="g866"
transform="translate(0,155)">
</g>
<g
id="g868"
transform="translate(0,155)">
</g>
<g
id="g870"
transform="translate(0,155)">
</g>
<g
id="g872"
transform="translate(0,155)">
</g>
<g
id="g874"
transform="translate(0,155)">
</g>
<g
id="g876"
transform="translate(0,155)">
</g>
<g
id="g878"
transform="translate(0,155)">
</g>
<g
id="g880"
transform="translate(0,155)">
</g>
<g
id="g882"
transform="translate(0,155)">
</g>
<g
id="g884"
transform="translate(0,155)">
</g>
<g
id="g886"
transform="translate(0,155)">
</g>
<g
id="g888"
transform="translate(0,155)">
</g>
<g
id="g890"
transform="translate(0,155)">
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

119
src/close-button.svg Normal file
View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="512"
height="512"
viewBox="0 0 512 512"
xml:space="preserve"
sodipodi:docname="close-button.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata897"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs895" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview893"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.85862966"
inkscape:cx="345.29142"
inkscape:cy="32.731258"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<g
id="g860"
transform="matrix(0.71708683,0,0,0.71708683,128,128)">
<g
id="close">
<polygon
points="357,321.3 214.2,178.5 357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 "
id="polygon857" />
</g>
</g>
<g
id="g862"
transform="translate(0,155)">
</g>
<g
id="g864"
transform="translate(0,155)">
</g>
<g
id="g866"
transform="translate(0,155)">
</g>
<g
id="g868"
transform="translate(0,155)">
</g>
<g
id="g870"
transform="translate(0,155)">
</g>
<g
id="g872"
transform="translate(0,155)">
</g>
<g
id="g874"
transform="translate(0,155)">
</g>
<g
id="g876"
transform="translate(0,155)">
</g>
<g
id="g878"
transform="translate(0,155)">
</g>
<g
id="g880"
transform="translate(0,155)">
</g>
<g
id="g882"
transform="translate(0,155)">
</g>
<g
id="g884"
transform="translate(0,155)">
</g>
<g
id="g886"
transform="translate(0,155)">
</g>
<g
id="g888"
transform="translate(0,155)">
</g>
<g
id="g890"
transform="translate(0,155)">
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

74
src/close.svg Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
x="0"
y="0"
width="512"
height="512"
version="1.1"
viewBox="0 0 512 512"
id="svg4554"
sodipodi:docname="close.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata4560">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4558" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview4556"
showgrid="false"
inkscape:zoom="1.296875"
inkscape:cx="256"
inkscape:cy="256"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4554" />
<title
id="title4540">close icon</title>
<desc
id="desc4542">close icon from the IconExperience.com G-Collection. Copyright by INCORS GmbH (www.incors.com).</desc>
<path
style="fill:#d74214"
inkscape:connector-curvature="0"
id="path4544"
d="m 48,32 h 416 c 8.8,0 16,7.2 16,16 v 416 c 0,8.8 -7.2,16 -16,16 H 48 c -8.8,0 -16,-7.2 -16,-16 V 48 c 0,-8.8 7.2,-16 16,-16 z" />
<path
style="fill:#bd360c"
inkscape:connector-curvature="0"
id="path4546"
d="m 475.3,36.7 c 2.9,2.9 4.7,6.9 4.7,11.3 v 416 c 0,8.8 -7.2,16 -16,16 H 48 c -4.4,0 -8.4,-1.8 -11.3,-4.7 z" />
<polygon
style="fill:#ffffff"
id="polygon4548"
points="323.9,256 425.7,357.8 357.8,425.7 256,323.9 154.2,425.7 86.3,357.8 188.1,256 86.3,154.2 154.2,86.3 256,188.1 357.8,86.3 425.7,154.2 " />
<polygon
style="fill:#000002;fill-opacity:1"
id="polygon4550"
points="323.9,256 425.7,357.8 357.8,425.7 256,323.9 154.2,425.7 120.25,391.75 391.75,120.25 425.7,154.2 " />
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB