[Qt-interest] modificationChanged() signal will not emit after QTextEdit::setAlignment(Qt::AlignJustify) called

程梁 chengliang.soft at gmail.com
Thu Dec 9 07:19:03 CET 2010


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 the key 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.

-- 
Cheng Liang
from: chengliang.soft at gmail.com



More information about the Qt-interest-old mailing list