Changeset View
Changeset View
Standalone View
Standalone View
addons/katebuild-plugin/TargetHtmlDelegate.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | #include "UrlInserter.h" | 35 | #include "UrlInserter.h" | ||
36 | 36 | | |||
37 | #include <QDebug> | 37 | #include <QDebug> | ||
38 | 38 | | |||
39 | TargetHtmlDelegate::TargetHtmlDelegate( QObject* parent ) | 39 | TargetHtmlDelegate::TargetHtmlDelegate( QObject* parent ) | ||
40 | : QStyledItemDelegate(parent), m_isEditing(false) | 40 | : QStyledItemDelegate(parent), m_isEditing(false) | ||
41 | { | 41 | { | ||
42 | connect(this, SIGNAL(sendEditStart()), | 42 | connect(this, &TargetHtmlDelegate::sendEditStart, this, &TargetHtmlDelegate::editStarted); | ||
43 | this, SLOT(editStarted())); | | |||
44 | } | 43 | } | ||
45 | 44 | | |||
46 | TargetHtmlDelegate::~TargetHtmlDelegate() {} | 45 | TargetHtmlDelegate::~TargetHtmlDelegate() {} | ||
47 | 46 | | |||
48 | void TargetHtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const | 47 | void TargetHtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const | ||
49 | { | 48 | { | ||
50 | QStyleOptionViewItem options = option; | 49 | QStyleOptionViewItem options = option; | ||
51 | initStyleOption(&options, index); | 50 | initStyleOption(&options, index); | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 124 | else { | |||
128 | completer->setModel(new QDirModel(QStringList(), | 127 | completer->setModel(new QDirModel(QStringList(), | ||
129 | QDir::AllDirs|QDir::NoDotAndDotDot, | 128 | QDir::AllDirs|QDir::NoDotAndDotDot, | ||
130 | QDir::Name, e)); | 129 | QDir::Name, e)); | ||
131 | e->setCompleter(completer); | 130 | e->setCompleter(completer); | ||
132 | editor = e; | 131 | editor = e; | ||
133 | } | 132 | } | ||
134 | editor->setAutoFillBackground(true); | 133 | editor->setAutoFillBackground(true); | ||
135 | emit sendEditStart(); | 134 | emit sendEditStart(); | ||
136 | connect(editor, SIGNAL(destroyed(QObject*)), this, SLOT(editEnded())); | 135 | connect(editor, &QWidget::destroyed, this, &TargetHtmlDelegate::editEnded); | ||
137 | return editor; | 136 | return editor; | ||
138 | } | 137 | } | ||
139 | 138 | | |||
140 | void TargetHtmlDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const | 139 | void TargetHtmlDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const | ||
141 | { | 140 | { | ||
142 | QString value = index.model()->data(index, Qt::EditRole).toString(); | 141 | QString value = index.model()->data(index, Qt::EditRole).toString(); | ||
143 | 142 | | |||
144 | if (index.column() == 1) { | 143 | if (index.column() == 1) { | ||
Show All 38 Lines |