Помогите вставить в модель QSplitter



  • Помогите вставить QSplitter в модель, не понимаю как с этим работать. И почему view1 и view2 не имеют цвет?

    #include "sliderdelegate.h"
    #include <QApplication>
    #include <QStyleOptionProgressBar>
    #include <QGraphicsView>
    #include <QSplitter>
    #include <QGraphicsScene>
    #include <QOpenGLWidget>
    SliderDelegate::SliderDelegate(QObject *parent) : QStyledItemDelegate (parent)
    {
    
    }
    
    QWidget *SliderDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
    {
    
        QGraphicsView* view1 = new QGraphicsView(parent);
    
        view1->setBackgroundBrush(QBrush(Qt::green, Qt::SolidPattern));
    
        QGraphicsView* view2 = new QGraphicsView(parent);
        view2->setBackgroundBrush(QBrush(Qt::green, Qt::SolidPattern));
    
    
        QSplitter* splitter = new QSplitter(Qt::Horizontal);
        splitter->addWidget(view1);
        splitter->addWidget(view2);
    
        return splitter;
    
    }
    
    void SliderDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
    {
        QSplitter *splitter = static_cast<QSplitter*>(editor);
    
        int value = index.model()->data(index, Qt::EditRole).toInt();
    
    }
    
    void SliderDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
    {
    
        QSplitter* splitter = static_cast<QSplitter*>(editor);
    
    }
    
    void SliderDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
    {
        editor->setGeometry(option.rect);
    }
    
    void SliderDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
    {
        
    
        //QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBar, painter);
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.