Qt World Summit: Submit your Presentation

QTextEdit and predictive input mode

  • Hi,

    How can I change the default input mode in QTextEdit to start input from the upper case (like the default input method in Symbian UI). Now the default input mode is lowercase.

    Also when I use predictive text input, than I fail to start the word from the uppercase letter. I'm able to type uppercase letter in the middle of the word, but when I try to make the first letter uppercase, it automatically sets to lowercase.

    Is this a Qt bug or mine ?

    Thanks in advance,


    I've found some other issues, regarding this problem. To be concrete, I wrote some test code, and you could download the sources and binaries from "here":http://bit.ly/c5xPdc

    This test shows the fullscreen QTextEdit widget, where you can type any sort of text and the 'Show' softkey. This softkey shows the message box with the text, from the editor widget. The code is simple, and doesn't set up any widget's properties.

    Now, ensure that T9 is on and try to do with this application the following:

    • Write A Sentence Where Each Word Starts From Capital Letter (I can't do this)

    • Start the new sentence from the lowercase letter (Ensure you've typed dot and space before)

    • Start the first word in the editor from the uppercase letter.

    • Write a single word, without the trailing spaces and press 'Show' button (It shows me nothing, only the second press on 'Show' shows me the word).

    This code was tested on Nokia 5800 XpressMusic and N8 against Qt 4.6.3 library. And I also couldn't find any opened bugs related to this issue.

    And here is the code:

    #include <QTextEdit>
    #include <QMainWindow>

    class T9Test : public QMainWindow
    T9Test(QWidget* parent = 0);

    private slots:
    void showText();

    QTextEdit* textField_;

    #include "main.h"
    #include <QMessageBox>
    #include <QAction>
    #include <QApplication>

    T9Test::T9Test(QWidget* parent):QMainWindow(parent)
    textField_ = new QTextEdit;

    QAction* show = new QAction("Show", this);
    connect(show, SIGNAL(triggered()), this, SLOT(showText()));

    void T9Test::showText()
    QMessageBox::information(this, "Text", textField_->toPlainText());

    int main (int argc, char** argv)
    QApplication app(argc, argv);

    T9Test wnd;


    return app.exec();

  • Hi,
    Did you try changing the "inputMethodHints":http://doc.qt.nokia.com/4.7/qwidget.html#inputMethodHints-prop? It's a QWidget method, so QTextEdit inherits it. Take a look at the "flags":http://doc.qt.nokia.com/4.7/qt.html#InputMethodHint-enum , test it and post your results here.

  • Thanks for your reply, Anselmo,

    Looks like I've found a problem. When I've set ImhPreferUppercase, by default input mode was set to uppercase letters, but when I try to change the default case when predictive input is on, it returns to the uppercase again. So it is the similar bug to the previous, and I tend to think it is something in Qt.

    Best regards,

  • You may also look into "QTBUG-10006":http://bugreports.qt.nokia.com/browse/QTBUG-10006 which led to some corrections in the flags.

    [edit: Link fixed / Denis Kormalev]

Log in to reply