Skip to content

Commit 1dfabb3

Browse files
author
Uwe Kindler
committed
Fixed handling of dock area removal in floating dock container, added close-button.svg icon to enable display of disabled close button
1 parent 6617cf6 commit 1dfabb3

File tree

6 files changed

+321
-22
lines changed

6 files changed

+321
-22
lines changed

src/DockAreaTitleBar.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,9 @@ void DockAreaTitleBarPrivate::createButtons()
9393
CloseButton = new tTileBarButton();
9494
CloseButton->setObjectName("closeButton");
9595
CloseButton->setFlat(true);
96-
QPixmap ClosePixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
97-
QIcon CloseIcon;
98-
QStyleOptionButton option;
99-
option.initFrom(CloseButton);
100-
QPixmap ClosePixmapDisabled = _this->style()->generatedIconPixmap(QIcon::Disabled, ClosePixmap, &option);
101-
CloseIcon.addPixmap(ClosePixmap, QIcon::Active);
102-
CloseIcon.addPixmap(ClosePixmapDisabled, QIcon::Disabled);
96+
QIcon CloseIcon(":/ads/close-button.svg");
97+
CloseIcon.addFile(":/ads/close-button-disabled.svg", QSize(), QIcon::Disabled);
10398
CloseButton->setIcon(CloseIcon);
104-
//CloseButton->setIcon(QIcon(":/ads/close.svg"));
10599
CloseButton->setToolTip(QObject::tr("Close"));
106100
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
107101
TopLayout->addWidget(CloseButton, 0);

src/FloatingDockContainer.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -460,19 +460,7 @@ void CFloatingDockContainer::moveFloating()
460460
//============================================================================
461461
bool CFloatingDockContainer::isClosable() const
462462
{
463-
auto OpenDockAreas = d->DockContainer->openedDockAreas();
464-
for (auto DockArea : OpenDockAreas)
465-
{
466-
auto OpenDockWidgets = DockArea->openedDockWidgets();
467-
for (auto DockWidget : OpenDockWidgets)
468-
{
469-
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetClosable))
470-
{
471-
return false;
472-
}
473-
}
474-
}
475-
return true;
463+
return d->DockContainer->features().testFlag(CDockWidget::DockWidgetClosable);
476464
}
477465

478466

@@ -482,7 +470,7 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
482470
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
483471
if (d->DockContainer->visibleDockAreaCount() == 1)
484472
{
485-
d->SingleDockArea = topLevelDockWidget()->dockAreaWidget();
473+
d->SingleDockArea = d->DockContainer->openedDockAreas()[0];
486474
this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
487475
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
488476
SLOT(onDockAreaCurrentChanged(int)));

src/ads.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
<qresource prefix="/ads">
33
<file>stylesheets/default.css</file>
44
<file>close.svg</file>
5+
<file>close-button.svg</file>
6+
<file>close-button-disabled.svg</file>
57
</qresource>
68
</RCC>

src/close-button-disabled.svg

Lines changed: 122 additions & 0 deletions
Loading

src/close-button.svg

Lines changed: 119 additions & 0 deletions
Loading

src/close.svg

Lines changed: 74 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)