Changeset View
Changeset View
Standalone View
Standalone View
incidenceeditor-ng/attendeecomboboxdelegate.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
void AttendeeComboBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const | void AttendeeComboBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const | ||||
{ | { | ||||
editor->setGeometry(option.rect); | editor->setGeometry(option.rect); | ||||
} | } | ||||
void AttendeeComboBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const | void AttendeeComboBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const | ||||
{ | { | ||||
QStyleOptionButton myOption;; | QStyleOptionButton myOption; | ||||
int value = index.model()->data(index).toUInt(); | int value = index.model()->data(index).toUInt(); | ||||
if (value >= entries.count()) { | if (value >= entries.count()) { | ||||
value = standardIndex; | value = standardIndex; | ||||
} | } | ||||
myOption.rect = option.rect; | myOption.rect = option.rect; | ||||
myOption.state = option.state; | myOption.state = option.state; | ||||
myOption.icon = entries[value].first; | myOption.icon = entries[value].first; | ||||
myOption.iconSize = entries[value].first.actualSize(QSize(64,64)); | |||||
QApplication::style()->drawControl(QStyle::CE_PushButton, &myOption, painter); | QApplication::style()->drawControl(QStyle::CE_PushButton, &myOption, painter); | ||||
} | } | ||||
bool AttendeeComboBoxDelegate::eventFilter ( QObject * editor, QEvent * event ) | bool AttendeeComboBoxDelegate::eventFilter ( QObject * editor, QEvent * event ) | ||||
{ | { | ||||
if (event->type() == QEvent::Enter) { | if (event->type() == QEvent::Enter) { | ||||
AttendeeComboBox *comboBox = static_cast<AttendeeComboBox*>(editor); | AttendeeComboBox *comboBox = static_cast<AttendeeComboBox*>(editor); | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |