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. Custom copying
Qt 6.11 is out! See what's new in the release blog

Custom copying

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.2k 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.
  • T Offline
    T Offline
    tomasz_grobelny
    wrote on last edited by
    #1

    Is it possible to change what happens when user wants to copy selected text from QLineEdit? I would like to have text like "1234 1234" visible in the line edit box but copy it as "12341234" (without the space). Is this possible? If so, how do I start?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      I think that you should play with QClipboard class. Also there is a more complex way: look into qt sources, find how is clipboard handled in QTextEdit and change it in derived class.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomasz_grobelny
        wrote on last edited by
        #3

        QTextEdit class has createMimeDataFromSelection() method overriding which should do what I want. But I need an equivalent solution for QLineEdit (I need to use it in QDateEdit).

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          Oops, sorry, I meant that you can look int Qt sources how does QLineEdit handle it :)

          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