Хранилища Subversion OpenInventory

Редакция

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

Редакция 134 Редакция 161
Строка 270... Строка 270...
270
               const QModelIndex& /* index */) const {
270
               const QModelIndex& /* index */) const {
271
       editor->setGeometry(option.rect);
271
       editor->setGeometry(option.rect);
272
   }
272
   }
273
273
274
274
-
 
275
-
 
276
   CPictureDelegate::CPictureDelegate( QObject * parent ) : QItemDelegate(parent)
-
 
277
   {
-
 
278
   }
-
 
279
-
 
280
   void CPictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
-
 
281
   {
-
 
282
           m_pxPicture.fill( QColor(Qt::white) );
-
 
283
-
 
284
           const QAbstractItemModel * model = index.model();
-
 
285
           QString sFileName = model->data( index, Qt::DisplayRole ).toString();
-
 
286
-
 
287
           QVariant currentImage = model->data(index,0);
-
 
288
-
 
289
-
 
290
           QByteArray bytes = currentImage.toByteArray();
-
 
291
     //       QImage image;
-
 
292
     //       image.loadFromData(bytes);
-
 
293
-
 
294
-
 
295
           if (currentImage.isValid()) {
-
 
296
                m_pxPicture.loadFromData(bytes);
-
 
297
           }
-
 
298
           else {
-
 
299
               //QItemDelegate::paint(painter, option, index);
-
 
300
           return;
-
 
301
           }
-
 
302
-
 
303
-
 
304
           /*
-
 
305

-
 
306
           if ( !sFileName.isEmpty() )
-
 
307
                   m_pxPicture.load( sFileName );
-
 
308
           else {
-
 
309
               //QItemDelegate::paint(painter, option, index);
-
 
310
           return;
-
 
311
           }
-
 
312
*/
-
 
313
-
 
314
-
 
315
           QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ?
-
 
316
                                                             ((option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive ) :
-
 
317
                                                             QPalette::Disabled;
-
 
318
-
 
319
            if (option.state & QStyle::State_Selected)
-
 
320
                    painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight));
-
 
321
-
 
322
           int nX = option.rect.x() + ( ( option.rect.width() - m_pxPicture.rect().width() ) / 2 );
-
 
323
           int nY = option.rect.y() + ( ( option.rect.height() - m_pxPicture.rect().height() ) / 2 );
-
 
324
           painter->drawPixmap( nX, nY, m_pxPicture );
-
 
325
-
 
326
-
 
327
       ////    drawFocus(painter, option, option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves
-
 
328
-
 
329
           /*
-
 
330
           QPen pen = painter->pen();
-
 
331
           painter->setPen(option.palette.color(QPalette::Mid));
-
 
332
           painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
-
 
333
           painter->drawLine(option.rect.topRight(), option.rect.bottomRight());
-
 
334
           painter->setPen(pen);
-
 
335
   */
-
 
336
   }
-
 
337
-
 
338