void SensorWidget::paintEvent(QPaintEvent* event)
{
  painter.begin(this);
  painter.setFont(font);
  painter.setBrush(altBrush);
  painter.setPen(fontPen);
  fillBackground = false;

  paintRect = painter.window();
  paintRectField0 = QRect(headerView->sectionViewportPosition(0) + textOffset, 0, headerView->sectionSize(0) - textOffset * 2, lineSpacing);
  paintRectField1 = QRect(headerView->sectionViewportPosition(1) + textOffset, 0, headerView->sectionSize(1) - textOffset * 2, lineSpacing);
  {
    SYNC_WITH(sensorView.console);
    paintInertialSensorData();
    newSection();
    paintSystemSensorData();
    newSection();
    paintFsrSensorData();
    newSection();
    paintKeyStates();
  }
  painter.end();
  setMinimumHeight(paintRectField1.top());
}
Exemple #2
0
void TreeWidget::paintEvent(QPaintEvent* event)
{
    QTreeWidget::paintEvent(event);

    if(isVerticalGridLineShown && topLevelItemCount()){
        QHeaderView* hv = header();
        QPainter painter(viewport());
        QPen oldPen = painter.pen();
        painter.setPen(QPen(QColor::fromRgb(gridColorRGB)));
    
        for(int i = 0; i < hv->count(); ++i){
            // draw only visible sections starting from second column
            if(hv->isSectionHidden(i) || hv->visualIndex(i) <= 0){
                continue;
            }
            // position mapped to viewport
            int pos = hv->sectionViewportPosition(i) - 1;
            if(pos > 0){
                painter.drawLine(QPoint(pos, 0), QPoint(pos, height()));
            }
        }
        painter.setPen(oldPen);
    }
}
Exemple #3
0
int HeaderView::sectionViewportPosition(lua_State * L) // ( int logicalIndex ) const : int
{	
    QHeaderView* obj = QtObject<QHeaderView>::check( L, 1);
	Util::push( L, obj->sectionViewportPosition( Util::toInt( L, 2) ) );
	return 1;
}