diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index c9016a4..115277b 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -576,6 +576,7 @@ CMainWindow::CMainWindow(QWidget *parent) : //CDockManager::setConfigFlag(CDockManager::AlwaysShowTabs, true); CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); + CDockManager::setConfigFlag(CDockManager::AllTabsHaveCloseButton, true); // Now create the dock manager and its content d->DockManager = new CDockManager(this); diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index 2341a1a..e14fffe 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -666,10 +666,7 @@ void CDockWidgetTab::setElideMode(Qt::TextElideMode mode) //============================================================================ void CDockWidgetTab::updateStyle() { - this->style()->unpolish(this); - this->style()->polish(this); - d->TitleLabel->style()->unpolish(d->TitleLabel); - d->TitleLabel->style()->polish(d->TitleLabel); + internal::repolishStyle(this, internal::RepolishDirectChildren); } diff --git a/src/ads.qrc b/src/ads.qrc index e636379..33157a2 100644 --- a/src/ads.qrc +++ b/src/ads.qrc @@ -4,6 +4,6 @@ images/close-button.svg images/close-button-disabled.svg stylesheets/default_linux.css - images/close-button2.svg + images/close-button-focused.svg diff --git a/src/ads_globals.cpp b/src/ads_globals.cpp index 79ad9e1..b185e5e 100644 --- a/src/ads_globals.cpp +++ b/src/ads_globals.cpp @@ -121,7 +121,7 @@ void setButtonIcon(QAbstractButton* Button, QStyle::StandardPixmap StandarPixmap //============================================================================ -void repolishStyle(QWidget* w) +void repolishStyle(QWidget* w, eRepolishChildOptions Options) { if (!w) { @@ -129,6 +129,19 @@ void repolishStyle(QWidget* w) } w->style()->unpolish(w); w->style()->polish(w); + + if (RepolishIgnoreChildren == Options) + { + return; + } + + QList Children = w->findChildren(QString(), + (RepolishDirectChildren == Options) ? Qt::FindDirectChildrenOnly: Qt::FindChildrenRecursively); + for (auto Widget : Children) + { + Widget->style()->unpolish(Widget); + Widget->style()->polish(Widget); + } } } // namespace internal diff --git a/src/ads_globals.h b/src/ads_globals.h index 93430b9..3523be5 100644 --- a/src/ads_globals.h +++ b/src/ads_globals.h @@ -245,11 +245,18 @@ void setButtonIcon(QAbstractButton* Button, QStyle::StandardPixmap StandarPixmap ads::eIcon CustomIconId); +enum eRepolishChildOptions +{ + RepolishIgnoreChildren, + RepolishDirectChildren, + RepolishChildrenRecursively +}; + /** * Calls unpolish() / polish for the style of the given widget to update * stylesheet if a property changes */ -void repolishStyle(QWidget* w); +void repolishStyle(QWidget* w, eRepolishChildOptions Options = RepolishIgnoreChildren); } // namespace internal diff --git a/src/images/close-button-disabled.svg b/src/images/close-button-disabled.svg index 7bce2a8..e213ca7 100644 --- a/src/images/close-button-disabled.svg +++ b/src/images/close-button-disabled.svg @@ -1,6 +1,4 @@ - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" + version="1.1" + id="svg2" + viewBox="0 0 16 16" + height="16px" + width="16px"> + + + + + + + + + + + + + + + + + + + + + + + + + Jemis Mali + + + + + image/svg+xml + + + + + + diff --git a/src/images/close-button2.svg b/src/images/close-button-focused.svg similarity index 83% rename from src/images/close-button2.svg rename to src/images/close-button-focused.svg index c772029..b9a6fad 100644 --- a/src/images/close-button2.svg +++ b/src/images/close-button-focused.svg @@ -7,120 +7,120 @@ 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" - width="16px" - height="16px" - viewBox="0 0 16 16" - id="svg2" - version="1.1" + sodipodi:docname="close-button-focused.svg" inkscape:version="1.0 (4035a4fb49, 2020-05-01)" - sodipodi:docname="close-button2.svg"> + version="1.1" + id="svg2" + viewBox="0 0 16 16" + height="16px" + width="16px"> + width="6" + height="6" + x="0" + y="0" /> + width="6" + height="6" + x="0" + y="0" /> + width="6" + height="6" + x="0" + y="0" /> + width="6" + height="6" + x="0" + y="0" /> + inkscape:document-rotation="0" + inkscape:snap-global="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:bbox-nodes="true" + inkscape:bbox-paths="true" + inkscape:snap-bbox="true" + inkscape:window-maximized="1" + inkscape:window-y="-8" + inkscape:window-x="-8" + inkscape:window-height="1017" + inkscape:window-width="1920" + units="px" + showgrid="true" + inkscape:current-layer="g5228" + inkscape:document-units="px" + inkscape:cy="13.17691" + inkscape:cx="6.2316889" + inkscape:zoom="22.627417" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base"> + id="grid3336" + type="xygrid" /> + position="4,10" /> + position="10,12" /> + position="12,2" /> + position="14,4" /> + inkscape:groupmode="layer" + inkscape:label="Layer 1"> + id="g5228" + transform="translate(628,-140.49998)"> + transform="translate(-628,1176.8622)" /> + dc:date="2016-12-14" + dc:publisher="Iconscout" + dc:description="Menu, Bar, Lines, Option, List, Hamburger, Web" + dc:title="Menu, Bar, Lines, Option, List, Hamburger, Web" + about="https://iconscout.com/legal#licenses"> Jemis Mali @@ -132,7 +132,7 @@ image/svg+xml - + diff --git a/src/images/close-button.svg b/src/images/close-button.svg index e6254df..c772029 100644 --- a/src/images/close-button.svg +++ b/src/images/close-button.svg @@ -1,6 +1,4 @@ - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" + sodipodi:docname="close-button2.svg"> + + + + + + + + + + + + + + + + + + + + + + + + + Jemis Mali + + + + + image/svg+xml + + + + + + diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 7adac0a..23e23be 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -89,7 +89,7 @@ QScrollArea#dockWidgetScrollArea #tabCloseButton { - qproperty-icon: url(:/ads/images/close-button2.svg); + qproperty-icon: url(:/ads/images/close-button.svg); qproperty-iconSize: 16px; } @@ -105,15 +105,27 @@ ads--CDockSplitter::handle /* Focus related styling */ ads--CDockWidgetTab[focused="true"] -{ +{; background: palette(highlight); border-color: palette(highlight); } +ads--CDockWidgetTab[focused="true"] > #tabCloseButton +{ + qproperty-icon: url(:/ads/images/close-button-focused.svg) +} + + ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover { - background: rgba(255, 255, 255, 24); + background: rgba(255, 255, 255, 48); +} + + +ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed +{ + background: rgba(255, 255, 255, 92); }