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. Drag fill (like Excel)
QtWS25 Last Chance

Drag fill (like Excel)

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 6 Posters 973 Views
  • 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.
  • N Offline
    N Offline
    Neil305
    wrote on last edited by
    #1

    Does QT include a grid that does "drag fill", like Excel does, when you get the drag handle in the bottom right corner of a cell and can drag the selection across and down to copy a range of data?

    Pl45m4P JKSHJ 2 Replies Last reply
    0
    • N Neil305

      Does QT include a grid that does "drag fill", like Excel does, when you get the drag handle in the bottom right corner of a cell and can drag the selection across and down to copy a range of data?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Neil305

      I dont know if there's a function already, but even if there isn't, it shouldn't be that hard to implement in a custom model.
      What grid are you talking about? Do you mean QTableView / QTableWidget

      I know, it's not classical "Drag'n'Drop" as such, but this might be interesting
      https://doc.qt.io/qt-5/model-view-programming.html#using-drag-and-drop-with-item-views


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      3
      • N Neil305

        Does QT include a grid that does "drag fill", like Excel does, when you get the drag handle in the bottom right corner of a cell and can drag the selection across and down to copy a range of data?

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi, and welcome!

        @Neil305 said in Drag fill (like Excel):

        Does QT include a grid that does "drag fill", like Excel does, when you get the drag handle in the bottom right corner of a cell and can drag the selection across and down to copy a range of data?

        That is not a feature that is provided by Qt out-of-the-box. To implement this yourself, I believe you'd need to:

        • Subclass QTableView to add your custom "drag fill" logic
        • Reimplement the event handlers that involve QMouseEvent to detect the user's mouse actions
        • Reimplement QWidget::paintEvent() to add the bounding box around the appropriate cells and show a preview of the auto-calculated values from your "drag fill" logic
        • Call QAbstractItemModel::setData() to insert the auto-calculated values into the model

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

        1 Reply Last reply
        5
        • M Offline
          M Offline
          MajidKamali
          wrote on last edited by
          #4

          Why there is not these easy-to-implement widgets already available on internet? :|
          Qt lack many ready-to-use components compared to e.g. C#

          JKSHJ 1 Reply Last reply
          -1
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @MajidKamali said in Drag fill (like Excel):

            Why there is not these easy-to-implement widgets already available on internet?

            Because nobody wrote them and put them in the internet. Feel free to do so.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            3
            • M MajidKamali

              Why there is not these easy-to-implement widgets already available on internet? :|
              Qt lack many ready-to-use components compared to e.g. C#

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              @MajidKamali said in Drag fill (like Excel):

              Why there is not these easy-to-implement widgets already available on internet? :|
              Qt lack many ready-to-use components compared to e.g. C#

              Does C# have Excel-like drag fill?

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

              1 Reply Last reply
              2
              • M Offline
                M Offline
                MajidKamali
                wrote on last edited by
                #7

                Does C# have Excel-like drag fill?

                I don't know actually :D
                But there are lots of ready-to-use components for C#, also lots of DataGrids

                mrjjM 1 Reply Last reply
                0
                • M MajidKamali

                  Does C# have Excel-like drag fill?

                  I don't know actually :D
                  But there are lots of ready-to-use components for C#, also lots of DataGrids

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

                  @MajidKamali
                  Hi
                  C# has the huge advantage of just having to support Windows but Qt must
                  run on many different platforms, so having a huge easy to use pack of components
                  is not really an option without an army of programmers like Microsoft has.
                  While so in many cases Qt supplies the building blocks but the programmer has
                  the task of creating the actual specialized Widgets to use.

                  For Database, Qt has
                  all the SQL classes and models to allow such widgets but
                  it does require somewhat more to get going.
                  https://doc.qt.io/qt-5/qtsql-module.html

                  1 Reply Last reply
                  4

                  • Login

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