Changeset View
Changeset View
Standalone View
Standalone View
src/libkdepimakonadi/widgets/tagselectioncombo.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 47 | { | |||
---|---|---|---|---|---|
54 | QItemSelectionModel *selectionModel = new QItemSelectionModel(model, this); | 54 | QItemSelectionModel *selectionModel = new QItemSelectionModel(model, this); | ||
55 | KCheckableProxyModel *checkableProxy = new MatchingCheckableProxyModel(this); | 55 | KCheckableProxyModel *checkableProxy = new MatchingCheckableProxyModel(this); | ||
56 | checkableProxy->setSourceModel(model); | 56 | checkableProxy->setSourceModel(model); | ||
57 | checkableProxy->setSelectionModel(selectionModel); | 57 | checkableProxy->setSelectionModel(selectionModel); | ||
58 | 58 | | |||
59 | setModel(checkableProxy); | 59 | setModel(checkableProxy); | ||
60 | 60 | | |||
61 | //We need to reconnect from the constructor of KCheckComboBox to the new model | 61 | //We need to reconnect from the constructor of KCheckComboBox to the new model | ||
62 | connect(checkableProxy, SIGNAL(dataChanged(QModelIndex,QModelIndex)), | 62 | connect(checkableProxy, &QAbstractItemModel::dataChanged, this, [this] (const QModelIndex &topLeft, const QModelIndex &bottomRight) { | ||
63 | this, SLOT(updateCheckedItems(QModelIndex,QModelIndex))); | 63 | updateCheckedItems(topLeft, bottomRight); | ||
64 | }); | ||||
64 | } | 65 | } | ||
65 | 66 | | |||
66 | TagCombo::TagCombo(QWidget *parent) | 67 | TagCombo::TagCombo(QWidget *parent) | ||
67 | : KComboBox(parent) | 68 | : KComboBox(parent) | ||
68 | { | 69 | { | ||
69 | Akonadi::Monitor *monitor = new Akonadi::Monitor(this); | 70 | Akonadi::Monitor *monitor = new Akonadi::Monitor(this); | ||
70 | monitor->setObjectName(QStringLiteral("TagSelectionComboMonitor")); | 71 | monitor->setObjectName(QStringLiteral("TagSelectionComboMonitor")); | ||
71 | monitor->setTypeMonitored(Akonadi::Monitor::Tags); | 72 | monitor->setTypeMonitored(Akonadi::Monitor::Tags); | ||
72 | Akonadi::TagModel *model = new Akonadi::TagModel(monitor, this); | 73 | Akonadi::TagModel *model = new Akonadi::TagModel(monitor, this); | ||
73 | setModel(model); | 74 | setModel(model); | ||
74 | } | 75 | } |