#pragma once #include "fusion_model.hpp" #include "boost_any_to_qvariant.hpp" #include "meta_types.hpp" #include #include #include #include template struct QtModelType { typedef void type; }; template struct QtModelType> { typedef QAbstractTableModel type; }; template struct QtAdapter : public Q { typedef void view; QtAdapter(T) {} }; template struct QtAdapter : public QAbstractTableModel { typedef QTableView view; T model; QtAdapter(T model) : model(model) {} virtual int rowCount(QModelIndex const&) const override { return model.row_count(); } virtual int columnCount(QModelIndex const&) const override { return model.column_count(); } virtual QVariant data(QModelIndex const& index, int role) const { if(role != Qt::DisplayRole) return QVariant(); return to_qvariant(model.get_cell(index.row(), index.column()), index.column()); } }; template std::shared_ptr::type>> make_qt_adapter(T value) { return std::make_shared::type>>(value); }