Fixed update of floating widget window title, make disabled close button look nicer, fixed restoring of floating dock container, change save and restore functionality of dock area to save the current dock widget name instead of the current index to ensure that the right dock widget is active in an area if the number of dock widgets changes for some reasons (i.e. in plugin based applications)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
#include <QStyleOptionButton>
|
||||
#include <QPainter>
|
||||
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockAreaWidget.h"
|
||||
@@ -61,6 +62,8 @@ struct DockAreaTitleBarPrivate
|
||||
* Creates the internal TabBar
|
||||
*/
|
||||
void createTabBar();
|
||||
|
||||
QPixmap createTransparentPixmap(const QPixmap& Source);
|
||||
};// struct DockAreaTitleBarPrivate
|
||||
|
||||
|
||||
@@ -73,6 +76,18 @@ DockAreaTitleBarPrivate::DockAreaTitleBarPrivate(CDockAreaTitleBar* _public) :
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QPixmap DockAreaTitleBarPrivate::createTransparentPixmap(const QPixmap& Source)
|
||||
{
|
||||
QPixmap disabledPixmap(Source.size());
|
||||
disabledPixmap.fill(Qt::transparent);
|
||||
QPainter p(&disabledPixmap);
|
||||
p.setOpacity(0.25);
|
||||
p.drawPixmap(0, 0, Source);
|
||||
return disabledPixmap;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void DockAreaTitleBarPrivate::createButtons()
|
||||
{
|
||||
@@ -94,8 +109,13 @@ void DockAreaTitleBarPrivate::createButtons()
|
||||
CloseButton = new tTileBarButton();
|
||||
CloseButton->setObjectName("closeButton");
|
||||
CloseButton->setAutoRaise(true);
|
||||
QIcon CloseIcon(":/ads/close-button.svg");
|
||||
CloseIcon.addFile(":/ads/close-button-disabled.svg", QSize(), QIcon::Disabled);
|
||||
|
||||
// The standard icons do does not look good on high DPI screens
|
||||
QIcon CloseIcon = _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton);
|
||||
QPixmap normalPixmap = _this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, CloseButton);
|
||||
QPixmap disabledPixmap = createTransparentPixmap(normalPixmap);
|
||||
CloseIcon.addPixmap(disabledPixmap, QIcon::Disabled);
|
||||
|
||||
CloseButton->setIcon(CloseIcon);
|
||||
CloseButton->setToolTip(QObject::tr("Close"));
|
||||
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
|
||||
Reference in New Issue
Block a user