How to customize QLineEdit like Telegram InputField?
-
I'm keen on customizing QLineEdit like Telegram InputField.
Can any one guide me through?
P.S.
I have tried to saw into Telegram src but it's really hard to read ( -
@artwaw I'm using Widgets. I'm aware that the key is to override paintEvent on subclassed QLineEdit. But dunno what to do next.
@Rustamo You can override but, depending on how much you'd like to mimic to look of the original - which might be hard to do considering the differences between QML and Qt Widgets, you could attempt to insert actions with icons into leading and trailing position if the QLineEdit + apply custom stylesheet.
-
@artwaw I've added style for border and background color but the main problem is when focused placeholder text should animate to label at the top of QLineEdit
-
@artwaw Perhaps I made mistake saying that placeholder needs to animate to QLabel. I saw solutions in QML where Text transforms or transitions using propertyanimations. Is it possible to the same sequence using widgets?
-
here is a nice project which has a lot of customized widgets.
https://github.com/Wanderson-Magalhaes/PyBlackBox_Qt_Widgets_PySide6_Or_PyQt6_v1.0.0
hope it helps to get some idea about styling QLineEdit.
more tutorials can be found here -> https://www.youtube.com/c/WandersonIsMe/featured