| 33 | static const int MIN_FIELD_WIDTH = 80; |
| 34 | |
| 35 | WidgetSettingFrames::WidgetSettingFrames(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaFrames& meta, |
| 36 | SettingDataSet& data_set) |
| 37 | : WidgetSettingBase(tree, item), |
| 38 | meta(meta), |
| 39 | data_set(data_set), |
| 40 | field(new QLineEdit(this)), |
| 41 | timer_error(new QTimer(this)), |
| 42 | timer_valid(new QTimer(this)) { |
| 43 | this->field->setFont(tree->font()); |
| 44 | this->field->setToolTip("Use list of comma separated integer ranges. Example: '0-2,16'."); |
| 45 | this->field->setAlignment(Qt::AlignRight); |
| 46 | this->field->show(); |
| 47 | this->default_palette = this->field->palette(); |
| 48 | |
| 49 | this->connect(this->field, SIGNAL(textEdited(const QString&)), this, SLOT(OnTextEdited(const QString&))); |
| 50 | this->connect(this->timer_error, &QTimer::timeout, this, &WidgetSettingFrames::OnErrorValue); |
| 51 | this->connect(this->timer_valid, &QTimer::timeout, this, &WidgetSettingFrames::OnValidValue); |
| 52 | |
| 53 | this->item->setText(0, GetLabel(this->meta).c_str()); |
| 54 | this->item->setFont(0, this->tree->font()); |
| 55 | this->item->setToolTip(0, meta.description.c_str()); |
| 56 | this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT)); |
| 57 | this->tree->setItemWidget(this->item, 0, this); |
| 58 | |
| 59 | this->Refresh(REFRESH_ENABLE_AND_STATE); |
| 60 | } |
| 61 | |
| 62 | WidgetSettingFrames::~WidgetSettingFrames() { |
| 63 | this->timer_error->stop(); |