Skip to content
Permalink
Browse files

add BookmarkInfoModel.(refs #79)

  • Loading branch information...
haraki committed Jun 14, 2019
1 parent 0ea84c8 commit dc40632e460444978a7b85b20c27e0294da1b03d
Showing with 146 additions and 0 deletions.
  1. +98 −0 bookmarkinfomodel.cpp
  2. +46 −0 bookmarkinfomodel.h
  3. +2 −0 farman.pro
@@ -0,0 +1,98 @@
#include "bookmarkinfomodel.h"

namespace Farman
{

BookmarkInfoModel::BookmarkInfoModel(QObject *parent)
: QAbstractTableModel(parent)
{
}

QVariant BookmarkInfoModel::headerData(int section, Qt::Orientation orientation, int role) const
{
// FIXME: Implement me!
}

bool BookmarkInfoModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
{
if (value != headerData(section, orientation, role)) {
// FIXME: Implement me!
emit headerDataChanged(orientation, section, section);
return true;
}
return false;
}


int BookmarkInfoModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;

// FIXME: Implement me!
}

int BookmarkInfoModel::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;

// FIXME: Implement me!
}

QVariant BookmarkInfoModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();

// FIXME: Implement me!
return QVariant();
}

bool BookmarkInfoModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (data(index, role) != value) {
// FIXME: Implement me!
emit dataChanged(index, index, QVector<int>() << role);
return true;
}
return false;
}

Qt::ItemFlags BookmarkInfoModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::NoItemFlags;

return Qt::ItemIsEditable; // FIXME: Implement me!
}

bool BookmarkInfoModel::insertRows(int row, int count, const QModelIndex &parent)
{
beginInsertRows(parent, row, row + count - 1);
// FIXME: Implement me!
endInsertRows();
}

bool BookmarkInfoModel::insertColumns(int column, int count, const QModelIndex &parent)
{
beginInsertColumns(parent, column, column + count - 1);
// FIXME: Implement me!
endInsertColumns();
}

bool BookmarkInfoModel::removeRows(int row, int count, const QModelIndex &parent)
{
beginRemoveRows(parent, row, row + count - 1);
// FIXME: Implement me!
endRemoveRows();
}

bool BookmarkInfoModel::removeColumns(int column, int count, const QModelIndex &parent)
{
beginRemoveColumns(parent, column, column + count - 1);
// FIXME: Implement me!
endRemoveColumns();
}

} // namespace Farman
@@ -0,0 +1,46 @@
#ifndef BOOKMARKINFOMODEL_H
#define BOOKMARKINFOMODEL_H

#include <QAbstractTableModel>

namespace Farman
{

class BookmarkInfoModel : public QAbstractTableModel
{
Q_OBJECT

public:
explicit BookmarkInfoModel(QObject *parent = nullptr);

// Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;

// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;

QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

// Editable:
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;

Qt::ItemFlags flags(const QModelIndex& index) const override;

// Add data:
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;

// Remove data:
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;

private:
};

} // namespace Farman

#endif // BOOKMARKINFOMODEL_H
@@ -22,6 +22,7 @@ DEFINES += APP_VERSION=\\\"$$VERSION\\\"
INCLUDEPATH += ./QHexView/include

SOURCES += main.cpp\
bookmarkinfomodel.cpp \
bookmarkmanagerdialog.cpp \
mainwindow.cpp \
folderform.cpp \
@@ -54,6 +55,7 @@ SOURCES += main.cpp\
file.cpp

HEADERS += mainwindow.h \
bookmarkinfomodel.h \
bookmarkmanagerdialog.h \
default_settings.h \
folderform.h \

0 comments on commit dc40632

Please sign in to comment.
You can’t perform that action at this time.