Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist the HideSingleWidgetTitleBar and AllowedAreas state #235

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/DockAreaWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const
auto CurrentDockWidget = currentDockWidget();
QString Name = CurrentDockWidget ? CurrentDockWidget->objectName() : "";
s.writeAttribute("Current", Name);
s.writeAttribute("AllowedAreas", QString::number(allowedAreas()));
s.writeAttribute("HideSingleWidgetTitleBar", QString::number(d->HideSingleWidgetTitleBar));
ADS_PRINT("CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
<< " Current: " << Name);
for (int i = 0; i < d->ContentsLayout->count(); ++i)
Expand Down Expand Up @@ -864,6 +866,12 @@ DockWidgetAreas CDockAreaWidget::allowedAreas() const
return d->AllowedAreas;
}

//============================================================================
bool CDockAreaWidget::isHideSingleWidgetTitleBar()
{
return d->HideSingleWidgetTitleBar;
}

//============================================================================
void CDockAreaWidget::setHideSingleWidgetTitleBar(bool hide)
{
Expand Down
6 changes: 6 additions & 0 deletions src/DockAreaWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ protected slots:
*/
void setHideSingleWidgetTitleBar(bool hide);

/**
* Returns if the title bar will be hidden when there is only one
* dock widget in this area
*/
bool isHideSingleWidgetTitleBar();

/**
* Returns the title bar of this dock area
*/
Expand Down
7 changes: 7 additions & 0 deletions src/DockContainerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,13 +935,20 @@ bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s,
#endif

QString CurrentDockWidget = s.attributes().value("Current").toString();

ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: "
<< CurrentDockWidget);

CDockAreaWidget* DockArea = nullptr;
if (!Testing)
{
DockArea = new CDockAreaWidget(DockManager, _this);
if(s.attributes().value("AllowedAreas").length()){
DockArea->setAllowedAreas((DockWidgetArea)s.attributes().value("AllowedAreas").toInt());
}
if(s.attributes().value("HideSingleWidgetTitleBar").length()){
DockArea->setHideSingleWidgetTitleBar(s.attributes().value("HideSingleWidgetTitleBar").toInt());
}
}

while (s.readNextStartElement())
Expand Down