mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +08:00
Removed DockWidget->sideTabWidget()->setProperty("focused", Focused), DockWidget->sideTabWidget()->updateStyle() because it is not required
This commit is contained in:
parent
b70fc7b3e8
commit
ae5a75bc3f
@ -268,6 +268,14 @@ CSideTabBar* CAutoHideDockContainer::sideTabBar() const
|
||||
return parentContainer()->sideTabBar(d->SideTabBarArea);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockWidgetSideTab* CAutoHideDockContainer::sideTab() const
|
||||
{
|
||||
return d->SideTab;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockWidget* CAutoHideDockContainer::dockWidget() const
|
||||
{
|
||||
@ -284,13 +292,13 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
|
||||
}
|
||||
|
||||
d->DockWidget = DockWidget;
|
||||
d->SideTab = DockWidget->sideTabWidget();
|
||||
CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget();
|
||||
if (OldDockArea)
|
||||
{
|
||||
OldDockArea->removeDockWidget(DockWidget);
|
||||
}
|
||||
d->DockArea->addDockWidget(DockWidget);
|
||||
d->DockWidget->sideTabWidget()->updateOrientationAndSpacing(d->SideTabBarArea);
|
||||
|
||||
// Prevent overriding of d->Size parameter when this function is called during
|
||||
// state restoring
|
||||
@ -336,9 +344,10 @@ void CAutoHideDockContainer::cleanupAndDelete()
|
||||
const auto dockWidget = d->DockWidget;
|
||||
if (dockWidget)
|
||||
{
|
||||
dockWidget->sideTabWidget()->removeFromSideTabBar();
|
||||
dockWidget->sideTabWidget()->setParent(dockWidget);
|
||||
dockWidget->sideTabWidget()->hide();
|
||||
auto SideTab = d->SideTab;
|
||||
SideTab->removeFromSideTabBar();
|
||||
SideTab->setParent(dockWidget);
|
||||
SideTab->hide();
|
||||
}
|
||||
|
||||
hide();
|
||||
@ -391,18 +400,16 @@ void CAutoHideDockContainer::toggleView(bool Enable)
|
||||
{
|
||||
if (Enable)
|
||||
{
|
||||
const auto dockWidget = d->DockWidget;
|
||||
if (dockWidget)
|
||||
if (d->SideTab)
|
||||
{
|
||||
dockWidget->sideTabWidget()->show();
|
||||
d->SideTab->show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto dockWidget = d->DockWidget;
|
||||
if (dockWidget)
|
||||
if (d->SideTab)
|
||||
{
|
||||
dockWidget->sideTabWidget()->hide();
|
||||
d->SideTab->hide();
|
||||
}
|
||||
hide();
|
||||
qApp->removeEventFilter(this);
|
||||
@ -429,7 +436,7 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
||||
}
|
||||
|
||||
ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable);
|
||||
d->DockWidget->sideTabWidget()->updateStyle();
|
||||
d->SideTab->updateStyle();
|
||||
}
|
||||
|
||||
|
||||
@ -494,7 +501,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
||||
// because the side tab click handler will call collapseView(). If we
|
||||
// do not ignore this here, then we will collapse the container and the side tab
|
||||
// click handler will uncollapse it
|
||||
auto SideTab = d->DockWidget->sideTabWidget();
|
||||
auto SideTab = d->SideTab;
|
||||
pos = SideTab->mapFromGlobal(me->globalPos());
|
||||
if (SideTab->rect().contains(pos))
|
||||
{
|
||||
|
@ -89,6 +89,11 @@ public:
|
||||
*/
|
||||
CSideTabBar* sideTabBar() const;
|
||||
|
||||
/**
|
||||
* Returns the side tab
|
||||
*/
|
||||
CDockWidgetSideTab* sideTab() const;
|
||||
|
||||
/**
|
||||
* Get's the dock widget in this dock container
|
||||
*/
|
||||
|
@ -1546,7 +1546,6 @@ CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DockWidget->sideTabWidget()->updateOrientationAndSpacing(area);
|
||||
sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget());
|
||||
DockWidget->sideTabWidget()->show();
|
||||
|
||||
|
@ -70,8 +70,6 @@ static void updateDockWidgetFocusStyle(CDockWidget* DockWidget, bool Focused)
|
||||
DockWidget->setProperty("focused", Focused);
|
||||
DockWidget->tabWidget()->setProperty("focused", Focused);
|
||||
DockWidget->tabWidget()->updateStyle();
|
||||
DockWidget->sideTabWidget()->setProperty("focused", Focused);
|
||||
DockWidget->sideTabWidget()->updateStyle();
|
||||
internal::repolishStyle(DockWidget);
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,9 @@ public:
|
||||
CDockAreaWidget* dockAreaWidget() const;
|
||||
|
||||
/**
|
||||
* Returns the side tab widget for this dock
|
||||
* Returns the side tab widget for this dock, if this dock widget is in
|
||||
* a auto hide container. If it is not in a auto hide container, then this
|
||||
* function returns a nullptr,
|
||||
*/
|
||||
CDockWidgetSideTab* sideTabWidget() const;
|
||||
|
||||
|
@ -142,7 +142,7 @@ Qt::Orientation CDockWidgetSideTab::orientation() const
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidgetSideTab::updateOrientationAndSpacing(SideBarLocation area)
|
||||
void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area)
|
||||
{
|
||||
setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical);
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
/**
|
||||
* Update the orientation, visibility and spacing based on the area and the config
|
||||
*/
|
||||
void updateOrientationAndSpacing(SideBarLocation area);
|
||||
void updateOrientationForArea(SideBarLocation area);
|
||||
|
||||
/**
|
||||
* Returns true, if this is the active tab. The tab is active if the auto hide widget is visible
|
||||
|
@ -128,6 +128,7 @@ CSideTabBar::~CSideTabBar()
|
||||
//============================================================================
|
||||
void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab)
|
||||
{
|
||||
SideTab->updateOrientationForArea(d->SideTabArea);
|
||||
SideTab->installEventFilter(this);
|
||||
d->TabsLayout->insertWidget(Index, SideTab);
|
||||
SideTab->setSideTabBar(this);
|
||||
@ -142,7 +143,7 @@ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* Do
|
||||
auto area = sideTabBarArea();
|
||||
qDebug() << "area " << area;
|
||||
Tab->setSideTabBar(this);
|
||||
Tab->updateOrientationAndSpacing(area);
|
||||
Tab->updateOrientationForArea(area);
|
||||
d->TabsLayout->insertWidget(Index, Tab);
|
||||
Tab->show();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user