#include <map_layer_list_model.h>
Public 型 | |
enum | { COL_VISIBILITY = 0, COL_OPACITY, COL_NAME, N_COLUMNS } |
レイヤの各属性にアクセスするための「論理」列番号。 viewでの表示列番号とは無関係であることに注意。 [詳細] | |
Public メソッド | |
MapLayerListModel (QObject *parent=0) | |
コンストラクタ | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
行数を返す。 | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
列数を返す。 | |
QVariant | data (const QModelIndex &index, int role) const |
indexで指定された場所のデータを返す。 | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
indexで指定された場所のヘッダを返す。 | |
Qt::ItemFlags | flags (const QModelIndex &index) const |
indexで指定された場所のitemflagを返す | |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
indexで指定された場所のroleに対応するdataを設定。成功したか どうかを返す。 | |
int | addMapLayer (MapLayer *layer) |
このモデルに新たな地図レイヤを追加する。追加後のレイヤ数を返す | |
int | removeLayer (MapLayer *layer) |
このモデルからレイヤを削除する。削除後のレイヤ数を返す | |
MapLayer * | layerAt (int index) const |
index番目のレイヤへのポインタを返す。 | |
MapLayer * | layerOfName (const QString &name) const |
名前がnameであるレイヤへのポインタを返す。 | |
Private 変数 | |
QList< MapLayer * > | mapLayers_ |
管理するレイヤを格納するコンテナ |
詳細はQtのmodel/view/delegateフレームワーク参照。(今回のview実装で は)テーブル風に表示しているが,データ管理はレイヤー毎であるため QAbstractListModelを継承。ただし,各属性は列挙定数でcolumnを指定する ことでアクセスする。(より良い実装が有るかもしれない)
anonymous enum |
MapLayerListModel::MapLayerListModel | ( | QObject * | parent = 0 |
) |
コンストラクタ
[in] | parent | 親オブジェクト |
int MapLayerListModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
行数を返す。
int MapLayerListModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
列数を返す。
QVariant MapLayerListModel::data | ( | const QModelIndex & | index, | |
int | role | |||
) | const |
indexで指定された場所のデータを返す。
QVariant MapLayerListModel::headerData | ( | int | section, | |
Qt::Orientation | orientation, | |||
int | role = Qt::DisplayRole | |||
) | const |
indexで指定された場所のヘッダを返す。
Qt::ItemFlags MapLayerListModel::flags | ( | const QModelIndex & | index | ) | const |
indexで指定された場所のitemflagを返す
Qt::ItemFlags
bool MapLayerListModel::setData | ( | const QModelIndex & | index, | |
const QVariant & | value, | |||
int | role = Qt::EditRole | |||
) |
indexで指定された場所のroleに対応するdataを設定。成功したか どうかを返す。
int MapLayerListModel::addMapLayer | ( | MapLayer * | layer | ) |
このモデルに新たな地図レイヤを追加する。追加後のレイヤ数を返す
[in] | layer | 追加したいlayer |
int MapLayerListModel::removeLayer | ( | MapLayer * | layer | ) |
このモデルからレイヤを削除する。削除後のレイヤ数を返す
[in] | layer | 削除したいlayer |
MapLayer * MapLayerListModel::layerAt | ( | int | index | ) | const |
index番目のレイヤへのポインタを返す。
MapLayer * MapLayerListModel::layerOfName | ( | const QString & | name | ) | const |
名前がnameであるレイヤへのポインタを返す。
QList<MapLayer*> MapLayerListModel::mapLayers_ [private] |
管理するレイヤを格納するコンテナ