refactor: Renames member _splitAreas to _cross.

mod: removes ContainerWiget::set/Orientation() members. Obsolete since
everything is managed over drop areas.
This commit is contained in:
mfreiholz 2016-04-18 07:18:50 +02:00
parent 86c23c6269
commit 9c530dcc58
5 changed files with 17 additions and 34 deletions

View File

@ -29,7 +29,6 @@ class InternalContentData;
class ADS_EXPORT_API ContainerWidget : public QFrame
{
Q_OBJECT
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
friend class SectionContent;
friend class SectionWidget;
@ -45,9 +44,6 @@ public:
// Public API
//
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
/*!
* Adds the section-content <em>sc</em> to this container-widget into the section-widget <em>sw</em>.
* If <em>sw</em> is not NULL, the <em>area</em> is used to indicate how the content should be arranged.

View File

@ -12,8 +12,10 @@ class QGridLayout;
ADS_NAMESPACE_BEGIN
class DropOverlayCross;
// DropOverlay paints a translucent rectangle over another widget.
// It can also show different types of drop area indicators.
/*!
* DropOverlay paints a translucent rectangle over another widget. The geometry
* of the rectangle is based on the mouse location.
*/
class DropOverlay : public QFrame
{
Q_OBJECT
@ -41,7 +43,7 @@ protected:
private:
DropAreas _allowedAreas;
DropOverlayCross* _splitAreas;
DropOverlayCross* _cross;
bool _fullAreaDrop;
QPointer<QWidget> _target;
@ -49,7 +51,7 @@ private:
DropArea _lastLocation;
};
// DropSplitAreas shows a cross with 5 different drop area possibilities.
// DropOverlayCross shows a cross with 5 different drop area possibilities.
class DropOverlayCross : public QWidget
{
Q_OBJECT

View File

@ -67,20 +67,6 @@ ContainerWidget::~ContainerWidget()
_swLookupMapById.clear();
}
Qt::Orientation ContainerWidget::orientation() const
{
return _orientation;
}
void ContainerWidget::setOrientation(Qt::Orientation orientation)
{
if (_orientation != orientation)
{
_orientation = orientation;
emit orientationChanged();
}
}
SectionWidget* ContainerWidget::addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw, DropArea area)
{
if (!sw)

View File

@ -27,7 +27,7 @@ static QWidget* createDropWidget(const QString& img)
DropOverlay::DropOverlay(QWidget* parent) :
QFrame(parent),
_allowedAreas(InvalidDropArea),
_splitAreas(new DropOverlayCross(this)),
_cross(new DropOverlayCross(this)),
_fullAreaDrop(false),
_lastLocation(InvalidDropArea)
{
@ -40,7 +40,7 @@ DropOverlay::DropOverlay(QWidget* parent) :
l->setSpacing(0);
setLayout(l);
_splitAreas->setVisible(false);
_cross->setVisible(false);
setVisible(false);
}
@ -54,9 +54,9 @@ void DropOverlay::setAllowedAreas(DropAreas areas)
return;
_allowedAreas = areas;
_splitAreas->reset();
_splitAreas->move(pos());
_splitAreas->resize(size());
_cross->reset();
_cross->move(pos());
_cross->resize(size());
}
DropAreas DropOverlay::allowedAreas() const
@ -67,9 +67,9 @@ DropAreas DropOverlay::allowedAreas() const
DropArea DropOverlay::cursorLocation() const
{
DropArea loc = InvalidDropArea;
if (_splitAreas)
if (_cross)
{
loc = _splitAreas->cursorLocation();
loc = _cross->cursorLocation();
}
return loc;
}
@ -195,22 +195,22 @@ void DropOverlay::paintEvent(QPaintEvent*)
void DropOverlay::showEvent(QShowEvent*)
{
_splitAreas->show();
_cross->show();
}
void DropOverlay::hideEvent(QHideEvent*)
{
_splitAreas->hide();
_cross->hide();
}
void DropOverlay::resizeEvent(QResizeEvent* e)
{
_splitAreas->resize(e->size());
_cross->resize(e->size());
}
void DropOverlay::moveEvent(QMoveEvent* e)
{
_splitAreas->move(e->pos());
_cross->move(e->pos());
}
///////////////////////////////////////////////////////////////////////

View File

@ -93,7 +93,6 @@ MainWindow::MainWindow(QWidget *parent) :
// ADS - Create main container (ContainerWidget).
_container = new ADS_NS::ContainerWidget();
_container->setOrientation(Qt::Vertical);
#if QT_VERSION >= 0x050000
QObject::connect(_container, &ADS_NS::ContainerWidget::activeTabChanged, this, &MainWindow::onActiveTabChanged);
QObject::connect(_container, &ADS_NS::ContainerWidget::sectionContentVisibilityChanged, this, &MainWindow::onSectionContentVisibilityChanged);