void GLWidget::paintGL() { // clear glClear(GL_COLOR_BUFFER_BIT); // Koordinatensystem glColor3f(0.5,0.5,0.5); glBegin(GL_LINES); glVertex2f(-1.0, 0.0); glVertex2f( 1.0, 0.0); glVertex2f( 0.0,-1.0); glVertex2f( 0.0, 1.0); glEnd(); // Draw points glBegin( GL_POINTS ); glColor4f( 0.95f, 0.207, 0.031f, 1.0f ); for (auto &point : points) { glVertex2f( point.x(), point.y() ); } glEnd(); // Linien zeichnen drawPartitions(); // DrawQuery drawQuery(); }
void PartitionSplitterWidget::paintEvent( QPaintEvent* event ) { QPainter painter( this ); painter.fillRect( rect(), palette().window() ); painter.setRenderHint( QPainter::Antialiasing ); drawPartitions( &painter, rect(), m_items ); }
void PartitionBarsView::paintEvent( QPaintEvent* event ) { QPainter painter( viewport() ); painter.fillRect( rect(), palette().window() ); painter.setRenderHint( QPainter::Antialiasing ); QRect partitionsRect = rect(); partitionsRect.setHeight( VIEW_HEIGHT ); painter.save(); drawPartitions( &painter, partitionsRect, QModelIndex() ); painter.restore(); }
void PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const QModelIndex& parent ) { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) return; const int totalWidth = rect.width(); auto pair = computeItemsVector( parent ); QVector< PartitionBarsView::Item >& items = pair.first; qreal& total = pair.second; int x = rect.x(); for ( int row = 0; row < items.count(); ++row ) { const auto& item = items[ row ]; int width; if ( row < items.count() - 1 ) width = totalWidth * ( item.size / total ); else // Make sure we fill the last pixel column width = rect.right() - x + 1; drawSection( painter, rect, x, width, item.index ); if ( m_nestedPartitionsMode == DrawNestedPartitions && modl->hasChildren( item.index ) ) { QRect subRect( x + EXTENDED_PARTITION_MARGIN, rect.y() + EXTENDED_PARTITION_MARGIN, width - 2 * EXTENDED_PARTITION_MARGIN, rect.height() - 2 * EXTENDED_PARTITION_MARGIN ); drawPartitions( painter, subRect, item.index ); } x += width; } if ( !items.count() && !modl->device()->partitionTable() ) // No disklabel or unknown { int width = rect.right() - rect.x() + 1; drawSection( painter, rect, rect.x(), width, QModelIndex() ); } }