コード例 #1
0
QWidget *OutlinerItemPoVDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & option , const QModelIndex & index ) const
{


    QListWidget *listWidget = new QListWidget(parent);
    //        qDebug()<< "createEditor";
    listWidget->setStyleSheet(qListWidgetCss);

    return(listWidget);
    //       }
    //    else
    //        return QStyledItemDelegate::createEditor(parent,option,index);

}
コード例 #2
0
QWidget* CReportDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QVariant data = index.data(Qt::DisplayRole);

    // Validate that the data is in the correct format
    if (data.type()==QVariant::List) //List for reports
    {
        QListWidget* listWidget = new QListWidget(parent);
        listWidget->setStyleSheet("background-color:#E0E0E0");
        return listWidget;
    }

    else
        return QStyledItemDelegate::createEditor(parent,option,index);
}