mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Implemented workaround for blurry icons in latest Qt versions
This commit is contained in:
parent
1fccb943fe
commit
a6ed4354a9
@ -116,7 +116,13 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
TabsMenuButton->setObjectName("tabsMenuButton");
|
TabsMenuButton->setObjectName("tabsMenuButton");
|
||||||
TabsMenuButton->setAutoRaise(true);
|
TabsMenuButton->setAutoRaise(true);
|
||||||
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
||||||
TabsMenuButton->setIcon(_this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton));
|
|
||||||
|
QIcon MenuIcon;
|
||||||
|
QPixmap normalPixmap = _this->style()->standardPixmap(
|
||||||
|
QStyle::SP_TitleBarUnshadeButton, 0, TabsMenuButton);
|
||||||
|
MenuIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
|
||||||
|
MenuIcon.addPixmap(normalPixmap, QIcon::Normal);
|
||||||
|
TabsMenuButton->setIcon(MenuIcon);
|
||||||
|
|
||||||
QMenu* TabsMenu = new QMenu(TabsMenuButton);
|
QMenu* TabsMenu = new QMenu(TabsMenuButton);
|
||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
@ -139,7 +145,11 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
UndockButton->setToolTip(QObject::tr("Detach Group"));
|
UndockButton->setToolTip(QObject::tr("Detach Group"));
|
||||||
#endif
|
#endif
|
||||||
UndockButton->setIcon(_this->style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
QIcon UndockIcon;
|
||||||
|
normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarNormalButton, 0, UndockButton);
|
||||||
|
UndockIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
|
||||||
|
UndockIcon.addPixmap(normalPixmap, QIcon::Normal);
|
||||||
|
UndockButton->setIcon(UndockIcon);
|
||||||
UndockButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
UndockButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
TopLayout->addWidget(UndockButton, 0);
|
TopLayout->addWidget(UndockButton, 0);
|
||||||
_this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked()));
|
_this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked()));
|
||||||
@ -148,11 +158,11 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
CloseButton->setObjectName("closeButton");
|
CloseButton->setObjectName("closeButton");
|
||||||
CloseButton->setAutoRaise(true);
|
CloseButton->setAutoRaise(true);
|
||||||
|
|
||||||
// The standard icons do not look good on high DPI screens
|
// The standard icons does not look good on high DPI screens
|
||||||
QIcon CloseIcon = _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton);
|
QIcon CloseIcon;// = _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton);
|
||||||
QPixmap normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, CloseButton);
|
normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, CloseButton);
|
||||||
QPixmap disabledPixmap = internal::createTransparentPixmap(normalPixmap, 0.25);
|
CloseIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
|
||||||
CloseIcon.addPixmap(disabledPixmap, QIcon::Disabled);
|
CloseIcon.addPixmap(normalPixmap, QIcon::Normal);
|
||||||
|
|
||||||
CloseButton->setIcon(CloseIcon);
|
CloseButton->setIcon(CloseIcon);
|
||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
@ -166,6 +176,7 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
|
CloseButton->setIconSize(QSize(16, 16));
|
||||||
TopLayout->addWidget(CloseButton, 0);
|
TopLayout->addWidget(CloseButton, 0);
|
||||||
_this->connect(CloseButton, SIGNAL(clicked()), SLOT(onCloseButtonClicked()));
|
_this->connect(CloseButton, SIGNAL(clicked()), SLOT(onCloseButtonClicked()));
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,10 @@ void DockWidgetTabPrivate::createLayout()
|
|||||||
CloseButton = new tCloseButton();
|
CloseButton = new tCloseButton();
|
||||||
CloseButton->setObjectName("tabCloseButton");
|
CloseButton->setObjectName("tabCloseButton");
|
||||||
// The standard icons do does not look good on high DPI screens
|
// The standard icons do does not look good on high DPI screens
|
||||||
QIcon CloseIcon = _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton);
|
QIcon CloseIcon;
|
||||||
QPixmap normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, CloseButton);
|
QPixmap normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, CloseButton);
|
||||||
QPixmap disabledPixmap = internal::createTransparentPixmap(normalPixmap, 0.25);
|
CloseIcon.addPixmap(normalPixmap, QIcon::Normal);
|
||||||
CloseIcon.addPixmap(disabledPixmap, QIcon::Disabled);
|
CloseIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
|
||||||
CloseButton->setIcon(CloseIcon);
|
CloseButton->setIcon(CloseIcon);
|
||||||
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
CloseButton->setVisible(false);
|
CloseButton->setVisible(false);
|
||||||
|
@ -63,7 +63,7 @@ ads--CDockWidget
|
|||||||
#closeButton,
|
#closeButton,
|
||||||
#undockButton
|
#undockButton
|
||||||
{
|
{
|
||||||
padding: 0 -2px;
|
padding: 0px -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user