Scanf with TextEdit

  • Hi,

    I have a problem with qt creator. I study on "textEdit". I want to do "scanf" with textedit. Is it possible?

  • Not sure i understand completely your question,
    Something like this would help :

    class CMyMainWindow

    private slots:
    void nameChanged();

    QTextEdit m_textEditName;
    QString m_theName;

    connect (m_textEditName, SIGNAL(textChanged()), this, SLOT(nameChanged()));

    void CMyMainWindow::nameChanged()
    m_theName = m_textEditName->toPlainText();

    The slot function "nameChanged()" will be called every time the textEdit is modified, updating the filed member "m_theName" (Thank to the "connect")

    (Perhaps a QLineEdit would be more suitable, no ?)

  • In Qt we don't use the function "scanf", you can give what is there in a variable or you can work just wich is in the line edit or text edit.

    in line edit be this:


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.