renamings.
This commit is contained in:
@@ -17,11 +17,11 @@
|
||||
#include <xqselectionmodel.h>
|
||||
#include <xqitemdelegate.h>
|
||||
#include <xqappdata.h>
|
||||
#include <xqtreeview.h>
|
||||
#include <xqtreetable.h>
|
||||
#include <xqitemfactory.h>
|
||||
|
||||
XQChildModel::XQChildModel( QObject *parent )
|
||||
: XQModel{parent}
|
||||
: XQViewModel{parent}
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -16,11 +16,11 @@
|
||||
#define XQCHILDMODEL_H
|
||||
|
||||
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
|
||||
|
||||
|
||||
class XQChildModel : public XQModel
|
||||
class XQChildModel : public XQViewModel
|
||||
{
|
||||
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 }
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
addAtKey( aFileName, newDocument );
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <xqmaptor.h>
|
||||
#include <xqnode.h>
|
||||
|
||||
class XQModel;
|
||||
class XQViewModel;
|
||||
class XQItem;
|
||||
|
||||
// should this be internal??
|
||||
@@ -26,14 +26,14 @@ struct XQDocument
|
||||
{
|
||||
|
||||
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();
|
||||
|
||||
QString fileName; // also used as key
|
||||
QString friendlyName;
|
||||
XQItem* treeItem{};
|
||||
XQModel* modelView{};
|
||||
XQViewModel* modelView{};
|
||||
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
XQDocumentStore() = default;
|
||||
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:
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <xqmainmodel.h>
|
||||
|
||||
#include <xqexception.h>
|
||||
#include <xqtreeview.h>
|
||||
#include <xqtreetable.h>
|
||||
#include <xqitemdelegate.h>
|
||||
#include <xqitem.h>
|
||||
#include <xqappdata.h>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
XQMainModel::XQMainModel(QObject *parent )
|
||||
: XQModel{parent}
|
||||
: XQViewModel{parent}
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -17,13 +17,13 @@
|
||||
|
||||
//#include <QItemSelectionModel>
|
||||
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
//#include <xqmodelsections.h>
|
||||
|
||||
class XQTreeView;
|
||||
class XQTreeTable;
|
||||
|
||||
|
||||
class XQMainModel : public XQModel
|
||||
class XQMainModel : public XQViewModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -63,7 +63,7 @@ void XQMainWindow::initMainWindow()
|
||||
connect( _mainTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeItemClicked(QModelIndex)) );
|
||||
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 ...
|
||||
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 );
|
||||
|
||||
// Eine neue TreeView erzeugn und im TabWidget parken.
|
||||
XQTreeView* childTreeView = new XQTreeView(_tabWidget);
|
||||
XQTreeTable* childTreeView = new XQTreeTable(_tabWidget);
|
||||
_tabWidget->addTab( childTreeView, pTitle );
|
||||
_tabWidget->setCurrentWidget( childTreeView );
|
||||
setWindowTitle( pTitle );
|
||||
|
@@ -101,7 +101,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="XQTreeView" name="_mainTreeView">
|
||||
<widget class="XQTreeTable" name="_mainTreeView">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
@@ -280,9 +280,9 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>XQTreeView</class>
|
||||
<class>XQTreeTable</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">xqtreeview.h</header>
|
||||
<header location="global">xqtreetable.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <xqitem.h>
|
||||
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
#include <xqmaptor.h>
|
||||
#include <QDateTime>
|
||||
#include <xqitemtype.h>
|
||||
@@ -576,7 +576,7 @@ XQItem& XQItem::xqItemFromIndex(const QModelIndex& index)
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
const XQModel* mdl = dynamic_cast<const XQModel*>(index.model());
|
||||
const XQViewModel* mdl = dynamic_cast<const XQViewModel*>(index.model());
|
||||
if (mdl)
|
||||
return mdl->xqItemFromIndex(index);
|
||||
}
|
||||
|
@@ -23,9 +23,9 @@
|
||||
#include <QCommonStyle>
|
||||
|
||||
#include <xqitemdelegate.h>
|
||||
#include <xqtreeview.h>
|
||||
#include <xqtreetable.h>
|
||||
#include <xqitemtype.h>
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
|
||||
|
||||
class XQItemEditorFactory : public QItemEditorFactory
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
|
||||
|
||||
XQItemDelegate::XQItemDelegate( XQModel& modelView)
|
||||
XQItemDelegate::XQItemDelegate( XQViewModel& modelView)
|
||||
: _modelView{modelView}
|
||||
{
|
||||
static XQItemEditorFactory s_EditorFactory;
|
||||
@@ -69,7 +69,7 @@ XQItemDelegate::XQItemDelegate( XQModel& modelView)
|
||||
}
|
||||
|
||||
|
||||
XQTreeView* XQItemDelegate::treeView() const
|
||||
XQTreeTable* XQItemDelegate::treeView() const
|
||||
{
|
||||
return _modelView.treeView();
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#include <xqappdata.h>
|
||||
|
||||
class XQItem;
|
||||
class XQTreeView;
|
||||
class XQModel;
|
||||
class XQTreeTable;
|
||||
class XQViewModel;
|
||||
|
||||
/**
|
||||
* @brief A specialized QItemDelegate class to draw different XQItem styles.
|
||||
@@ -32,9 +32,9 @@ class XQItemDelegate : public QStyledItemDelegate
|
||||
|
||||
public:
|
||||
|
||||
explicit XQItemDelegate(XQModel& modelView);
|
||||
explicit XQItemDelegate(XQViewModel& modelView);
|
||||
|
||||
XQTreeView* treeView() const;
|
||||
XQTreeTable* treeView() const;
|
||||
XQItem& xqItemFromIndex( const QModelIndex& index ) const;
|
||||
|
||||
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 drawSpinBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
XQModel& _modelView;
|
||||
XQViewModel& _modelView;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <xqitemfactory.h>
|
||||
#include <xqexception.h>
|
||||
#include <xqdocumentstore.h>
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
#include <xqitemtype.h>
|
||||
|
||||
#include <znode_factory.h>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <xqitemtype.h>
|
||||
#include <functional>
|
||||
|
||||
class XQModel;
|
||||
class XQViewModel;
|
||||
|
||||
// erzeugt items aus XQNodes
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
/*
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
#include <xqsimpleclipboard.h>
|
||||
#include <xqmodel.h>
|
||||
#include <xqviewmodel.h>
|
||||
|
||||
|
||||
bool XQSimpleClipBoard::canPaste( const QModelIndex& curIdx ) const
|
||||
|
@@ -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;
|
@@ -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
|
@@ -15,12 +15,12 @@
|
||||
#include <QTime>
|
||||
|
||||
#include "qheaderview.h"
|
||||
#include <xqtreeview.h>
|
||||
#include <xqmodel.h>
|
||||
#include <xqtreetable.h>
|
||||
#include <xqviewmodel.h>
|
||||
|
||||
#define DB_TIMESTAMP QTime::currentTime().toString(" -- HH:mm:ss.zzz")
|
||||
|
||||
XQTreeView::XQTreeView(QWidget* parent)
|
||||
XQTreeTable::XQTreeTable(QWidget* 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?
|
||||
XQItem& XQTreeView::xqItemFromIndex(const QModelIndex& index )
|
||||
XQItem& XQTreeTable::xqItemFromIndex(const QModelIndex& 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);
|
||||
@@ -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
|
||||
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
|
||||
static const int s_CatchOffset = 5;
|
||||
@@ -128,7 +128,7 @@ void XQTreeView::mouseMoveEvent(QMouseEvent* event)
|
||||
QTreeView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void XQTreeView::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
void XQTreeTable::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
/*
|
||||
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:
|
||||
@@ -161,7 +161,7 @@ void XQTreeView::mousePressEvent(QMouseEvent* event)
|
||||
}
|
||||
|
||||
|
||||
void XQTreeView::mouseReleaseEvent(QMouseEvent* event)
|
||||
void XQTreeTable::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
// reset index for resize column
|
||||
_indexToResize = QModelIndex();
|
||||
@@ -170,7 +170,7 @@ void XQTreeView::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
|
||||
|
||||
void XQTreeView::wheelEvent(QWheelEvent* event)
|
||||
void XQTreeTable::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
// Ctrl-key down?
|
||||
if (!event->modifiers().testFlag(Qt::ControlModifier))
|
@@ -12,32 +12,32 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef XQTREEVIEW_H
|
||||
#define XQTREEVIEW_H
|
||||
#ifndef XQTREETABLE_H
|
||||
#define XQTREETABLE_H
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
class XQItem;
|
||||
class XQModel;
|
||||
class XQViewModel;
|
||||
|
||||
/**
|
||||
* @brief A specialized QTreeView that will handle the drawing of
|
||||
* empty or non-existing items in the future.
|
||||
*/
|
||||
|
||||
class XQTreeView : public QTreeView
|
||||
class XQTreeTable : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QTreeView)
|
||||
|
||||
public:
|
||||
|
||||
XQTreeView(QWidget* parent = nullptr );
|
||||
virtual ~XQTreeView();
|
||||
XQTreeTable(QWidget* parent = nullptr );
|
||||
virtual ~XQTreeTable();
|
||||
|
||||
XQModel* modelView();
|
||||
XQViewModel* modelView();
|
||||
XQItem& xqItemFromIndex(const QModelIndex& index );
|
||||
|
||||
protected:
|
||||
@@ -59,4 +59,4 @@ protected:
|
||||
QModelIndex _indexToResize;
|
||||
};
|
||||
|
||||
#endif // XQTREEVIEW_H
|
||||
#endif // XQTREETABLE_H
|
@@ -21,12 +21,12 @@ HEADERS += \
|
||||
items/xqitemtype.h \
|
||||
items/xqitemdelegate.h \
|
||||
model/xqcommand.h \
|
||||
model/xqmodel.h \
|
||||
model/xqmodelsections.h \
|
||||
model/xqnode.h \
|
||||
model/xqnodewriter.h \
|
||||
model/xqselectionmodel.h \
|
||||
model/xqsimpleclipboard.h \
|
||||
model/xqviewmodel.h \
|
||||
nodes/znode.h \
|
||||
nodes/znode_factory.h \
|
||||
nodes/znode_id.h \
|
||||
@@ -44,7 +44,7 @@ HEADERS += \
|
||||
util/xsingleton.h \
|
||||
util/xtreewalker.h \
|
||||
widgets/xqcontextmenu.h \
|
||||
widgets/xqtreeview.h
|
||||
widgets/xqtreetable.h
|
||||
|
||||
SOURCES += \
|
||||
application/xqchildmodel.cpp \
|
||||
@@ -59,17 +59,17 @@ SOURCES += \
|
||||
items/xqitemdelegate.cpp \
|
||||
main.cpp \
|
||||
model/xqcommand.cpp \
|
||||
model/xqmodel.cpp \
|
||||
model/xqmodelsections.cpp \
|
||||
model/xqnode.cpp \
|
||||
model/xqnodewriter.cpp \
|
||||
model/xqselectionmodel.cpp \
|
||||
model/xqsimpleclipboard.cpp \
|
||||
model/xqviewmodel.cpp \
|
||||
nodes/znode.cpp \
|
||||
pugixml/pugixml.cpp \
|
||||
pugixml/pugixml.cpp \
|
||||
util/xqexception.cpp \
|
||||
widgets/xqcontextmenu.cpp \
|
||||
widgets/xqtreeview.cpp
|
||||
widgets/xqtreetable.cpp
|
||||
|
||||
|
||||
FORMS += \
|
||||
|
Reference in New Issue
Block a user