Commit 5498dfbc authored by Ulf Hermann's avatar Ulf Hermann
Browse files

Add support for contents() to BinEditorDocument



Change-Id: I41c7541984ecc5128c8d742ee44f8b3227c671b6
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent e79a7d47
......@@ -63,6 +63,8 @@ public:
Q_INVOKABLE void setSizes(quint64 startAddr, int range, int blockSize = 4096);
int dataBlockSize() const { return m_blockSize; }
QByteArray contents() const { return dataMid(0, m_size); }
Q_INVOKABLE void addData(quint64 block, const QByteArray &data);
bool newWindowRequestAllowed() const { return m_canRequestNewWindow; }
......
......@@ -232,13 +232,19 @@ public:
this, SLOT(provideData(quint64)));
connect(m_widget, SIGNAL(newRangeRequested(quint64)),
this, SLOT(provideNewRange(quint64)));
connect(m_widget, &BinEditorWidget::dataChanged, this, &IDocument::contentsChanged);
}
QByteArray contents() const override
{
return m_widget->contents();
}
bool setContents(const QByteArray &contents) override
{
if (!contents.isEmpty())
return false;
m_widget->clear();
m_widget->setSizes(0, contents.length(), contents.length());
m_widget->addData(0, contents);
return true;
}
......
Supports Markdown
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