diff --git a/mainwindow.cpp b/mainwindow.cpp index 9d49985..73e2763 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -74,7 +74,7 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(renderNextSheet())); connect(fontDialog, SIGNAL(fontReady()), - ui->svgView, SLOT(loadFont())); + this, SLOT(updateCurrentSheet())); errorMessage->setModal(true); ui->toolBar->actions()[ToolButton::Render]->setShortcut(Qt::ControlModifier + Qt::Key_R); @@ -278,6 +278,13 @@ void MainWindow::renderPreviousSheet() showSheetNumber(currentSheetNumber); } +void MainWindow::updateCurrentSheet() +{ + ui->svgView->loadFont(); + int lettersToTheEnd = text.length() - sheetPointers.at(currentSheetNumber); + ui->svgView->renderText(QStringRef(&text, sheetPointers.at(currentSheetNumber), lettersToTheEnd)); +} + void MainWindow::loadFont() { QString fileName = QFileDialog::getOpenFileName(0, tr("Open"), "", diff --git a/mainwindow.h b/mainwindow.h index 541608e..30f73aa 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -78,6 +78,7 @@ private slots: void renderFirstSheet(); void renderNextSheet(); void renderPreviousSheet(); + void updateCurrentSheet(); void loadFont(); void saveSheet(QString fileName = QString()); void saveAllSheets();