Хранилища Subversion OpenInventory

Редакция

Редакция 138 | Редакция 169 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 138 Редакция 158
Строка 323... Строка 323...
323
           painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
323
           painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
324
           painter->drawLine(option.rect.topRight(), option.rect.bottomRight());
324
           painter->drawLine(option.rect.topRight(), option.rect.bottomRight());
325
           painter->setPen(pen);
325
           painter->setPen(pen);
326
   */
326
   */
327
   }
327
   }
-
 
328
-
 
329
-
 
330
-
 
331
-
 
332
   void TimeEditDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
-
 
333
                            const QModelIndex &index) const
-
 
334
   {
-
 
335
       int datetime = index.model()->data(index, Qt::DisplayRole).toInt();
-
 
336
-
 
337
       QString indexvalue = "";
-
 
338
-
 
339
       if (datetime > 0)
-
 
340
       {
-
 
341
           QDateTime dateTime2 = QDateTime();
-
 
342
           dateTime2.setTime_t(datetime);
-
 
343
           indexvalue = dateTime2.toString(this->timeformat);
-
 
344
       }
-
 
345
       else
-
 
346
       {
-
 
347
           indexvalue = tr("Date not set");
-
 
348
       }
-
 
349
-
 
350
       Q_ASSERT(index.isValid());
-
 
351
-
 
352
       QStyleOptionViewItemV3 opt = setOptions(index, option);
-
 
353
-
 
354
       const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&option);
-
 
355
       opt.features = v2 ? v2->features
-
 
356
                       : QStyleOptionViewItemV2::ViewItemFeatures(QStyleOptionViewItemV2::None);
-
 
357
       const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3 *>(&option);
-
 
358
       opt.locale = v3 ? v3->locale : QLocale();
-
 
359
       opt.widget = v3 ? v3->widget : 0;
-
 
360
-
 
361
       // prepare
-
 
362
       painter->save();
-
 
363
-
 
364
       painter->setClipRect(opt.rect);
-
 
365
-
 
366
       // get the data and the rectangles
-
 
367
       QVariant value;
-
 
368
-
 
369
       QPixmap pixmap;
-
 
370
       QRect decorationRect;
-
 
371
       value = index.data(Qt::DecorationRole);
-
 
372
-
 
373
       QString text;
-
 
374
       QRect displayRect;
-
 
375
       value = index.data(Qt::DisplayRole);
-
 
376
       if (value.isValid()) {
-
 
377
           text = indexvalue;
-
 
378
           displayRect = textRectangle(painter, option.rect, opt.font, text);
-
 
379
       }
-
 
380
-
 
381
       QRect checkRect;
-
 
382
       Qt::CheckState checkState = Qt::Unchecked;
-
 
383
       value = index.data(Qt::CheckStateRole);
-
 
384
       if (value.isValid()) {
-
 
385
           checkState = static_cast<Qt::CheckState>(value.toInt());
-
 
386
           checkRect = check(opt, opt.rect, value);
-
 
387
       }
-
 
388
-
 
389
       // do the layout
-
 
390
       doLayout(opt, &checkRect, &decorationRect, &displayRect, false);
-
 
391
       // draw the item
-
 
392
-
 
393
       drawBackground(painter, opt, index);
-
 
394
       drawCheck(painter, opt, checkRect, checkState);
-
 
395
       drawDecoration(painter, opt, decorationRect, pixmap);
-
 
396
       drawDisplay(painter, opt, displayRect, text);
-
 
397
       drawFocus(painter, opt, displayRect);
-
 
398
-
 
399
       // done
-
 
400
       painter->restore();
-
 
401
   }