Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How does the tdesktop render tabs?
Qt 6.11 is out! See what's new in the release blog

How does the tdesktop render tabs?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 199 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MarkoProg
    wrote last edited by
    #1

    I'm new to this and trying to figure out how the Telegram team managed to render tabs and chat selection so effectively. Can anyone give me a conceptual overview (perhaps with some key code examples) of how they did it?

    I tried reading the source code, but it's pretty hard for a beginner to understand—it's written in a very low-level style. By the way, I didn't find a single QTabWidget in it.

    I'm particularly interested in how they implemented interaction between tabs and the chat,
    and how they store both.
    image-2025-02-08-2036.png

    I'll try to recreate something similar

    JKSHJ 1 Reply Last reply
    0
    • M MarkoProg

      I'm new to this and trying to figure out how the Telegram team managed to render tabs and chat selection so effectively. Can anyone give me a conceptual overview (perhaps with some key code examples) of how they did it?

      I tried reading the source code, but it's pretty hard for a beginner to understand—it's written in a very low-level style. By the way, I didn't find a single QTabWidget in it.

      I'm particularly interested in how they implemented interaction between tabs and the chat,
      and how they store both.
      image-2025-02-08-2036.png

      I'll try to recreate something similar

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote last edited by
      #2

      @MarkoProg said in How does the tdesktop render tabs?:

      trying to figure out how the Telegram team managed to render tabs

      From your screenshot, that looks like a ListView or similar -- no tabs involved.

      This tutorial shows a simple version of that: https://doc.qt.io/qt-6/qtquickcontrols-chattutorial-example.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      M 1 Reply Last reply
      1
      • JKSHJ JKSH

        @MarkoProg said in How does the tdesktop render tabs?:

        trying to figure out how the Telegram team managed to render tabs

        From your screenshot, that looks like a ListView or similar -- no tabs involved.

        This tutorial shows a simple version of that: https://doc.qt.io/qt-6/qtquickcontrols-chattutorial-example.html

        M Offline
        M Offline
        MarkoProg
        wrote last edited by
        #3

        @JKSH They don't use QML; they render everything from scratch using QWidgets, and I'm also interested in this approach. How exactly did they achieve this using QWidgets? It seems to require a deeper understanding of how rendering works in Qt.

        JKSHJ 1 Reply Last reply
        0
        • M MarkoProg

          @JKSH They don't use QML; they render everything from scratch using QWidgets, and I'm also interested in this approach. How exactly did they achieve this using QWidgets? It seems to require a deeper understanding of how rendering works in Qt.

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote last edited by
          #4

          @MarkoProg said in How does the tdesktop render tabs?:

          They don't use QML; they render everything from scratch using QWidgets, and I'm also interested in this approach. How exactly did they achieve this using QWidgets?

          The idea the same, regardless of whether you're using Qt Quick or Qt Widgets:

          • A Model stores an overview of the chat data.
            • One row in the Model represents one chat.
            • A row would contain data like chat title, chat icon, latest timestamp, latest message, delivery status.
          • A Delegate lays out the GUI components in its rectangle (e.g. icon on the left, timestamp of the top-right).
          • A ListView (Qt Quick) or QListView/QListWidget (Qt Widgets) is used to display the "tabs".
            • If the Model contains N rows (N chats), then the View creates N Delegates.
            • The View takes data from each row and gives that data to corresponding Delegate of that row. The Delegate then writes the data into the GUI

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved