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_i32_QByteArray, 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_i32_QByteArray::default();
57        names.into_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_column_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 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            if let Some(proxy) = self.try_get_rust_proxy_ptr() {
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            }
383            true
384        } else {
385            false
386        }
387    }
388
389    /// Appends a row of `values` to the end of the model and notifies any attached views about
390    /// the change.
391    ///
392    /// This method calls [`QTableModel::push_row_unnotified`].
393    fn push_row(&mut self, values: &[Self::Item]) {
394        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
395            return self.push_row_unnotified(values);
396        };
397        let row_count = self.row_count() as i32;
398        unsafe { &mut *proxy }.base_begin_insert_rows(&mut *self, &QModelIndex::default(), row_count, row_count);
399        self.push_row_unnotified(values);
400        unsafe { &mut *proxy }.base_end_insert_rows(&mut *self);
401    }
402
403    /// Appends a column of `value` to the end of the model and notifies any attached views about
404    /// the change.
405    ///
406    /// This method calls [`QTableModel::push_column_unnotified`].
407    fn push_column(&mut self, values: &[Self::Item]) {
408        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
409            return self.push_column_unnotified(values);
410        };
411        let col_count = self.column_count() as i32;
412        unsafe { &mut *proxy }.base_begin_insert_columns(&mut *self, &QModelIndex::default(), col_count, col_count);
413        self.push_column_unnotified(values);
414        unsafe { &mut *proxy }.base_end_insert_columns(&mut *self);
415    }
416
417    /// Inserts a row with `values` at `index` and notifies any attached views about
418    /// the change.
419    ///
420    /// This method calls [`QTableModel::insert_row_unnotified`].
421    fn insert_row(&mut self, index: usize, values: &[Self::Item]) {
422        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
423            return self.insert_row_unnotified(index, values);
424        };
425        unsafe { &mut *proxy }.base_begin_insert_rows(&mut *self, &QModelIndex::default(), index as i32, index as i32);
426        self.insert_row_unnotified(index, values);
427        unsafe { &mut *proxy }.base_end_insert_rows(&mut *self);
428    }
429
430    /// Inserts a column with `values` at `index` and notifies any attached views about
431    /// the change.
432    ///
433    /// This method calls [`QTableModel::insert_column_unnotified`].
434    fn insert_column(&mut self, index: usize, values: &[Self::Item]) {
435        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
436            return self.insert_column_unnotified(index, values);
437        };
438        unsafe { &mut *proxy }.base_begin_insert_columns(&mut *self, &QModelIndex::default(), index as i32, index as i32);
439        self.insert_column_unnotified(index, values);
440        unsafe { &mut *proxy }.base_end_insert_columns(&mut *self);
441    }
442
443    /// Removes and returns the last row in the model and notifies any attached views about
444    /// the change.
445    ///
446    /// This method calls [`QTableModel::pop_row_unnotified`].
447    ///
448    /// Returns `None` if the model is empty. If the model is not empty,
449    /// the function has to guarantee the success of the operation.
450    fn pop_row(&mut self) -> Option<Vec<Self::Item>> {
451        if self.row_count() == 0 {
452            return None;
453        }
454        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
455            return self.pop_row_unnotified();
456        };
457        let row_count = self.row_count() as i32;
458        unsafe { &mut *proxy }.base_begin_remove_rows(&mut *self, &QModelIndex::default(), row_count - 1, row_count - 1);
459        let values = self.pop_row_unnotified();
460        unsafe { &mut *proxy }.base_end_remove_rows(&mut *self);
461        values
462    }
463
464    /// Removes and returns the last column in the model and notifies any attached views about
465    /// the change.
466    ///
467    /// This method calls [`QTableModel::pop_column_unnotified`].
468    ///
469    /// Returns `None` if the model is empty. If the model is not empty,
470    /// the function has to guarantee the success of the operation.
471    fn pop_column(&mut self) -> Option<Vec<Self::Item>> {
472        if self.column_count() == 0 {
473            return None;
474        }
475        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
476            return self.pop_column_unnotified();
477        };
478        let col_count = self.column_count() as i32;
479        unsafe { &mut *proxy }.base_begin_remove_columns(&mut *self, &QModelIndex::default(), col_count - 1, col_count - 1);
480        let values = self.pop_column_unnotified();
481        unsafe { &mut *proxy }.base_end_remove_columns(&mut *self);
482        values
483    }
484
485    /// Removes and returns the row at `index` and notifies any attached views about
486    /// the change.
487    ///
488    /// This method calls [`QTableModel::remove_row_unnotified`].
489    fn remove_row(&mut self, index: usize) -> Vec<Self::Item> {
490        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
491            return self.remove_row_unnotified(index);
492        };
493        unsafe { &mut *proxy }.base_begin_remove_rows(&mut *self, &QModelIndex::default(), index as i32, index as i32);
494        let values = self.remove_row_unnotified(index);
495        unsafe { &mut *proxy }.base_end_remove_rows(&mut *self);
496        values
497    }
498
499    /// Removes and returns the column at `index` and notifies any attached views about
500    /// the change.
501    ///
502    /// This method calls [`QTableModel::remove_column_unnotified`].
503    fn remove_column(&mut self, index: usize) -> Vec<Self::Item> {
504        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
505            return self.remove_column_unnotified(index);
506        };
507        unsafe { &mut *proxy }.base_begin_remove_columns(&mut *self, &QModelIndex::default(), index as i32, index as i32);
508        let values = self.remove_column_unnotified(index);
509        unsafe { &mut *proxy }.base_end_remove_columns(&mut *self);
510        values
511    }
512
513    /// Resets the entire model and notifies any attached views to resynchronize all data.
514    ///
515    /// This method calls [`QTableModel::reset_unnotified`].
516    fn reset(&mut self) {
517        let Some(proxy) = self.try_get_rust_proxy_ptr() else {
518            return self.reset_unnotified();
519        };
520        unsafe { &mut *proxy }.base_begin_reset_model(&mut *self);
521        self.reset_unnotified();
522        unsafe { &mut *proxy }.base_end_reset_model(&mut *self);
523    }
524}
525
526impl<T> QTableModelBase for T
527where T: QTableModel + QObjectHolder<ProxyRust = QTableModelProxyRust> { }
528
529pub type QTableModelProxyRust = GenericRustProxy<QTableModelProxyCpp, dyn QTableModelAdapter>;
530
531impl<T: QTableModelAdapter + 'static> qtbridge_runtime::qproxies::AdapterUpcast<T> for QTableModelProxyRust {
532    fn upcast(rc: std::rc::Rc<std::cell::RefCell<T>>) -> std::rc::Rc<std::cell::RefCell<dyn QTableModelAdapter>> {
533        rc
534    }
535}
536
537impl QTableModelProxyRust {
538    pub fn index(&self, row: i32, column: i32, parent: &QModelIndex) -> QModelIndex {
539        call_rust_trait_impl!(self, index(row, column, parent))
540    }
541    pub fn parent(&self, child: &QModelIndex) -> QModelIndex {
542        call_rust_trait_impl!(self, parent(child))
543    }
544    pub fn row_count(&self, parent: &QModelIndex) -> i32 {
545        call_rust_trait_impl!(self, row_count(parent))
546    }
547    pub fn column_count(&self, parent: &QModelIndex) -> i32 {
548        call_rust_trait_impl!(self, column_count(parent))
549    }
550    pub fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
551        call_rust_trait_impl!(self, data(index, role))
552    }
553    pub fn role_names(&self) -> QHash_i32_QByteArray {
554        call_rust_trait_impl!(self, role_names())
555    }
556    pub fn set_data(&mut self, index: &QModelIndex, value: &QVariant, role: i32) -> bool {
557        call_rust_trait_impl!(mut self, set_data(index, value, role))
558    }
559    pub fn remove_columns(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
560        call_rust_trait_impl!(mut self, remove_columns(first, count, parent))
561    }
562    pub fn remove_rows(&mut self, first: i32, count: i32, parent: &QModelIndex) -> bool {
563        call_rust_trait_impl!(mut self, remove_rows(first, count, parent))
564    }
565    pub fn sibling(&self, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex {
566        call_rust_trait_impl!(self, sibling(row, column, idx))
567    }
568
569    pub fn base_role_names(&self, reference: &dyn QTableModelAdapter) -> QHash_i32_QByteArray {
570        call_cpp_impl!(self, reference, base_role_names())
571    }
572    pub fn base_set_data(&mut self, mut_ref: &mut dyn QTableModelAdapter, index: &QModelIndex, value: &QVariant, role: i32) -> bool {
573        call_cpp_impl!(mut self, mut_ref, base_set_data(index, value, role))
574    }
575    pub fn base_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, first: i32, count: i32, parent: &QModelIndex) -> bool {
576        call_cpp_impl!(mut self, mut_ref, base_remove_columns(first, count, parent))
577    }
578    pub fn base_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, first: i32, count: i32, parent: &QModelIndex) -> bool {
579        call_cpp_impl!(mut self, mut_ref, base_remove_rows(first, count, parent))
580    }
581    pub fn base_sibling(&self, reference: &dyn QTableModelAdapter, row: i32, column: i32, idx: &QModelIndex) -> QModelIndex {
582        call_cpp_impl!(self, reference, base_sibling(row, column, idx))
583    }
584    pub fn base_data_changed(&mut self, mut_ref: &mut dyn QTableModelAdapter, top_left: &QModelIndex, bottom_right: &QModelIndex) {
585        call_cpp_impl!(mut self, mut_ref, base_data_changed(top_left, bottom_right))
586    }
587    pub fn base_begin_insert_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
588        call_cpp_impl!(mut self, mut_ref, base_begin_insert_columns(parent, first, last))
589    }
590    pub fn base_end_insert_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
591        call_cpp_impl!(mut self, mut_ref, base_end_insert_columns())
592    }
593    pub fn base_begin_insert_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
594        call_cpp_impl!(mut self, mut_ref, base_begin_insert_rows(parent, first, last))
595    }
596    pub fn base_end_insert_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
597        call_cpp_impl!(mut self, mut_ref, base_end_insert_rows())
598    }
599    pub fn base_begin_move_columns(
600        &mut self,
601        mut_ref: &mut dyn QTableModelAdapter,
602        source_parent: &QModelIndex,
603        source_first: i32,
604        source_last: i32,
605        destination_parent: &QModelIndex,
606        destination_child: i32,
607    ) {
608        call_cpp_impl!(mut self, mut_ref, base_begin_move_columns(source_parent, source_first, source_last, destination_parent, destination_child))
609    }
610    pub fn base_end_move_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
611        call_cpp_impl!(mut self, mut_ref, base_end_move_columns())
612    }
613    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) {
614        call_cpp_impl!(mut self, mut_ref, base_begin_move_rows(source_parent, source_first, source_last, destination_parent, destination_child))
615    }
616    pub fn base_end_move_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
617        call_cpp_impl!(mut self, mut_ref, base_end_move_rows())
618    }
619    pub fn base_begin_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
620        call_cpp_impl!(mut self, mut_ref, base_begin_remove_columns(parent, first, last))
621    }
622    pub fn base_end_remove_columns(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
623        call_cpp_impl!(mut self, mut_ref, base_end_remove_columns())
624    }
625    pub fn base_begin_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter, parent: &QModelIndex, first: i32, last: i32) {
626        call_cpp_impl!(mut self, mut_ref, base_begin_remove_rows(parent, first, last))
627    }
628    pub fn base_end_remove_rows(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
629        call_cpp_impl!(mut self, mut_ref, base_end_remove_rows())
630    }
631    pub fn base_begin_reset_model(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
632        call_cpp_impl!(mut self, mut_ref, base_begin_reset_model())
633    }
634    pub fn base_end_reset_model(&mut self, mut_ref: &mut dyn QTableModelAdapter) {
635        call_cpp_impl!(mut self, mut_ref, base_end_reset_model())
636    }
637    pub fn base_create_index(&self, reference: &dyn QTableModelAdapter, row: i32, column: i32, ptr: usize) -> QModelIndex {
638        call_cpp_impl!(self, reference, base_create_index(row, column, ptr))
639    }
640}