void Delegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    /*int value = index.model()->data(index, Qt::EditRole).toInt();
    QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
    spinBox->setValue(value);*/
    QString value = index.model()->data(index, Qt::DisplayRole).toString();
    QComboBox *cmbBox = static_cast<QComboBox*>(editor);
    cmbBox->setCurrentIndex(cmbBox->findText(value, Qt::MatchCaseSensitive));
    temp_editor = cmbBox;
    //connect(cmbBox, SIGNAL(valueChanged(int)), this, SLOT(indexChanged(int)));
    connect(cmbBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
    connect(cmbBox, SIGNAL(editTextChanged(QString)), this, SLOT(editTextChangedSlot(QString)));
}
Exemple #2
0
GComboBox::GComboBox(QWidget *parent,VM *pVM)  : QComboBox(parent)
{
	this->pVM = pVM;
	strcpy(this->cactivatedEvent,"");
	strcpy(this->ccurrentIndexChangedEvent,"");
	strcpy(this->ceditTextChangedEvent,"");
	strcpy(this->chighlightedEvent,"");

	QObject::connect(this, SIGNAL(activated(int)),this, SLOT(activatedSlot()));
	QObject::connect(this, SIGNAL(currentIndexChanged(int)),this, SLOT(currentIndexChangedSlot()));
	QObject::connect(this, SIGNAL(editTextChanged(QString)),this, SLOT(editTextChangedSlot()));
	QObject::connect(this, SIGNAL(highlighted(int)),this, SLOT(highlightedSlot()));

}
void Delegate::editTextChangedSlot(QString new_val)
{
    disconnect(temp_editor, SIGNAL(editTextChanged(QString)), this, SLOT(editTextChangedSlot(QString)));
    emit signal_changed(ind_field, new_val);
}