Ejemplo n.º 1
0
void draw() {
    int row, col;
    
    // Clear framebuffer
    glClear(GL_COLOR_BUFFER_BIT);
    
    // Draw pixels to the buffer
    for (row = 0; row < GFX_ROWS; row++) {
        for (col = 0; col < GFX_COLS; col++) {
            paint_cell(row, col, gfx[row][col] ? WHITE : BLACK);
        }
    }
    
    // Update Texture
    glDrawPixels(SCREEN_COLS, SCREEN_ROWS, GL_RGB, GL_UNSIGNED_BYTE,
                 (void *) screen);
    glutSwapBuffers();
}
void UberDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, const QModelIndex &proxy_idx) const {
    if (!proxy_idx.isValid()) {
        return;
    }
    if (proxy_idx.column() == 0) { // we never do anything with the 0 col...
        QStyledItemDelegate::paint(p, opt, proxy_idx);
        return;
    }

    paint_cell(p, opt, proxy_idx);


    if (m_model && proxy_idx.column() == m_model->selected_col()) {
        p->save();
        p->setPen(QPen(color_guides));
        p->drawLine(opt.rect.topLeft(), opt.rect.bottomLeft());
        p->drawLine(opt.rect.topRight(), opt.rect.bottomRight());
        p->restore();
    }
}
Ejemplo n.º 3
0
void UberDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, const QModelIndex &proxy_idx) const {
    if (!proxy_idx.isValid()) {
        return;
    }

    bool cell_is_agg = proxy_idx.data(DwarfModel::DR_IS_AGGREGATE).toBool();
    bool drawing_aggregate = false;
    if(m_model && m_model->current_grouping() != DwarfModel::GB_NOTHING && show_aggregates && cell_is_agg)
        drawing_aggregate = true;

    //name column's cells are drawn differently
    if (proxy_idx.column() == 0) {
        QStyledItemDelegate::paint(p, opt, proxy_idx);
        //draw a line under the name's cell if it's an aggregate row
        //        if(drawing_aggregate){
        //            p->save();
        //            p->setPen(QPen(QColor(Qt::black)));
        //            p->drawLine(opt.rect.bottomLeft(), opt.rect.bottomRight());
        //            p->restore();
        //        }
        //                return;
    }else{

        //all other cells
        paint_cell(p, opt, proxy_idx,drawing_aggregate);

        //vertical guide lines when columns are selected
        if (m_model && proxy_idx.column() == m_model->selected_col()) {
            p->save();
            p->setPen(QPen(color_guides));
            p->drawLine(opt.rect.topLeft(), opt.rect.bottomLeft());
            p->drawLine(opt.rect.topRight(), opt.rect.bottomRight());
            p->restore();
        }
    }
    paint_guide_borders(opt,p,drawing_aggregate);
}