I am writing a text editor on qt and I stumbled with a problem of saving changes of the files. I use rich texedit to make changes with colors, but when I change colors of selected words and save file, it doesn't save color changes.
I know that I can make something like config.txt file, where app can automatically wright changes, but this will make global changes, and I want to save changes for every individual file.
Can it be done?
Remark: Word office can save individual changes so 1.doc and 2.doc differ by its formatting.
void MainWindow::on_actionFont_triggered()
{
bool ok;
QFont font = QFontDialog::getFont(&ok,QFont("Palatino Linotype",12,QFont::Normal),this);
if(ok)
ui->textEdit->setFont(font);
}
void MainWindow::on_actionText_Color_triggered()
{
QColor color = QColorDialog::getColor(Qt::white,this);
if(color.isValid())
ui->textEdit->setTextColor(color);
}
void MainWindow::on_actionBackground_Color_triggered()
{
QColor color = QColorDialog::getColor(Qt::white,this);
QPalette palette;
palette.setColor(QPalette::Base,color);
if(color.isValid())
ui->textEdit->setPalette(palette);
}