Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Scanf with TextEdit

Scanf with TextEdit

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mertebe
    wrote on last edited by
    #1

    Hi,

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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sraboisson
      wrote on last edited by
      #2

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

      @
      class CMyMainWindow
      {
      public:
      CMyMainWindow()
      init();

      private slots:
      void nameChanged();

      private:
      QTextEdit m_textEditName;
      QString m_theName;
      }

      CMyMainWindow::int()
      {
      ...
      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 ?)

      1 Reply Last reply
      0
      • F Offline
        F Offline
        felipe.c.sousa
        wrote on last edited by
        #3

        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:

        @ui->lineEdit->text();@

        From all, to all.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved