
Originally Posted by
wysota
You only need to fetch the data there and you can store it for later use.
Yes I could do that, but I'm trying not to duplicate the data un-necessarily.
The reason I want to create the combo box in the creator is so I could use it like this:
{
Q_OBJECT
public:
//...all the usual declarations...
void addItem
(QString text,
int index
) const;
void setEditColumn(int colNumber) const;
private:
int editColumn;
};
class ComboBoxDelegate : public QItemDelegate
{
Q_OBJECT
public:
//...all the usual declarations...
void addItem(QString text, int index) const;
void setEditColumn(int colNumber) const;
private:
QComboBox *editor;
int editColumn;
};
To copy to clipboard, switch view to plain text mode
And then I can fill the combo box with data after I create it...
ComboBoxDelegate *delegate = new ComboBoxDelegate(this);
delegate->addItem(string, int);
delegate->setEditColumn(int);
ComboBoxDelegate *delegate = new ComboBoxDelegate(this);
delegate->addItem(string, int);
delegate->setEditColumn(int);
To copy to clipboard, switch view to plain text mode
This way the class is re-useable
Bookmarks