minor layout and behavior tweaks

This commit is contained in:
Axel Kohlmeyer
2023-07-30 07:23:32 -04:00
parent 05c8d260d9
commit ac9163447c
3 changed files with 27 additions and 31 deletions

View File

@ -27,10 +27,8 @@ CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
connect(this, &CodeEditor::blockCountChanged, this, &CodeEditor::updateLineNumberAreaWidth);
connect(this, &CodeEditor::updateRequest, this, &CodeEditor::updateLineNumberArea);
// connect(this, &CodeEditor::cursorPositionChanged, this, &CodeEditor::highlightCurrentLine);
updateLineNumberAreaWidth(0);
// highlightCurrentLine();
}
int CodeEditor::lineNumberAreaWidth()
@ -78,11 +76,15 @@ void CodeEditor::dropEvent(QDropEvent *event)
if (event->mimeData()->hasUrls()) {
auto file = event->mimeData()->urls()[0].url().remove("file://");
auto gui = dynamic_cast<LammpsGui *>(parent());
if (gui) gui->open_file(file);
if (gui) {
moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
gui->open_file(file);
}
} else if (event->mimeData()->hasText()) {
fprintf(stderr, "Drag - Drop for text block not yet implemented: text=%s\n",
event->mimeData()->text().toStdString().c_str());
}
QPlainTextEdit::dropEvent(event);
}
void CodeEditor::resizeEvent(QResizeEvent *e)