FACT++  1.0
void CheckBoxDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

Definition at line 13 of file CheckBoxDelegate.cc.

References reverse().

14 {
15  //--- QColumnViewDelegate
16  const bool reverse = (option.direction == Qt::RightToLeft);
17  const int width = (option.rect.height() * 2) / 3;
18 
19 
20  // Modify the options to give us room to add an arrow
21  QStyleOptionViewItemV4 opt = option;
22  if (reverse)
23  opt.rect.adjust(width,0,0,0);
24  else
25  opt.rect.adjust(0,0,-width,0);
26 
27  if (!(index.model()->flags(index) & Qt::ItemIsEnabled))
28  {
29  opt.showDecorationSelected = true;
30  opt.state |= QStyle::State_Selected;
31  }
32 
33 
34  QStyledItemDelegate::paint(painter, opt, index);
35 
36 
37  if (reverse)
38  opt.rect = QRect(option.rect.x(), option.rect.y(),
39  width, option.rect.height());
40  else
41  opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(),
42  width, option.rect.height());
43 
44  // Draw >
45  if (index.model()->hasChildren(index))
46  {
47  const QWidget *view = opt.widget;
48 
49  QStyle *style = view ? view->style() : qApp->style();
50  style->drawPrimitive(QStyle::PE_IndicatorColumnViewArrow, &opt,
51  painter, view);
52  }
53 }
void reverse()
Definition: HeadersFTM.h:194

+ Here is the call graph for this function: