int paintVerticalCell (QPainter *painter, const QHeaderView* hv, const QModelIndex& cellIndex, const QModelIndex& leafIndex, int logicalLeafIndex, const QStyleOptionHeader& styleOptions, const QRect& sectionRect, int left) const { QStyleOptionHeader uniopt(styleOptions); setForegroundBrush(uniopt, cellIndex); setBackgroundBrush(uniopt, cellIndex); int width=cellSize(cellIndex, hv, uniopt).width(); if(cellIndex==leafIndex) width=sectionRect.width()-left; int top=currentCellLeft(cellIndex, leafIndex, logicalLeafIndex, sectionRect.top(), hv); int height=currentCellWidth(cellIndex, leafIndex, logicalLeafIndex, hv); QRect r(left, top, width, height); uniopt.text = cellIndex.data(Qt::DisplayRole).toString(); if(cellIndex.data(Qt::UserRole).isValid()) { QRect new_r(0, 0, r.width(), r.height()); uniopt.rect = new_r; QPixmap original_button(r.width(), r.height()); QPainter original_button_painter(&original_button); hv->style()->drawControl(QStyle::CE_HeaderSection, &uniopt, &original_button_painter, hv); new_r.setWidth(r.height()); new_r.setHeight(r.width()); QMatrix m; m.translate(0, r.height()); m.rotate(-90); original_button_painter.setWorldMatrix(m, true); uniopt.rect = new_r; hv->style()->drawControl(QStyle::CE_HeaderLabel, &uniopt, &original_button_painter, hv); painter->drawPixmap(r, original_button); } else { bool clipping=painter->hasClipping(); uniopt.rect = r; hv->style()->drawControl(QStyle::CE_Header, &uniopt, painter, hv); painter->setClipping(clipping); } return left+width; }
int paintHorizontalCell (QPainter *painter, const QHeaderView* hv, const QModelIndex& cellIndex, const QModelIndex& leafIndex, int logicalLeafIndex, const QStyleOptionHeader& styleOptions, const QRect& sectionRect, int top) const { QStyleOptionHeader uniopt(styleOptions); setForegroundBrush(uniopt, cellIndex); setBackgroundBrush(uniopt, cellIndex); int height=cellSize(cellIndex, hv, uniopt).height(); if(cellIndex==leafIndex) height=sectionRect.height()-top; int left=currentCellLeft(cellIndex, leafIndex, logicalLeafIndex, sectionRect.left(), hv); int width=currentCellWidth(cellIndex, leafIndex, logicalLeafIndex, hv); QRect r(left, top, width, height); uniopt.text = cellIndex.data(Qt::DisplayRole).toString(); painter->save(); uniopt.rect = r; if(cellIndex.data(Qt::UserRole).isValid()) { hv->style()->drawControl(QStyle::CE_HeaderSection, &uniopt, painter, hv); QMatrix m; m.rotate(-90); painter->setWorldMatrix(m, true); QRect new_r(0, 0, r.height(), r.width()); new_r.moveCenter(QPoint(-r.center().y(), r.center().x())); uniopt.rect = new_r; hv->style()->drawControl(QStyle::CE_HeaderLabel, &uniopt, painter, hv); } else { hv->style()->drawControl(QStyle::CE_Header, &uniopt, painter, hv); } painter->restore(); hv->childAt(QPoint(uniopt.rect.left()+5, uniopt.rect.top()+3))->setToolTip(uniopt.text); return top+height; }
int main(int argc, char *argv[]) { char **p = argv; signal(SIGCHLD, SIG_DFL); while (*++p) { /* filename or option ? */ if (**p != '-') { add_file(*p); continue; } switch ((*p)[1]) { /* Don't link */ case 'c': uniopt(*p); last_phase = 3; break; /* Don't assemble */ case 'S': uniopt(*p); last_phase = 2; break; /* Only pre-process */ case 'E': uniopt(*p); last_phase = 1; only_one_input = 1; break; case 'l': p = add_library(p); break; case 'I': p = add_includes(p); break; case 'L': p = add_library_path(p); break; case 'D': p = add_macro(p); break; case 'i': /* split_id();*/ uniopt(*p); break; case 'o': if (target != NULL) { fprintf(stderr, "-o can only be used once.\n"); fatal(); } if ((*p)[2]) target = *p + 2; else target = *++p; break; case 'X': uniopt(*p); keep_temp = 1; break; default: usage(); } } if (target == NULL) target = "a.out"; if (only_one_input && c_files > 1) one_input(); processing_loop(); unused_files(); return 0; }