Chart::Chart(QWidget *parent) : QWidget(parent) { m_colorList = QList<QColor>(); m_colorList << QColor(Qt::red) << QColor(Qt::yellow) << QColor(Qt::blue) << QColor(Qt::green); m_partList = QList<ChartPart *>(); resize(300, 300); addPartition(30, "meeeow", QIcon()); addPartition(60, "meeeow", QIcon()); }
PartitionComboBox::PartitionComboBox( QWidget* parent ) : QComboBox( parent ) { mButton = new QToolButton( this ); mButton->setAutoRaise( true ); mButton->setIcon( QIcon( ":/icons/256/properties.png" ) ); mButton->setToolTip( tr( "Add a partition" ) ); QHBoxLayout* hl = new QHBoxLayout( this ); hl->setMargin( 0 ); hl->setSpacing( 5 ); hl->addStretch(); hl->addWidget( mButton ); setAttribute( Qt::WA_Hover, true ); setModel( partitionModel() ); setModelColumn( pPartition::DevicePath ); setItemDelegate( new PartitionDelegate( partitionModel() ) ); connect( partitionModel(), SIGNAL( rowsInserted( const QModelIndex&, int, int ) ), this, SLOT( modelChanged() ) ); connect( partitionModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ), this, SLOT( modelChanged() ) ); connect( partitionModel(), SIGNAL( layoutChanged() ), this, SLOT( modelChanged() ) ); connect( partitionModel(), SIGNAL( modelReset() ), this, SLOT( modelChanged() ) ); connect( mButton, SIGNAL( clicked() ), this, SLOT( addPartition() ) ); modelChanged(); }
void pPartitionModel::addPartitions( const QStringList& partitions ) { foreach ( const QString& partition, partitions ) { addPartition( partition ); }