Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] What are the differences between TextField and TextInput. Also TextArea and TextEdit?
QtWS25 Last Chance

[Solved] What are the differences between TextField and TextInput. Also TextArea and TextEdit?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 19.3k Views
  • 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.
  • F Offline
    F Offline
    fxam
    wrote on 13 May 2014, 16:46 last edited by
    #1

    Both TextField and TextInput are single line text edit.
    TextInput seems to have more functions than TextField.

    Both TextArea and TextEdit support multi-lines text edit.
    And the functions are similar.

    I don't understand, why two sets of edit controls? Which one should I use?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hawk30100
      wrote on 14 May 2014, 06:36 last edited by
      #2

      TextEdit and TextInput are derived classes from ... QWidget

      I think TextArea and TextField was added with QtQuickControls.
      They are derived classes from ... QQuickItem.

      bq. Which one should I use?

      Just have a look on this page, maybe it will help you:
      http://qt-project.org/doc/qt-5/topics-ui.html#comparison

      The decision between QtQuick and QtWidgets depends on your usage.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jens
        wrote on 14 May 2014, 09:11 last edited by
        #3

        Hawk: not really. I believe he refers to the controls vs the built-int Qt Quick primitives. Which one to use depends on your the case:

        TextField and TextArea are fully developed controls complete with native or custom styling that can be directly used in layouts or forms without you providing anything else. If you are coming from the widget world, this is most likely what you are looking for. They generally have a somewhat simpler API because they will implicitly adopt the behavior from the platform they are used on.

        TextInput and TextEdit are only primitives. They provide a more extensive api but require you to provide your own background, frame, size hint and default behavior. If you are building your own component set for instance in a custom car dashboard or similar this is probably what you want to use.

        I could probably add that TextField and TextEdit make use of TextInput and TextArea as part of their implementation.

        1 Reply Last reply
        2
        • F Offline
          F Offline
          fxam
          wrote on 14 May 2014, 13:08 last edited by
          #4

          [quote author="Hawk30100" date="1400049362"]TextEdit and TextInput are derived classes from ... QWidget

          I think TextArea and TextField was added with QtQuickControls.
          They are derived classes from ... QQuickItem.
          [/quote]
          Thanks Hawk, but Jens was right, I wasn't talking about QWidget at all :)

          [quote author="Jens" date="1400058672"]
          I could probably add that TextField and TextEdit make use of TextInput and TextArea as part of their implementation.[/quote]
          Thanks Jens! Realizing that a TextField actually embeds a TextInput, and a TextArea actually embeds a TextEdit clears lots of doubt :)

          For those interested, you can see how TextField and TextArea are implemented here:
          C:\Qt\Qt5.2.1\5.2.1\Src\qtquickcontrols\src\controls\TextField.qml
          C:\Qt\Qt5.2.1\5.2.1\Src\qtquickcontrols\src\controls\TextArea.qml

          1 Reply Last reply
          1

          1/4

          13 May 2014, 16:46

          • Login

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