diff --git a/CMakeLists.txt b/CMakeLists.txt index 3edc5a646..f717554c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QMovie/qmovie_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QPalette/qpalette_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QStyle/qstyle_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtCore/QDate/qdate_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtCore/QDateTime/qdatetime_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtCore/QModelIndex/qmodelindex_wrap.cpp" @@ -144,6 +145,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QSvgWidget/qsvgwidget_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QDesktopWidget/qdesktopwidget_wrap.cpp" # Custom widgets (include them for automoc since they contain Q_OBJECT) + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtCore/QAbstractItemModel/nabstractitemmodel.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtCore/QObject/nobject.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/core/FlexLayout/flexlayout.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtGui/QMovie/nmovie.hpp" diff --git a/package.json b/package.json index b3857a9d8..1eafa7a0c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "lint:ts": "cross-env tsc --noEmit && cross-env eslint './src/**/*.{ts,tsx,js,jsx}' --fix", "docs": "cross-env typedoc && node ./website/docs/scripts/fixdocs.js", "qode": "cross-env node ./scripts/qode.js", - "prepublishOnly": "cross-env npm run build" + "prepublishOnly": "cross-env npm run build", + "example-modelview_1_readonly": "node ./scripts/qode.js dist/examples/modelview_1_readonly.js" }, "engines": { "node": ">=14.x.x" diff --git a/src/cpp/include/nodegui/QtCore/QAbstractItemModel/nabstractitemmodel.hpp b/src/cpp/include/nodegui/QtCore/QAbstractItemModel/nabstractitemmodel.hpp new file mode 100644 index 000000000..4b1f0c538 --- /dev/null +++ b/src/cpp/include/nodegui/QtCore/QAbstractItemModel/nabstractitemmodel.hpp @@ -0,0 +1,93 @@ +#pragma once +#include + +#include "Extras/Export/export.h" +#include "QtCore/QObject/qobject_macro.h" +#include "core/NodeWidget/nodewidget.h" +#include "QtCore/QModelIndex/qmodelindex_wrap.h" + +#include "napi.h" + +class DLL_EXPORT NAbstractItemModel : public QAbstractItemModel, public EventWidget { + Q_OBJECT + EVENTWIDGET_IMPLEMENTATIONS(QAbstractItemModel) + public: + Napi::FunctionReference dispatchOnNode; + + void connectSignalsToEventEmitter() { + // Qt Connects: Implement all signal connects here + QOBJECT_SIGNALS + } + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto parentModelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(parent))}); + Napi::Value modelIndexNapiWrap = this->dispatchOnNode.Call( + {Napi::String::New(env, "index"), Napi::Value::From(env, row), Napi::Value::From(env, column), parentModelIndexWrap}); + + QModelIndexWrap* modelIndexWrap = Napi::ObjectWrap::Unwrap(modelIndexNapiWrap.As()); + QModelIndex* newIndex = modelIndexWrap->getInternalInstance(); + return *newIndex; + } + + QModelIndex parent(const QModelIndex &child) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto childModelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(child))}); + Napi::Value modelIndexNapiWrap = this->dispatchOnNode.Call({Napi::String::New(env, "parent"), childModelIndexWrap}); + + QModelIndexWrap* modelIndexWrap = Napi::ObjectWrap::Unwrap(modelIndexNapiWrap.As()); + QModelIndex* parentIndex = modelIndexWrap->getInternalInstance(); + return *parentIndex; + } + + int rowCount(const QModelIndex &parent = QModelIndex()) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto modelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(parent))}); + Napi::Value result = this->dispatchOnNode.Call({Napi::String::New(env, "rowCount"), modelIndexWrap}); + + return result.As().Int32Value(); + } + + int columnCount(const QModelIndex &parent = QModelIndex()) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto modelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(parent))}); + Napi::Value result = this->dispatchOnNode.Call({Napi::String::New(env, "columnCount"), modelIndexWrap}); + return result.As().Int32Value(); + } + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto modelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(index))}); + auto roleValue = Napi::Value::From(env, role); + Napi::Value variantJsObject = this->dispatchOnNode.Call({Napi::String::New(env, "data"), modelIndexWrap, roleValue}); + + QVariantWrap* variantWrap = Napi::ObjectWrap::Unwrap(variantJsObject.As()); + QVariant* variant = variantWrap->getInternalInstance(); + return *variant; + } + + Qt::ItemFlags flags(const QModelIndex &index) const override { + Napi::Env env = this->dispatchOnNode.Env(); + Napi::HandleScope scope(env); + + auto modelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(index))}); + Napi::Value numberJs = this->dispatchOnNode.Call({Napi::String::New(env, "flags"), modelIndexWrap}); + + auto result = static_cast(numberJs.As().Uint32Value()); + return result; + } + + QModelIndex _protected_createIndex(int row, int column) const { + return createIndex(row, column); + } +}; diff --git a/src/cpp/include/nodegui/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h b/src/cpp/include/nodegui/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h new file mode 100644 index 000000000..f391b95a9 --- /dev/null +++ b/src/cpp/include/nodegui/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +#include "Extras/Export/export.h" +#include "QtCore/QObject/qobject_macro.h" +#include "nabstractitemmodel.hpp" + + +class DLL_EXPORT QAbstractItemModelWrap : public Napi::ObjectWrap { + QOBJECT_WRAPPED_METHODS_DECLARATION + + private: + QPointer instance; + public: + static Napi::Object init(Napi::Env env, Napi::Object exports); + QAbstractItemModelWrap(const Napi::CallbackInfo& info); + ~QAbstractItemModelWrap(); + NAbstractItemModel* getInternalInstance(); + // class constructor + static Napi::FunctionReference constructor; + // wrapped methods + Napi::Value initNodeDispatcher(const Napi::CallbackInfo& info); + + Napi::Value hasIndex(const Napi::CallbackInfo& info); + Napi::Value createIndex(const Napi::CallbackInfo& info); + Napi::Value _super_flags(const Napi::CallbackInfo& info); +}; diff --git a/src/cpp/include/nodegui/QtCore/QVariant/qvariant_wrap.h b/src/cpp/include/nodegui/QtCore/QVariant/qvariant_wrap.h index de217c3ee..26e3e1f18 100644 --- a/src/cpp/include/nodegui/QtCore/QVariant/qvariant_wrap.h +++ b/src/cpp/include/nodegui/QtCore/QVariant/qvariant_wrap.h @@ -27,5 +27,5 @@ class DLL_EXPORT QVariantWrap : public Napi::ObjectWrap { }; namespace StaticQVariantWrapMethods { -DLL_EXPORT Napi::Value converToQVariant(const Napi::CallbackInfo& info); +DLL_EXPORT Napi::Value convertToQVariant(const Napi::CallbackInfo& info); } // namespace StaticQVariantWrapMethods \ No newline at end of file diff --git a/src/cpp/include/nodegui/QtWidgets/QAbstractItemView/qabstractitemview_macro.h b/src/cpp/include/nodegui/QtWidgets/QAbstractItemView/qabstractitemview_macro.h index 01b6ffd65..b4a6497b0 100644 --- a/src/cpp/include/nodegui/QtWidgets/QAbstractItemView/qabstractitemview_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QAbstractItemView/qabstractitemview_macro.h @@ -1,6 +1,7 @@ #pragma once #include "QtCore/QModelIndex/qmodelindex_wrap.h" +#include "QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h" #include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h" #include "QtWidgets/QWidget/qwidget_wrap.h" @@ -88,6 +89,16 @@ Napi::HandleScope scope(env); \ this->instance->scrollToTop(); \ return env.Null(); \ + } \ + Napi::Value setModel(const Napi::CallbackInfo& info) { \ + Napi::Env env = info.Env(); \ + Napi::HandleScope scope(env); \ + Napi::Object modelObject = info[0].As(); \ + QAbstractItemModelWrap* modelWrap = \ + Napi::ObjectWrap::Unwrap(modelObject); \ + QAbstractItemView* instance= this->instance; \ + instance->setModel(modelWrap->getInternalInstance()); \ + return env.Null(); \ } #endif // QABSTRACTITEMVIEW_WRAPPED_METHODS_DECLARATION @@ -105,7 +116,8 @@ &WidgetWrapName::resetVerticalScrollMode), \ InstanceMethod("rootIndex", &WidgetWrapName::rootIndex), \ InstanceMethod("scrollToBottom", &WidgetWrapName::scrollToBottom), \ - InstanceMethod("scrollToTop", &WidgetWrapName::scrollToTop), + InstanceMethod("scrollToTop", &WidgetWrapName::scrollToTop), \ + InstanceMethod("setModel", &WidgetWrapName::setModel), #endif // QABSTRACTITEMVIEW_WRAPPED_METHODS_EXPORT_DEFINE diff --git a/src/cpp/lib/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.cpp b/src/cpp/lib/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.cpp new file mode 100644 index 000000000..db6646a55 --- /dev/null +++ b/src/cpp/lib/QtCore/QAbstractItemModel/qabstractitemmodel_wrap.cpp @@ -0,0 +1,76 @@ + +#include "QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h" + +#include "Extras/Utils/nutils.h" + + +Napi::FunctionReference QAbstractItemModelWrap::constructor; + +Napi::Object QAbstractItemModelWrap::init(Napi::Env env, Napi::Object exports) { + Napi::HandleScope scope(env); + char CLASSNAME[] = "QAbstractItemModel"; + Napi::Function func = DefineClass( + env, CLASSNAME, + {InstanceMethod("initNodeDispatcher", &QAbstractItemModelWrap::initNodeDispatcher), + InstanceMethod("hasIndex", &QAbstractItemModelWrap::hasIndex), + InstanceMethod("createIndex", &QAbstractItemModelWrap::createIndex), + InstanceMethod("_super_flags", &QAbstractItemModelWrap::_super_flags), + QOBJECT_WRAPPED_METHODS_EXPORT_DEFINE(QAbstractItemModelWrap)}); + constructor = Napi::Persistent(func); + exports.Set(CLASSNAME, func); + return exports; +} + +NAbstractItemModel* QAbstractItemModelWrap::getInternalInstance() { return this->instance; } +QAbstractItemModelWrap::~QAbstractItemModelWrap() { extrautils::safeDelete(this->instance); } + +QAbstractItemModelWrap::QAbstractItemModelWrap(const Napi::CallbackInfo& info) + : Napi::ObjectWrap(info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + + this->instance = new NAbstractItemModel(); +} + +Napi::Value QAbstractItemModelWrap::initNodeDispatcher(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + this->instance->dispatchOnNode = Napi::Persistent(info[0].As()); + return env.Null(); +} + +Napi::Value QAbstractItemModelWrap::hasIndex(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + + int row = info[0].As().Int32Value(); + int column = info[1].As().Int32Value(); + QModelIndexWrap* modelIndexWrap = Napi::ObjectWrap::Unwrap(info[2].As()); + QModelIndex* parentIndex = modelIndexWrap->getInternalInstance(); + + auto result = Napi::Value::From(env, this->instance->hasIndex(row, column, *parentIndex)); + return result; +} + +Napi::Value QAbstractItemModelWrap::createIndex(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + + int row = info[0].As().Int32Value(); + int column = info[1].As().Int32Value(); + + QModelIndex resultIndex = this->instance->_protected_createIndex(row, column); + + auto resultModelIndexWrap = QModelIndexWrap::constructor.New({Napi::External::New(env, new QModelIndex(resultIndex))}); + return resultModelIndexWrap; +} + +Napi::Value QAbstractItemModelWrap::_super_flags(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + + QModelIndexWrap* modelIndexWrap = Napi::ObjectWrap::Unwrap(info[0].As()); + QModelIndex* index = modelIndexWrap->getInternalInstance(); + + auto result = Napi::Value::From(env, static_cast(this->instance->QAbstractItemModel::flags(*index))); + return result; +} diff --git a/src/cpp/lib/QtCore/QVariant/qvariant_wrap.cpp b/src/cpp/lib/QtCore/QVariant/qvariant_wrap.cpp index cf539bd0d..9193f3e29 100644 --- a/src/cpp/lib/QtCore/QVariant/qvariant_wrap.cpp +++ b/src/cpp/lib/QtCore/QVariant/qvariant_wrap.cpp @@ -14,8 +14,8 @@ Napi::Object QVariantWrap::init(Napi::Env env, Napi::Object exports) { InstanceMethod("toDouble", &QVariantWrap::toDouble), InstanceMethod("toBool", &QVariantWrap::toBool), InstanceMethod("toStringList", &QVariantWrap::toStringList), - StaticMethod("converToQVariant", - &StaticQVariantWrapMethods::converToQVariant), + StaticMethod("convertToQVariant", + &StaticQVariantWrapMethods::convertToQVariant), COMPONENT_WRAPPED_METHODS_EXPORT_DEFINE(QVariantWrap)}); constructor = Napi::Persistent(func); exports.Set(CLASSNAME, func); @@ -72,7 +72,7 @@ Napi::Value QVariantWrap::toStringList(const Napi::CallbackInfo& info) { return result; } -Napi::Value StaticQVariantWrapMethods::converToQVariant( +Napi::Value StaticQVariantWrapMethods::convertToQVariant( const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); Napi::HandleScope scope(env); diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 6e72970ef..36b3b494d 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -1,6 +1,7 @@ #include #include "Extras/Utils/nutils.h" +#include "QtCore/QAbstractItemModel/qabstractitemmodel_wrap.h" #include "QtCore/QDate/qdate_wrap.h" #include "QtCore/QDateTime/qdatetime_wrap.h" #include "QtCore/QMimeData/qmimedata_wrap.h" @@ -220,6 +221,7 @@ Napi::Object Main(Napi::Env env, Napi::Object exports) { QDesktopWidgetWrap::init(env, exports); QPaintEventWrap::init(env, exports); QPaletteWrap::init(env, exports); + QAbstractItemModelWrap::init(env, exports); return exports; } diff --git a/src/examples/modelview_1_readonly.ts b/src/examples/modelview_1_readonly.ts new file mode 100644 index 000000000..ad33c25bd --- /dev/null +++ b/src/examples/modelview_1_readonly.ts @@ -0,0 +1,30 @@ +import { ItemDataRole, QAbstractTableModel, QModelIndex, QTableView, QVariant } from '..'; + +function main(): void { + const tableView = new QTableView(); + const model = new MyModel(); + tableView.setModel(model); + + tableView.show(); + + (global as any).win = tableView; +} + +class MyModel extends QAbstractTableModel { + rowCount(parent = new QModelIndex()): number { + return 2; + } + + columnCount(parent = new QModelIndex()): number { + return 2; + } + + data(index: QModelIndex, role = ItemDataRole.DisplayRole): QVariant { + if (role === ItemDataRole.DisplayRole) { + return new QVariant(`Row${index.row() + 1}, Column${index.column() + 1}`); + } + return new QVariant(); + } +} + +main(); diff --git a/src/index.ts b/src/index.ts index cbe53c014..7eac6eef3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -128,6 +128,8 @@ export { WrapMode, } from './lib/QtWidgets/QTextEdit'; // Core +export { QAbstractItemModel } from './lib/QtCore/QAbstractItemModel'; +export { QAbstractTableModel } from './lib/QtCore/QAbstractTableModel'; export { QDate } from './lib/QtCore/QDate'; export { QDateTime } from './lib/QtCore/QDateTime'; export { QModelIndex } from './lib/QtCore/QModelIndex'; diff --git a/src/lib/QtCore/QAbstractItemModel.ts b/src/lib/QtCore/QAbstractItemModel.ts new file mode 100644 index 000000000..2c2f932e9 --- /dev/null +++ b/src/lib/QtCore/QAbstractItemModel.ts @@ -0,0 +1,113 @@ +import addon from '../utils/addon'; +import { NativeElement } from '../core/Component'; +import { NodeObject, QObjectSignals } from '../QtCore/QObject'; +import { QModelIndex } from './QModelIndex'; +import { QVariant } from './QVariant'; +import { ItemDataRole, ItemFlag } from '../QtEnums'; + +export interface QAbstractItemSignals extends QObjectSignals { + // itemChanged: (item: QStandardItem) => void; +} + +export class QAbstractItemModel extends NodeObject { + native: NativeElement; + constructor() { + const native = new addon.QAbstractItemModel(); + super(native); + this.native = native; + const dispatcher = (methodName: string, ...args: any[]): any => { + switch (methodName) { + case 'index': + try { + return this.index(args[0], args[1], new QModelIndex(args[2])).native; + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'index':`); + console.log(e); + } + return new QModelIndex().native; + + case 'parent': + try { + return this.parent(new QModelIndex(args[0])).native; + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'parent':`); + console.log(e); + } + return new QModelIndex().native; + + case 'rowCount': + try { + return this.columnCount(new QModelIndex(args[0])); + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'rowCount':`); + console.log(e); + } + return 0; + + case 'columnCount': + try { + return this.columnCount(new QModelIndex(args[0])); + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'columnCount':`); + console.log(e); + } + return 0; + + case 'data': + try { + return this.data(new QModelIndex(args[0]), args[1]).native; + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'data':`); + console.log(e); + } + return new QVariant().native; + + case 'flags': + try { + return this.flags(new QModelIndex(args[0])); + } catch (e) { + console.log(`An exception was thrown while dispatching to method 'flags':`); + console.log(e); + } + return ItemFlag.NoItemFlags; + + default: + return null; + } + }; + this.native.initNodeDispatcher(dispatcher); + } + + index(row: number, column: number, parent = new QModelIndex()): QModelIndex { + return new QModelIndex(); + } + + parent(child: QModelIndex): QModelIndex { + return new QModelIndex(); + } + + rowCount(parent = new QModelIndex()): number { + return 0; + } + + columnCount(parent = new QModelIndex()): number { + return 0; + } + + data(index: QModelIndex, role = ItemDataRole.DisplayRole): QVariant { + return new QVariant(); + } + + hasIndex(row: number, column: number, parent = new QModelIndex()): boolean { + return this.native.hasIndex(row, column, parent.native); + } + + createIndex(row: number, column: number): QModelIndex { + const result = this.native.createIndex(row, column); + return new QModelIndex(result); + } + + flags(index: QModelIndex): ItemFlag { + return this.native._super_flags(index.native); + } +} diff --git a/src/lib/QtCore/QAbstractTableModel.ts b/src/lib/QtCore/QAbstractTableModel.ts new file mode 100644 index 000000000..b44ab5412 --- /dev/null +++ b/src/lib/QtCore/QAbstractTableModel.ts @@ -0,0 +1,32 @@ +import { ItemFlag } from '../QtEnums'; +import { QAbstractItemModel } from './QAbstractItemModel'; +import { QModelIndex } from './QModelIndex'; + +export class QAbstractTableModel extends QAbstractItemModel { + index(row: number, column: number, parent = new QModelIndex()): QModelIndex { + return this.hasIndex(row, column, parent) ? this.createIndex(row, column) : new QModelIndex(); + } + + parent(child: QModelIndex): QModelIndex { + return new QModelIndex(); + } + + sibling(row: number, column: number, index: QModelIndex): QModelIndex { + return this.index(row, column); + } + + hasChildren(parent: QModelIndex): boolean { + if (!parent.isValid()) { + return this.rowCount(parent) > 0 && this.columnCount(parent) > 0; + } + return false; + } + + flags(index: QModelIndex): ItemFlag { + let f = super.flags(index); + if (index.isValid()) { + f |= ItemFlag.ItemNeverHasChildren; + } + return f; + } +} diff --git a/src/lib/QtCore/QVariant.ts b/src/lib/QtCore/QVariant.ts index d9677a91e..d1f7d6345 100644 --- a/src/lib/QtCore/QVariant.ts +++ b/src/lib/QtCore/QVariant.ts @@ -14,7 +14,7 @@ export class QVariant extends Component { if (checkIfNativeElement(arg) && arg instanceof addon.QVariant) { this.native = arg as NativeElement; } else if (arg) { - this.native = new addon.QVariant.converToQVariant(arg); + this.native = new addon.QVariant.convertToQVariant(arg); } else { this.native = new addon.QVariant(); } diff --git a/src/lib/QtWidgets/QAbstractItemView.ts b/src/lib/QtWidgets/QAbstractItemView.ts index 85c90cf13..c1fd28a3e 100644 --- a/src/lib/QtWidgets/QAbstractItemView.ts +++ b/src/lib/QtWidgets/QAbstractItemView.ts @@ -4,9 +4,10 @@ import { QModelIndex } from '../QtCore/QModelIndex'; import { QSize } from '../QtCore/QSize'; import { DropAction } from '../QtEnums/DropAction'; import { TextElideMode } from '../QtEnums/TextElideMode'; +import { QAbstractItemModel } from '../QtCore/QAbstractItemModel'; /** - + > This is the abstract base class of button widgets, providing their functionality. * **This class is a JS wrapper around Qt's [QAbstractItemView class](https://doc.qt.io/qt-5/qabstractitemview.html)** @@ -138,6 +139,9 @@ export abstract class QAbstractItemView