if (!index.isValid()) {
}
if (index.row() >= romCount || index.row() < 0 ) {
}
if (role == Qt::TextAlignmentRole) {
if (index.column() > 0 && index.column() < 10) {
return Qt::AlignHCenter;
}
}
if (role == Qt::UserRole) {
if (index.column() == 0) {
return QString("%1;%2;%3").
arg(ROMs.
at(index.
row()).
section(";",
12,
12)).
arg(ROMs.
at(index.
row()).
section(";",
14,
14)).
arg(ROMs.
at(index.
row()).
section(";",
15,
15));
}
if (index.column() == 1) {
return ROMs.at(index.row()).section(";", 1, 1);
}
if (index.column() == 2) {
return ROMs.at(index.row()).section(";", 2, 2);
}
if (index.column() == 3) {
return ROMs.at(index.row()).section(";", 11, 11);
}
}
// if (role == Qt::DecorationRole) {
// if (index.column() == 0) {
// return romicon;
// }
// if (index.column() == 1) {
// QString tmpExt = ROMs.at(index.row()).section(";", 1, 1);
// if (tmpExt.compare("zip", Qt::CaseInsensitive) == 0 || tmpExt.compare("7Z", Qt::CaseInsensitive) == 0 || tmpExt.compare("r", Qt::CaseInsensitive) == 0 ) {
// return QIcon(QString("Skin/%1/icons/sys/compressed16.png").arg(CurrSkin));
// } else if (tmpExt.compare("iso", Qt::CaseInsensitive) == 0 || tmpExt.compare("cue", Qt::CaseInsensitive) == 0 || tmpExt.compare("bin", Qt::CaseInsensitive) == 0 ||
// tmpExt.compare("nrg", Qt::CaseInsensitive) == 0 || tmpExt.compare("mdf", Qt::CaseInsensitive) == 0 || tmpExt.compare("mds", Qt::CaseInsensitive) == 0 ) {
// return QIcon(QString("Skin/%1/icons/sys/cddvd16.png").arg(CurrSkin));
// } else {
// return QIcon(QString("Skin/%1/icons/sys/cartridge16.png").arg(CurrSkin));
// }
// }
// if (index.column() == 2) {
// if (ROMs.at(index.row()).section(";", 2, 2).toInt() != 0) {
// return QPixmap(QString("Skin/%1/icons/sys/rate%2.png").arg(CurrSkin).arg(ROMs.at(index.row()).section(";", 2, 2).toInt()));
// }
// }
// }
if (role == Qt::DisplayRole) {
if (index.column() == 0) {
return ROMs.at(index.row()).section(";", 0, 0);
}
if (index.column() == 3) {
if (ROMs.at(index.row()).section(";", 3,3) == "rsnull") {
return cEmulator;
} else {
return ROMs.at(index.row()).section(";", 3,3); }
}
if (index.column() == 4) {
return ROMs.at(index.row()).section(";", 4, 4);
}
if (index.column() == 5) {
return ROMs.at(index.row()).section(";", 5, 5).replace("rsnull", "");
}
if (index.column() == 6 ) {
return ROMs.at(index.row()).section(";", 6, 6);
}
if (index.column() == 7) { // Compañia
return ROMs.at(index.row()).section(";", 7, 7);
}
if (index.column() == 8) {
return ROMs.at(index.row()).section(";", 8, 8);
}
if (index.column() == 9) {
return ROMs.at(index.row()).section(";", 9, 9);
}
if (index.column() == 11) {
return ROMs.at(index.row()).section(";", 10, 10);
}
}
}
QVariant rs_GameModel::data(const QModelIndex &index, int role) const { // DATA
if (!index.isValid()) {
return QVariant();
}
if (index.row() >= romCount || index.row() < 0 ) {
return QVariant();
}
if (role == Qt::TextAlignmentRole) {
if (index.column() > 0 && index.column() < 10) {
return Qt::AlignHCenter;
}
}
if (role == Qt::UserRole) {
if (index.column() == 0) {
return QString("%1;%2;%3").arg(ROMs.at(index.row()).section(";", 12, 12)).arg(ROMs.at(index.row()).section(";", 14, 14)).arg(ROMs.at(index.row()).section(";", 15, 15));
}
if (index.column() == 1) {
return ROMs.at(index.row()).section(";", 1, 1);
}
if (index.column() == 2) {
return ROMs.at(index.row()).section(";", 2, 2);
}
if (index.column() == 3) {
return ROMs.at(index.row()).section(";", 11, 11);
}
}
// if (role == Qt::DecorationRole) {
// if (index.column() == 0) {
// return romicon;
// }
// if (index.column() == 1) {
// QString tmpExt = ROMs.at(index.row()).section(";", 1, 1);
// if (tmpExt.compare("zip", Qt::CaseInsensitive) == 0 || tmpExt.compare("7Z", Qt::CaseInsensitive) == 0 || tmpExt.compare("r", Qt::CaseInsensitive) == 0 ) {
// return QIcon(QString("Skin/%1/icons/sys/compressed16.png").arg(CurrSkin));
// } else if (tmpExt.compare("iso", Qt::CaseInsensitive) == 0 || tmpExt.compare("cue", Qt::CaseInsensitive) == 0 || tmpExt.compare("bin", Qt::CaseInsensitive) == 0 ||
// tmpExt.compare("nrg", Qt::CaseInsensitive) == 0 || tmpExt.compare("mdf", Qt::CaseInsensitive) == 0 || tmpExt.compare("mds", Qt::CaseInsensitive) == 0 ) {
// return QIcon(QString("Skin/%1/icons/sys/cddvd16.png").arg(CurrSkin));
// } else {
// return QIcon(QString("Skin/%1/icons/sys/cartridge16.png").arg(CurrSkin));
// }
// }
// if (index.column() == 2) {
// if (ROMs.at(index.row()).section(";", 2, 2).toInt() != 0) {
// return QPixmap(QString("Skin/%1/icons/sys/rate%2.png").arg(CurrSkin).arg(ROMs.at(index.row()).section(";", 2, 2).toInt()));
// }
// }
// }
if (role == Qt::DisplayRole) {
if (index.column() == 0) {
return ROMs.at(index.row()).section(";", 0, 0);
}
if (index.column() == 3) {
if (ROMs.at(index.row()).section(";", 3,3) == "rsnull") {
return cEmulator;
} else {
return ROMs.at(index.row()).section(";", 3,3); }
}
if (index.column() == 4) {
return ROMs.at(index.row()).section(";", 4, 4);
}
if (index.column() == 5) {
return ROMs.at(index.row()).section(";", 5, 5).replace("rsnull", "");
}
if (index.column() == 6 ) {
return ROMs.at(index.row()).section(";", 6, 6);
}
if (index.column() == 7) { // Compañia
return ROMs.at(index.row()).section(";", 7, 7);
}
if (index.column() == 8) {
return ROMs.at(index.row()).section(";", 8, 8);
}
if (index.column() == 9) {
return ROMs.at(index.row()).section(";", 9, 9);
}
if (index.column() == 11) {
return ROMs.at(index.row()).section(";", 10, 10);
}
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
Bookmarks