void FilterTime::setupModel () { if (!m_model) m_model = new QStandardItemModel; m_ui->view->setModel(m_model); connect(m_ui->qFilterLineEdit, SIGNAL(returnPressed()), this, SLOT(onAdd())); m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers); m_ui->view->header()->hide(); connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClickedAt(QModelIndex))); //connect(m_ui->view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onDoubleClickedAtStringList(QModelIndex))); //connect(ui->comboBoxString, SIGNAL(activated(int)), this, SLOT(onStringActivate(int))); connect(m_ui->buttonAdd, SIGNAL(clicked()), this, SLOT(onAdd())); connect(m_ui->buttonRm, SIGNAL(clicked()), this, SLOT(onRm())); //m_ui->view->setItemDelegate(m_delegates.get<e_delegate_String>()); }
///////// colorizer void ColorizerRow::setupModel () { if (!m_model) { qDebug("new tree view model"); m_model = new QStandardItemModel; } m_ui->view->setModel(m_model); QStringList l; l.append("Enabled"); l.append("Row"); l.append("fg"); l.append("bg"); m_model->setHorizontalHeaderLabels(l); //m_ui->view->model()->setHeaderData(0, Qt::Horizontal, "Enabled"); //m_ui->view->model()->setHeaderData(1, Qt::Horizontal, "Reg Exp"); //m_ui->view->model()->setHeaderData(2, Qt::Horizontal, "fg"); //m_ui->view->model()->setHeaderData(3, Qt::Horizontal, "bg"); //m_ui->view->setSortingEnabled(true); m_ui->view->expandAll(); m_model->setColumnCount(4); m_ui->view->setColumnWidth(0, 192); ColorizerRowDelegate * d = new ColorizerRowDelegate(this); m_ui->view->setItemDelegate(d); m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(onAdd())); connect(m_ui->comboBox->lineEdit(), SIGNAL(returnPressed()), this, SLOT(onAdd())); connect(m_ui->rmButton, SIGNAL(clicked()), this, SLOT(onRm())); connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClickedAt(QModelIndex))); connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll())); connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone())); m_ui->fgButton->setStandardColors(); m_ui->fgButton->setCurrentColor(QColor(Qt::black)); m_ui->bgButton->setStandardColors(); m_ui->bgButton->setCurrentColor(QColor(Qt::white)); }