Freeciv-3.2
Loading...
Searching...
No Matches
Public Member Functions | Private Slots | Private Attributes
city_model Class Reference

#include <cityrep.h>

+ Inheritance diagram for city_model:

Public Member Functions

 city_model (QObject *parent=0)
 
 ~city_model ()
 
int rowCount (const QModelIndex &index=QModelIndex()) const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole)
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QVariant menu_data (int section) const
 
QVariant hide_data (int section) const
 
void populate ()
 
void city_changed (struct city *pcity)
 
void all_changed ()
 

Private Slots

void notify_city_changed (int row)
 

Private Attributes

QList< city_item * > city_list
 

Detailed Description

Definition at line 102 of file cityrep.h.

Constructor & Destructor Documentation

◆ city_model()

city_model::city_model ( QObject *  parent = 0)

Constructor for city model

Definition at line 165 of file cityrep.cpp.

◆ ~city_model()

city_model::~city_model ( )

Destructor for city model

Definition at line 173 of file cityrep.cpp.

Member Function Documentation

◆ all_changed()

void city_model::all_changed ( )

Notifies about whole model changed

Definition at line 316 of file cityrep.cpp.

Referenced by city_widget::update_model().

◆ city_changed()

void city_model::city_changed ( struct city pcity)

Notifies about changed item

Definition at line 299 of file cityrep.cpp.

Referenced by city_widget::update_city().

◆ columnCount()

int city_model::columnCount ( const QModelIndex parent = QModelIndex()) const
inline

◆ data()

QVariant city_model::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const

Returns stored data in index

Definition at line 190 of file cityrep.cpp.

◆ headerData()

QVariant city_model::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Returns header data for given section(column)

Definition at line 226 of file cityrep.cpp.

Referenced by city_widget::update_model().

◆ hide_data()

QVariant city_model::hide_data ( int  section) const

Hides given column if show is false

Definition at line 265 of file cityrep.cpp.

Referenced by city_widget::hide_columns().

◆ menu_data()

QVariant city_model::menu_data ( int  section) const

Returns header information about section

Definition at line 251 of file cityrep.cpp.

Referenced by city_widget::display_header_menu().

◆ notify_city_changed

void city_model::notify_city_changed ( int  row)
privateslot

Notifies about changed row

Definition at line 182 of file cityrep.cpp.

Referenced by city_changed(), and setData().

◆ populate()

void city_model::populate ( )

Creates city model

Definition at line 279 of file cityrep.cpp.

Referenced by all_changed(), and city_model().

◆ rowCount()

int city_model::rowCount ( const QModelIndex index = QModelIndex()) const
inline

Definition at line 108 of file cityrep.h.

Referenced by data(), city_widget::gen_production_labels(), and setData().

◆ setData()

bool city_model::setData ( const QModelIndex index,
const QVariant value,
int  role = Qt::DisplayRole 
)

Sets data in model under index

Definition at line 205 of file cityrep.cpp.

Field Documentation

◆ city_list

QList<city_item *> city_model::city_list
private

Definition at line 129 of file cityrep.h.

Referenced by all_changed(), city_changed(), data(), populate(), rowCount(), setData(), and ~city_model().