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.
This commit is contained in:
Mark Liversedge
2011-08-10 15:34:50 +01:00
parent c08dae1378
commit 78bb7eb551

View File

@@ -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;