ItemWidget *ItemDataLoader::create(const QModelIndex &index, QWidget *parent) const { const QStringList formats = index.data(contentType::formats).toStringList(); if ( emptyIntersection(formats, formatsToSave()) ) return NULL; return new ItemData( index, m_settings.value("max_bytes", defaultMaxBytes).toInt(), parent ); }
QWidget *ItemDataLoader::createSettingsWidget(QWidget *parent) { ui.reset(new Ui::ItemDataSettings); QWidget *w = new QWidget(parent); ui->setupUi(w); const QStringList formats = formatsToSave(); ui->plainTextEditFormats->setPlainText( formats.join(QString("\n")) ); ui->spinBoxMaxChars->setValue( m_settings.value("max_bytes", defaultMaxBytes).toInt() ); connect( ui->treeWidgetFormats, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(on_treeWidgetFormats_itemActivated(QTreeWidgetItem*,int)) ); return w; }