From 78bb7eb551e9673f758cc353bdba1eefabd97add Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 10 Aug 2011 15:34:50 +0100 Subject: [PATCH] Drag and Drop straight onto Layout This patch removes the dialog box that pops up when you drag a chart onto a layout and sets the title of the chart to a default value (which is the chart name). This fixes the drag/drop crash on Windows 7. However, when dragging and dropping on a 64bit Windows 7 there is still a crash, this appears to be in a different part of the code and will require further investigation. Also, since the title is now defaulted it is important that the user has the ability to rename charts once added. This is already registed as bug no. 397. --- src/HomeWindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 0ab071b44..0cc07ef71 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -370,7 +370,7 @@ void HomeWindow::dropEvent(QDropEvent *event) { QStandardItemModel model; - model.dropMimeData(event->mimeData(), Qt::CopyAction, 0,0, QModelIndex()); + model.dropMimeData(event->mimeData(), Qt::CopyAction, -1,-1, QModelIndex()); QString chart = model.data(model.index(0,0), Qt::DisplayRole).toString(); dropPending = false; @@ -381,6 +381,17 @@ HomeWindow::dropEvent(QDropEvent *event) event->accept(); + GcWindow *newone = GcWindowRegistry::newGcWindow(GcWindows[i].id, mainWindow); + newone->setProperty("title", GcWindows[i].name); + newone->setProperty("widthFactor", (double)2.0); + newone->setProperty("heightFactor", (double)2.0); + newone->setProperty("GcWinID", GcWindows[i].id); + if (currentStyle == 2) newone->setResizable(true); + addChart(newone); + newone->show(); + newone->setProperty("ride", property("ride")); + resizeEvent(NULL); +#if 0 // GcWindowDialog is delete on close, so no need to delete GcWindowDialog *f = new GcWindowDialog(GcWindows[i].id, mainWindow); GcWindow *newone = f->exec(); @@ -393,6 +404,7 @@ HomeWindow::dropEvent(QDropEvent *event) // now wipe it delete f; +#endif // before we return lets turn the cursor off chartCursor = -2;