renamings.
This commit is contained in:
@@ -17,11 +17,11 @@
|
|||||||
#include <xqselectionmodel.h>
|
#include <xqselectionmodel.h>
|
||||||
#include <xqitemdelegate.h>
|
#include <xqitemdelegate.h>
|
||||||
#include <xqappdata.h>
|
#include <xqappdata.h>
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
#include <xqitemfactory.h>
|
#include <xqitemfactory.h>
|
||||||
|
|
||||||
XQChildModel::XQChildModel( QObject *parent )
|
XQChildModel::XQChildModel( QObject *parent )
|
||||||
: XQModel{parent}
|
: XQViewModel{parent}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,11 @@
|
|||||||
#define XQCHILDMODEL_H
|
#define XQCHILDMODEL_H
|
||||||
|
|
||||||
|
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class XQChildModel : public XQModel
|
class XQChildModel : public XQViewModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
XQDocument::XQDocument(const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQModel* aModelView )
|
XQDocument::XQDocument(const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView )
|
||||||
: fileName{ aFileName }, friendlyName{ aFriendlyName }, treeItem{ aTreeItem }, modelView{ aModelView }
|
: fileName{ aFileName }, friendlyName{ aFriendlyName }, treeItem{ aTreeItem }, modelView{ aModelView }
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ XQDocumentStore::~XQDocumentStore()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void XQDocumentStore::addDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQModel* aModelView )
|
void XQDocumentStore::addDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView )
|
||||||
{
|
{
|
||||||
XQDocument newDocument( aFileName, aFriendlyName, aTreeItem,aModelView );
|
XQDocument newDocument( aFileName, aFriendlyName, aTreeItem,aModelView );
|
||||||
addAtKey( aFileName, newDocument );
|
addAtKey( aFileName, newDocument );
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include <xqmaptor.h>
|
#include <xqmaptor.h>
|
||||||
#include <xqnode.h>
|
#include <xqnode.h>
|
||||||
|
|
||||||
class XQModel;
|
class XQViewModel;
|
||||||
class XQItem;
|
class XQItem;
|
||||||
|
|
||||||
// should this be internal??
|
// should this be internal??
|
||||||
@@ -26,14 +26,14 @@ struct XQDocument
|
|||||||
{
|
{
|
||||||
|
|
||||||
XQDocument() = default;
|
XQDocument() = default;
|
||||||
XQDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQModel* aModelView );
|
XQDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView );
|
||||||
|
|
||||||
virtual ~XQDocument();
|
virtual ~XQDocument();
|
||||||
|
|
||||||
QString fileName; // also used as key
|
QString fileName; // also used as key
|
||||||
QString friendlyName;
|
QString friendlyName;
|
||||||
XQItem* treeItem{};
|
XQItem* treeItem{};
|
||||||
XQModel* modelView{};
|
XQViewModel* modelView{};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
XQDocumentStore() = default;
|
XQDocumentStore() = default;
|
||||||
virtual ~ XQDocumentStore();
|
virtual ~ XQDocumentStore();
|
||||||
|
|
||||||
void addDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQModel* aModelView );
|
void addDocument( const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aModelView );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include <xqmainmodel.h>
|
#include <xqmainmodel.h>
|
||||||
|
|
||||||
#include <xqexception.h>
|
#include <xqexception.h>
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
#include <xqitemdelegate.h>
|
#include <xqitemdelegate.h>
|
||||||
#include <xqitem.h>
|
#include <xqitem.h>
|
||||||
#include <xqappdata.h>
|
#include <xqappdata.h>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
XQMainModel::XQMainModel(QObject *parent )
|
XQMainModel::XQMainModel(QObject *parent )
|
||||||
: XQModel{parent}
|
: XQViewModel{parent}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
//#include <QItemSelectionModel>
|
//#include <QItemSelectionModel>
|
||||||
|
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
//#include <xqmodelsections.h>
|
//#include <xqmodelsections.h>
|
||||||
|
|
||||||
class XQTreeView;
|
class XQTreeTable;
|
||||||
|
|
||||||
|
|
||||||
class XQMainModel : public XQModel
|
class XQMainModel : public XQViewModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ void XQMainWindow::initMainWindow()
|
|||||||
connect( _mainTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeItemClicked(QModelIndex)) );
|
connect( _mainTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeItemClicked(QModelIndex)) );
|
||||||
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
|
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
|
||||||
|
|
||||||
connect( &_mainModelView, &XQModel::xqItemCreated, this, [=, this](XQItem* item)
|
connect( &_mainModelView, &XQViewModel::xqItemCreated, this, [=, this](XQItem* item)
|
||||||
{
|
{
|
||||||
// when a new main tree item has been created ...
|
// when a new main tree item has been created ...
|
||||||
QString pID = item->contentNode()->attribute(c_ProjectID);
|
QString pID = item->contentNode()->attribute(c_ProjectID);
|
||||||
@@ -247,7 +247,7 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
|||||||
QString pTitle = QString("Project %1: %2").arg( pID, fName );
|
QString pTitle = QString("Project %1: %2").arg( pID, fName );
|
||||||
|
|
||||||
// Eine neue TreeView erzeugn und im TabWidget parken.
|
// Eine neue TreeView erzeugn und im TabWidget parken.
|
||||||
XQTreeView* childTreeView = new XQTreeView(_tabWidget);
|
XQTreeTable* childTreeView = new XQTreeTable(_tabWidget);
|
||||||
_tabWidget->addTab( childTreeView, pTitle );
|
_tabWidget->addTab( childTreeView, pTitle );
|
||||||
_tabWidget->setCurrentWidget( childTreeView );
|
_tabWidget->setCurrentWidget( childTreeView );
|
||||||
setWindowTitle( pTitle );
|
setWindowTitle( pTitle );
|
||||||
|
@@ -101,7 +101,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="XQTreeView" name="_mainTreeView">
|
<widget class="XQTreeTable" name="_mainTreeView">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -280,9 +280,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>XQTreeView</class>
|
<class>XQTreeTable</class>
|
||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header location="global">xqtreeview.h</header>
|
<header location="global">xqtreetable.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <xqitem.h>
|
#include <xqitem.h>
|
||||||
|
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
#include <xqmaptor.h>
|
#include <xqmaptor.h>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <xqitemtype.h>
|
#include <xqitemtype.h>
|
||||||
@@ -576,7 +576,7 @@ XQItem& XQItem::xqItemFromIndex(const QModelIndex& index)
|
|||||||
{
|
{
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
{
|
{
|
||||||
const XQModel* mdl = dynamic_cast<const XQModel*>(index.model());
|
const XQViewModel* mdl = dynamic_cast<const XQViewModel*>(index.model());
|
||||||
if (mdl)
|
if (mdl)
|
||||||
return mdl->xqItemFromIndex(index);
|
return mdl->xqItemFromIndex(index);
|
||||||
}
|
}
|
||||||
|
@@ -23,9 +23,9 @@
|
|||||||
#include <QCommonStyle>
|
#include <QCommonStyle>
|
||||||
|
|
||||||
#include <xqitemdelegate.h>
|
#include <xqitemdelegate.h>
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
#include <xqitemtype.h>
|
#include <xqitemtype.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
|
|
||||||
|
|
||||||
class XQItemEditorFactory : public QItemEditorFactory
|
class XQItemEditorFactory : public QItemEditorFactory
|
||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
XQItemDelegate::XQItemDelegate( XQModel& modelView)
|
XQItemDelegate::XQItemDelegate( XQViewModel& modelView)
|
||||||
: _modelView{modelView}
|
: _modelView{modelView}
|
||||||
{
|
{
|
||||||
static XQItemEditorFactory s_EditorFactory;
|
static XQItemEditorFactory s_EditorFactory;
|
||||||
@@ -69,7 +69,7 @@ XQItemDelegate::XQItemDelegate( XQModel& modelView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XQTreeView* XQItemDelegate::treeView() const
|
XQTreeTable* XQItemDelegate::treeView() const
|
||||||
{
|
{
|
||||||
return _modelView.treeView();
|
return _modelView.treeView();
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
#include <xqappdata.h>
|
#include <xqappdata.h>
|
||||||
|
|
||||||
class XQItem;
|
class XQItem;
|
||||||
class XQTreeView;
|
class XQTreeTable;
|
||||||
class XQModel;
|
class XQViewModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A specialized QItemDelegate class to draw different XQItem styles.
|
* @brief A specialized QItemDelegate class to draw different XQItem styles.
|
||||||
@@ -32,9 +32,9 @@ class XQItemDelegate : public QStyledItemDelegate
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit XQItemDelegate(XQModel& modelView);
|
explicit XQItemDelegate(XQViewModel& modelView);
|
||||||
|
|
||||||
XQTreeView* treeView() const;
|
XQTreeTable* treeView() const;
|
||||||
XQItem& xqItemFromIndex( const QModelIndex& index ) const;
|
XQItem& xqItemFromIndex( const QModelIndex& index ) const;
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
@@ -53,7 +53,7 @@ protected:
|
|||||||
void drawComboBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void drawComboBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
void drawSpinBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void drawSpinBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
XQModel& _modelView;
|
XQViewModel& _modelView;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include <xqitemfactory.h>
|
#include <xqitemfactory.h>
|
||||||
#include <xqexception.h>
|
#include <xqexception.h>
|
||||||
#include <xqdocumentstore.h>
|
#include <xqdocumentstore.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
#include <xqitemtype.h>
|
#include <xqitemtype.h>
|
||||||
|
|
||||||
#include <znode_factory.h>
|
#include <znode_factory.h>
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#include <xqitemtype.h>
|
#include <xqitemtype.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
class XQModel;
|
class XQViewModel;
|
||||||
|
|
||||||
// erzeugt items aus XQNodes
|
// erzeugt items aus XQNodes
|
||||||
|
|
||||||
|
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <xqcommand.h>
|
#include <xqcommand.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
|
|
||||||
|
|
||||||
void XQNodeStore::dumpList( const QString& title ) const
|
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)
|
: _cmdType{ cmdType }, _model(modelView)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
#include <xqitem.h>
|
#include <xqitem.h>
|
||||||
|
|
||||||
class XQModel;
|
class XQViewModel;
|
||||||
|
|
||||||
struct XQNodeBackup
|
struct XQNodeBackup
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
cmdExtern //??
|
cmdExtern //??
|
||||||
};
|
};
|
||||||
|
|
||||||
XQCommand(CmdType cmdType, XQModel* modelView );
|
XQCommand(CmdType cmdType, XQViewModel* modelView );
|
||||||
virtual ~XQCommand();
|
virtual ~XQCommand();
|
||||||
|
|
||||||
CmdType commandType() const;
|
CmdType commandType() const;
|
||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
CmdType _cmdType{cmdInvalid};
|
CmdType _cmdType{cmdInvalid};
|
||||||
XQModel* _model{}; // needed for redo() / undo()
|
XQViewModel* _model{}; // needed for redo() / undo()
|
||||||
QModelIndex _originIndex;
|
QModelIndex _originIndex;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <xqsimpleclipboard.h>
|
#include <xqsimpleclipboard.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
|
|
||||||
|
|
||||||
bool XQSimpleClipBoard::canPaste( const QModelIndex& curIdx ) const
|
bool XQSimpleClipBoard::canPaste( const QModelIndex& curIdx ) const
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
#include <xqexception.h>
|
#include <xqexception.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
#include <xqselectionmodel.h>
|
#include <xqselectionmodel.h>
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
#include <xqcommand.h>
|
#include <xqcommand.h>
|
||||||
#include <xqitemdelegate.h>
|
#include <xqitemdelegate.h>
|
||||||
#include <xqitemfactory.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() }
|
: QStandardItemModel{ parent }, _itemFactory{ XQItemFactory::instance() }
|
||||||
{
|
{
|
||||||
invisibleRootItem()->setData( "[rootItem]", Qt::DisplayRole );
|
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
|
// das ist ein hack, denn 'invisibleRootItem()' ist und bleibt ein
|
||||||
// QStandardItem. Trick: keine eigenen members in XQItem, alles
|
// 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() )
|
if( index.isValid() )
|
||||||
{
|
{
|
||||||
@@ -73,12 +73,12 @@ XQItem& XQModel::xqItemFromIndex(const QModelIndex& index) const
|
|||||||
return XQItem::fallBackDummyItem();
|
return XQItem::fallBackDummyItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
XQItem& XQModel::xqFirstItem(int row) const
|
XQItem& XQViewModel::xqFirstItem(int row) const
|
||||||
{
|
{
|
||||||
return *static_cast<XQItem*>( QStandardItemModel::item(row) );
|
return *static_cast<XQItem*>( QStandardItemModel::item(row) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void XQModel::onActionTriggered(QAction* action)
|
void XQViewModel::onActionTriggered(QAction* action)
|
||||||
{
|
{
|
||||||
qDebug() << " --- onActionTriggered: count:" << XQNode::s_Count;
|
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
|
* @param command the current command
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XQModel::onCommandRedo( XQCommand& command )
|
void XQViewModel::onCommandRedo( XQCommand& command )
|
||||||
{
|
{
|
||||||
try
|
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.
|
* @param command the command to be undone.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XQModel::onCommandUndo( XQCommand& command )
|
void XQViewModel::onCommandUndo( XQCommand& command )
|
||||||
{
|
{
|
||||||
qDebug() << " --- onCommandUndo: count: " << XQNode::s_Count;
|
qDebug() << " --- onCommandUndo: count: " << XQNode::s_Count;
|
||||||
try
|
try
|
||||||
@@ -220,7 +220,7 @@ void XQModel::onCommandUndo( XQCommand& command )
|
|||||||
// undo-/redo-able stuff
|
// undo-/redo-able stuff
|
||||||
|
|
||||||
//! markierte knoten entfernen, 'command' enthält die liste
|
//! 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 ...
|
// wir gehen rückwärts über alle gemerkten knoten ...
|
||||||
for (auto it = command.rbegin(); it != command.rend(); ++it)
|
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
|
//! entfernte knoten wieder einfügen , 'command' enthält die liste
|
||||||
|
|
||||||
void XQModel::cmdCutUndo( XQCommand& command )
|
void XQViewModel::cmdCutUndo( XQCommand& command )
|
||||||
{
|
{
|
||||||
// die anfangsposition
|
// die anfangsposition
|
||||||
int itmPos = command.first().itemPos;
|
int itmPos = command.first().itemPos;
|
||||||
@@ -262,7 +262,7 @@ void XQModel::cmdCutUndo( XQCommand& command )
|
|||||||
|
|
||||||
//! clipboard inhalte einfügen
|
//! clipboard inhalte einfügen
|
||||||
|
|
||||||
void XQModel::cmdPaste( XQCommand& command )
|
void XQViewModel::cmdPaste( XQCommand& command )
|
||||||
{
|
{
|
||||||
// selection holen ...
|
// selection holen ...
|
||||||
QItemSelectionModel* selectionModel = treeView()->selectionModel();
|
QItemSelectionModel* selectionModel = treeView()->selectionModel();
|
||||||
@@ -303,7 +303,7 @@ void XQModel::cmdPaste( XQCommand& command )
|
|||||||
|
|
||||||
//! einfügen aus dem clipboard wieder rückgängig machen
|
//! einfügen aus dem clipboard wieder rückgängig machen
|
||||||
|
|
||||||
void XQModel::cmdPasteUndo( XQCommand& command )
|
void XQViewModel::cmdPasteUndo( XQCommand& command )
|
||||||
{
|
{
|
||||||
command.dumpList("Paste UNDO");
|
command.dumpList("Paste UNDO");
|
||||||
// wir gehen rückwärts über alle markieren knoten ...
|
// 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
|
// 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 ...
|
// wir gehen rückwärts über alle markieren knoten ...
|
||||||
for (auto it = command.rbegin(); it != command.rend(); ++it)
|
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
|
* @param command the command
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XQModel::cmdNew( XQCommand& command )
|
void XQViewModel::cmdNew( XQCommand& command )
|
||||||
{
|
{
|
||||||
|
|
||||||
// __fix
|
// __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());
|
Q_ASSERT(index.isValid());
|
||||||
|
|
||||||
@@ -401,12 +401,12 @@ void XQModel::cmdToggleSection( const QModelIndex& index )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XQTreeView* XQModel::treeView()
|
XQTreeTable* XQViewModel::treeView()
|
||||||
{
|
{
|
||||||
return _treeView;
|
return _treeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XQModel::setTreeView(XQTreeView* mainView )
|
void XQViewModel::setTreeView(XQTreeTable* mainView )
|
||||||
{
|
{
|
||||||
// store view for direct access: the maintree
|
// store view for direct access: the maintree
|
||||||
_treeView = mainView;
|
_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.
|
* edit triggers and so on.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XQModel::setupViewProperties()
|
void XQViewModel::setupViewProperties()
|
||||||
{
|
{
|
||||||
_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
_treeView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
|
_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);
|
appendRow(list);
|
||||||
_sections.addSectionEntry( list[0]->index(), sheetNode );
|
_sections.addSectionEntry( list[0]->index(), sheetNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QUndoStack* XQModel::undoStack()
|
QUndoStack* XQViewModel::undoStack()
|
||||||
{
|
{
|
||||||
return _undoStack;
|
return _undoStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQModel::setUndoStack( QUndoStack* undoStack )
|
void XQViewModel::setUndoStack( QUndoStack* undoStack )
|
||||||
{
|
{
|
||||||
_undoStack = undoStack;
|
_undoStack = undoStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQModel::onShowContextMenu(const QPoint& point)
|
void XQViewModel::onShowContextMenu(const QPoint& point)
|
||||||
{
|
{
|
||||||
initContextMenu();
|
initContextMenu();
|
||||||
_contextMenu->popup(_treeView->mapToGlobal(point));
|
_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;
|
QHash<int, QByteArray> roles;
|
@@ -12,8 +12,8 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef XQMODEL_H
|
#ifndef XQVIEWMODEL_H
|
||||||
#define XQMODEL_H
|
#define XQVIEWMODEL_H
|
||||||
|
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <xqcontextmenu.h>
|
#include <xqcontextmenu.h>
|
||||||
|
|
||||||
|
|
||||||
class XQTreeView;
|
class XQTreeTable;
|
||||||
class XQItem;
|
class XQItem;
|
||||||
class XQCommand;
|
class XQCommand;
|
||||||
|
|
||||||
@@ -35,25 +35,25 @@ class XQCommand;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// might be own implementation of QAbstractItemModel, not done yet.
|
// might be own implementation of QAbstractItemModel, not done yet.
|
||||||
//using QStandardItemModel = XQSimpleItemModel;
|
// using QStandardItemModel = XQSimpleItemModel;
|
||||||
using QStandardItemModel = QStandardItemModel;
|
using QStandardItemModel = QStandardItemModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The XQModel class: An extendend QStandardItem model
|
* @brief The XQViewModel class: An extendend QStandardItem model
|
||||||
* containing its own view.
|
* containing its own view.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class XQModel : public QStandardItemModel
|
class XQViewModel : public QStandardItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XQModel(QObject* parent = nullptr);
|
XQViewModel(QObject* parent = nullptr);
|
||||||
virtual ~XQModel();
|
virtual ~XQViewModel();
|
||||||
|
|
||||||
XQTreeView* treeView();
|
XQTreeTable* treeView();
|
||||||
virtual void setTreeView( XQTreeView* mainView );
|
virtual void setTreeView( XQTreeTable* mainView );
|
||||||
|
|
||||||
QUndoStack* undoStack();
|
QUndoStack* undoStack();
|
||||||
void setUndoStack( QUndoStack* undoStack );
|
void setUndoStack( QUndoStack* undoStack );
|
||||||
@@ -125,7 +125,7 @@ protected:
|
|||||||
XQSimpleClipBoard _clipBoard;
|
XQSimpleClipBoard _clipBoard;
|
||||||
XQModelSections _sections;
|
XQModelSections _sections;
|
||||||
|
|
||||||
XQTreeView* _treeView{};
|
XQTreeTable* _treeView{};
|
||||||
QUndoStack* _undoStack{};
|
QUndoStack* _undoStack{};
|
||||||
XQContextMenu* _contextMenu{};
|
XQContextMenu* _contextMenu{};
|
||||||
|
|
||||||
@@ -136,4 +136,4 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XQMODEL_H
|
#endif // XQVIEWMODEL_H
|
@@ -15,12 +15,12 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#include "qheaderview.h"
|
#include "qheaderview.h"
|
||||||
#include <xqtreeview.h>
|
#include <xqtreetable.h>
|
||||||
#include <xqmodel.h>
|
#include <xqviewmodel.h>
|
||||||
|
|
||||||
#define DB_TIMESTAMP QTime::currentTime().toString(" -- HH:mm:ss.zzz")
|
#define DB_TIMESTAMP QTime::currentTime().toString(" -- HH:mm:ss.zzz")
|
||||||
|
|
||||||
XQTreeView::XQTreeView(QWidget* parent)
|
XQTreeTable::XQTreeTable(QWidget* parent)
|
||||||
: QTreeView(parent)
|
: QTreeView(parent)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -34,24 +34,24 @@ XQTreeView::XQTreeView(QWidget* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XQTreeView::~XQTreeView()
|
XQTreeTable::~XQTreeTable()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XQModel* XQTreeView::modelView()
|
XQViewModel* XQTreeTable::modelView()
|
||||||
{
|
{
|
||||||
return static_cast<XQModel*>(model());
|
return static_cast<XQViewModel*>(model());
|
||||||
}
|
}
|
||||||
|
|
||||||
// __fixme: necessary?
|
// __fixme: necessary?
|
||||||
XQItem& XQTreeView::xqItemFromIndex(const QModelIndex& index )
|
XQItem& XQTreeTable::xqItemFromIndex(const QModelIndex& index )
|
||||||
{
|
{
|
||||||
return modelView()->xqItemFromIndex( index );
|
return modelView()->xqItemFromIndex( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQTreeView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
|
void XQTreeTable::currentChanged(const QModelIndex& current, const QModelIndex& previous)
|
||||||
{
|
{
|
||||||
|
|
||||||
QTreeView::currentChanged(current, previous);
|
QTreeView::currentChanged(current, previous);
|
||||||
@@ -68,7 +68,7 @@ void XQTreeView::currentChanged(const QModelIndex& current, const QModelIndex& p
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQTreeView::mouseResizeHeaderEntry(int xpos)
|
void XQTreeTable::mouseResizeHeaderEntry(int xpos)
|
||||||
{
|
{
|
||||||
// resize colummn: minimal vertical margin in pixels
|
// resize colummn: minimal vertical margin in pixels
|
||||||
static const int s_MinimalMargin = 50;
|
static const int s_MinimalMargin = 50;
|
||||||
@@ -90,7 +90,7 @@ void XQTreeView::mouseResizeHeaderEntry(int xpos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XQTreeView::mouseMoveEvent(QMouseEvent* event)
|
void XQTreeTable::mouseMoveEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
// pixel Grenzwert zur Anzeige des Splitcursors
|
// pixel Grenzwert zur Anzeige des Splitcursors
|
||||||
static const int s_CatchOffset = 5;
|
static const int s_CatchOffset = 5;
|
||||||
@@ -128,7 +128,7 @@ void XQTreeView::mouseMoveEvent(QMouseEvent* event)
|
|||||||
QTreeView::mouseMoveEvent(event);
|
QTreeView::mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XQTreeView::mouseDoubleClickEvent(QMouseEvent* event)
|
void XQTreeTable::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
QModelIndex idxFromPos = indexAt(event->pos());
|
QModelIndex idxFromPos = indexAt(event->pos());
|
||||||
@@ -144,7 +144,7 @@ void XQTreeView::mouseDoubleClickEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQTreeView::mousePressEvent(QMouseEvent* event)
|
void XQTreeTable::mousePressEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
|
|
||||||
// case #1:
|
// case #1:
|
||||||
@@ -161,7 +161,7 @@ void XQTreeView::mousePressEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQTreeView::mouseReleaseEvent(QMouseEvent* event)
|
void XQTreeTable::mouseReleaseEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
// reset index for resize column
|
// reset index for resize column
|
||||||
_indexToResize = QModelIndex();
|
_indexToResize = QModelIndex();
|
||||||
@@ -170,7 +170,7 @@ void XQTreeView::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XQTreeView::wheelEvent(QWheelEvent* event)
|
void XQTreeTable::wheelEvent(QWheelEvent* event)
|
||||||
{
|
{
|
||||||
// Ctrl-key down?
|
// Ctrl-key down?
|
||||||
if (!event->modifiers().testFlag(Qt::ControlModifier))
|
if (!event->modifiers().testFlag(Qt::ControlModifier))
|
@@ -12,32 +12,32 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef XQTREEVIEW_H
|
#ifndef XQTREETABLE_H
|
||||||
#define XQTREEVIEW_H
|
#define XQTREETABLE_H
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
class XQItem;
|
class XQItem;
|
||||||
class XQModel;
|
class XQViewModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A specialized QTreeView that will handle the drawing of
|
* @brief A specialized QTreeView that will handle the drawing of
|
||||||
* empty or non-existing items in the future.
|
* empty or non-existing items in the future.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class XQTreeView : public QTreeView
|
class XQTreeTable : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QTreeView)
|
Q_DECLARE_PRIVATE(QTreeView)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XQTreeView(QWidget* parent = nullptr );
|
XQTreeTable(QWidget* parent = nullptr );
|
||||||
virtual ~XQTreeView();
|
virtual ~XQTreeTable();
|
||||||
|
|
||||||
XQModel* modelView();
|
XQViewModel* modelView();
|
||||||
XQItem& xqItemFromIndex(const QModelIndex& index );
|
XQItem& xqItemFromIndex(const QModelIndex& index );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -59,4 +59,4 @@ protected:
|
|||||||
QModelIndex _indexToResize;
|
QModelIndex _indexToResize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XQTREEVIEW_H
|
#endif // XQTREETABLE_H
|
@@ -21,12 +21,12 @@ HEADERS += \
|
|||||||
items/xqitemtype.h \
|
items/xqitemtype.h \
|
||||||
items/xqitemdelegate.h \
|
items/xqitemdelegate.h \
|
||||||
model/xqcommand.h \
|
model/xqcommand.h \
|
||||||
model/xqmodel.h \
|
|
||||||
model/xqmodelsections.h \
|
model/xqmodelsections.h \
|
||||||
model/xqnode.h \
|
model/xqnode.h \
|
||||||
model/xqnodewriter.h \
|
model/xqnodewriter.h \
|
||||||
model/xqselectionmodel.h \
|
model/xqselectionmodel.h \
|
||||||
model/xqsimpleclipboard.h \
|
model/xqsimpleclipboard.h \
|
||||||
|
model/xqviewmodel.h \
|
||||||
nodes/znode.h \
|
nodes/znode.h \
|
||||||
nodes/znode_factory.h \
|
nodes/znode_factory.h \
|
||||||
nodes/znode_id.h \
|
nodes/znode_id.h \
|
||||||
@@ -44,7 +44,7 @@ HEADERS += \
|
|||||||
util/xsingleton.h \
|
util/xsingleton.h \
|
||||||
util/xtreewalker.h \
|
util/xtreewalker.h \
|
||||||
widgets/xqcontextmenu.h \
|
widgets/xqcontextmenu.h \
|
||||||
widgets/xqtreeview.h
|
widgets/xqtreetable.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
application/xqchildmodel.cpp \
|
application/xqchildmodel.cpp \
|
||||||
@@ -59,17 +59,17 @@ SOURCES += \
|
|||||||
items/xqitemdelegate.cpp \
|
items/xqitemdelegate.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
model/xqcommand.cpp \
|
model/xqcommand.cpp \
|
||||||
model/xqmodel.cpp \
|
|
||||||
model/xqmodelsections.cpp \
|
model/xqmodelsections.cpp \
|
||||||
model/xqnode.cpp \
|
model/xqnode.cpp \
|
||||||
model/xqnodewriter.cpp \
|
model/xqnodewriter.cpp \
|
||||||
model/xqselectionmodel.cpp \
|
model/xqselectionmodel.cpp \
|
||||||
model/xqsimpleclipboard.cpp \
|
model/xqsimpleclipboard.cpp \
|
||||||
|
model/xqviewmodel.cpp \
|
||||||
nodes/znode.cpp \
|
nodes/znode.cpp \
|
||||||
pugixml/pugixml.cpp \
|
pugixml/pugixml.cpp \
|
||||||
util/xqexception.cpp \
|
util/xqexception.cpp \
|
||||||
widgets/xqcontextmenu.cpp \
|
widgets/xqcontextmenu.cpp \
|
||||||
widgets/xqtreeview.cpp
|
widgets/xqtreetable.cpp
|
||||||
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
Reference in New Issue
Block a user