Commit 3cb783f7 authored by hjk's avatar hjk
Browse files

debugger: allow drag&drop from main editor to watchers view

parent 918cac90
......@@ -122,6 +122,9 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
setIndentation(indentation() * 9/10);
setUniformRowHeights(true);
setItemDelegate(new WatchDelegate(this));
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
connect(this, SIGNAL(expanded(QModelIndex)),
this, SLOT(expandNode(QModelIndex)));
......@@ -161,6 +164,35 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
QTreeView::keyPressEvent(ev);
}
void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
{
//QTreeView::dragEnterEvent(ev);
if (ev->mimeData()->hasFormat("text/plain")) {
ev->setDropAction(Qt::CopyAction);
ev->accept();
}
}
void WatchWindow::dragMoveEvent(QDragMoveEvent *ev)
{
//QTreeView::dragMoveEvent(ev);
if (ev->mimeData()->hasFormat("text/plain")) {
ev->setDropAction(Qt::CopyAction);
ev->accept();
}
}
void WatchWindow::dropEvent(QDropEvent *ev)
{
if (ev->mimeData()->hasFormat("text/plain")) {
theDebuggerAction(WatchExpression)->trigger(ev->mimeData()->text());
//ev->acceptProposedAction();
ev->setDropAction(Qt::CopyAction);
ev->accept();
}
//QTreeView::dropEvent(ev);
}
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
......
......@@ -64,6 +64,10 @@ private:
void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
void dragEnterEvent(QDragEnterEvent *ev);
void dropEvent(QDropEvent *ev);
void dragMoveEvent(QDragMoveEvent *ev);
void editItem(const QModelIndex &idx);
void reset(); /* reimpl */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment