Bug #2361 ยป 0091-Qt-Drop-city_production_model-setData.patch
| client/gui-qt/citydlg.cpp | ||
|---|---|---|
|
return QVariant::fromValue((void *)target);
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Sets data for item, must be declared.
|
||
|
****************************************************************************/
|
||
|
bool production_item::setData()
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Constructor for city production model
|
||
|
****************************************************************************/
|
||
| ... | ... | |
|
sh.setX(qMin(sh.x(), 250));
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Sets data in model
|
||
|
****************************************************************************/
|
||
|
bool city_production_model::setData(const QModelIndex &index,
|
||
|
const QVariant &value, int role)
|
||
|
{
|
||
|
if (!index.isValid() || role != Qt::DisplayRole || role != Qt::ToolTipRole)
|
||
|
return false;
|
||
|
if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0
|
||
|
&& index.column() < columnCount()) {
|
||
|
bool change = city_target_list[index.row()]->setData();
|
||
|
return change;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Constructor for production widget
|
||
|
future - show future targets
|
||
| client/gui-qt/citydlg.h | ||
|---|---|---|
|
return 1;
|
||
|
}
|
||
|
QVariant data() const;
|
||
|
bool setData();
|
||
|
private:
|
||
|
struct universal *target;
|
||
| ... | ... | |
|
return 3;
|
||
|
}
|
||
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||
|
bool setData(const QModelIndex &index, const QVariant &value,
|
||
|
int role = Qt::DisplayRole);
|
||
|
QPoint size_hint();
|
||
|
void populate();
|
||
|
QPoint sh;
|
||