fix: #13 custom drop area widgets

- adds public function to set widgets
- some cleanup changes
This commit is contained in:
mfreiholz
2016-04-18 09:40:51 +02:00
parent 180ed31fc4
commit e04b5c7900
5 changed files with 35 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ DropOverlay::DropOverlay(QWidget* parent) :
l->setSpacing(0);
setLayout(l);
// Cross widget.
// Cross with default drop area widgets.
QHash<DropArea, QWidget*> areaWidgets;
areaWidgets.insert(ADS_NS::TopDropArea, createDropWidget(":/img/split-top.png"));
areaWidgets.insert(ADS_NS::RightDropArea, createDropWidget(":/img/split-right.png"));
@@ -64,8 +64,6 @@ void DropOverlay::setAllowedAreas(DropAreas areas)
_allowedAreas = areas;
_cross->reset();
// _cross->move(pos());
// _cross->resize(size());
}
DropAreas DropOverlay::allowedAreas() const
@@ -73,6 +71,11 @@ DropAreas DropOverlay::allowedAreas() const
return _allowedAreas;
}
void DropOverlay::setAreaWidgets(const QHash<DropArea, QWidget*>& widgets)
{
_cross->setAreaWidgets(widgets);
}
DropArea DropOverlay::cursorLocation() const
{
return _cross->cursorLocation();
@@ -243,7 +246,7 @@ DropOverlayCross::DropOverlayCross(DropOverlay* overlay) :
_widgets()
{
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
setWindowTitle("DropSplitAreas");
setWindowTitle("DropOverlayCross");
setAttribute(Qt::WA_TranslucentBackground);
_grid = new QGridLayout();