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. Scrollable QGraphicsItem ?
Forum Updated to NodeBB v4.3 + New Features

Scrollable QGraphicsItem ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 3.8k Views 3 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
    MajidKamali
    wrote on last edited by
    #1

    Hi.
    How can I create a Scrollable GraphicsItem? I derived my class from QScrollArea and QGraphicsItem.
    I did not set any widget for my class, but added some QGraphicsItems in a QList and set those parent as my class. viewportHint function returns, boundingRect, but no scrolling or scrollbars.

    Thanks.

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

      Hi,

      Are you going to put widgets in that scroll area ? If so, you can use the QGraphicsWidgetProxyItem

      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
      0
      • M Offline
        M Offline
        MajidKamali
        wrote on last edited by
        #3

        I'm going to add some QGraphicsItems in that scroll area.
        I can not find QGraphicsWidgetProxyItem class in documentation. I'm using Qt 5.4.1

        How about nesting a QGraphicsView inside my QGraphicsScene? becuase QGraphicsView already is scrollable.
        does it have good performance?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          Could you describe what you are trying to achieve? Take a look at the "40000 chips" demo sample. Does this do what you need?

          M 1 Reply Last reply
          0
          • A Asperamanca

            Could you describe what you are trying to achieve? Take a look at the "40000 chips" demo sample. Does this do what you need?

            M Offline
            M Offline
            MajidKamali
            wrote on last edited by
            #5

            @Asperamanca I am going to create a listview-like horizontal list, showing 3 items at a time; which, center item is bigger than two other items. animating scaling of items on scroll.

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

              My bad it was QGraphicsProxyWidget that I was thinking about.

              That kind of things is generally easier to do with QtQuick

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

              M 1 Reply Last reply
              0
              • SGaistS SGaist

                My bad it was QGraphicsProxyWidget that I was thinking about.

                That kind of things is generally easier to do with QtQuick

                M Offline
                M Offline
                MajidKamali
                wrote on last edited by
                #7

                @SGaist I created exactly what I want in QtQuick, but I can not integrate that component in QGraphicsView. I searched a lot, but it seems that it can not be done :(

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

                  You can try with a QQuickWidget but I don't know if it would work that well. Depending on your application, you should maybe consider a full QtQuick UI.

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

                  M 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    You can try with a QQuickWidget but I don't know if it would work that well. Depending on your application, you should maybe consider a full QtQuick UI.

                    M Offline
                    M Offline
                    MajidKamali
                    wrote on last edited by
                    #9

                    @SGaist I tested this solution too. widget is shown, but no update. when I resize the window, it updates.
                    changing QGraphicsView::updateMode did not help.

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

                      What should the rest of your scene show ?

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

                      M 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        What should the rest of your scene show ?

                        M Offline
                        M Offline
                        MajidKamali
                        wrote on last edited by
                        #11

                        @SGaist Some other UIs that I created with Graphics Framwork classes, like QGraphicsSvgItem

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

                          You can also show SVG images on a QtQuick UI

                          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
                          0

                          • Login

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