Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Custom copying



  • 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?



  • 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.



  • 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).



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


Log in to reply