2 #include "ui_transform_selector.h" 4 #include <QDomDocument> 5 #include <QTableWidget> 10 QStringList available_transforms,
11 QString *default_tansform,
12 std::map<std::string, QString> *curve_transforms,
15 ui(new
Ui::transform_selector),
16 _curves_trans(curve_transforms),
17 _default_trans(default_tansform)
21 QStringList transforms = builtin_transform + available_transforms;
23 ui->comboDefault->insertItems(0, transforms);
24 ui->comboDefault->insertSeparator( builtin_transform.size() );
25 if( transforms.contains( *default_tansform ) )
27 ui->comboDefault->setCurrentText( *default_tansform );
30 ui->tableWidget->setRowCount(
int(curve_transforms->size()) );
31 ui->tableWidget->setColumnCount(2);
34 for(
const auto& it: *curve_transforms)
36 const auto& trans = it.second;
37 auto item_name =
new QTableWidgetItem(QString::fromStdString(it.first));
38 auto item_combo =
new QComboBox();
39 item_combo->insertItems(0, transforms);
40 item_combo->insertSeparator(3);
41 ui->tableWidget->setItem(row, 0, item_name);
42 ui->tableWidget->setCellWidget(row, 1, item_combo);
43 if( transforms.contains( trans ) )
45 item_combo->setCurrentText( trans );
49 QHeaderView*
header =
ui->tableWidget->horizontalHeader();
50 header->setSectionResizeMode(QHeaderView::Stretch);
61 int default_index =
ui->comboDefault->currentIndex();
62 for(
int row = 0; row <
ui->tableWidget->rowCount(); row++)
64 auto combo =
static_cast<QComboBox*
>(
ui->tableWidget->cellWidget(row,1));
65 combo->setCurrentIndex(default_index);
71 for(
int row = 0; row <
ui->tableWidget->rowCount(); row++)
73 auto combo =
static_cast<QComboBox*
>(
ui->tableWidget->cellWidget(row,1));
74 combo->setCurrentIndex(0);
80 for(
int row = 0; row <
ui->tableWidget->rowCount(); row++)
82 const auto&
name =
ui->tableWidget->item(row,0)->text();
83 auto combo =
static_cast<QComboBox*
>(
ui->tableWidget->cellWidget(row,1));
84 (*_curves_trans)[
name.toStdString() ] = combo->currentText();
struct absl::base_internal::@37::AllocList::Header header