Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved GridView with sections

    QML and Qt Quick
    3
    7
    970
    Loading More Posts
    • 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.
    • F
      FOXLISIN last edited by

      Hi. I need to find a solution for the following problem: display GridView with sections (like a ListView with sections). Is it possible?

      1 Reply Last reply Reply Quote 0
      • F
        FOXLISIN last edited by

        This is really important question, anyone :)

        p3c0 1 Reply Last reply Reply Quote 0
        • p3c0
          p3c0 Moderators @FOXLISIN last edited by

          @FOXLISIN As you can see there is no section built-in property for GridView so it is not possible to use sections there. But you can always try to create your own custom elements to suit yur needs :)
          Btw. can you explain what you re trying to achieve ?

          157

          F 1 Reply Last reply Reply Quote 0
          • F
            FOXLISIN @p3c0 last edited by

            @p3c0 Thanks for your reply :)

            I want to create emoji widget like emoji widget in "Slack".
            See image: http://s32.postimg.org/9tggf3345/emoji_my.png

            p3c0 1 Reply Last reply Reply Quote 0
            • p3c0
              p3c0 Moderators @FOXLISIN last edited by

              @FOXLISIN I think it could be achieved using ListView with delegate as a component containing GridView.

              157

              M 1 Reply Last reply Reply Quote 1
              • M
                medyakovvit @p3c0 last edited by medyakovvit

                @FOXLISIN
                @p3c0 said:

                @FOXLISIN I think it could be achieved using ListView with delegate as a component containing GridView.

                And for example c++ model can be looked like:

                class MyModel : public QAbstractListModel
                {
                    ...
                    // Some implementation
                    ...
                    QVector<SubModel*> m_subModels;
                };
                
                class SubModel : public QAbstractListModel
                {
                    ...
                    // Some implementation
                    ...
                    QString m_sectionName;
                    QVector<EmojiItem*> m_emojis;
                };
                
                F 1 Reply Last reply Reply Quote 0
                • F
                  FOXLISIN @medyakovvit last edited by

                  Thank you guys @p3c0 @medyakovvit
                  I'll try to implement it as you say

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post