Switched to ToolButton instead of PushButtons for Close- and TabsMenu button in dock area title bar

This commit is contained in:
Uwe Kindler 2018-11-01 09:07:10 +01:00
parent 3f5697554a
commit a9246f7ce4
3 changed files with 9 additions and 7 deletions

View File

@ -32,7 +32,7 @@
namespace ads namespace ads
{ {
using tTileBarButton = QPushButton; using tTileBarButton = QToolButton;
/** /**
* Private data class of CDockAreaTitleBar class (pimpl) * Private data class of CDockAreaTitleBar class (pimpl)
*/ */
@ -78,7 +78,8 @@ void DockAreaTitleBarPrivate::createButtons()
{ {
TabsMenuButton = new tTileBarButton(); TabsMenuButton = new tTileBarButton();
TabsMenuButton->setObjectName("tabsMenuButton"); TabsMenuButton->setObjectName("tabsMenuButton");
TabsMenuButton->setFlat(true); TabsMenuButton->setAutoRaise(true);
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
TabsMenuButton->setIcon(_this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton)); TabsMenuButton->setIcon(_this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton));
TabsMenuButton->setMaximumWidth(TabsMenuButton->iconSize().width()); TabsMenuButton->setMaximumWidth(TabsMenuButton->iconSize().width());
@ -92,7 +93,7 @@ void DockAreaTitleBarPrivate::createButtons()
CloseButton = new tTileBarButton(); CloseButton = new tTileBarButton();
CloseButton->setObjectName("closeButton"); CloseButton->setObjectName("closeButton");
CloseButton->setFlat(true); CloseButton->setAutoRaise(true);
QIcon CloseIcon(":/ads/close-button.svg"); QIcon CloseIcon(":/ads/close-button.svg");
CloseIcon.addFile(":/ads/close-button-disabled.svg", QSize(), QIcon::Disabled); CloseIcon.addFile(":/ads/close-button-disabled.svg", QSize(), QIcon::Disabled);
CloseButton->setIcon(CloseIcon); CloseButton->setIcon(CloseIcon);

View File

@ -271,7 +271,6 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
CDockAreaWidget* DockArea = DockContainer->dockArea(i); CDockAreaWidget* DockArea = DockContainer->dockArea(i);
QString DockWidgetName = DockArea->property("currentDockWidget").toString(); QString DockWidgetName = DockArea->property("currentDockWidget").toString();
CDockWidget* DockWidget = _this->findDockWidget(DockWidgetName); CDockWidget* DockWidget = _this->findDockWidget(DockWidgetName);
std::cout << "restore DockWIdgetName " << DockWidget->objectName().toStdString() << std::endl;
if (!DockWidget->isClosed()) if (!DockWidget->isClosed())
{ {
DockArea->internalSetCurrentDockWidget(DockWidget); DockArea->internalSetCurrentDockWidget(DockWidget);

View File

@ -58,12 +58,14 @@ ads--CDockWidget
border-width: 1px 0 0 0; border-width: 1px 0 0 0;
} }
QPushButton#closeButton, #closeButton,
QPushButton#tabsMenuButton #tabsMenuButton
{ {
padding: 2px; padding: 0px;
} }
QScrollArea#dockWidgetScrollArea QScrollArea#dockWidgetScrollArea
{ {
padding: 0px; padding: 0px;