#include "kdganttsummaryhandlingproxymodel.h"
#include "kdganttsummaryhandlingproxymodel_p.h"
#include <QDebug>
#include <cassert>
#include "unittest/test.h"
#include <QStandardItemModel>
#include "moc_kdganttsummaryhandlingproxymodel.cpp"
Go to the source code of this file.
Defines | |
#define | d d_func() |
Typedefs | |
typedef ForwardingProxyModel | BASE |
Functions | |
KDAB_SCOPED_UNITTEST_SIMPLE (KDGantt, SummaryHandlingProxyModel,"test") | |
std::ostream & | operator<< (std::ostream &os, const QDateTime &dt) |
#define d d_func() |
Definition at line 130 of file kdganttsummaryhandlingproxymodel.cpp.
typedef ForwardingProxyModel BASE |
Definition at line 50 of file kdganttsummaryhandlingproxymodel.cpp.
KDAB_SCOPED_UNITTEST_SIMPLE | ( | KDGantt | , | |
SummaryHandlingProxyModel | , | |||
"test" | ||||
) |
Definition at line 290 of file kdganttsummaryhandlingproxymodel.cpp.
References assertEqual, assertFalse, assertTrue, KDGantt::SummaryHandlingProxyModel::data(), KDGantt::EndTimeRole, KDGantt::SummaryHandlingProxyModel::flags(), KDGantt::ForwardingProxyModel::index(), KDGantt::ItemTypeRole, KDGantt::SummaryHandlingProxyModel::setSourceModel(), KDGantt::StartTimeRole, KDGantt::TypeSummary, and KDGantt::TypeTask.
00290 { 00291 SummaryHandlingProxyModel model; 00292 QStandardItemModel sourceModel; 00293 00294 model.setSourceModel( &sourceModel ); 00295 00296 QStandardItem* topitem = new QStandardItem( QString::fromLatin1( "Summary" ) ); 00297 topitem->setData( KDGantt::TypeSummary, KDGantt::ItemTypeRole ); 00298 sourceModel.appendRow( topitem ); 00299 00300 QStandardItem* task1 = new QStandardItem( QString::fromLatin1( "Task1" ) ); 00301 task1->setData( KDGantt::TypeTask, KDGantt::ItemTypeRole ); 00302 QStandardItem* task2 = new QStandardItem( QString::fromLatin1( "Task2" ) ); 00303 task2->setData( KDGantt::TypeTask, KDGantt::ItemTypeRole ); 00304 topitem->appendRow( task1 ); 00305 topitem->appendRow( task2 ); 00306 00307 00308 QDateTime startdt = QDateTime::currentDateTime(); 00309 QDateTime enddt = startdt.addDays( 1 ); 00310 00311 00312 task1->setData( startdt, KDGantt::StartTimeRole ); 00313 task1->setData( enddt, KDGantt::EndTimeRole ); 00314 task2->setData( startdt, KDGantt::StartTimeRole ); 00315 task2->setData( enddt, KDGantt::EndTimeRole ); 00316 00317 const QModelIndex topidx = model.index( 0, 0, QModelIndex() ); 00318 00319 assertEqual( model.data( topidx, KDGantt::ItemTypeRole ).toInt(), KDGantt::TypeSummary ); 00320 assertEqual( model.data( model.index( 0, 0, topidx ), KDGantt::ItemTypeRole ).toInt(), KDGantt::TypeTask ); 00321 00322 QDateTime task1startdt = model.data( model.index( 0, 0, topidx ), KDGantt::StartTimeRole ).toDateTime(); 00323 assertEqual( task1startdt, startdt ); 00324 00325 QDateTime summarystartdt = model.data( topidx, KDGantt::StartTimeRole ).toDateTime(); 00326 assertEqual( summarystartdt, startdt ); 00327 assertTrue( model.flags( model.index( 0, 0, topidx ) ) & Qt::ItemIsEditable ); 00328 assertFalse( model.flags( topidx ) & Qt::ItemIsEditable ); 00329 }
std::ostream& @35::operator<< | ( | std::ostream & | os, | |
const QDateTime & | dt | |||
) | [static] |
Definition at line 279 of file kdganttsummaryhandlingproxymodel.cpp.
00280 { 00281 #ifdef QT_NO_STL 00282 os << dt.toString().toLatin1().constData(); 00283 #else 00284 os << dt.toString().toStdString(); 00285 #endif 00286 return os; 00287 }
int c |
Definition at line 143 of file kdganttsummaryhandlingproxymodel.cpp.
const QAbstractItemModel* m |
Definition at line 145 of file kdganttsummaryhandlingproxymodel.cpp.
void* p |
Definition at line 144 of file kdganttsummaryhandlingproxymodel.cpp.
int r |
Definition at line 143 of file kdganttsummaryhandlingproxymodel.cpp.