Continued refactoring, created private ContainerWidget class

This commit is contained in:
Uwe Kindler
2017-01-21 22:22:20 +01:00
parent 889d9bff5b
commit 3fd20fad16
10 changed files with 148 additions and 188 deletions

View File

@@ -15,36 +15,13 @@ class QGridLayout;
#include "ads/SectionContent.h"
#include "ads/FloatingWidget.h"
#include "ads/Serialization.h"
#include "ContainerWidget_p.h"
ADS_NAMESPACE_BEGIN
class SectionWidget;
class DropOverlay;
class InternalContentData;
struct ContainerWidgetPrivate
{
// Elements inside container.
QList<SectionWidget*> sections;
QList<FloatingWidget*> floatings;
QHash<int, HiddenSectionItem> hiddenSectionContents;
// Helper lookup maps, restricted to this container.
QHash<int, SectionContent::WeakPtr> scLookupMapById;
QHash<QString, SectionContent::WeakPtr> scLookupMapByName;
QHash<int, SectionWidget*> swLookupMapById;
// Layout stuff
QGridLayout* mainLayout = nullptr;;
Qt::Orientation orientation = Qt::Horizontal;
QPointer<QSplitter> splitter; // $mfreiholz: I'd like to remove this variable entirely,
// because it changes during user interaction anyway.
// Drop overlay stuff.
QPointer<DropOverlay> dropOverlay;
};
/*!
* ContainerWidget is the main container to provide the docking
@@ -130,13 +107,6 @@ public:
// Advanced Public API
// You usually should not need access to this methods
//
// Outer DropAreas
QRect outerTopDropRect() const;
QRect outerRightDropRect() const;
QRect outerBottomDropRect() const;
QRect outerLeftDropRect() const;
/*!
* \brief contents
* \return List of known SectionContent for this ContainerWidget.

View File

@@ -0,0 +1,57 @@
#ifndef ContainerWidget_pH
#define ContainerWidget_pH
//============================================================================
/// \file ContainerWidget_p.h
/// \author Uwe Kindler
/// \date 21.01.2017
/// \brief Declaration of
//============================================================================
//============================================================================
// INCLUDES
//============================================================================
#include <QList>
#include <QHash>
#include <QPointer>
#include <QGridLayout>
#include <QSplitter>
#include "ads/DropOverlay.h"
namespace ads
{
class SectionWidget;
class FloatingWidget;
class HiddenSectionItem;
struct ContainerWidgetPrivate
{
// Elements inside container.
QList<SectionWidget*> sections;
QList<FloatingWidget*> floatings;
QHash<int, HiddenSectionItem> hiddenSectionContents;
// Helper lookup maps, restricted to this container.
QHash<int, SectionContent::WeakPtr> SectionContentIdMap;
QHash<QString, SectionContent::WeakPtr> SectionContentNameMap;
QHash<int, SectionWidget*> SectionWidgetIdMap;
// Layout stuff
QGridLayout* mainLayout = nullptr;
Qt::Orientation orientation = Qt::Horizontal;
QPointer<QSplitter> splitter; // $mfreiholz: I'd like to remove this variable entirely,
// because it changes during user interaction anyway.
// Drop overlay stuff.
QPointer<DropOverlay> dropOverlay;
QWidget* LeftBorderDropArea;
};
} // namespace ads
//---------------------------------------------------------------------------
#endif // ContainerWidget_pH

View File

@@ -27,9 +27,6 @@ public:
void setAllowedAreas(DropAreas areas);
DropAreas allowedAreas() const;
void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
DropArea cursorLocation() const;
DropArea showDropOverlay(QWidget* target);
@@ -51,12 +48,9 @@ protected:
private:
DropAreas _allowedAreas;
DropOverlayCross* _cross;
bool _fullAreaDrop;
QPointer<QWidget> _target;
QRect _targetRect;
DropArea _lastLocation;
QWidget* m_LeftBorderDropArea;
};
/*!