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. Recreating the Slack.App channel selector with Qt
Qt 6.11 is out! See what's new in the release blog

Recreating the Slack.App channel selector with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 802 Views 2 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.
  • W Offline
    W Offline
    Wolosocu
    wrote on last edited by
    #1

    I am looking to implement a control very similar to the channel selector in the Slack app.

    Attached is a gif of me hovering my mouse above certain icons and clicking on them.

    What would be the best control to implement something like this in Qt? I started looking at QTreeView but I'm not that's best. I would prefer to keep this in Widgets world and not use QML, though I'm not entirely opposed to the idea.

    Recommendations and suggestions are welcome!

    0_1544473245901_slack.gif

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Looks rather like a QListView with a custom QStyledItemDelegate for the painting.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        How many channels will there be?
        A listview + delegate would be able to handle a long list with grace.
        Some stylesheet for the scrollbar and some code for the hover effect.

        1 Reply Last reply
        3
        • W Offline
          W Offline
          Wolosocu
          wrote on last edited by
          #4

          Only took a couple days but here is! Used QListView with a custom QStyledItemDelegate.

          0_1544642535396_Untitled.gif

          One thing I don't understand is early on I had defined a stylesheet for my QListView derived control. The stylesheet looked pretty basic:

          QListView
          {
              background: #181F26;
              border-style: none;
          }
          
          QListView::item::selected
          {
              border-color: #93C0A4;
              border-style: outset;
              border-width: 2px;
              border-radius: 5px;
          }
          
          QListView::item::hover
          {
              border-color: #606060;
              border-style: outset;
              border-width: 3px;
              border-radius: 5px;
          }
          

          Now, most of that is largely ignored (I think?) in my derived paint() method. Yet, if I remove the stylesheet, then QStyle::State_Selected and QStyle::State_MouseOver don't work as expected. Why is this?

          mrjjM 1 Reply Last reply
          0
          • W Wolosocu

            Only took a couple days but here is! Used QListView with a custom QStyledItemDelegate.

            0_1544642535396_Untitled.gif

            One thing I don't understand is early on I had defined a stylesheet for my QListView derived control. The stylesheet looked pretty basic:

            QListView
            {
                background: #181F26;
                border-style: none;
            }
            
            QListView::item::selected
            {
                border-color: #93C0A4;
                border-style: outset;
                border-width: 2px;
                border-radius: 5px;
            }
            
            QListView::item::hover
            {
                border-color: #606060;
                border-style: outset;
                border-width: 3px;
                border-radius: 5px;
            }
            

            Now, most of that is largely ignored (I think?) in my derived paint() method. Yet, if I remove the stylesheet, then QStyle::State_Selected and QStyle::State_MouseOver don't work as expected. Why is this?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Wolosocu
            Hi
            Good work. it looks nice.
            Unless you use QStyle paint functions, any stylesheet have no effect.
            QPainter have no idea about it.

            Im not sure how
            QStyle::State_Selected and QStyle::State_MouseOver
            is not working./ be different.

            1 Reply Last reply
            1

            • Login

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