What I mean is like this
In my delegate fuction I have createActions to create action which changes in every row.
void ProformaDelegate::createActions()
{
fiyat_tipleri.exec("SELECT id, stokid from table where if = '" + xxx +"';");
int i = 0;
while(fiyat_tipleri.next()){
recentFileActs
[i
] = new QAction(fiyat_tipleri.
value(3).
toString(),
this);
++i;
sayi = i;
}
}
void ProformaDelegate::createActions()
{
QSqlQuery fiyat_tipleri;
fiyat_tipleri.exec("SELECT id, stokid from table where if = '" + xxx +"';");
int i = 0;
while(fiyat_tipleri.next()){
recentFileActs[i] = new QAction(fiyat_tipleri.value(3).toString(), this);
++i;
sayi = i;
}
}
To copy to clipboard, switch view to plain text mode
And in createEditor part I ask for the delegate.
else if(index.column() == 5 || index.column() == 8)
{
MyDoubleSpinBox2 *editor = new MyDoubleSpinBox2(parent);
editor->setMinimum(0);
editor->setMaximum(4000000000);
editor->setDecimals(4);
editor->setSuffix(" " + totalParaBirimi);
editor->setAlignment(Qt::AlignRight);
for (int i = 0; i < sayi; ++i)
editor->addAction(recentFileActs[i]);
editor->setContextMenuPolicy(Qt::ActionsContextMenu);
return editor;
}
else if(index.column() == 5 || index.column() == 8)
{
MyDoubleSpinBox2 *editor = new MyDoubleSpinBox2(parent);
editor->setMinimum(0);
editor->setMaximum(4000000000);
editor->setDecimals(4);
editor->setSuffix(" " + totalParaBirimi);
editor->setAlignment(Qt::AlignRight);
for (int i = 0; i < sayi; ++i)
editor->addAction(recentFileActs[i]);
editor->setContextMenuPolicy(Qt::ActionsContextMenu);
return editor;
}
To copy to clipboard, switch view to plain text mode
The problem is I could not start createActions() functions from createEditor() part, and also send information (xxx) for the SQL query
Bookmarks