summaryrefslogtreecommitdiffabout
path: root/microkde/kdatetbl.cpp
Unidiff
Diffstat (limited to 'microkde/kdatetbl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 146291b..508ce31 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -155,396 +155,399 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
155 if(pos<firstday || (firstday+numdays<=pos)) 155 if(pos<firstday || (firstday+numdays<=pos))
156 { // we are either 156 { // we are either
157 // ° painting a day of the previous month or 157 // ° painting a day of the previous month or
158 // ° painting a day of the following month 158 // ° painting a day of the following month
159 if(pos<firstday) 159 if(pos<firstday)
160 { // previous month 160 { // previous month
161 text.setNum(numDaysPrevMonth+pos-firstday+1); 161 text.setNum(numDaysPrevMonth+pos-firstday+1);
162 } else { // following month 162 } else { // following month
163 text.setNum(pos-firstday-numdays+1); 163 text.setNum(pos-firstday-numdays+1);
164 } 164 }
165 painter->setPen(gray); 165 painter->setPen(gray);
166 } else { // paint a day of the current month 166 } else { // paint a day of the current month
167 text.setNum(pos-firstday+1); 167 text.setNum(pos-firstday+1);
168 painter->setPen(black); 168 painter->setPen(black);
169 } 169 }
170 170
171 pen=painter->pen(); 171 pen=painter->pen();
172 if(firstday+date.day()-1==pos) 172 if(firstday+date.day()-1==pos)
173 { 173 {
174 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) 174 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
175 painter->setPen(green); 175 painter->setPen(green);
176 else 176 else
177 painter->setPen(red); 177 painter->setPen(red);
178 if(hasFocus()) 178 if(hasFocus())
179 { 179 {
180 painter->setBrush(darkRed); 180 painter->setBrush(darkRed);
181 pen=white; 181 pen=white;
182 } else { 182 } else {
183 painter->setBrush(darkGray); 183 painter->setBrush(darkGray);
184 pen=white; 184 pen=white;
185 } 185 }
186 } else { 186 } else {
187 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) 187 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
188 { 188 {
189 painter->setPen(green); 189 painter->setPen(green);
190 painter->setBrush(darkGreen); 190 painter->setBrush(darkGreen);
191 pen=white; 191 pen=white;
192 } else { 192 } else {
193 painter->setBrush(QColor(220,245,255)); 193 painter->setBrush(QColor(220,245,255));
194 painter->setPen(QColor(220,245,255)); 194 painter->setPen(QColor(220,245,255));
195 } 195 }
196 } 196 }
197 painter->drawRect(0, 0, w, h); 197 painter->drawRect(0, 0, w, h);
198 painter->setPen(pen); 198 painter->setPen(pen);
199 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); 199 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect);
200 } 200 }
201 if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); 201 if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
202 if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height()); 202 if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height());
203} 203}
204 204
205void 205void
206KDateTable::keyPressEvent( QKeyEvent *e ) 206KDateTable::keyPressEvent( QKeyEvent *e )
207{ 207{
208 /* 208 /*
209 // not working properly 209 // not working properly
210 if ( e->key() == Qt::Key_Prior ) { 210 if ( e->key() == Qt::Key_Prior ) {
211 if ( date.month() == 1 ) { 211 if ( date.month() == 1 ) {
212 KNotifyClient::beep(); 212 KNotifyClient::beep();
213 return; 213 return;
214 } 214 }
215 int day = date.day(); 215 int day = date.day();
216 if ( day > 27 ) 216 if ( day > 27 )
217 while ( !QDate::isValid( date.year(), date.month()-1, day ) ) 217 while ( !QDate::isValid( date.year(), date.month()-1, day ) )
218 day--; 218 day--;
219 setDate(QDate(date.year(), date.month()-1, day)); 219 setDate(QDate(date.year(), date.month()-1, day));
220 return; 220 return;
221 } 221 }
222 if ( e->key() == Qt::Key_Next ) { 222 if ( e->key() == Qt::Key_Next ) {
223 if ( date.month() == 12 ) { 223 if ( date.month() == 12 ) {
224 KNotifyClient::beep(); 224 KNotifyClient::beep();
225 return; 225 return;
226 } 226 }
227 int day = date.day(); 227 int day = date.day();
228 if ( day > 27 ) 228 if ( day > 27 )
229 while ( !QDate::isValid( date.year(), date.month()+1, day ) ) 229 while ( !QDate::isValid( date.year(), date.month()+1, day ) )
230 day--; 230 day--;
231 setDate(QDate(date.year(), date.month()+1, day)); 231 setDate(QDate(date.year(), date.month()+1, day));
232 return; 232 return;
233 } 233 }
234 */ 234 */
235 int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; 235 int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0;
236 236
237 int temp=firstday+date.day()-dayoff; 237 int temp=firstday+date.day()-dayoff;
238 int pos = temp; 238 int pos = temp;
239 bool irgnore = true; 239 bool irgnore = true;
240 if ( e->state() != Qt::ControlButton ) { 240 if ( e->state() != Qt::ControlButton ) {
241 if ( e->key() == Qt::Key_Up ) { 241 if ( e->key() == Qt::Key_Up ) {
242 pos -= 7; 242 pos -= 7;
243 irgnore = false; 243 irgnore = false;
244 } 244 }
245 if ( e->key() == Qt::Key_Down ) { 245 if ( e->key() == Qt::Key_Down ) {
246 pos += 7; 246 pos += 7;
247 irgnore = false; 247 irgnore = false;
248 } 248 }
249 if ( e->key() == Qt::Key_Left ) { 249 if ( e->key() == Qt::Key_Left ) {
250 pos--; 250 pos--;
251 irgnore = false; 251 irgnore = false;
252 } 252 }
253 if ( e->key() == Qt::Key_Right ) { 253 if ( e->key() == Qt::Key_Right ) {
254 pos++; 254 pos++;
255 irgnore = false; 255 irgnore = false;
256 } 256 }
257 } 257 }
258 if ( irgnore ) 258 if ( irgnore )
259 e->ignore(); 259 e->ignore();
260 260
261 if(pos+dayoff<=firstday) 261 if(pos+dayoff<=firstday)
262 { // this day is in the previous month 262 { // this day is in the previous month
263 KNotifyClient::beep(); 263 KNotifyClient::beep();
264 return; 264 return;
265 } 265 }
266 if(firstday+numdays<pos+dayoff) 266 if(firstday+numdays<pos+dayoff)
267 { // this date is in the next month 267 { // this date is in the next month
268 KNotifyClient::beep(i18n( "Month not long enough" )); 268 KNotifyClient::beep(i18n( "Month not long enough" ));
269 return; 269 return;
270 } 270 }
271 271
272 if ( pos == temp ) 272 if ( pos == temp )
273 return; 273 return;
274 274
275 setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); 275 setDate(QDate(date.year(), date.month(), pos-firstday+dayoff));
276 updateCell(temp/7+1, temp%7); // Update the previously selected cell 276 updateCell(temp/7+1, temp%7); // Update the previously selected cell
277 updateCell(pos/7+1, pos%7); // Update the selected cell 277 updateCell(pos/7+1, pos%7); // Update the selected cell
278 assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); 278 assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid());
279 279
280 280
281} 281}
282 282
283void 283void
284KDateTable::viewportResizeEvent(QResizeEvent * e) 284KDateTable::viewportResizeEvent(QResizeEvent * e)
285{ 285{
286 QGridView::viewportResizeEvent(e); 286 QGridView::viewportResizeEvent(e);
287 287
288 setCellWidth(viewport()->width()/7); 288 setCellWidth(viewport()->width()/7);
289 setCellHeight(viewport()->height()/7); 289 setCellHeight(viewport()->height()/7);
290} 290}
291 291
292void 292void
293KDateTable::setFontSize(int size) 293KDateTable::setFontSize(int size)
294{ 294{
295 int count; 295 int count;
296 QRect rect; 296 QRect rect;
297 // ----- store rectangles: 297 // ----- store rectangles:
298 fontsize=size; 298 fontsize=size;
299 QFont font = KGlobalSettings::generalFont(); 299 QFont font = KGlobalSettings::generalFont();
300 font.setPointSize(fontsize); 300 font.setPointSize(fontsize);
301 font.setBold( true ); 301 font.setBold( true );
302 QFontMetrics metrics(font); 302 QFontMetrics metrics(font);
303 303
304 // ----- find largest day name: 304 // ----- find largest day name:
305 maxCell.setWidth(0); 305 maxCell.setWidth(0);
306 maxCell.setHeight(0); 306 maxCell.setHeight(0);
307 for(count=0; count<7; ++count) 307 for(count=0; count<7; ++count)
308 { 308 {
309 rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); 309 rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true));
310 maxCell.setWidth(QMAX(maxCell.width(), rect.width())); 310 maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
311 maxCell.setHeight(QMAX(maxCell.height(), rect.height())); 311 maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
312 } 312 }
313 // ----- compare with a real wide number and add some space: 313 // ----- compare with a real wide number and add some space:
314 rect=metrics.boundingRect(QString::fromLatin1("88")); 314 rect=metrics.boundingRect(QString::fromLatin1("88"));
315 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); 315 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width()));
316 maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); 316 maxCell.setHeight(QMAX(maxCell.height()+4, rect.height()));
317 if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) 317 if ( maxCell.width() * 1000 / maxCell.height() > 1900 )
318 maxCell.setHeight(maxCell.width() * 1000 / 1900 ); 318 maxCell.setHeight(maxCell.width() * 1000 / 1900 );
319} 319}
320 320
321void 321void
322KDateTable::contentsMousePressEvent(QMouseEvent *e) 322KDateTable::contentsMousePressEvent(QMouseEvent *e)
323{ 323{
324 if(e->type()!=QEvent::MouseButtonPress) 324 if(e->type()!=QEvent::MouseButtonPress)
325 { // the KDatePicker only reacts on mouse press events: 325 { // the KDatePicker only reacts on mouse press events:
326 return; 326 return;
327 } 327 }
328 if(!isEnabled()) 328 if(!isEnabled())
329 { 329 {
330 KNotifyClient::beep(); 330 KNotifyClient::beep();
331 return; 331 return;
332 } 332 }
333 333
334 int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; 334 int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0;
335 // ----- 335 // -----
336 int row, col, pos, temp; 336 int row, col, pos, temp;
337 QPoint mouseCoord; 337 QPoint mouseCoord;
338 // ----- 338 // -----
339 mouseCoord = e->pos(); 339 mouseCoord = e->pos();
340 row=rowAt(mouseCoord.y()); 340 row=rowAt(mouseCoord.y());
341 col=columnAt(mouseCoord.x()); 341 col=columnAt(mouseCoord.x());
342 if(row<0 || col<0) 342 if(row<0 || col<0)
343 { // the user clicked on the frame of the table 343 { // the user clicked on the frame of the table
344 return; 344 return;
345 } 345 }
346 pos=7*(row-1)+col+1; 346 pos=7*(row-1)+col+1;
347#if 0
347 if(pos+dayoff<=firstday) 348 if(pos+dayoff<=firstday)
348 { // this day is in the previous month 349 { // this day is in the previous month
349 KNotifyClient::beep(); 350 KNotifyClient::beep();
350 return; 351 return;
351 } 352 }
352 if(firstday+numdays<pos+dayoff) 353 if(firstday+numdays<pos+dayoff)
353 { // this date is in the next month 354 { // this date is in the next month
354 KNotifyClient::beep(); 355 KNotifyClient::beep();
355 return; 356 return;
356 } 357 }
358#endif
357 temp=firstday+date.day()-dayoff-1; 359 temp=firstday+date.day()-dayoff-1;
358 setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); 360 QDate da = QDate(date.year(), date.month(),1);
361 setDate(da.addDays( pos-firstday+dayoff-1));
359 updateCell(temp/7+1, temp%7); // Update the previously selected cell 362 updateCell(temp/7+1, temp%7); // Update the previously selected cell
360 updateCell(row, col); // Update the selected cell 363 updateCell(row, col); // Update the selected cell
361 // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); 364 // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid());
362 emit(tableClicked()); 365 emit(tableClicked());
363} 366}
364 367
365bool 368bool
366KDateTable::setDate(const QDate& date_) 369KDateTable::setDate(const QDate& date_)
367{ 370{
368 bool changed=false; 371 bool changed=false;
369 QDate temp; 372 QDate temp;
370 mMarkCurrent = false; 373 mMarkCurrent = false;
371 // ----- 374 // -----
372 if(!date_.isValid()) 375 if(!date_.isValid())
373 { 376 {
374 kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; 377 kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl;
375 return false; 378 return false;
376 } 379 }
377 if(date!=date_) 380 if(date!=date_)
378 { 381 {
379 date=date_; 382 date=date_;
380 changed=true; 383 changed=true;
381 } 384 }
382 mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() ); 385 mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() );
383 temp.setYMD(date.year(), date.month(), 1); 386 temp.setYMD(date.year(), date.month(), 1);
384 firstday=temp.dayOfWeek(); 387 firstday=temp.dayOfWeek();
385 if(firstday==1) firstday=8; 388 if(firstday==1) firstday=8;
386 numdays=date.daysInMonth(); 389 numdays=date.daysInMonth();
387 if(date.month()==1) 390 if(date.month()==1)
388 { // set to december of previous year 391 { // set to december of previous year
389 temp.setYMD(date.year()-1, 12, 1); 392 temp.setYMD(date.year()-1, 12, 1);
390 } else { // set to previous month 393 } else { // set to previous month
391 temp.setYMD(date.year(), date.month()-1, 1); 394 temp.setYMD(date.year(), date.month()-1, 1);
392 } 395 }
393 numDaysPrevMonth=temp.daysInMonth(); 396 numDaysPrevMonth=temp.daysInMonth();
394 if(changed) 397 if(changed)
395 { 398 {
396 repaintContents(false); 399 repaintContents(false);
397 } 400 }
398 emit(dateChanged(date)); 401 emit(dateChanged(date));
399 return true; 402 return true;
400} 403}
401 404
402const QDate& 405const QDate&
403KDateTable::getDate() const 406KDateTable::getDate() const
404{ 407{
405 return date; 408 return date;
406} 409}
407 410
408void KDateTable::focusInEvent( QFocusEvent *e ) 411void KDateTable::focusInEvent( QFocusEvent *e )
409{ 412{
410 repaintContents(false); 413 repaintContents(false);
411 QGridView::focusInEvent( e ); 414 QGridView::focusInEvent( e );
412} 415}
413 416
414void KDateTable::focusOutEvent( QFocusEvent *e ) 417void KDateTable::focusOutEvent( QFocusEvent *e )
415{ 418{
416 repaintContents(false); 419 repaintContents(false);
417 QGridView::focusOutEvent( e ); 420 QGridView::focusOutEvent( e );
418} 421}
419 422
420QSize 423QSize
421KDateTable::sizeHint() const 424KDateTable::sizeHint() const
422{ 425{
423 if(maxCell.height()>0 && maxCell.width()>0) 426 if(maxCell.height()>0 && maxCell.width()>0)
424 { 427 {
425 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), 428 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
426 (maxCell.height()+4)*numRows()+2*frameWidth()); 429 (maxCell.height()+4)*numRows()+2*frameWidth());
427 } else { 430 } else {
428 return QSize(-1, -1); 431 return QSize(-1, -1);
429 } 432 }
430} 433}
431 434
432KDateInternalMonthPicker::KDateInternalMonthPicker 435KDateInternalMonthPicker::KDateInternalMonthPicker
433(int fontsize, QWidget* parent, const char* name) 436(int fontsize, QWidget* parent, const char* name)
434 : QGridView(parent, name), 437 : QGridView(parent, name),
435 result(0) // invalid 438 result(0) // invalid
436{ 439{
437 QRect rect; 440 QRect rect;
438 QFont font; 441 QFont font;
439 // ----- 442 // -----
440 activeCol = -1; 443 activeCol = -1;
441 activeRow = -1; 444 activeRow = -1;
442 font=KGlobalSettings::generalFont(); 445 font=KGlobalSettings::generalFont();
443 font.setPointSize(fontsize); 446 font.setPointSize(fontsize);
444 setFont(font); 447 setFont(font);
445 setHScrollBarMode(AlwaysOff); 448 setHScrollBarMode(AlwaysOff);
446 setVScrollBarMode(AlwaysOff); 449 setVScrollBarMode(AlwaysOff);
447 setFrameStyle(QFrame::NoFrame); 450 setFrameStyle(QFrame::NoFrame);
448 setNumRows(4); 451 setNumRows(4);
449 setNumCols(3); 452 setNumCols(3);
450 // enable to find drawing failures: 453 // enable to find drawing failures:
451 // setTableFlags(Tbl_clipCellPainting); 454 // setTableFlags(Tbl_clipCellPainting);
452#if 0 455#if 0
453 viewport()->setEraseColor(lightGray); // for consistency with the datepicker 456 viewport()->setEraseColor(lightGray); // for consistency with the datepicker
454#endif 457#endif
455 // ----- find the preferred size 458 // ----- find the preferred size
456 // (this is slow, possibly, but unfortunatly it is needed here): 459 // (this is slow, possibly, but unfortunatly it is needed here):
457 QFontMetrics metrics(font); 460 QFontMetrics metrics(font);
458 for(int i=1; i <= 12; ++i) 461 for(int i=1; i <= 12; ++i)
459 { 462 {
460 rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); 463 rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false));
461 if(max.width()<rect.width()) max.setWidth(rect.width()); 464 if(max.width()<rect.width()) max.setWidth(rect.width());
462 if(max.height()<rect.height()) max.setHeight(rect.height()); 465 if(max.height()<rect.height()) max.setHeight(rect.height());
463 } 466 }
464 467
465} 468}
466 469
467QSize 470QSize
468KDateInternalMonthPicker::sizeHint() const 471KDateInternalMonthPicker::sizeHint() const
469{ 472{
470 return QSize((max.width()+6)*numCols()+2*frameWidth(), 473 return QSize((max.width()+6)*numCols()+2*frameWidth(),
471 (max.height()+6)*numRows()+2*frameWidth()); 474 (max.height()+6)*numRows()+2*frameWidth());
472} 475}
473 476
474int 477int
475KDateInternalMonthPicker::getResult() const 478KDateInternalMonthPicker::getResult() const
476{ 479{
477 return result; 480 return result;
478} 481}
479 482
480void 483void
481KDateInternalMonthPicker::setupPainter(QPainter *p) 484KDateInternalMonthPicker::setupPainter(QPainter *p)
482{ 485{
483 p->setPen(black); 486 p->setPen(black);
484} 487}
485 488
486void 489void
487KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) 490KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
488{ 491{
489 setCellWidth(width()/3); 492 setCellWidth(width()/3);
490 setCellHeight(height()/4); 493 setCellHeight(height()/4);
491} 494}
492 495
493void 496void
494KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) 497KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
495{ 498{
496 int index; 499 int index;
497 QString text; 500 QString text;
498 // ----- find the number of the cell: 501 // ----- find the number of the cell:
499 index=3*row+col+1; 502 index=3*row+col+1;
500 text=KGlobal::locale()->monthName(index, false); 503 text=KGlobal::locale()->monthName(index, false);
501 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); 504 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
502 if ( activeCol == col && activeRow == row ) 505 if ( activeCol == col && activeRow == row )
503 painter->drawRect( 0, 0, cellWidth(), cellHeight() ); 506 painter->drawRect( 0, 0, cellWidth(), cellHeight() );
504} 507}
505 508
506void 509void
507KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) 510KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e)
508{ 511{
509 if(!isEnabled() || e->button() != LeftButton) 512 if(!isEnabled() || e->button() != LeftButton)
510 { 513 {
511 KNotifyClient::beep(); 514 KNotifyClient::beep();
512 return; 515 return;
513 } 516 }
514 // ----- 517 // -----
515 int row, col; 518 int row, col;
516 QPoint mouseCoord; 519 QPoint mouseCoord;
517 // ----- 520 // -----
518 mouseCoord = e->pos(); 521 mouseCoord = e->pos();
519 row=rowAt(mouseCoord.y()); 522 row=rowAt(mouseCoord.y());
520 col=columnAt(mouseCoord.x()); 523 col=columnAt(mouseCoord.x());
521 524
522 if(row<0 || col<0) 525 if(row<0 || col<0)
523 { // the user clicked on the frame of the table 526 { // the user clicked on the frame of the table
524 activeCol = -1; 527 activeCol = -1;
525 activeRow = -1; 528 activeRow = -1;
526 } else { 529 } else {
527 activeCol = col; 530 activeCol = col;
528 activeRow = row; 531 activeRow = row;
529 updateCell( row, col /*, false */ ); 532 updateCell( row, col /*, false */ );
530 } 533 }
531} 534}
532 535
533void 536void
534KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) 537KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e)
535{ 538{
536 if (e->state() & LeftButton) 539 if (e->state() & LeftButton)
537 { 540 {
538 int row, col; 541 int row, col;
539 QPoint mouseCoord; 542 QPoint mouseCoord;
540 // ----- 543 // -----
541 mouseCoord = e->pos(); 544 mouseCoord = e->pos();
542 row=rowAt(mouseCoord.y()); 545 row=rowAt(mouseCoord.y());
543 col=columnAt(mouseCoord.x()); 546 col=columnAt(mouseCoord.x());
544 int tmpRow = -1, tmpCol = -1; 547 int tmpRow = -1, tmpCol = -1;
545 if(row<0 || col<0) 548 if(row<0 || col<0)
546 { // the user clicked on the frame of the table 549 { // the user clicked on the frame of the table
547 if ( activeCol > -1 ) 550 if ( activeCol > -1 )
548 { 551 {
549 tmpRow = activeRow; 552 tmpRow = activeRow;
550 tmpCol = activeCol; 553 tmpCol = activeCol;