renamings.

This commit is contained in:
2025-08-07 03:11:56 +02:00
parent e3256c68f0
commit e7213c60b8
21 changed files with 110 additions and 110 deletions

View File

@@ -13,8 +13,8 @@
#include <xqcommand.h>
#include <xqmodel.h>
#include <xqtreeview.h>
#include <xqviewmodel.h>
#include <xqtreetable.h>
void XQNodeStore::dumpList( const QString& title ) const
@@ -26,7 +26,7 @@ void XQNodeStore::dumpList( const QString& title ) const
}
XQCommand::XQCommand(CmdType cmdType, XQModel* modelView )
XQCommand::XQCommand(CmdType cmdType, XQViewModel* modelView )
: _cmdType{ cmdType }, _model(modelView)
{

View File

@@ -18,7 +18,7 @@
#include <QUndoCommand>
#include <xqitem.h>
class XQModel;
class XQViewModel;
struct XQNodeBackup
{
@@ -66,7 +66,7 @@ public:
cmdExtern //??
};
XQCommand(CmdType cmdType, XQModel* modelView );
XQCommand(CmdType cmdType, XQViewModel* modelView );
virtual ~XQCommand();
CmdType commandType() const;
@@ -85,7 +85,7 @@ public:
protected:
CmdType _cmdType{cmdInvalid};
XQModel* _model{}; // needed for redo() / undo()
XQViewModel* _model{}; // needed for redo() / undo()
QModelIndex _originIndex;
/*

View File

@@ -13,7 +13,7 @@
#include <xqsimpleclipboard.h>
#include <xqmodel.h>
#include <xqviewmodel.h>
bool XQSimpleClipBoard::canPaste( const QModelIndex& curIdx ) const

View File

@@ -16,9 +16,9 @@
#include <QUndoStack>
#include <xqexception.h>
#include <xqmodel.h>
#include <xqviewmodel.h>
#include <xqselectionmodel.h>
#include <xqtreeview.h>
#include <xqtreetable.h>
#include <xqcommand.h>
#include <xqitemdelegate.h>
#include <xqitemfactory.h>
@@ -38,12 +38,12 @@ void showItemList( const XQItemList& list)
}
XQModel::~XQModel()
XQViewModel::~XQViewModel()
{
}
XQModel::XQModel( QObject* parent )
XQViewModel::XQViewModel( QObject* parent )
: QStandardItemModel{ parent }, _itemFactory{ XQItemFactory::instance() }
{
invisibleRootItem()->setData( "[rootItem]", Qt::DisplayRole );
@@ -51,7 +51,7 @@ XQModel::XQModel( QObject* parent )
}
const XQItem& XQModel::xqRootItem()
const XQItem& XQViewModel::xqRootItem()
{
// das ist ein hack, denn 'invisibleRootItem()' ist und bleibt ein
// QStandardItem. Trick: keine eigenen members in XQItem, alles
@@ -62,7 +62,7 @@ const XQItem& XQModel::xqRootItem()
}
XQItem& XQModel::xqItemFromIndex(const QModelIndex& index) const
XQItem& XQViewModel::xqItemFromIndex(const QModelIndex& index) const
{
if( index.isValid() )
{
@@ -73,12 +73,12 @@ XQItem& XQModel::xqItemFromIndex(const QModelIndex& index) const
return XQItem::fallBackDummyItem();
}
XQItem& XQModel::xqFirstItem(int row) const
XQItem& XQViewModel::xqFirstItem(int row) const
{
return *static_cast<XQItem*>( QStandardItemModel::item(row) );
}
void XQModel::onActionTriggered(QAction* action)
void XQViewModel::onActionTriggered(QAction* action)
{
qDebug() << " --- onActionTriggered: count:" << XQNode::s_Count;
@@ -125,11 +125,11 @@ void XQModel::onActionTriggered(QAction* action)
/**
* @brief XQModel::onCommandRedo called to execute a command ('do').
* @brief XQViewModel::onCommandRedo called to execute a command ('do').
* @param command the current command
*/
void XQModel::onCommandRedo( XQCommand& command )
void XQViewModel::onCommandRedo( XQCommand& command )
{
try
{
@@ -167,11 +167,11 @@ void XQModel::onCommandRedo( XQCommand& command )
/**
* @brief XQModel::onCommandUndo: called to 'undo' a command.
* @brief XQViewModel::onCommandUndo: called to 'undo' a command.
* @param command the command to be undone.
*/
void XQModel::onCommandUndo( XQCommand& command )
void XQViewModel::onCommandUndo( XQCommand& command )
{
qDebug() << " --- onCommandUndo: count: " << XQNode::s_Count;
try
@@ -220,7 +220,7 @@ void XQModel::onCommandUndo( XQCommand& command )
// undo-/redo-able stuff
//! markierte knoten entfernen, 'command' enthält die liste
void XQModel::cmdCut( XQCommand& command )
void XQViewModel::cmdCut( XQCommand& command )
{
// wir gehen rückwärts über alle gemerkten knoten ...
for (auto it = command.rbegin(); it != command.rend(); ++it)
@@ -238,7 +238,7 @@ void XQModel::cmdCut( XQCommand& command )
//! entfernte knoten wieder einfügen , 'command' enthält die liste
void XQModel::cmdCutUndo( XQCommand& command )
void XQViewModel::cmdCutUndo( XQCommand& command )
{
// die anfangsposition
int itmPos = command.first().itemPos;
@@ -262,7 +262,7 @@ void XQModel::cmdCutUndo( XQCommand& command )
//! clipboard inhalte einfügen
void XQModel::cmdPaste( XQCommand& command )
void XQViewModel::cmdPaste( XQCommand& command )
{
// selection holen ...
QItemSelectionModel* selectionModel = treeView()->selectionModel();
@@ -303,7 +303,7 @@ void XQModel::cmdPaste( XQCommand& command )
//! einfügen aus dem clipboard wieder rückgängig machen
void XQModel::cmdPasteUndo( XQCommand& command )
void XQViewModel::cmdPasteUndo( XQCommand& command )
{
command.dumpList("Paste UNDO");
// wir gehen rückwärts über alle markieren knoten ...
@@ -322,7 +322,7 @@ void XQModel::cmdPasteUndo( XQCommand& command )
// don't clone into clipboard, remove items
void XQModel::cmdDelete( XQCommand& command )
void XQViewModel::cmdDelete( XQCommand& command )
{
// wir gehen rückwärts über alle markieren knoten ...
for (auto it = command.rbegin(); it != command.rend(); ++it)
@@ -337,18 +337,18 @@ void XQModel::cmdDelete( XQCommand& command )
}
}
void XQModel::cmdDeleteUndo( XQCommand& command )
void XQViewModel::cmdDeleteUndo( XQCommand& command )
{
}
/**
* @brief XQModel::cmdNewRow create one new item row
* @brief XQViewModel::cmdNewRow create one new item row
* @param command the command
*/
void XQModel::cmdNew( XQCommand& command )
void XQViewModel::cmdNew( XQCommand& command )
{
// __fix
@@ -382,12 +382,12 @@ void XQModel::cmdNew( XQCommand& command )
*/
}
void XQModel::cmdNewUndo( XQCommand& command )
void XQViewModel::cmdNewUndo( XQCommand& command )
{
}
void XQModel::cmdToggleSection( const QModelIndex& index )
void XQViewModel::cmdToggleSection( const QModelIndex& index )
{
Q_ASSERT(index.isValid());
@@ -401,12 +401,12 @@ void XQModel::cmdToggleSection( const QModelIndex& index )
}
XQTreeView* XQModel::treeView()
XQTreeTable* XQViewModel::treeView()
{
return _treeView;
}
void XQModel::setTreeView(XQTreeView* mainView )
void XQViewModel::setTreeView(XQTreeTable* mainView )
{
// store view for direct access: the maintree
_treeView = mainView;
@@ -426,11 +426,11 @@ void XQModel::setTreeView(XQTreeView* mainView )
}
/**
* @brief XQModel::setupViewProperties set the tree views' properties: context menu policy,
* @brief XQViewModel::setupViewProperties set the tree views' properties: context menu policy,
* edit triggers and so on.
*/
void XQModel::setupViewProperties()
void XQViewModel::setupViewProperties()
{
_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
_treeView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
@@ -441,26 +441,26 @@ void XQModel::setupViewProperties()
}
void XQModel::addSection( const XQItemList& list, const XQNodePtr& sheetNode )
void XQViewModel::addSection( const XQItemList& list, const XQNodePtr& sheetNode )
{
appendRow(list);
_sections.addSectionEntry( list[0]->index(), sheetNode );
}
QUndoStack* XQModel::undoStack()
QUndoStack* XQViewModel::undoStack()
{
return _undoStack;
}
void XQModel::setUndoStack( QUndoStack* undoStack )
void XQViewModel::setUndoStack( QUndoStack* undoStack )
{
_undoStack = undoStack;
}
void XQModel::onShowContextMenu(const QPoint& point)
void XQViewModel::onShowContextMenu(const QPoint& point)
{
initContextMenu();
_contextMenu->popup(_treeView->mapToGlobal(point));
@@ -468,7 +468,7 @@ void XQModel::onShowContextMenu(const QPoint& point)
QHash<int, QByteArray> XQModel::roleNames() const
QHash<int, QByteArray> XQViewModel::roleNames() const
{
QHash<int, QByteArray> roles;

View File

@@ -12,8 +12,8 @@
***************************************************************************/
#ifndef XQMODEL_H
#define XQMODEL_H
#ifndef XQVIEWMODEL_H
#define XQVIEWMODEL_H
#include <QUndoStack>
#include <QMenu>
@@ -25,7 +25,7 @@
#include <xqcontextmenu.h>
class XQTreeView;
class XQTreeTable;
class XQItem;
class XQCommand;
@@ -35,25 +35,25 @@ class XQCommand;
*/
// might be own implementation of QAbstractItemModel, not done yet.
//using QStandardItemModel = XQSimpleItemModel;
// using QStandardItemModel = XQSimpleItemModel;
using QStandardItemModel = QStandardItemModel;
/**
* @brief The XQModel class: An extendend QStandardItem model
* @brief The XQViewModel class: An extendend QStandardItem model
* containing its own view.
*/
class XQModel : public QStandardItemModel
class XQViewModel : public QStandardItemModel
{
Q_OBJECT
public:
XQModel(QObject* parent = nullptr);
virtual ~XQModel();
XQViewModel(QObject* parent = nullptr);
virtual ~XQViewModel();
XQTreeView* treeView();
virtual void setTreeView( XQTreeView* mainView );
XQTreeTable* treeView();
virtual void setTreeView( XQTreeTable* mainView );
QUndoStack* undoStack();
void setUndoStack( QUndoStack* undoStack );
@@ -125,7 +125,7 @@ protected:
XQSimpleClipBoard _clipBoard;
XQModelSections _sections;
XQTreeView* _treeView{};
XQTreeTable* _treeView{};
QUndoStack* _undoStack{};
XQContextMenu* _contextMenu{};
@@ -136,4 +136,4 @@ protected:
};
#endif // XQMODEL_H
#endif // XQVIEWMODEL_H