summaryrefslogtreecommitdiff
path: root/editor/macrowindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'editor/macrowindow.cc')
-rw-r--r--editor/macrowindow.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/editor/macrowindow.cc b/editor/macrowindow.cc
index 761f107..c3f8185 100644
--- a/editor/macrowindow.cc
+++ b/editor/macrowindow.cc
@@ -34,6 +34,7 @@
#include <math.h>
#include "widget.h"
+#include "widgetwrapper.h"
MacroWindow::MacroWindow(Qt::Orientation orientation)
: QFrame()
@@ -47,7 +48,7 @@ MacroWindow::MacroWindow(Qt::Orientation orientation)
}
// layout()->setSpacing(0);
// layout()->setContentsMargins(2,2,2,2);
- show();
+ // show();
dragObject = NULL;
setFrameStyle(QFrame::Box | QFrame::Plain);
@@ -119,11 +120,15 @@ void MacroWindow::dropEvent(QDropEvent *event)
if(event->mimeData()->hasFormat("pracro/widget")) {
int idx = layout()->indexOf(dragObject);
+ /*
QString type = event->mimeData()->data("pracro/widget").data();
QWidget *widget;
if(type == "horizontal") widget = new MacroWindow(Qt::Horizontal);
else if(type == "vertical") widget = new MacroWindow(Qt::Vertical);
else widget = new Widget(type);
+ */
+ QWidget *widget = unwrapWidget(event->mimeData()->data("pracro/widget"));
+ widget->setVisible(true);
((QBoxLayout*)layout())->insertWidget(idx, widget);
delete dragObject;
@@ -181,11 +186,8 @@ void MacroWindow::mousePressEvent(QMouseEvent *event)
QMimeData *mimedata = new QMimeData();
- if(orientation == Qt::Horizontal) {
- mimedata->setData("pracro/widget", "horizontal");
- } else {
- mimedata->setData("pracro/widget", "vertical");
- }
+ mimedata->setData("pracro/widget", wrapWidget(this));
+
drag->setMimeData(mimedata);
QWidget *parent = parentWidget();