cxx_qt_lib/core/
qpersistentmodelindex.rs1use cxx::{type_id, ExternType};
6use std::fmt;
7use std::mem::MaybeUninit;
8
9#[cxx::bridge]
10mod ffi {
11 unsafe extern "C++" {
12 include!("cxx-qt-lib/qpersistentmodelindex.h");
13 include!("cxx-qt-lib/qstring.h");
14
15 type QPersistentModelIndex = super::QPersistentModelIndex;
16 type QString = crate::QString;
17
18 include!("cxx-qt-lib/qmodelindex.h");
19 type QModelIndex = crate::QModelIndex;
20
21 fn column(self: &QPersistentModelIndex) -> i32;
23 #[rust_name = "is_valid"]
27 fn isValid(self: &QPersistentModelIndex) -> bool;
28 fn parent(self: &QPersistentModelIndex) -> QModelIndex;
30 fn row(self: &QPersistentModelIndex) -> i32;
32 fn sibling(self: &QPersistentModelIndex, row: i32, column: i32) -> QModelIndex;
34
35 fn swap(self: &mut QPersistentModelIndex, other: &mut QPersistentModelIndex);
37 }
38
39 #[namespace = "rust::cxxqtlib1"]
40 unsafe extern "C++" {
41 include!("cxx-qt-lib/common.h");
42
43 #[doc(hidden)]
44 #[rust_name = "qpersistentmodelindex_drop"]
45 fn drop(string: &mut QPersistentModelIndex);
46
47 #[doc(hidden)]
48 #[rust_name = "qpersistentmodelindex_from_qmodelindex"]
49 fn construct(index: &QModelIndex) -> QPersistentModelIndex;
50 #[doc(hidden)]
51 #[rust_name = "qpersistentmodelindex_clone"]
52 fn construct(other: &QPersistentModelIndex) -> QPersistentModelIndex;
53 #[doc(hidden)]
54 #[rust_name = "qpersistentmodelindex_eq"]
55 fn operatorEq(a: &QPersistentModelIndex, b: &QPersistentModelIndex) -> bool;
56 #[doc(hidden)]
57 #[rust_name = "qpersistentmodelindex_to_qstring"]
58 fn toQString(value: &QPersistentModelIndex) -> QString;
59 }
60}
61
62#[repr(C)]
64pub struct QPersistentModelIndex {
65 _space: MaybeUninit<usize>,
66}
67
68impl Clone for QPersistentModelIndex {
69 fn clone(&self) -> Self {
71 ffi::qpersistentmodelindex_clone(self)
72 }
73}
74
75impl Drop for QPersistentModelIndex {
76 fn drop(&mut self) {
78 ffi::qpersistentmodelindex_drop(self)
79 }
80}
81
82impl From<&crate::QModelIndex> for QPersistentModelIndex {
83 fn from(index: &crate::QModelIndex) -> Self {
85 ffi::qpersistentmodelindex_from_qmodelindex(index)
86 }
87}
88
89impl std::cmp::PartialEq for QPersistentModelIndex {
90 fn eq(&self, other: &Self) -> bool {
91 ffi::qpersistentmodelindex_eq(self, other)
92 }
93}
94
95impl std::cmp::Eq for QPersistentModelIndex {}
96
97impl fmt::Display for QPersistentModelIndex {
98 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
99 write!(f, "{}", ffi::qpersistentmodelindex_to_qstring(self))
100 }
101}
102
103impl fmt::Debug for QPersistentModelIndex {
104 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
105 write!(f, "{self}")
106 }
107}
108
109unsafe impl ExternType for QPersistentModelIndex {
113 type Id = type_id!("QPersistentModelIndex");
114 type Kind = cxx::kind::Trivial;
115}