Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Silly newb question, regarding text inputs and the return key
Qt 6.11 is out! See what's new in the release blog

Silly newb question, regarding text inputs and the return key

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.4k 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.
  • S Offline
    S Offline
    SavageTwinky
    wrote on last edited by
    #1

    So I've got a chat program up and running, with a friends list, individual windows per chat, all i want to do is set up the chat widget to send on enter while entering text in the input, and not add a \n to the text.

    This is a pretty simple task but its completely eluded me so far

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      You have 2 choices : subclass from QTextEdit (or other inputwidget) and add your functionality in keyPressEvent() or install eventFilter without subclassing.

      "I suggest you to read this :":http://developer.qt.nokia.com/doc/qt-4.7/eventsandfilters.html

      There are plenty of examples there.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        "Here is a good chat network example :":http://developer.qt.nokia.com/doc/qt-4.7/network-network-chat.html#id-5c32885a-244d-40f7-95b1-054e0e80ffb7

        There they use signal slots

        Qt Certified Specialist
        www.edalsolutions.be

        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