Skip to content

Commit

Permalink
force modified line update upon save
Browse files Browse the repository at this point in the history
the capture modified line function is called by the program save
function to force any modified line to be emitted before the program
is saved, which required this function to be made public
  • Loading branch information
thunder422 committed Mar 9, 2013
1 parent 93c856d commit 0561cc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion editbox.h
Expand Up @@ -40,6 +40,7 @@ class EditBox : public QPlainTextEdit
void selectAll(void);
void resetModified(void);
void setPlainText(const QString &text);
void captureModifiedLine(void);

int lineNumberWidgetWidth(void);
void paintLineNumberWidget(QPaintEvent *event);
Expand All @@ -62,7 +63,6 @@ private slots:

private:
bool pasteSelection(const QPoint &pos = QPoint());
void captureModifiedLine(void);

enum {
BaseLineNumber = 0 // number of first line
Expand Down
3 changes: 3 additions & 0 deletions mainwindow.cpp
Expand Up @@ -405,6 +405,9 @@ bool MainWindow::programSave(const QString &programPath)
{
QFile file(programPath);

// make sure any current modified line is emitted from the edit box
m_editBox->captureModifiedLine();

if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
QMessageBox::warning(this, tr("IBCP"), tr("Failed to save file."));
Expand Down

0 comments on commit 0561cc9

Please sign in to comment.