Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions src/EditDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,38 +94,44 @@ void EditDialog::loadData(const QByteArray& data)
case Null:
switch (editMode) {
case TextEditor:
// The text widget buffer is now the main data source
dataSource = TextBuffer;

// Empty the text editor contents, then enable text editing
ui->editorText->clear();
ui->editorText->setEnabled(true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused the error, as it indirectly calls the editTextChanged function, but changed all of them as it's safer.


// The text widget buffer is now the main data source
dataSource = TextBuffer;
break;

case HexEditor:
// The hex widget buffer is now the main data source
dataSource = HexBuffer;

// Load the Null into the hex editor
hexEdit->setData(data);

// The hex widget buffer is now the main data source
dataSource = HexBuffer;
break;

case ImageViewer:
// The hex widget buffer is now the main data source
dataSource = HexBuffer;

// Clear any image from the image viewing widget
ui->editorImage->setPixmap(QPixmap(0,0));

// Load the Null into the hex editor
hexEdit->setData(data);

// The hex widget buffer is now the main data source
dataSource = HexBuffer;
break;
}
break;

case Text:
switch (editMode) {
case TextEditor:
// The text widget buffer is now the main data source
dataSource = TextBuffer;

// Load the text into the text editor
textData = QString::fromUtf8(data.constData(), data.size());
ui->editorText->setPlainText(textData);
Expand All @@ -136,20 +142,21 @@ void EditDialog::loadData(const QByteArray& data)
// Select all of the text by default
ui->editorText->selectAll();

// The text widget buffer is now the main data source
dataSource = TextBuffer;

break;

case HexEditor:
// The hex widget buffer is now the main data source
dataSource = HexBuffer;

// Load the text into the hex editor
hexEdit->setData(data);

// The hex widget buffer is now the main data source
dataSource = HexBuffer;
break;

case ImageViewer:
// The text widget buffer is now the main data source
dataSource = TextBuffer;

// Clear any image from the image viewing widget
ui->editorImage->setPixmap(QPixmap(0,0));

Expand All @@ -163,9 +170,6 @@ void EditDialog::loadData(const QByteArray& data)
// Select all of the text by default
ui->editorText->selectAll();

// The text widget buffer is now the main data source
dataSource = TextBuffer;

break;
}
break;
Expand Down Expand Up @@ -200,15 +204,15 @@ void EditDialog::loadData(const QByteArray& data)
break;

default:
// The hex widget buffer is now the main data source
dataSource = HexBuffer;

// The data seems to be general binary data, which is always loaded
// into the hex widget (the only safe place for it)

// Load the data into the hex editor
hexEdit->setData(data);

// The hex widget buffer is now the main data source
dataSource = HexBuffer;

switch (editMode) {
case TextEditor:
// Disable text editing, and use a warning message as the contents
Expand Down