Changeset c53a3f4
- Timestamp:
- 01/19/10 18:34:18 (13 years ago)
- Branches:
- master, qt5
- Children:
- 395d6d3
- Parents:
- 02c1e09
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/mainwindow.cpp
r02c1e09 rc53a3f4 17 17 #include "daynavigatorwidget.h" 18 18 #include "mapwindow.h" 19 20 const int confId = 1; 19 21 20 22 MainWindow::MainWindow(QWidget *parent) … … 65 67 actTreeView->setItemDelegate(new Delegate(actTreeView)); 66 68 67 // event doubleclicked68 connect(dayTreeView, SIGNAL( doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &)));69 connect(favTreeView, SIGNAL( doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &)));70 connect(actTreeView, SIGNAL( doubleClicked(const QModelIndex &)), SLOT(itemDoubleClicked(const QModelIndex &)));69 // event clicked 70 connect(dayTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 71 connect(favTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 72 connect(actTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); 71 73 // request for map to be displayed 72 74 connect(dayTreeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &))); … … 78 80 if(Conference::getAll().count()) // no conference(s) in the DB 79 81 { 80 int confId = 1;81 82 static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); 82 83 favTreeView->reset(); … … 90 91 else 91 92 { 92 int confId = 1;93 93 QDate aStartDate = Conference::getById(confId).start(); 94 94 QDate aEndDate = Conference::getById(confId).end(); … … 130 130 if(Conference::getAll().count()) 131 131 { 132 int confId = 1;133 132 // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates 134 133 QDate aStartDate = Conference::getById(confId).start(); … … 155 154 void MainWindow::updateDayView(const QDate &aDate) 156 155 { 157 int confId = 1;158 156 static_cast<EventModel*>(dayTreeView->model())->loadEvents(aDate,confId); 159 157 dayTreeView->reset(); … … 163 161 void MainWindow::updateTab(const int aIndex) 164 162 { 165 int confId = 1;166 163 switch(aIndex) 167 164 { … … 192 189 } 193 190 }; 194 195 196 191 } 197 192 198 193 void MainWindow::updateActivitiesDayView(const QDate &aDate) 199 194 { 200 int confId = 1;201 195 static_cast<EventModel*>(actTreeView->model())->loadEventsByActivities(aDate,confId); 202 196 actTreeView->reset(); … … 206 200 void MainWindow::updateFavouritesDayView(const QDate &aDate) 207 201 { 208 int confId = 1;209 202 static_cast<EventModel*>(favTreeView->model())->loadFavEvents(aDate,confId); 210 203 favTreeView->reset(); … … 212 205 } 213 206 214 void MainWindow::item DoubleClicked(const QModelIndex &aIndex)207 void MainWindow::itemClicked(const QModelIndex &aIndex) 215 208 { 216 209 // have to handle only events, not time-groups -
src/gui/mainwindow.h
r02c1e09 rc53a3f4 23 23 void updateActivitiesDayView(const QDate &aDate); 24 24 void updateFavouritesDayView(const QDate &aDate); 25 void item DoubleClicked(const QModelIndex &aIndex);25 void itemClicked(const QModelIndex &aIndex); 26 26 void displayMap(const QModelIndex &aIndex); 27 27 private: -
src/mvc/treeview.cpp
r02c1e09 rc53a3f4 22 22 QPoint point = aEvent->pos(); 23 23 24 testForControlClicked(index,point); 25 26 // pass the event to the Base class, so item clicks/events are handled correctly 27 QTreeView::mouseReleaseEvent(aEvent); 24 // test whether we have handled the mouse event 25 if(!testForControlClicked(index,point)) 26 { 27 // pass the event to the Base class, so item clicks/events are handled correctly 28 QTreeView::mouseReleaseEvent(aEvent); 29 } 28 30 } 29 31 30 void TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint) 32 // returns bool if some Control was clicked 33 bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint) 31 34 { 35 bool handled = false; 36 32 37 if(!aIndex.isValid()) 33 return ;38 return handled; 34 39 35 40 QRect rect = visualRect(aIndex); // visual QRect of selected/clicked item in the list … … 56 61 // since the Favourite icon has changed, update TreeView accordingly 57 62 static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex); 63 handled = true; 58 64 } 59 65 break; … … 89 95 // since the Alarm icon has changed, update TreeView accordingly 90 96 static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex); 91 97 handled = true; 92 98 } 93 99 break; … … 97 103 qDebug() << "MAP CLICKED: " << qVariantValue<QString>(aIndex.data()); 98 104 emit(requestForMap(aIndex)); 105 handled = true; 99 106 } 100 107 break; … … 103 110 { 104 111 // item was clicked, but not a control 112 handled = false; 105 113 } 106 114 }; 115 116 return handled; 107 117 } 108 118 -
src/mvc/treeview.h
r02c1e09 rc53a3f4 12 12 private: 13 13 void mouseReleaseEvent(QMouseEvent *aEvent); 14 voidtestForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint);14 bool testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint); 15 15 signals: 16 16 void requestForMap(const QModelIndex &aIndex);
Note: See TracChangeset
for help on using the changeset viewer.