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?
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 meanQTableView
/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 -
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?
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
- Subclass
-
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# -
@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.
-
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#@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?
-
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 -
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@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