May 27, 2011

tomasz_grobelny tomasz_grobe..
Lab Rat
23 posts

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?

3 replies

May 27, 2011

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

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.

May 28, 2011

tomasz_grobelny tomasz_grobe..
Lab Rat
23 posts

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

May 28, 2011

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

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

 
  ‹‹ QGraphicsView transparent over another QGraphicsView      QStringList to QByteArray?? ››

You must log in to post a reply. Not a member yet? Register here!