Copy formatted text from line edit and paste in another line edit with same format
How to copy the formatted text from a line edit and paste the text with format in another line edit?
I try with following code.I can able to paste the text but not with format which I apply in the first line edit.
You can try to do this:
You can try with copy() and paste().. methods provided by the lineEdit.
Try this one:
setHtml is the member for textedit not for line edit.
I also try with setText it only copy the text not format
Sorry, my bad. But isn't
QLineEditfor plain text? How do you have a formatted text in it?
How do you have a formatted text in it?
I am also curious about this. QLineEdit doesn't support rich-text/HTML-subset.
So about what formatting do you talk?
intially I give text color in first line using setstylesheet as following code.
ok, you can't transfer this kind of formatting.
Since it's not part of the content itself, but only used for displaying by the widget (QLineEdit)
QLineEdit's public API only support plain text. But internally it actually would support QTextFormats, etc.
Probably it's best if you create your custom widget (based on QTextEdit). Make sure to remove the scrollbar policies, filter the ENTER/RETURN key events and override the sizeHint to make it look like a one-liner text entry like the QLineEdit is.