2017-02-25 05:44:02 +08:00
|
|
|
//============================================================================
|
|
|
|
/// \file DockAreaWidget.cpp
|
|
|
|
/// \author Uwe Kindler
|
|
|
|
/// \date 24.02.2017
|
|
|
|
/// \brief Implementation of CDockAreaWidget class
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
// INCLUDES
|
|
|
|
//============================================================================
|
|
|
|
#include "DockAreaWidget.h"
|
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
#include <QStackedLayout>
|
|
|
|
|
2017-02-25 05:44:02 +08:00
|
|
|
#include "DockContainerWidget.h"
|
2017-02-27 01:13:56 +08:00
|
|
|
#include "DockWidget.h"
|
2017-02-25 05:44:02 +08:00
|
|
|
|
|
|
|
namespace ads
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Private data class of CDockAreaWidget class (pimpl)
|
|
|
|
*/
|
|
|
|
struct DockAreaWidgetPrivate
|
|
|
|
{
|
|
|
|
CDockAreaWidget* _this;
|
2017-02-27 01:13:56 +08:00
|
|
|
QStackedLayout* StackedLayout;
|
2017-02-25 05:44:02 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Private data constructor
|
|
|
|
*/
|
|
|
|
DockAreaWidgetPrivate(CDockAreaWidget* _public);
|
|
|
|
};
|
|
|
|
// struct DockAreaWidgetPrivate
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
DockAreaWidgetPrivate::DockAreaWidgetPrivate(CDockAreaWidget* _public) :
|
|
|
|
_this(_public)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget* parent) :
|
|
|
|
QFrame(parent),
|
|
|
|
d(new DockAreaWidgetPrivate(this))
|
|
|
|
{
|
2017-02-27 01:13:56 +08:00
|
|
|
setStyleSheet("background: yellow;");
|
|
|
|
d->StackedLayout = new QStackedLayout();
|
|
|
|
d->StackedLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
d->StackedLayout->setSpacing(0);
|
|
|
|
setLayout(d->StackedLayout);
|
2017-02-25 05:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockAreaWidget::~CDockAreaWidget()
|
|
|
|
{
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockContainerWidget* CDockAreaWidget::dockContainerWidget() const
|
|
|
|
{
|
|
|
|
QWidget* Parent = parentWidget();
|
|
|
|
while (Parent)
|
|
|
|
{
|
|
|
|
CDockContainerWidget* Container = dynamic_cast<CDockContainerWidget*>(Parent);
|
|
|
|
if (Container)
|
|
|
|
{
|
|
|
|
return Container;
|
|
|
|
}
|
|
|
|
Parent = Parent->parentWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-02-27 01:13:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void CDockAreaWidget::addDockWidget(CDockWidget* DockWidget)
|
|
|
|
{
|
|
|
|
d->StackedLayout->addWidget(DockWidget);
|
|
|
|
}
|
2017-02-25 05:44:02 +08:00
|
|
|
} // namespace ads
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// EOF DockAreaWidget.cpp
|