summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index 751a1da..ca63dc5 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -115,361 +115,361 @@ void DateBookDayView::moveUp()
115 scrollBy(0, -20); 115 scrollBy(0, -20);
116} 116}
117 117
118void DateBookDayView::moveDown() 118void DateBookDayView::moveDown()
119{ 119{
120 scrollBy(0, 20); 120 scrollBy(0, 20);
121} 121}
122 122
123void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool ) 123void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool )
124{ 124{
125 int w = cr.width(); 125 int w = cr.width();
126 int h = cr.height(); 126 int h = cr.height();
127 p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) ); 127 p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) );
128 if ( showGrid() ) { 128 if ( showGrid() ) {
129 // Draw our lines 129 // Draw our lines
130 int x2 = w - 1; 130 int x2 = w - 1;
131 int y2 = h - 1; 131 int y2 = h - 1;
132 QPen pen( p->pen() ); 132 QPen pen( p->pen() );
133 p->setPen( colorGroup().dark() ); 133 p->setPen( colorGroup().dark() );
134 p->drawLine( x2, 0, x2, y2 ); 134 p->drawLine( x2, 0, x2, y2 );
135 p->drawLine( 0, y2, x2, y2 ); 135 p->drawLine( 0, y2, x2, y2 );
136 136
137 p->setPen( colorGroup().midlight() ); 137 p->setPen( colorGroup().midlight() );
138 p->drawLine( 0, y2 - h/2, x2, y2 - h/2); 138 p->drawLine( 0, y2 - h/2, x2, y2 - h/2);
139 139
140 p->setPen( pen ); 140 p->setPen( pen );
141 } 141 }
142} 142}
143 143
144void DateBookDayView::paintFocus( QPainter *, const QRect & ) 144void DateBookDayView::paintFocus( QPainter *, const QRect & )
145{ 145{
146} 146}
147 147
148void DateBookDayView::resizeEvent( QResizeEvent *e ) 148void DateBookDayView::resizeEvent( QResizeEvent *e )
149{ 149{
150 QTable::resizeEvent( e ); 150 QTable::resizeEvent( e );
151 columnWidthChanged( 0 ); 151 columnWidthChanged( 0 );
152 emit sigColWidthChanged(); 152 emit sigColWidthChanged();
153} 153}
154 154
155void DateBookDayView::keyPressEvent( QKeyEvent *e ) 155void DateBookDayView::keyPressEvent( QKeyEvent *e )
156{ 156{
157 QString txt = e->text(); 157 QString txt = e->text();
158 if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { 158 if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) {
159 // we this is some sort of thing we know about... 159 // we this is some sort of thing we know about...
160 e->accept(); 160 e->accept();
161 emit sigCapturedKey( txt ); 161 emit sigCapturedKey( txt );
162 } else { 162 } else {
163 // I don't know what this key is, do you? 163 // I don't know what this key is, do you?
164 e->ignore(); 164 e->ignore();
165 } 165 }
166} 166}
167 167
168void DateBookDayView::setRowStyle( int style ) 168void DateBookDayView::setRowStyle( int style )
169{ 169{
170 if (style<0) style = 0; 170 if (style<0) style = 0;
171 171
172 for (int i=0; i<numRows(); i++) 172 for (int i=0; i<numRows(); i++)
173 setRowHeight(i, style*10+20); 173 setRowHeight(i, style*10+20);
174} 174}
175 175
176void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ ) 176void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ )
177{ 177{
178 int sh=99,eh=-1; 178 int sh=99,eh=-1;
179 179
180 for(int i=0;i<this->numSelections();i++) { 180 for(int i=0;i<this->numSelections();i++) {
181 QTableSelection sel = this->selection( i ); 181 QTableSelection sel = this->selection( i );
182 sh = QMIN(sh,sel.topRow()); 182 sh = QMIN(sh,sel.topRow());
183 eh = QMAX(sh,sel.bottomRow()+1); 183 eh = QMAX(sh,sel.bottomRow()+1);
184 } 184 }
185 if (sh > 23 || eh < 1) { 185 if (sh > 23 || eh < 1) {
186 sh=8; 186 sh=8;
187 eh=9; 187 eh=9;
188 } 188 }
189 189
190 quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); 190 quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit");
191 quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); 191 quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0));
192 this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); 192 this->moveChild(quickLineEdit,0,sh*this->rowHeight(0));
193 quickLineEdit->setFocus(); 193 quickLineEdit->setFocus();
194 quickLineEdit->show(); 194 quickLineEdit->show();
195} 195}
196 196
197//=========================================================================== 197//===========================================================================
198 198
199DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) 199DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name)
200{ 200{
201 active=1; 201 active=1;
202 quickEvent.setStart(start); 202 quickEvent.setStart(start);
203 quickEvent.setEnd(end); 203 quickEvent.setEnd(end);
204 connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); 204 connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed()));
205} 205}
206 206
207void DateBookDayViewQuickLineEdit::slotReturnPressed() 207void DateBookDayViewQuickLineEdit::slotReturnPressed()
208{ 208{
209 if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. 209 if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times.
210 quickEvent.setDescription(this->text()); 210 quickEvent.setDescription(this->text());
211 connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); 211 connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&)));
212 emit(insertEvent(quickEvent)); 212 emit(insertEvent(quickEvent));
213 active=0; 213 active=0;
214 } 214 }
215 /* we need to return to this object.. */ 215 /* we need to return to this object.. */
216 QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget 216 QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget
217} 217}
218void DateBookDayViewQuickLineEdit::finallyCallClose() { 218void DateBookDayViewQuickLineEdit::finallyCallClose() {
219 close(true); // also deletes this widget... 219 close(true); // also deletes this widget...
220} 220}
221 221
222void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) 222void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */)
223{ 223{
224 slotReturnPressed(); // Reuse code to add event and close this widget. 224 slotReturnPressed(); // Reuse code to add event and close this widget.
225} 225}
226 226
227//=========================================================================== 227//===========================================================================
228 228
229DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) 229DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name )
230 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) 230 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 )
231{ 231{
232 widgetList.setAutoDelete( true ); 232 widgetList.setAutoDelete( true );
233 header = new DateBookDayHeader( startOnMonday, this, "day header" ); 233 header = new DateBookDayHeader( startOnMonday, this, "day header" );
234 header->setDate( currDate.year(), currDate.month(), currDate.day() ); 234 header->setDate( currDate.year(), currDate.month(), currDate.day() );
235 235
236 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); 236 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" );
237 m_allDays->hide(); 237 m_allDays->hide();
238 238
239 view = new DateBookDayView( ampm, this, "day view" ); 239 view = new DateBookDayView( ampm, this, "day view" );
240 240
241 connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); 241 connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) );
242 connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); 242 connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) );
243 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); 243 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) );
244 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 244 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
245 connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); 245 connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) );
246 246
247 QTimer *timer = new QTimer( this ); 247 QTimer *timer = new QTimer( this );
248 248
249 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors 249 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors
250 timer->start( 1000*60*5, FALSE ); //update every 5min 250 timer->start( 1000*60*5, FALSE ); //update every 5min
251 251
252 selectedWidget = 0; 252 selectedWidget = 0;
253 253
254 timeMarker = new DateBookDayTimeMarker( this ); 254 timeMarker = new DateBookDayTimeMarker( this );
255 timeMarker->setTime( QTime::currentTime() ); 255 timeMarker->setTime( QTime::currentTime() );
256 rowStyle = -1; // initialize with bogus values 256 rowStyle = -1; // initialize with bogus values
257 jumpToCurTime = false; 257 jumpToCurTime = false;
258} 258}
259 259
260void DateBookDay::setJumpToCurTime( bool bJump ) 260void DateBookDay::setJumpToCurTime( bool bJump )
261{ 261{
262 jumpToCurTime = bJump; 262 jumpToCurTime = bJump;
263} 263}
264 264
265void DateBookDay::setRowStyle( int style ) 265void DateBookDay::setRowStyle( int style )
266{ 266{
267 if (rowStyle != style) view->setRowStyle( style ); 267 if (rowStyle != style) view->setRowStyle( style );
268 rowStyle = style; 268 rowStyle = style;
269} 269}
270 270
271void DateBookDay::updateView( void ) 271void DateBookDay::updateView( void )
272{ 272{
273 timeMarker->setTime( QTime::currentTime() ); 273 timeMarker->setTime( QTime::currentTime() );
274 //need to find a way to update all DateBookDayWidgets 274 //need to find a way to update all DateBookDayWidgets
275} 275}
276 276
277void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) 277void DateBookDay::setSelectedWidget( DateBookDayWidget *w )
278{ 278{
279 selectedWidget = w; 279 selectedWidget = w;
280} 280}
281 281
282DateBookDayWidget * DateBookDay::getSelectedWidget( void ) 282DateBookDayWidget * DateBookDay::getSelectedWidget( void )
283{ 283{
284 return selectedWidget; 284 return selectedWidget;
285} 285}
286 286
287void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) 287void DateBookDay::selectedDates( QDateTime &start, QDateTime &end )
288{ 288{
289 start.setDate( currDate ); 289 start.setDate( currDate );
290 end.setDate( currDate ); 290 end.setDate( currDate );
291 291
292 int sh=99,eh=-1; 292 int sh=99,eh=-1;
293 293
294 int n = dayView()->numSelections(); 294 int n = dayView()->numSelections();
295 295
296 for (int i=0; i<n; i++) { 296 for (int i=0; i<n; i++) {
297 QTableSelection sel = dayView()->selection( i ); 297 QTableSelection sel = dayView()->selection( i );
298 sh = QMIN(sh,sel.topRow()); 298 sh = QMIN(sh,sel.topRow());
299 eh = QMAX(sh,sel.bottomRow()+1); 299 eh = QMAX(sh,sel.bottomRow()+1);
300 } 300 }
301 301
302 if (sh > 23 || eh < 1) { 302 if (sh > 23 || eh < 1) {
303 sh=8; 303 sh=8;
304 eh=9; 304 eh=9;
305 } 305 }
306 306
307 start.setTime( QTime( sh, 0, 0 ) ); 307 start.setTime( QTime( sh, 0, 0 ) );
308 end.setTime( QTime( eh, 0, 0 ) ); 308 end.setTime( QTime( eh, 0, 0 ) );
309} 309}
310 310
311void DateBookDay::setDate( int y, int m, int d ) 311void DateBookDay::setDate( int y, int m, int d )
312{ 312{
313 header->setDate( y, m, d ); 313 header->setDate( y, m, d );
314 selectedWidget = 0; 314 selectedWidget = 0;
315} 315}
316 316
317void DateBookDay::setDate( QDate d) 317void DateBookDay::setDate( QDate d)
318{ 318{
319 header->setDate( d.year(), d.month(), d.day() ); 319 header->setDate( d.year(), d.month(), d.day() );
320 selectedWidget = 0; 320 selectedWidget = 0;
321} 321}
322 322
323void DateBookDay::dateChanged( int y, int m, int d ) 323void DateBookDay::dateChanged( int y, int m, int d )
324{ 324{
325 QDate date( y, m, d ); 325 QDate date( y, m, d );
326 if ( currDate == date ) 326 if ( currDate == date )
327 return; 327 return;
328 currDate.setYMD( y, m, d ); 328 currDate.setYMD( y, m, d );
329 relayoutPage(); 329 relayoutPage();
330 dayView()->clearSelection(); 330 dayView()->clearSelection();
331 QTableSelection ts; 331 QTableSelection ts;
332 332
333 if (jumpToCurTime && this->date() == QDate::currentDate()) 333 if (jumpToCurTime && this->date() == QDate::currentDate())
334 { 334 {
335 ts.init( QTime::currentTime().hour(), 0); 335 ts.init( QTime::currentTime().hour(), 0);
336 ts.expandTo( QTime::currentTime().hour(), 0); 336 ts.expandTo( QTime::currentTime().hour(), 0);
337 } else { 337 } else {
338 ts.init( startTime, 0 ); 338 ts.init( startTime, 0 );
339 ts.expandTo( startTime, 0 ); 339 ts.expandTo( startTime, 0 );
340 } 340 }
341 341
342 dayView()->addSelection( ts ); 342 dayView()->addSelection( ts );
343 selectedWidget = 0; 343 selectedWidget = 0;
344} 344}
345 345
346void DateBookDay::redraw() 346void DateBookDay::redraw()
347{ 347{
348 if ( isUpdatesEnabled() ) 348 if ( isUpdatesEnabled() )
349 relayoutPage(); 349 relayoutPage();
350} 350}
351 351
352void DateBookDay::getEvents() 352void DateBookDay::getEvents()
353{ 353{
354 widgetList.clear(); 354 widgetList.clear();
355 355
356 /* clear the AllDay List */ 356 /* clear the AllDay List */
357 m_allDays->hide(); // just in case 357 m_allDays->hide(); // just in case
358 m_allDays->removeAllEvents(); 358 m_allDays->removeAllEvents();
359 359
360 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); 360 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
361 QValueListIterator<EffectiveEvent> it; 361 QValueListIterator<EffectiveEvent> it;
362 QObject* object = 0; 362 QObject* object = 0;
363 for ( it = eventList.begin(); it != eventList.end(); ++it ) { 363 for ( it = eventList.begin(); it != eventList.end(); ++it ) {
364 EffectiveEvent ev=*it; 364 EffectiveEvent ev=*it;
365 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day. 365 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day.
366 if (ev.event().type() == Event::AllDay ) { 366 if (ev.event().type() == Event::AllDay ) {
367 object = m_allDays->addEvent( ev ); 367 object = m_allDays->addEvent( ev );
368 if (!object) 368 if (!object)
369 continue; 369 continue;
370 }else { 370 }else {
371 DateBookDayWidget* w = new DateBookDayWidget( *it, this ); 371 DateBookDayWidget* w = new DateBookDayWidget( *it, this );
372 widgetList.append( w ); 372 widgetList.append( w );
373 object = w; 373 object = w;
374 } 374 }
375 375
376 connect( object, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) ); 376 connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) );
377 connect( object, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) ); 377 connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) );
378 connect( object, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) ); 378 connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) );
379 connect( object, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) ); 379 connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) );
380 380
381 } 381 }
382 } 382 }
383} 383}
384 384
385static int place( const DateBookDayWidget *item, bool *used, int maxn ) 385static int place( const DateBookDayWidget *item, bool *used, int maxn )
386{ 386{
387 int place = 0; 387 int place = 0;
388 int start = item->event().start().hour(); 388 int start = item->event().start().hour();
389 QTime e = item->event().end(); 389 QTime e = item->event().end();
390 int end = e.hour(); 390 int end = e.hour();
391 if ( e.minute() < 5 ) 391 if ( e.minute() < 5 )
392 end--; 392 end--;
393 if ( end < start ) 393 if ( end < start )
394 end = start; 394 end = start;
395 while ( place < maxn ) { 395 while ( place < maxn ) {
396 bool free = TRUE; 396 bool free = TRUE;
397 int s = start; 397 int s = start;
398 while( s <= end ) { 398 while( s <= end ) {
399 if ( used[10*s+place] ) { 399 if ( used[10*s+place] ) {
400 free = FALSE; 400 free = FALSE;
401 break; 401 break;
402 } 402 }
403 s++; 403 s++;
404 } 404 }
405 if ( free ) 405 if ( free )
406 break; 406 break;
407 place++; 407 place++;
408 } 408 }
409 if ( place == maxn ) { 409 if ( place == maxn ) {
410 return -1; 410 return -1;
411 } 411 }
412 while( start <= end ) { 412 while( start <= end ) {
413 used[10*start+place] = TRUE; 413 used[10*start+place] = TRUE;
414 start++; 414 start++;
415 } 415 }
416 return place; 416 return place;
417} 417}
418 418
419 419
420void DateBookDay::relayoutPage( bool fromResize ) 420void DateBookDay::relayoutPage( bool fromResize )
421{ 421{
422 setUpdatesEnabled( FALSE ); 422 setUpdatesEnabled( FALSE );
423 if ( !fromResize ) { 423 if ( !fromResize ) {
424 getEvents(); // no need we already have them! 424 getEvents(); // no need we already have them!
425 425
426 if (m_allDays->items() > 0 ) 426 if (m_allDays->items() > 0 )
427 m_allDays->show(); 427 m_allDays->show();
428 /* 428 /*
429 * else if ( m_allDays->items() == 0 ) already hide in getEvents 429 * else if ( m_allDays->items() == 0 ) already hide in getEvents
430 */ 430 */
431 } 431 }
432 432
433 widgetList.sort(); 433 widgetList.sort();
434 //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning 434 //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning
435 //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view 435 //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view
436 436
437 int wCount = widgetList.count(); 437 int wCount = widgetList.count();
438 int wid = view->columnWidth(0)-1; 438 int wid = view->columnWidth(0)-1;
439 int wd; 439 int wd;
440 int n = 1; 440 int n = 1;
441 441
442 QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget 442 QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget
443 443
444 for (int i = 0; i<wCount; anzIntersect[i] = 1, i++); 444 for (int i = 0; i<wCount; anzIntersect[i] = 1, i++);
445 445
446 if ( wCount < 20 ) { 446 if ( wCount < 20 ) {
447 447
448 QArray<QRect> geometries(wCount); 448 QArray<QRect> geometries(wCount);
449 for (int i = 0; i < wCount; geometries[i] = widgetList.at(i)->geometry(), i++);//stores geometry for each widget in vector 449 for (int i = 0; i < wCount; geometries[i] = widgetList.at(i)->geometry(), i++);//stores geometry for each widget in vector
450 450
451 for ( int i = 0; i < wCount; i++) { 451 for ( int i = 0; i < wCount; i++) {
452 QValueList<int> intersectedWidgets; 452 QValueList<int> intersectedWidgets;
453 453
454 //find all widgets intersecting with widgetList.at(i) 454 //find all widgets intersecting with widgetList.at(i)
455 for ( int j = 0; j < wCount; j++) { 455 for ( int j = 0; j < wCount; j++) {
456 if (i != j) 456 if (i != j)
457 if (geometries[j].intersects(geometries[i])) 457 if (geometries[j].intersects(geometries[i]))
458 intersectedWidgets.append(j); 458 intersectedWidgets.append(j);
459 } 459 }
460 460
461 //for each of these intersecting widgets find out how many widgets are they intersecting with 461 //for each of these intersecting widgets find out how many widgets are they intersecting with
462 for ( uint j = 0; j < intersectedWidgets.count(); j++) 462 for ( uint j = 0; j < intersectedWidgets.count(); j++)
463 { 463 {
464 QArray<int> inter(wCount); 464 QArray<int> inter(wCount);
465 inter[j]=1; 465 inter[j]=1;
466 466
467 if (intersectedWidgets[j] != -1) 467 if (intersectedWidgets[j] != -1)
468 for ( uint k = j; k < intersectedWidgets.count(); k++) { 468 for ( uint k = j; k < intersectedWidgets.count(); k++) {
469 if (j != k && intersectedWidgets[k] != -1) 469 if (j != k && intersectedWidgets[k] != -1)
470 if (geometries[intersectedWidgets[k]].intersects(geometries[intersectedWidgets[j]])) { 470 if (geometries[intersectedWidgets[k]].intersects(geometries[intersectedWidgets[j]])) {
471 inter[j]++; 471 inter[j]++;
472 intersectedWidgets[k] = -1; 472 intersectedWidgets[k] = -1;
473 } 473 }
474 if (inter[j] > anzIntersect[i]) anzIntersect[i] = inter[j] + 1; 474 if (inter[j] > anzIntersect[i]) anzIntersect[i] = inter[j] + 1;
475 } 475 }