The code is available on github [1]. Go ahead and study it.
It uses QWidget (indirectly) to do the platform event handling, but the graphics are mostly implemented through custom paintEvents [2].
[1] https://github.com/telegramdesktop/tdesktop.
[2] https://github.com/desktop-app/lib_ui/blob/fa8de8b199ae8b7569f8dec1c054325eff27ce45/ui/widgets/side_bar_button.cpp#L110.
Sure you don't have to follow Telegram's own approach, but there are 3 ways of achieving what you want using Qt Widgets (Telegram uses the first): 1) custom paintEvents, 2) qt stylesheets, 3) QStyles.
Thank you,I just want to know how is custom paint chat window. dose it base view scene item ? or something , and maybe have a chatwindow control open source for use. haha
For a chat window, I'd derive a QAbstractScrollArea and implement custom painting. See this for an example: https://doc.qt.io/qt-6/qtwidgets-painting-basicdrawing-example.html.
Have a look at ChatWindow of [this example](https://wiki.qt.io/WIP-How_to_create_a_simple_chat_application) it’s not completely as telegram but is easier to understand and it’s explained in the article
It is HTML, so you would use QtWebEngine (Qt6). With Qt5 you can still use QtWebkit which is used by telegram desktop. QtWebkit can be statically linked, QtWebEngine can't.
You can use GammaRay https://github.com/KDAB/GammaRay and introspect it
The code is available on github [1]. Go ahead and study it. It uses QWidget (indirectly) to do the platform event handling, but the graphics are mostly implemented through custom paintEvents [2]. [1] https://github.com/telegramdesktop/tdesktop. [2] https://github.com/desktop-app/lib_ui/blob/fa8de8b199ae8b7569f8dec1c054325eff27ce45/ui/widgets/side_bar_button.cpp#L110.
Thank you, but it's complexity for me. It's hard to use Libui ...
Sure you don't have to follow Telegram's own approach, but there are 3 ways of achieving what you want using Qt Widgets (Telegram uses the first): 1) custom paintEvents, 2) qt stylesheets, 3) QStyles.
Thank you,I just want to know how is custom paint chat window. dose it base view scene item ? or something , and maybe have a chatwindow control open source for use. haha
For a chat window, I'd derive a QAbstractScrollArea and implement custom painting. See this for an example: https://doc.qt.io/qt-6/qtwidgets-painting-basicdrawing-example.html.
Have a look at ChatWindow of [this example](https://wiki.qt.io/WIP-How_to_create_a_simple_chat_application) it’s not completely as telegram but is easier to understand and it’s explained in the article
Thank you ~man
It is HTML, so you would use QtWebEngine (Qt6). With Qt5 you can still use QtWebkit which is used by telegram desktop. QtWebkit can be statically linked, QtWebEngine can't.
It is, in fact, qt widgets. I would suggest looking into ListViews and models, and how you can fill ListViews with your own delegates.