PDA

View Full Version : modificationChanged() signal will not emit after QTextEdit::setAlignment() called



FinderCheng
9th December 2010, 07:32
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) :
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)));
}

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?

FinderCheng
10th December 2010, 16:59
I have found a solution at http://developer.qt.nokia.com/forums/viewthread/2311/, good luck!