Пример #1
0
void EditTagDialog::UpdateFieldValue(const FieldData& field,
                                     const QModelIndexList& sel) {
  // Get the value from the field
  QVariant value;
  if (ExtendedEditor* editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
    value = editor->text();
  }

  // Did we get it?
  if (!value.isValid()) {
    return;
  }

  // Set it in each selected song
  for (const QModelIndex& i : sel) {
    data_[i.row()].set_value(field.id_, value);
  }

  // Update the boldness
  const bool modified = IsValueModified(sel, field.id_);

  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}
Пример #2
0
void EditTagDialog::UpdateModifiedField(const FieldData& field, const QModelIndexList& sel) {
  const bool modified = IsValueModified(sel, field.id_);

  // Update the boldness
  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}
Пример #3
0
void EditTagDialog::InitFieldValue(const FieldData& field,
                                   const QModelIndexList& sel) {
  const bool varies = DoesValueVary(sel, field.id_);
  const bool modified = IsValueModified(sel, field.id_);

  if (ExtendedEditor* editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
    editor->clear();
    editor->clear_hint();
    if (varies) {
      editor->set_hint(tr(EditTagDialog::kHintText));
    } else {
      editor->set_text(data_[sel[0].row()].current_value(field.id_).toString());
    }
  }

  QFont new_font(font());
  new_font.setBold(modified);
  field.label_->setFont(new_font);
  field.editor_->setFont(new_font);
}