Hi, there! I wonder if you have found this problem. After I called
QTextEdit::setAlignment(Qt::AlignJustify), the textEdit->document()'s
modificationChanged(bool) will not be emitted. I've no idea if this is
my fault or something else. Here is my code:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowTitle(tr("Text[*]"));
ui->textEdit->setAlignment(Qt::AlignJustify);
connect(ui->textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool)));
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowTitle(tr("Text[*]"));
ui->textEdit->setAlignment(Qt::AlignJustify);
connect(ui->textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool)));
}
To copy to clipboard, switch view to plain text mode
If I remove ui->textEdit->setAlignment(Qt::AlignJustify);, everything
is OK. But if this line is not removed, the window title will not be
changed. I think this is because the signal is not emitted. How do I solve this?
Bookmarks