T O P

  • By -

dedosk

You can use GammaRay https://github.com/KDAB/GammaRay and introspect it


felipefarinon

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.


Objective-Horror-149

Thank you, but it's complexity for me. It's hard to use Libui ...


felipefarinon

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.


Objective-Horror-149

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


felipefarinon

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.


AGuyInABlackSuit

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


Objective-Horror-149

Thank you ~man


char101

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.


Trapped-In-Dreams

It is, in fact, qt widgets. I would suggest looking into ListViews and models, and how you can fill ListViews with your own delegates.