23 // ======== MEMBER FUNCTIONS ======== |
23 // ======== MEMBER FUNCTIONS ======== |
24 |
24 |
25 // ---------------------------------------------------------------------- |
25 // ---------------------------------------------------------------------- |
26 // LocationPickerCollectionListContent::LocationPickerCollectionListContent() |
26 // LocationPickerCollectionListContent::LocationPickerCollectionListContent() |
27 // ---------------------------------------------------------------------- |
27 // ---------------------------------------------------------------------- |
28 LocationPickerCollectionListContent::LocationPickerCollectionListContent(Qt::Orientation aOrientation ) |
28 LocationPickerCollectionListContent::LocationPickerCollectionListContent( Qt::Orientation aOrientation ) |
29 :mOrientation(aOrientation), |
29 :mOrientation(aOrientation), |
30 mModel(NULL), |
30 mModel(NULL), |
31 mDataManager(NULL) |
31 mDataManager(NULL) |
32 { |
32 { |
33 // Create a standard model for the view list |
33 // Create a standard model for the view list |
34 mModel = new QStandardItemModel( this ); |
34 mModel = new QStandardItemModel( this ); |
35 |
35 // create data manager to manage data in the model |
36 mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionListContent ); |
36 mDataManager = LocationPickerDataManager::getInstance(); |
37 mDataManager->populateModel( mOrientation ); |
37 mDataManager->populateModel( *mModel, ELocationPickerCollectionListContent, mOrientation ); |
38 } |
38 } |
39 |
39 |
40 // ---------------------------------------------------------------------- |
40 // ---------------------------------------------------------------------- |
41 // LocationPickerCollectionListContent::~LocationPickerCollectionListContent() |
41 // LocationPickerCollectionListContent::~LocationPickerCollectionListContent() |
42 // ---------------------------------------------------------------------- |
42 // ---------------------------------------------------------------------- |
43 LocationPickerCollectionListContent::~LocationPickerCollectionListContent() |
43 LocationPickerCollectionListContent::~LocationPickerCollectionListContent() |
44 { |
44 { |
45 if( mDataManager ) |
|
46 delete mDataManager; |
|
47 delete mModel; |
45 delete mModel; |
48 } |
46 } |
49 |
47 |
50 // ---------------------------------------------------------------- |
48 // ---------------------------------------------------------------- |
51 // LocationPickerCollectionListContent::getStandardModel |
49 // LocationPickerCollectionListContent::getStandardModel |
53 QStandardItemModel* LocationPickerCollectionListContent::getStandardModel() |
51 QStandardItemModel* LocationPickerCollectionListContent::getStandardModel() |
54 { |
52 { |
55 return mModel; |
53 return mModel; |
56 } |
54 } |
57 |
55 |
58 // ---------------------------------------------------------------- |
56 // ---------------------------------------------------------------------------- |
59 // LocationPickerCollectionListContent::getDataManager |
57 // LocationPickerCollectionListContent::getData() |
60 // ----------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
61 LocationPickerDataManager* LocationPickerCollectionListContent::getDataManager() |
|
62 { |
|
63 return mDataManager; |
|
64 } |
|
65 |
59 |
|
60 void LocationPickerCollectionListContent::getData( QModelIndex aIndex, quint32& aValue ) |
|
61 { |
|
62 QStandardItem* item = mModel->item( aIndex.row(), aIndex.column() ); |
|
63 QVariant var = item->data( Qt::UserRole ); |
|
64 aValue = var.toUInt(); |
|
65 } |