rust side builds but having trouble linking in main.cpp

This commit is contained in:
Chris Cochrun 2025-03-12 09:35:36 -05:00
parent fbcb6afc7a
commit 92f2b18a20
14 changed files with 377 additions and 140 deletions

View file

@ -2,6 +2,7 @@
pub mod image_model {
unsafe extern "C++" {
include!(< QAbstractListModel >);
type QAbstractListModel;
include!("cxx-qt-lib/qhash.h");
type QHash_i32_QByteArray =
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
@ -33,13 +34,14 @@ pub mod image_model {
unsafe extern "RustQt" {
#[qobject]
#[base = "QAbstractListModel"]
#[base = QAbstractListModel]
#[qml_element]
#[qproperty(i32, count)]
type ImageModel = super::ImageModelRust;
#[inherit]
#[qsignal]
#[cxx_name = "dataChanged"]
fn data_changed(
self: Pin<&mut ImageModel>,
top_left: &QModelIndex,
@ -83,6 +85,7 @@ pub mod image_model {
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]
unsafe fn begin_insert_rows(
self: Pin<&mut ImageModel>,
parent: &QModelIndex,
@ -91,9 +94,11 @@ pub mod image_model {
);
#[inherit]
#[cxx_name = "endInsertRows"]
unsafe fn end_insert_rows(self: Pin<&mut ImageModel>);
#[inherit]
#[cxx_name = "beginRemoveRows"]
unsafe fn begin_remove_rows(
self: Pin<&mut ImageModel>,
parent: &QModelIndex,
@ -102,6 +107,7 @@ pub mod image_model {
);
#[inherit]
#[cxx_name = "beginMoveRows"]
unsafe fn begin_move_rows(
self: Pin<&mut ImageModel>,
source_parent: &QModelIndex,
@ -112,18 +118,23 @@ pub mod image_model {
) -> bool;
#[inherit]
#[cxx_name = "endMoveRows"]
unsafe fn end_move_rows(self: Pin<&mut ImageModel>);
#[inherit]
#[cxx_name = "endRemoveRows"]
unsafe fn end_remove_rows(self: Pin<&mut ImageModel>);
#[inherit]
#[cxx_name = "beginResetModel"]
unsafe fn begin_reset_model(self: Pin<&mut ImageModel>);
#[inherit]
#[cxx_name = "endResetModel"]
unsafe fn end_reset_model(self: Pin<&mut ImageModel>);
#[inherit]
#[cxx_name = "canFetchMore"]
fn can_fetch_more(
self: &ImageModel,
parent: &QModelIndex,
@ -147,18 +158,20 @@ pub mod image_model {
#[qinvokable]
#[cxx_override]
#[cxx_name = "roleNames"]
fn role_names(self: &ImageModel) -> QHash_i32_QByteArray;
#[qinvokable]
#[cxx_override]
#[cxx_name = "rowCount"]
fn row_count(self: &ImageModel, _parent: &QModelIndex)
-> i32;
-> i32;
}
}
use cxx_qt::CxxQtType;
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
use sqlx::{query, query_as, Connection, SqliteConnection};
use sqlx::{Connection, SqliteConnection, query, query_as};
use std::path::PathBuf;
use std::pin::Pin;
use tracing::{debug, error};