QList<MEvent>evl=req->getAllEvents();
eventmodel->clear();
eventmodel->insertColumns(0,6);
- eventmodel->setHorizontalHeaderLabels(QStringList()<<tr("Start Time")<<tr("Title")<<tr("Capacity")<<tr("Sold")<<tr("Reserved")<<tr("Free"));
+ eventmodel->setHorizontalHeaderLabels(QStringList()<<tr("Start Time")<<tr("Title")<<tr("Free")<<tr("Reserved")<<tr("Sold")<<tr("Capacity"));
QDateTime now=QDateTime::currentDateTime();
for(int i=0,j=0;i<evl.size();i++){
QDateTime stime=QDateTime::fromTime_t(evl[i].startTime());
eventmodel->setData(eventmodel->index(j,0),evl[i].eventId(),Qt::UserRole);
eventmodel->setData(eventmodel->index(j,0),stime.toString(tr("ddd MMMM d yyyy, h:mm ap","time format")));
eventmodel->setData(eventmodel->index(j,1),evl[i].title());
- eventmodel->setData(eventmodel->index(j,2),evl[i].capacity());
- eventmodel->setData(eventmodel->index(j,3),evl[i].amountSold());
- eventmodel->setData(eventmodel->index(j,4),evl[i].amountReserved());
- eventmodel->setData(eventmodel->index(j,5),evl[i].capacity()-evl[i].amountSold()-evl[i].amountReserved());
+ eventmodel->setData(eventmodel->index(j,2),evl[i].capacity()-evl[i].amountSold()-evl[i].amountReserved());
+ eventmodel->setData(eventmodel->index(j,3),evl[i].amountReserved());
+ eventmodel->setData(eventmodel->index(j,4),evl[i].amountSold());
+ eventmodel->setData(eventmodel->index(j,5),evl[i].capacity());
j++;
}
eventtable->resizeColumnsToContents();