Skip to main content

qtbridge_interfaces/qtable_model/
proxy_rust.rs

1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only
3
4use super::proxy_cpp_bridge::QTableModelProxyCpp;
5use crate::{call_rust_trait_impl, call_cpp_impl};
6use qtbridge_runtime::{DispatchMetaCall, QObjectHolder};
7use qtbridge_runtime::QModelItem;
8use crate::genericrustproxy::GenericRustProxy;
9use qtbridge_type_lib::{QByteArray, QHash, QModelIndex, QVariant};
10
11#[doc(hidden)]
12pub trait QTableModelAdapter: DispatchMetaCall + 'static {
13    fn index(&self, row: i32, column: i32, parent: &QModelIndex) -> QModelIndex;
14    fn parent(&self, child: &QModelIndex) -> QModelIndex;
15    fn row_count(&self, parent: &QModelIndex) -> i32;
16    fn column_count(&self, parent: &QModelIndex) -> i32;
17    fn data(&self, index: &QModelIndex, role: i32) -> QVariant;
18    fn role_names(&self) -> QHash<i32, QByteArray>;
19    fn set_data(&mut self, index: &QModelIndex, value: &QVariant, role: i32) -> bool;
20    fn remove_columns(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool;
21    fn remove_rows(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool;
22    fn sibling(&self, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex;
23}
24
25impl<T> QTableModelAdapter for T
26where
27    T: QTableModel + QObjectHolder<ProxyRust = QTableModelProxyRust> {
28
29    fn index(&self, row: i32, column: i32, _: &QModelIndex) -> QModelIndex {
30        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
31        unsafe { &*proxy }.base_create_index(self, row, column, 0)
32    }
33
34    fn parent(&self, _: &QModelIndex) -> QModelIndex {
35        QModelIndex::default()
36    }
37
38    fn row_count(&self, _: &QModelIndex) -> i32 {
39        self.row_count() as i32
40    }
41
42    fn column_count(&self, _: &QModelIndex) -> i32 {
43        <Self as QTableModel>::column_count(&self) as i32
44    }
45
46    fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
47        let Some(item) = self.get((index.row() as usize, index.column() as usize))
48        else {
49            return QVariant::default();
50        };
51        item.get_role(role)
52    }
53
54    fn role_names(&self) -> QHash<i32, QByteArray> {
55        let names = T::Item::role_names();
56        let mut result = QHash::default();
57        names.iter()
58            .for_each(|(k, v)| result.insert(k, &QByteArray::from(v)));
59        result
60    }
61
62    fn set_data(&mut self, index: &QModelIndex, value: &QVariant, role: i32) -> bool {
63        if !index.is_valid() {
64            return false;
65        }
66        let Some(mut item) = self.get((index.row() as usize, index.column() as usize))
67            .cloned()
68        else {
69            return false;
70        };
71        let updated = item.set_role(role, value);
72        if updated {
73            self.set_unnotified((index.row() as usize, index.column() as usize), item);
74            let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
75            unsafe { &mut *proxy }.base_data_changed(&mut *self, index, index);
76        }
77        updated
78    }
79
80    fn remove_columns(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
81        let first = first as usize;
82        let last = first + count as usize;
83        if last > self.column_count() {
84            return false;
85        }
86        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
87        unsafe { &mut *proxy }.base_begin_remove_columns(&mut *self, parent, first as i32, (last - 1) as i32);
88        for index in (first..last).rev() {
89            self.remove_row_unnotified(index);
90        }
91        unsafe { &mut *proxy }.base_end_remove_columns(&mut *self);
92        true
93    }
94
95    fn remove_rows(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
96        let first = first as usize;
97        let last = first + count as usize;
98        if last > self.row_count() {
99            return false;
100        }
101        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
102        unsafe { &mut *proxy }.base_begin_remove_rows(&mut *self, parent, first as i32, (last - 1) as i32);
103        for index in (first..last).rev() {
104            self.remove_row_unnotified(index);
105        }
106        unsafe { &mut *proxy }.base_end_remove_rows(&mut *self);
107        true
108    }
109
110    fn sibling(&self, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex {
111        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
112        unsafe { &*proxy }.base_sibling(self, row, column, idx)
113    }
114}
115
116
117/// A trait representing a table-based Qt model.
118///
119/// [`QTableModel`] provides an interface for table-like data structures
120/// that are exposed to Qt through the Model-View concept.
121/// <https://doc.qt.io/qt-6/qtquick-modelviewsdata-modelview.html>.
122///
123/// This trait requires the `qobject` macro to set up the correct Qt proxy.
124/// The macro will further generate functionality in the form of the
125/// [`QTableModelBase`] trait that supplements the [`QTableModel`] functionality.
126///
127/// ## Design
128///
129/// - The model owns items of associated type `Item` that has to implement
130///   the [`QModelItem`] trait. Roles are derived from the [`QModelItem`]
131///   implementation.
132/// - Mutation methods are provided in an **unnotified** form, meaning
133///   they modify the underlying data without emitting Qt model signals.
134/// - These methods are used by the automatically implemented [`QTableModelBase`]
135///   trait to create methods that notify the UI about changes in collections.
136///
137/// As a minimum you have to implement the methods [`QTableModel::row_count`],
138/// [`QTableModel::column_count`] and [`QTableModel::get`] to create a readable
139/// table model. Further methods can be implemented to make the model fully mutable.
140///
141/// Methods that do not return an [`Option`] or a boolean value must succeed
142/// and perform exactly the operation described in the documentation to avoid
143/// invalidating the synchronization between any views and the underlying data.
144/// No additional structural changes may occur outside the provided functions.
145///
146/// **Note that default implementations may `panic!`** if the corresponding method is
147/// not overridden. It is your responsibility to make sure that these functions are
148/// not called from QML.
149///
150/// ## Example
151///
152/// ``` ignore
153/// use qtbridge::qobject;
154/// #[qobject(Base = QTableModel)]
155/// mod backend {
156///     use qtbridge::{QTableModel, QTableModelBase};
157///
158///     #[derive(Default)]
159///     pub struct Backend {
160///         string_data: Vec<Vec<String>>,
161///     }
162///     impl QTableModel for Backend {
163///         type Item = String;
164///
165///         fn len(&self) -> usize {
166///             self.string_data.len()
167///         }
168///         fn column_count(&self) -> usize {
169///             self.string_data[0].len()
170///         }
171///         fn get(&self, index: (usize, usize)) -> Option<&Self::Item> {
172///             self.string_list.get(index.0)?.get(index.1)
173///         }
174///     }
175/// }
176///
177/// ```
178///
179/// The table model can be used in QML views as follows
180/// ``` qml, ignore
181/// TableView {
182///     model: backend
183///     delegate: Text {
184///         required property string value
185///         text: value
186///     }
187/// }
188/// ```
189pub trait QTableModel {
190    /// The item type stored in the model.
191    ///
192    /// Items must:
193    /// - Implement [`QModelItem`] to integrate with Qt
194    /// - Be [`Default`] for creating new items
195    /// - Be [`Clone`] for safe data access and copying
196    type Item: QModelItem + Default + Clone;
197
198    /// Returns the number of rows in the table.
199    fn row_count(&self) -> usize;
200
201    /// Returns the number of columns in the table.
202    fn column_count(&self) -> usize;
203
204    /// Returns a reference to the item at `index`, or `None` if the index
205    /// is out of bounds.
206    fn get(&self, index: (usize, usize)) -> Option<&Self::Item>;
207
208    /// Sets the item at `index`. Reimplement this function but call
209    /// [`QTableModelBase::set`] to notify Qt about the modification.
210    ///
211    /// Returns `true` if the value was successfully set, or `false` if the
212    /// operation failed (e.g., index out of bounds or value fails
213    /// validation by the business logic).
214    ///
215    /// The default implementation does nothing and returns `false`.
216    fn set_unnotified(&mut self, _index: (usize, usize), _value: Self::Item) -> bool {
217        false
218    }
219
220    /// Appends a row of items to the end of the model. Reimplement this
221    /// function but call [`QTableModelBase::push_row`] to notify Qt about the
222    /// modification.
223    ///
224    /// The function has to accept the value. Validation has to be
225    /// done before this function is called.
226    ///
227    /// The default implementation falls back to [`QTableModel::insert_row_unnotified`],
228    /// which in turn panics by default.
229    fn push_row_unnotified(&mut self, values: &[Self::Item]) {
230        self.insert_row_unnotified(self.row_count(), values);
231    }
232
233    /// Appends a column of items to the end of the model. Reimplement this
234    /// function but call [`QTableModelBase::push_column`] to notify Qt about the
235    /// modification.
236    ///
237    /// The function has to accept the value. Validation has to be
238    /// done before this function is called.
239    ///
240    /// The default implementation falls back to [`QTableModel::insert_column_unnotified`],
241    /// which in turn panics by default.
242    fn push_column_unnotified(&mut self, values: &[Self::Item]) {
243        self.insert_column_unnotified(self.column_count(), values);
244    }
245
246    /// Inserts a row with `value` at `index`. Reimplement this function but
247    /// call [`QTableModelBase::insert_row`] to notify Qt about the
248    /// modification.
249    ///
250    /// The function has to accept the value. Validation has to be
251    /// done before this function is called.
252    ///
253    /// Panics by default. Implementors must override this method to support
254    /// insertion.
255    fn insert_row_unnotified(&mut self, _index: usize, _value: &[Self::Item]) {
256        panic!("In order to use insert, implement insert_unnotified")
257    }
258
259    /// Inserts a column with `values` at `index`. Reimplement this function but
260    /// call [`QTableModelBase::insert_column`] to notify Qt about the
261    /// modification.
262    ///
263    /// The function has to accept the value. Validation has to be
264    /// done before this function is called.
265    ///
266    /// Panics by default. Implementors must override this method to support
267    /// insertion.
268    fn insert_column_unnotified(&mut self, _index: usize, _value: &[Self::Item]) {
269        panic!("In order to use insert, implement insert_unnotified")
270    }
271
272    /// Removes and returns the last row in the model. Reimplement this
273    /// function but call [`QTableModelBase::pop_row`] to notify Qt
274    /// about the modification.
275    ///
276    /// Returns `None` if the model is empty. If the model is not empty,
277    /// the function has to guarantee the success of the operation.
278    ///
279    /// The default implementation falls back to [`QTableModel::remove_row_unnotified`],
280    /// which in turn panics by default.
281    fn pop_row_unnotified(&mut self) -> Option<Vec<Self::Item>> {
282        (self.row_count() > 0)
283            .then(|| self.remove_row_unnotified(self.row_count() - 1))
284    }
285
286    /// Removes and returns the last column in the model. Reimplement this
287    /// function but call [`QTableModelBase::pop_column`] to notify Qt
288    /// about the modification.
289    ///
290    /// Returns `None` if the model is empty. If the model is not empty,
291    /// the function has to guarantee the success of the operation.
292    ///
293    /// The default implementation falls back to [`QTableModel::remove_column_unnotified`],
294    /// which in turn panics by default.
295    fn pop_column_unnotified(&mut self) -> Option<Vec<Self::Item>> {
296        (self.column_count() > 0)
297            .then(|| self.remove_column_unnotified(self.column_count() - 1))
298    }
299
300    /// Removes and returns the item at `index`. Reimplement this
301    /// function but call [`QTableModelBase::remove_row`] to notify Qt
302    /// about the modification.
303    ///
304    /// The index must be valid and the model has to guarantee the success of
305    /// the operation.
306    ///
307    /// Panics by default. Implementors must override this method to support
308    /// removal.
309    fn remove_row_unnotified(&mut self, _index: usize) -> Vec<Self::Item> {
310        panic!("In order to use remove, implement remove_unnotified")
311    }
312
313    /// Removes and returns the column at `index`. Reimplement this
314    /// function but call [`QTableModelBase::remove_column`] to notify Qt
315    /// about the modification.
316    ///
317    /// The index must be valid and the model has to guarantee the success of
318    /// the operation.
319    ///
320    /// Panics by default. Implementors must override this method to support
321    /// removal.
322    fn remove_column_unnotified(&mut self, _index: usize) -> Vec<Self::Item> {
323        panic!("In order to use remove, implement remove_unnotified")
324    }
325
326    /// Resets the model's internal storage. Reimplement this function but
327    /// call [`QTableModelBase::reset`] to notify Qt about the modification.
328    ///
329    /// Panics by default. Implementors must override this method to support
330    /// a model reset.
331    ///
332    /// After [`QTableModel::reset_unnotified`] returns, the internal storage
333    /// must reflect the new model state: [`QTableModel::row_count`] and
334    /// [`QTableModel::get`] must be consistent with the updated storage.
335    fn reset_unnotified(&mut self) {
336        panic!("In order to use reset, implement reset_unnotified")
337    }
338
339}
340
341/// A data-change signaling extension of [`QTableModel`].
342///
343/// `QTableModelBase` provides the signaling mutation API for list models.
344/// The methods defined in this trait wrap the corresponding
345/// `*_unnotified` methods from [`QTableModel`] and automatically emit the
346/// required Qt model signals (such as `beginInsertRows`, `endInsertRows`,
347/// `dataChanged`, etc.). This allows the UI to react to changes in the
348/// underlying data.
349///
350/// This trait is automatically implemented by the `qobject` macro and
351/// should not be implemented manually.
352///
353/// ## Usage
354///
355/// When modifying data that you made accessible with [`QTableModel`], you
356/// have to use the functions provided by this trait. Do **not** call the
357/// `*_unnotified` methods from [`QTableModel`] directly unless you are
358/// manually handling Qt model notifications.
359///
360/// The correctness of this trait depends on implementors of [`QTableModel`]
361/// ensuring that:
362///
363/// * The `*_unnotified` methods perform the exact mutation corresponding
364///   to the emitted Qt signals.
365/// * No additional structural changes occur.
366///
367/// Violating this contract may result in undefined behavior in Qt views.
368pub trait QTableModelBase : QTableModel + QObjectHolder<ProxyRust = QTableModelProxyRust> {
369    /// Sets the item at `index` and notifies any attached views about
370    /// the change, if the operation is successful.
371    ///
372    /// This method calls [`QTableModel::set_unnotified`].
373    ///
374    /// Returns `true` if the value was successfully updated,
375    /// or `false` if the operation failed (for example, if the index
376    /// was out of bounds or validation failed).
377    fn set(&mut self, index: (usize, usize), value: <Self as QTableModel>::Item) -> bool {
378        if self.set_unnotified(index, value) {
379            let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
380            let model_index = unsafe { &*proxy }.base_create_index(self, index.0 as i32, index.1 as i32, 0);
381            unsafe { &mut *proxy }.base_data_changed(&mut *self, &model_index, &model_index);
382            true
383        } else {
384            false
385        }
386    }
387
388    /// Appends a row of `values` to the end of the model and notifies any attached views about
389    /// the change.
390    ///
391    /// This method calls [`QTableModel::push_row_unnotified`].
392    fn push_row(&mut self, values: &[Self::Item]) {
393        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
394        let row_count = self.row_count() as i32;
395        unsafe { &mut *proxy }.base_begin_insert_rows(&mut *self, &QModelIndex::default(), row_count, row_count);
396        self.push_row_unnotified(values);
397        unsafe { &mut *proxy }.base_end_insert_rows(&mut *self);
398    }
399
400    /// Appends a column of `value` to the end of the model and notifies any attached views about
401    /// the change.
402    ///
403    /// This method calls [`QTableModel::push_column_unnotified`].
404    fn push_column(&mut self, values: &[Self::Item]) {
405        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
406        let col_count = self.column_count() as i32;
407        unsafe { &mut *proxy }.base_begin_insert_columns(&mut *self, &QModelIndex::default(), col_count, col_count);
408        self.push_column_unnotified(values);
409        unsafe { &mut *proxy }.base_end_insert_columns(&mut *self);
410    }
411
412    /// Inserts a row with `values` at `index` and notifies any attached views about
413    /// the change.
414    ///
415    /// This method calls [`QTableModel::insert_row_unnotified`].
416    fn insert_row(&mut self, index: usize, values: &[Self::Item]) {
417        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
418        unsafe { &mut *proxy }.base_begin_insert_rows(&mut *self, &QModelIndex::default(), index as i32, index as i32);
419        self.insert_row_unnotified(index, values);
420        unsafe { &mut *proxy }.base_end_insert_rows(&mut *self);
421    }
422
423    /// Inserts a column with `values` at `index` and notifies any attached views about
424    /// the change.
425    ///
426    /// This method calls [`QTableModel::insert_column_unnotified`].
427    fn insert_column(&mut self, index: usize, values: &[Self::Item]) {
428        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
429        unsafe { &mut *proxy }.base_begin_insert_columns(&mut *self, &QModelIndex::default(), index as i32, index as i32);
430        self.insert_column_unnotified(index, values);
431        unsafe { &mut *proxy }.base_end_insert_columns(&mut *self);
432    }
433
434    /// Removes and returns the last row in the model and notifies any attached views about
435    /// the change.
436    ///
437    /// This method calls [`QTableModel::pop_row_unnotified`].
438    ///
439    /// Returns `None` if the model is empty. If the model is not empty,
440    /// the function has to guarantee the success of the operation.
441    fn pop_row(&mut self) -> Option<Vec<Self::Item>> {
442        if self.row_count() == 0 {
443            return None;
444        }
445        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
446        let row_count = self.row_count() as i32;
447        unsafe { &mut *proxy }.base_begin_remove_rows(&mut *self, &QModelIndex::default(), row_count - 1, row_count - 1);
448        let values = self.pop_row_unnotified();
449        unsafe { &mut *proxy }.base_end_remove_rows(&mut *self);
450        values
451    }
452
453    /// Removes and returns the last column in the model and notifies any attached views about
454    /// the change.
455    ///
456    /// This method calls [`QTableModel::pop_column_unnotified`].
457    ///
458    /// Returns `None` if the model is empty. If the model is not empty,
459    /// the function has to guarantee the success of the operation.
460    fn pop_column(&mut self) -> Option<Vec<Self::Item>> {
461        if self.column_count() == 0 {
462            return None;
463        }
464        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
465        let col_count = self.column_count() as i32;
466        unsafe { &mut *proxy }.base_begin_remove_columns(&mut *self, &QModelIndex::default(), col_count - 1, col_count - 1);
467        let values = self.pop_column_unnotified();
468        unsafe { &mut *proxy }.base_end_remove_columns(&mut *self);
469        values
470    }
471
472    /// Removes and returns the row at `index` and notifies any attached views about
473    /// the change.
474    ///
475    /// This method calls [`QTableModel::remove_row_unnotified`].
476    fn remove_row(&mut self, index: usize) -> Vec<Self::Item> {
477        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
478        unsafe { &mut *proxy }.base_begin_remove_rows(&mut *self, &QModelIndex::default(), index as i32, index as i32);
479        let values = self.remove_row_unnotified(index);
480        unsafe { &mut *proxy }.base_end_remove_rows(&mut *self);
481        values
482    }
483
484    /// Removes and returns the column at `index` and notifies any attached views about
485    /// the change.
486    ///
487    /// This method calls [`QTableModel::remove_column_unnotified`].
488    fn remove_column(&mut self, index: usize) -> Vec<Self::Item> {
489        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
490        unsafe { &mut *proxy }.base_begin_remove_columns(&mut *self, &QModelIndex::default(), index as i32, index as i32);
491        let values = self.remove_column_unnotified(index);
492        unsafe { &mut *proxy }.base_end_remove_columns(&mut *self);
493        values
494    }
495
496    /// Resets the entire model and notifies any attached views to resynchronize all data.
497    ///
498    /// This method calls [`QTableModel::reset_unnotified`].
499    fn reset(&mut self) {
500        let proxy = self.try_get_rust_proxy_ptr().expect("No proxy");
501        unsafe { &mut *proxy }.base_begin_reset_model(&mut *self);
502        self.reset_unnotified();
503        unsafe { &mut *proxy }.base_end_reset_model(&mut *self);
504    }
505}
506
507impl<T> QTableModelBase for T
508where T: QTableModel + QObjectHolder<ProxyRust = QTableModelProxyRust> { }
509
510pub type QTableModelProxyRust = GenericRustProxy<QTableModelProxyCpp, dyn QTableModelAdapter>;
511
512impl QTableModelProxyRust {
513    pub fn index(&self, row: i32, column: i32, parent: &QModelIndex) -> QModelIndex {
514        call_rust_trait_impl!(self, index(row, column, parent))
515    }
516    pub fn parent(&self, child: &QModelIndex) -> QModelIndex {
517        call_rust_trait_impl!(self, parent(child))
518    }
519    pub fn row_count(&self, parent: &QModelIndex) -> i32 {
520        call_rust_trait_impl!(self, row_count(parent))
521    }
522    pub fn column_count(&self, parent: &QModelIndex) -> i32 {
523        call_rust_trait_impl!(self, column_count(parent))
524    }
525    pub fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
526        call_rust_trait_impl!(self, data(index, role))
527    }
528    pub fn role_names(&self) -> QHash<i32, QByteArray> {
529        call_rust_trait_impl!(self, role_names())
530    }
531    pub fn set_data(&mut self, index: &QModelIndex, value: &QVariant, role: i32) -> bool {
532        call_rust_trait_impl!(mut self, set_data(index, value, role))
533    }
534    pub fn remove_columns(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
535        call_rust_trait_impl!(mut self, remove_columns(first, count, parent))
536    }
537    pub fn remove_rows(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
538        call_rust_trait_impl!(mut self, remove_rows(first, count, parent))
539    }
540    pub fn sibling(&self, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex {
541        call_rust_trait_impl!(self, sibling(row, column, idx))
542    }
543
544    pub fn base_role_names(&self, reference: &dyn QTableModelAdapter) -> QHash<i32, QByteArray> {
545        call_cpp_impl!(self, reference, base_role_names())
546    }
547    pub fn base_set_data(&mut self, mut_ref: &mut dyn QTableModelAdapter, index: &QModelIndex, value: &QVariant, role: i32) -> bool {
548        call_cpp_impl!(mut self, mut_ref, base_set_data(index, value, role))
549    }
550    pub fn base_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, first: i32, count: i32, parent: &QModelIndex) -> bool {
551        call_cpp_impl!(mut self, mut_ref, base_remove_columns(first, count, parent))
552    }
553    pub fn base_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, first: i32, count: i32, parent: &QModelIndex) -> bool {
554        call_cpp_impl!(mut self, mut_ref, base_remove_rows(first, count, parent))
555    }
556    pub fn base_sibling(&self, reference: &dyn QTableModelAdapter, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex {
557        call_cpp_impl!(self, reference, base_sibling(row, column, idx))
558    }
559    pub fn base_data_changed(&mut self, mut_ref: &mut dyn QTableModelAdapter, top_left: &QModelIndex, bottom_right: &QModelIndex) {
560        call_cpp_impl!(mut self, mut_ref, base_data_changed(top_left, bottom_right))
561    }
562    pub fn base_begin_insert_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
563        call_cpp_impl!(mut self, mut_ref, base_begin_insert_columns(parent, first, last))
564    }
565    pub fn base_end_insert_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
566        call_cpp_impl!(mut self, mut_ref, base_end_insert_columns())
567    }
568    pub fn base_begin_insert_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
569        call_cpp_impl!(mut self, mut_ref, base_begin_insert_rows(parent, first, last))
570    }
571    pub fn base_end_insert_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
572        call_cpp_impl!(mut self, mut_ref, base_end_insert_rows())
573    }
574    pub fn base_begin_move_columns(
575        &mut self,
576        mut_ref: &mut dyn QTableModelAdapter,
577        source_parent: &QModelIndex,
578        source_first: i32,
579        source_last: i32,
580        destination_parent: &QModelIndex,
581        destination_child: i32,
582    ) {
583        call_cpp_impl!(mut self, mut_ref, base_begin_move_columns(source_parent, source_first, source_last, destination_parent, destination_child))
584    }
585    pub fn base_end_move_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
586        call_cpp_impl!(mut self, mut_ref, base_end_move_columns())
587    }
588    pub fn base_begin_move_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, source_parent: &QModelIndex, source_first: i32, source_last: i32, destination_parent: &QModelIndex, destination_child: i32) {
589        call_cpp_impl!(mut self, mut_ref, base_begin_move_rows(source_parent, source_first, source_last, destination_parent, destination_child))
590    }
591    pub fn base_end_move_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
592        call_cpp_impl!(mut self, mut_ref, base_end_move_rows())
593    }
594    pub fn base_begin_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
595        call_cpp_impl!(mut self, mut_ref, base_begin_remove_columns(parent, first, last))
596    }
597    pub fn base_end_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
598        call_cpp_impl!(mut self, mut_ref, base_end_remove_columns())
599    }
600    pub fn base_begin_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
601        call_cpp_impl!(mut self, mut_ref, base_begin_remove_rows(parent, first, last))
602    }
603    pub fn base_end_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
604        call_cpp_impl!(mut self, mut_ref, base_end_remove_rows())
605    }
606    pub fn base_begin_reset_model(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
607        call_cpp_impl!(mut self, mut_ref, base_begin_reset_model())
608    }
609    pub fn base_end_reset_model(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
610        call_cpp_impl!(mut self, mut_ref, base_end_reset_model())
611    }
612    pub fn base_create_index(&self, reference: &dyn QTableModelAdapter, row: i32, column: i32, ptr: usize) -> QModelIndex {
613        call_cpp_impl!(self, reference, base_create_index(row, column, ptr))
614    }
615}