mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 00:30:25 +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->DockArea->addDockWidget(DockWidget);
|
||||||
d->DockWidget->sideTabWidget()->updateOrientationAndSpacing(d->SideTabBarArea);
|
d->DockWidget->sideTabWidget()->updateOrientationAndSpacing(d->SideTabBarArea);
|
||||||
qDebug() << "DockWidget->size(): " << DockWidget->size();
|
|
||||||
// The initial size should be a little bit bigger than the original dock
|
// 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
|
// area size to prevent that the resize handle of this auto hid dock area
|
||||||
// is near of the splitter of the old dock area.
|
// is near of the splitter of the old dock area.
|
||||||
@ -454,7 +453,7 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
|||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "CAutoHideDockContainer::collapseView " << Enable;
|
ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable);
|
||||||
d->DockWidget->sideTabWidget()->updateStyle();
|
d->DockWidget->sideTabWidget()->updateStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2098,29 +2098,27 @@ void CDockContainerWidget::createRootSplitter()
|
|||||||
void CDockContainerWidget::createSideTabBarWidgets()
|
void CDockContainerWidget::createSideTabBarWidgets()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
auto leftLayout = new QVBoxLayout();
|
auto Area = CDockWidgetSideTab::Left;
|
||||||
d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this, Qt::Vertical);
|
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||||
leftLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Left]);
|
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 0);
|
||||||
leftLayout->addStretch(1);
|
|
||||||
d->Layout->addLayout(leftLayout, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto rightLayout = new QVBoxLayout();
|
auto Area = CDockWidgetSideTab::Right;
|
||||||
d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this, Qt::Vertical);
|
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||||
rightLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Right]);
|
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 2);
|
||||||
rightLayout->addStretch(1);
|
|
||||||
d->Layout->addLayout(rightLayout, 1, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
d->SideTabBarWidgets[CDockWidgetSideTab::Bottom] = new CSideTabBar(this, Qt::Horizontal);
|
auto Area = CDockWidgetSideTab::Bottom;
|
||||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Bottom], 2, 1);
|
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
|
||||||
|
d->Layout->addWidget(d->SideTabBarWidgets[Area], 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
d->SideTabBarWidgets[CDockWidgetSideTab::Top] = new CSideTabBar(this, Qt::Horizontal);
|
auto Area = CDockWidgetSideTab::Top;
|
||||||
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Top], 0, 1);
|
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;
|
return Left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetSideTab::setOrientation(Qt::Orientation Orientation)
|
void CDockWidgetSideTab::setOrientation(Qt::Orientation Orientation)
|
||||||
{
|
{
|
||||||
d->Orientation = Orientation;
|
d->Orientation = Orientation;
|
||||||
CPushButton::setOrientation((Qt::Horizontal == Orientation)
|
CPushButton::setButtonOrientation((Qt::Horizontal == Orientation)
|
||||||
? CPushButton::Horizontal : CPushButton::VerticalTopToBottom);
|
? CPushButton::Horizontal : CPushButton::VerticalTopToBottom);
|
||||||
updateStyle();
|
updateStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
Qt::Orientation CDockWidgetSideTab::orientation() const
|
||||||
|
{
|
||||||
|
return d->Orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area)
|
void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,7 @@ class ADS_EXPORT CDockWidgetSideTab : public CPushButton
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea)
|
Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea)
|
||||||
|
Q_PROPERTY(Qt::Orientation orientation READ orientation)
|
||||||
Q_PROPERTY(bool activeTab READ isActiveTab)
|
Q_PROPERTY(bool activeTab READ isActiveTab)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -109,6 +110,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setOrientation(Qt::Orientation Orientation);
|
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
|
* 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);
|
painter.drawControl(QStyle::CE_PushButton, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPushButton::Orientation CPushButton::orientation() const
|
CPushButton::Orientation CPushButton::buttonOrientation() const
|
||||||
{
|
{
|
||||||
return m_Orientation;
|
return m_Orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPushButton::setOrientation(Orientation orientation)
|
void CPushButton::setButtonOrientation(Orientation orientation)
|
||||||
{
|
{
|
||||||
m_Orientation = orientation;
|
m_Orientation = orientation;
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the current orientation
|
* Returns the current orientation
|
||||||
*/
|
*/
|
||||||
Orientation orientation() const;
|
Orientation buttonOrientation() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the orientation of this button
|
* Set the orientation of this button
|
||||||
*/
|
*/
|
||||||
void setOrientation(Orientation orientation);
|
void setButtonOrientation(Orientation orientation);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *event) override;
|
virtual void paintEvent(QPaintEvent *event) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user