I hope someone can come up with a better solution but here's one hackish and dirty way to work it around.
Fist, expose QComboBox::showPopup() as slot:
{
Q_OBJECT
public:
public slots:
};
class ComboBox : public QComboBox
{
Q_OBJECT
public:
ComboBox(QWidget* parent = 0) : QComboBox(parent) { }
public slots:
void showPopup() { QComboBox::showPopup(); }
};
To copy to clipboard, switch view to plain text mode
Then, use a timer in createEditor() to make a delayed call to above slot:
QWidget* createEditor
(QWidget* parent,
const QStyleOptionViewItem
&,
const QModelIndex
&) const {
ComboBox* combo = new ComboBox(parent);
...
QTimer::singleShot(100, combo,
SLOT(showPopup
()));
return combo;
}
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem&, const QModelIndex&) const
{
ComboBox* combo = new ComboBox(parent);
...
QTimer::singleShot(100, combo, SLOT(showPopup()));
return combo;
}
To copy to clipboard, switch view to plain text mode
Bookmarks