mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 21:25:44 +08:00
Fixed issue #251 - Window momentarily flashes as floating widget
This commit is contained in:
parent
175b48569f
commit
65058d3a48
@ -146,6 +146,19 @@ struct DockWidgetTabPrivate
|
|||||||
CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the size policy of the close button depending on the
|
||||||
|
* RetainTabSizeWhenCloseButtonHidden feature
|
||||||
|
*/
|
||||||
|
void updateCloseButtonSizePolicy()
|
||||||
|
{
|
||||||
|
auto Features = DockWidget->features();
|
||||||
|
auto SizePolicy = CloseButton->sizePolicy();
|
||||||
|
SizePolicy.setRetainSizeWhenHidden(Features.testFlag(CDockWidget::DockWidgetClosable)
|
||||||
|
&& testConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden));
|
||||||
|
CloseButton->setSizePolicy(SizePolicy);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
|
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
|
||||||
{
|
{
|
||||||
@ -200,7 +213,7 @@ void DockWidgetTabPrivate::createLayout()
|
|||||||
CloseButton->setObjectName("tabCloseButton");
|
CloseButton->setObjectName("tabCloseButton");
|
||||||
internal::setButtonIcon(CloseButton, QStyle::SP_TitleBarCloseButton, TabCloseIcon);
|
internal::setButtonIcon(CloseButton, QStyle::SP_TitleBarCloseButton, TabCloseIcon);
|
||||||
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
_this->onDockWidgetFeaturesChanged();
|
updateCloseButtonSizePolicy();
|
||||||
internal::setToolTip(CloseButton, QObject::tr("Close Tab"));
|
internal::setToolTip(CloseButton, QObject::tr("Close Tab"));
|
||||||
_this->connect(CloseButton, SIGNAL(clicked()), SIGNAL(closeRequested()));
|
_this->connect(CloseButton, SIGNAL(clicked()), SIGNAL(closeRequested()));
|
||||||
|
|
||||||
@ -473,7 +486,7 @@ bool CDockWidgetTab::isActiveTab() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetTab::setActiveTab(bool active)
|
void CDockWidgetTab::setActiveTab(bool active)
|
||||||
{
|
{
|
||||||
d->updateCloseButtonVisibility(active);
|
d->updateCloseButtonVisibility(active);
|
||||||
|
|
||||||
// Focus related stuff
|
// Focus related stuff
|
||||||
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
|
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
|
||||||
@ -656,12 +669,8 @@ bool CDockWidgetTab::event(QEvent *e)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetTab::onDockWidgetFeaturesChanged()
|
void CDockWidgetTab::onDockWidgetFeaturesChanged()
|
||||||
{
|
{
|
||||||
auto Features = d->DockWidget->features();
|
d->updateCloseButtonSizePolicy();
|
||||||
auto SizePolicy = d->CloseButton->sizePolicy();
|
d->updateCloseButtonVisibility(isActiveTab());
|
||||||
SizePolicy.setRetainSizeWhenHidden(Features.testFlag(CDockWidget::DockWidgetClosable)
|
|
||||||
&& d->testConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden));
|
|
||||||
d->CloseButton->setSizePolicy(SizePolicy);
|
|
||||||
d->updateCloseButtonVisibility(isActiveTab());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user