add signal prototypes

This commit is contained in:
Christoph Holzheuer
2025-09-02 16:58:56 +02:00
parent 147769bf60
commit 3e7b65dca5
10 changed files with 118 additions and 42 deletions

View File

@@ -40,19 +40,23 @@ void showItemList( const XQItemList& list)
}
//! Konstruktur mit parent.
//! Konstruktor mit parent.
XQViewModel::XQViewModel( QObject* parent )
: QStandardItemModel{ parent }, _itemFactory{ XQItemFactory::instance() }
{
invisibleRootItem()->setData( "[rootItem]", Qt::DisplayRole );
setItemPrototype( new XQItem );
connect(this, &QStandardItemModel::itemChanged, this, [](QStandardItem *item)
/*
// auf änderungen kann in den unterklassen reagiert werden
connect(this, &QStandardItemModel::itemChanged, this, [this](QStandardItem *item)
{
qDebug() << " --- item changed: " << item->text();
XQItem* xqItem = static_cast<XQItem*>(item);
onItemChanged( *xqItem );
});
*/
//qRegisterMetaType<XQItem>("XQItem");
}
@@ -185,6 +189,16 @@ void YourClass::onItemChanged(const QModelIndex &topLeft, const QModelIndex &bot
}
/*
//! SLOT als weiterleitung vom SIGNAL itemchanged
void XQViewModel::onItemChanged(XQItem* item )
{
qDebug() << " --- BASE item changed: " << item->text();
}
*/
//! SLOT, der aufgerufen wird, wenn eine edit-action getriggert wurde.
void XQViewModel::onActionTriggered(QAction* action)
@@ -518,7 +532,7 @@ void XQViewModel::setTreeTable(XQTreeTable* mainView )
{
// store view for direct access: the maintree
_treeTable = mainView;
// connect myself as model to the mainview
// set myself as model to the mainview
_treeTable->setModel(this);
XQItemDelegate* delegate = new XQItemDelegate( *this );
_treeTable->setItemDelegate( delegate );

View File

@@ -95,12 +95,16 @@ public:
*/
virtual void onItemChanged( XQItem& item ) = 0;
public slots:
virtual void onShowContextMenu(const QPoint& point);
virtual void onActionTriggered(QAction* action);
virtual void onToggleSection(const QString& sectionKey );
// handle XQCommands ( == UndoCommand )
virtual void onCommandRedo( const XQCommand& command );
virtual void onCommandUndo( const XQCommand& command );