mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Added properties to auto hide widgets to improve CSS styling options
This commit is contained in:
parent
875a358600
commit
b43770de37
@ -314,7 +314,6 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
|
||||
}
|
||||
d->DockArea->addDockWidget(DockWidget);
|
||||
d->DockWidget->sideTabWidget()->updateOrientationAndSpacing(d->SideTabBarArea);
|
||||
qDebug() << "DockWidget->size(): " << DockWidget->size();
|
||||
// The initial size should be a little bit bigger than the original dock
|
||||
// area size to prevent that the resize handle of this auto hid dock area
|
||||
// is near of the splitter of the old dock area.
|
||||
@ -454,7 +453,7 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
qDebug() << "CAutoHideDockContainer::collapseView " << Enable;
|
||||
ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable);
|
||||
d->DockWidget->sideTabWidget()->updateStyle();
|
||||
}
|
||||
|
||||
|
@ -2098,29 +2098,27 @@ void CDockContainerWidget::createRootSplitter()
|
||||
void CDockContainerWidget::createSideTabBarWidgets()
|
||||
{
|
||||
{
|
||||
auto leftLayout = new QVBoxLayout();
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this, Qt::Vertical);
|
||||
leftLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Left]);
|
||||
leftLayout->addStretch(1);
|
||||
d->Layout->addLayout(leftLayout, 1, 0);
|
||||
auto Area = CDockWidgetSideTab::Left;
|
||||
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 0);
|
||||
}
|
||||
|
||||
{
|
||||
auto rightLayout = new QVBoxLayout();
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this, Qt::Vertical);
|
||||
rightLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Right]);
|
||||
rightLayout->addStretch(1);
|
||||
d->Layout->addLayout(rightLayout, 1, 2);
|
||||
auto Area = CDockWidgetSideTab::Right;
|
||||
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 2);
|
||||
}
|
||||
|
||||
{
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Bottom] = new CSideTabBar(this, Qt::Horizontal);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Bottom], 2, 1);
|
||||
auto Area = CDockWidgetSideTab::Bottom;
|
||||
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[Area], 2, 1);
|
||||
}
|
||||
|
||||
{
|
||||
d->SideTabBarWidgets[CDockWidgetSideTab::Top] = new CSideTabBar(this, Qt::Horizontal);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Top], 0, 1);
|
||||
auto Area = CDockWidgetSideTab::Top;
|
||||
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||
d->Layout->addWidget(d->SideTabBarWidgets[Area], 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,16 +122,24 @@ CDockWidgetSideTab::SideTabBarArea CDockWidgetSideTab::sideTabBarArea() const
|
||||
return Left;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidgetSideTab::setOrientation(Qt::Orientation Orientation)
|
||||
{
|
||||
d->Orientation = Orientation;
|
||||
CPushButton::setOrientation((Qt::Horizontal == Orientation)
|
||||
CPushButton::setButtonOrientation((Qt::Horizontal == Orientation)
|
||||
? CPushButton::Horizontal : CPushButton::VerticalTopToBottom);
|
||||
updateStyle();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
Qt::Orientation CDockWidgetSideTab::orientation() const
|
||||
{
|
||||
return d->Orientation;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area)
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ class ADS_EXPORT CDockWidgetSideTab : public CPushButton
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea)
|
||||
Q_PROPERTY(Qt::Orientation orientation READ orientation)
|
||||
Q_PROPERTY(bool activeTab READ isActiveTab)
|
||||
|
||||
private:
|
||||
@ -109,6 +110,11 @@ public:
|
||||
*/
|
||||
void setOrientation(Qt::Orientation Orientation);
|
||||
|
||||
/**
|
||||
* Returns the current orientation
|
||||
*/
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
/**
|
||||
* Update the orientation, visibility and spacing based on the area and the config
|
||||
*/
|
||||
|
@ -54,12 +54,12 @@ void CPushButton::paintEvent(QPaintEvent *event)
|
||||
painter.drawControl(QStyle::CE_PushButton, option);
|
||||
}
|
||||
|
||||
CPushButton::Orientation CPushButton::orientation() const
|
||||
CPushButton::Orientation CPushButton::buttonOrientation() const
|
||||
{
|
||||
return m_Orientation;
|
||||
}
|
||||
|
||||
void CPushButton::setOrientation(Orientation orientation)
|
||||
void CPushButton::setButtonOrientation(Orientation orientation)
|
||||
{
|
||||
m_Orientation = orientation;
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ public:
|
||||
/**
|
||||
* Returns the current orientation
|
||||
*/
|
||||
Orientation orientation() const;
|
||||
Orientation buttonOrientation() const;
|
||||
|
||||
/**
|
||||
* Set the orientation of this button
|
||||
*/
|
||||
void setOrientation(Orientation orientation);
|
||||
void setButtonOrientation(Orientation orientation);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
|
Loading…
Reference in New Issue
Block a user