Hi every boby
i have probleme when i start implementing createEditor() function in Qstyleditemclass in Qtablewidget
her
{
if(creeConnexion())
{
if(index.column() == 1 || index.column() == 0)
{
editor->setEditable(true);
// Query data
while(query->next())
editor->addItem(query->value(0).toString());
return editor;
}
}else
// the problem her, i want to return the default editor for other cells but , the app crashed when i user this code below
return QStyledItemDelegate::createEditor(parent,option,index);
}
QWidget *comboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if(creeConnexion())
{
if(index.column() == 1 || index.column() == 0)
{
QComboBox *editor = new QComboBox(parent);
editor->setEditable(true);
// Query data
QSqlQuery *query = new QSqlQuery("select designation from Produit") ;
while(query->next())
editor->addItem(query->value(0).toString());
return editor;
}
}else
// the problem her, i want to return the default editor for other cells but , the app crashed when i user this code below
return QStyledItemDelegate::createEditor(parent,option,index);
}
To copy to clipboard, switch view to plain text mode
Bookmarks