mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>
|
||||
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
|
||||
{
|
||||
@ -200,7 +213,7 @@ void DockWidgetTabPrivate::createLayout()
|
||||
CloseButton->setObjectName("tabCloseButton");
|
||||
internal::setButtonIcon(CloseButton, QStyle::SP_TitleBarCloseButton, TabCloseIcon);
|
||||
CloseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
_this->onDockWidgetFeaturesChanged();
|
||||
updateCloseButtonSizePolicy();
|
||||
internal::setToolTip(CloseButton, QObject::tr("Close Tab"));
|
||||
_this->connect(CloseButton, SIGNAL(clicked()), SIGNAL(closeRequested()));
|
||||
|
||||
@ -473,7 +486,7 @@ bool CDockWidgetTab::isActiveTab() const
|
||||
//============================================================================
|
||||
void CDockWidgetTab::setActiveTab(bool active)
|
||||
{
|
||||
d->updateCloseButtonVisibility(active);
|
||||
d->updateCloseButtonVisibility(active);
|
||||
|
||||
// Focus related stuff
|
||||
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
|
||||
@ -656,12 +669,8 @@ bool CDockWidgetTab::event(QEvent *e)
|
||||
//============================================================================
|
||||
void CDockWidgetTab::onDockWidgetFeaturesChanged()
|
||||
{
|
||||
auto Features = d->DockWidget->features();
|
||||
auto SizePolicy = d->CloseButton->sizePolicy();
|
||||
SizePolicy.setRetainSizeWhenHidden(Features.testFlag(CDockWidget::DockWidgetClosable)
|
||||
&& d->testConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden));
|
||||
d->CloseButton->setSizePolicy(SizePolicy);
|
||||
d->updateCloseButtonVisibility(isActiveTab());
|
||||
d->updateCloseButtonSizePolicy();
|
||||
d->updateCloseButtonVisibility(isActiveTab());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user