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. QTextEdit and LineFeeds
Forum Updated to NodeBB v4.3 + New Features

QTextEdit and LineFeeds

Scheduled Pinned Locked Moved General and Desktop
6 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.
  • F Offline
    F Offline
    frankp
    wrote on last edited by
    #1

    I'm currently developing an application that has to evaluate a specific QR-Code under linux.
    I'm using a QTextEdit as input widget. The QR-Code consits of serveal lines and it is scanned by a 2D Barcode Scanner. The lines of the QR-Code are separated by a LineFeed (0x0A) character.

    When I read this QR-Code under Emacs or vi, the code appears as expected.(multiple lines), e.g.:
    A
    B
    C
    ...

    When I read the code into a QTextEdit widget, the line breaks disappear (only one long line). e.g.:
    ABC

    I have tested several properties (setAcceptRichText([true, false], setWordWrapMode, setAutoFormatting)) without success.

    Reconfiguring the Scanner or changing the QR-Code is not an option.

    Is there a change to get all lines from the QR-Code into the QTextEdit widget?
    Any suggestions?

    Thanks in advance,
    Frank

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      try QPlainTextEdit widget

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • F Offline
        F Offline
        frankp
        wrote on last edited by
        #3

        I have tested /examples/mainwindows/application, which contains a QPlainTextEdit widget, without success ...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          If you get the QR code in one string you could replace the line feed with carriage return and then set that to your QTextEdit.

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            frankp
            wrote on last edited by
            #5

            A barcode scanner acts like a Human Interface Device. It sends all keys to to the current active application window. Did you mean to subclass the QTextEdit and override the keyPressEvent(QKeyEvent *e) ?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              That would be a good idea to try, yes

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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