eventtable->setSelectionBehavior(QAbstractItemView::SelectRows);
eventtable->setEditTriggers(QAbstractItemView::NoEditTriggers);
eventtable->verticalHeader()->hide();
+ eventtable->setSortingEnabled(true);
+ eventmodel->setSortRole(SortRole);
hl->addSpacing(5);
hl->addLayout(vl=new QVBoxLayout,0);
QPushButton*p;
vl->addWidget(p=new QPushButton(tr("New Event")),0);
p->setEnabled(req->hasRight(req->RCreateEvent));
- QMenu*m;
- p->setMenu(m=new QMenu);
- m->addAction(tr("New Event..."),this,SLOT(newEvent()));
- m->addAction(tr("Clone Current Event..."),this,SLOT(cloneEvent()));
+ QMenu*m;
+ p->setMenu(m=new QMenu);
+ m->addAction(tr("New Event..."),this,SLOT(newEvent()));
+ m->addAction(tr("Clone Current Event..."),this,SLOT(cloneEvent()));
vl->addWidget(p=new QPushButton(tr("Details...")),0);
connect(p,SIGNAL(clicked()),this,SLOT(editEvent()));
{
//menu
QList<QMenu*>ret;
- QMenu*m=new QMenu(tr("&Event"));
+ QMenu*m=new QMenu(tr("&View"));
ret<<m;
m->addAction(tr("&Update Event List"),this,SLOT(updateEvents()))
->setEnabled(req->hasRight(req->RGetAllEvents));
- m->addAction(tr("&Show/Edit details..."),this,SLOT(editEvent()))
- ->setEnabled(req->hasRight(req->RGetEvent));
- m->addAction(tr("&New Event..."),this,SLOT(newEvent()))
- ->setEnabled(req->hasRight(req->RCreateEvent));
m->addSeparator();
showoldevents=m->addAction(tr("Show &old Events"),this,SLOT(updateEvents()));
showoldevents->setEnabled(req->hasRight(req->RGetAllEvents));
showoldevents->setCheckable(true);
showoldevents->setChecked(QSettings().value("profiles/"+profilekey+"/showOldEvents",false).toBool());
+
+ m=new QMenu(tr("&Edit"));
+ m->addAction(tr("&Show/Edit details..."),this,SLOT(editEvent()))
+ ->setEnabled(req->hasRight(req->RGetEvent));
+ m->addAction(tr("&New Event..."),this,SLOT(newEvent()))
+ ->setEnabled(req->hasRight(req->RCreateEvent));
m->addSeparator();
m->addAction(tr("&Edit Price Categories..."),this,SLOT(editPriceCat()));
if(!showveryold && stime<now)continue;
//show
eventmodel->insertRow(j);
- eventmodel->setData(eventmodel->index(j,0),evl[i].id().value(),Qt::UserRole);
+ eventmodel->setData(eventmodel->index(j,0),evl[i].id().value(),IdRole);
eventmodel->setData(eventmodel->index(j,0),evl[i].startTimeString());
+ eventmodel->setData(eventmodel->index(j,0),evl[i].start().value(),SortRole);
eventmodel->setData(eventmodel->index(j,1),evl[i].title().value());
+ eventmodel->setData(eventmodel->index(j,1),evl[i].title().value(),SortRole);
eventmodel->setData(eventmodel->index(j,2),evl[i].capacity()-evl[i].amountSold()-evl[i].amountReserved());
+ eventmodel->setData(eventmodel->index(j,2),evl[i].capacity()-evl[i].amountSold()-evl[i].amountReserved(),SortRole);
eventmodel->setData(eventmodel->index(j,3),evl[i].amountReserved().value());
+ eventmodel->setData(eventmodel->index(j,3),evl[i].amountReserved().value(),SortRole);
eventmodel->setData(eventmodel->index(j,4),evl[i].amountSold().value());
+ eventmodel->setData(eventmodel->index(j,4),evl[i].amountSold().value(),SortRole);
eventmodel->setData(eventmodel->index(j,5),evl[i].capacity().value());
+ eventmodel->setData(eventmodel->index(j,5),evl[i].capacity().value(),SortRole);
j++;
}
eventtable->resizeColumnsToContents();
QModelIndexList ilst=eventtable->selectionModel()->selectedIndexes();
if(ilst.size()<1)return;
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
- id=eventmodel->data(idx,Qt::UserRole).toInt();
+ id=eventmodel->data(idx,IdRole).toInt();
if(id<0)return;
MEventEditor ed(this,MEventEditor::OpenMode::Create,id);
ed.exec();
QModelIndexList ilst=eventtable->selectionModel()->selectedIndexes();
if(ilst.size()<1)return;
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
- id=eventmodel->data(idx,Qt::UserRole).toInt();
+ id=eventmodel->data(idx,IdRole).toInt();
if(id<0)return;
MEventEditor ed(this,id);
ed.exec();
QModelIndexList ilst=eventtable->selectionModel()->selectedIndexes();
if(ilst.size()<1)return;
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
- id=eventmodel->data(idx,Qt::UserRole).toInt();
+ id=eventmodel->data(idx,IdRole).toInt();
if(id<0)return;
MEventSummary ed(this,id);
ed.exec();
QModelIndexList ilst=eventtable->selectionModel()->selectedIndexes();
if(ilst.size()<1)return;
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
- id=eventmodel->data(idx,Qt::UserRole).toInt();
+ id=eventmodel->data(idx,IdRole).toInt();
if(id<0)return;
MTGetEvent getev=MTGetEvent::query(id);
if(!getev.hasError()){
QModelIndexList ilst=eventtable->selectionModel()->selectedIndexes();
if(ilst.size()<1)return -1;
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
- return eventmodel->data(idx,Qt::UserRole).toInt();
+ return eventmodel->data(idx,IdRole).toInt();
}
QString MEventsTab::currentEventTitle()const
}
//get events
for(int i=0;i<ilst.size();i++){
- int eid=eventmodel->data(eventmodel->index(ilst[i].row(),0),Qt::UserRole).toInt();
+ int eid=eventmodel->data(eventmodel->index(ilst[i].row(),0),IdRole).toInt();
if(!eids.contains(eid))eids.append(eid);
}
}