Commit 315a3ebd authored by hjk's avatar hjk

Debugger: make breakpoint markers draggable

Change-Id: I6139badeb8cb8b20e653ce9f6685c0e577123617
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 16c5a149
......@@ -37,6 +37,7 @@
#include "debuggerstringutils.h"
#include "stackframe.h"
#include <extensionsystem/invoker.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
......@@ -1258,6 +1259,25 @@ void BreakHandler::updateLineNumberFromMarker(BreakpointModelId id, int lineNumb
emit layoutChanged();
}
void BreakHandler::changeLineNumberFromMarker(BreakpointModelId id, int lineNumber)
{
// We need to delay this as it is called from a marker which will be destroyed.
ExtensionSystem::InvokerBase invoker;
invoker.addArgument(id);
invoker.addArgument(lineNumber);
invoker.setConnectionType(Qt::QueuedConnection);
invoker.invoke(this, "changeLineNumberFromMarkerHelper");
QTC_CHECK(invoker.wasSuccessful());
}
void BreakHandler::changeLineNumberFromMarkerHelper(BreakpointModelId id, int lineNumber)
{
BreakpointParameters data = breakpointData(id);
data.lineNumber = lineNumber;
removeBreakpoint(id);
appendBreakpoint(data);
}
BreakpointModelIds BreakHandler::allBreakpointIds() const
{
BreakpointModelIds ids;
......
......@@ -133,6 +133,7 @@ public:
void setEnabled(BreakpointModelId id, bool on);
void updateFileNameFromMarker(BreakpointModelId id, const QString &fileName);
void updateLineNumberFromMarker(BreakpointModelId id, int lineNumber);
void changeLineNumberFromMarker(BreakpointModelId id, int lineNumber);
void setMarkerFileAndLine(BreakpointModelId id,
const QString &fileName, int lineNumber);
bool isOneShot(BreakpointModelId id) const;
......@@ -189,6 +190,7 @@ private:
void loadBreakpoints();
void saveBreakpoints();
void cleanupBreakpoint(BreakpointModelId id);
Q_SLOT void changeLineNumberFromMarkerHelper(Debugger::Internal::BreakpointModelId id, int lineNumber);
struct BreakpointItem
{
......
......@@ -68,6 +68,11 @@ void BreakpointMarker::updateLineNumber(int lineNumber)
breakHandler()->updateLineNumberFromMarker(m_id, lineNumber);
}
void BreakpointMarker::dragToLine(int lineNumber)
{
breakHandler()->changeLineNumberFromMarker(m_id, lineNumber);
}
void BreakpointMarker::updateFileName(const QString &fileName)
{
BaseTextMark::updateFileName(fileName);
......
......@@ -46,6 +46,8 @@ public:
void removedFromEditor();
void updateLineNumber(int lineNumber);
void updateFileName(const QString &fileName);
bool isDraggable() const { return true; }
void dragToLine(int lineNumber);
private:
BreakpointModelId m_id;
......
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