Core: Modernize

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init (partially)

Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2018-07-21 21:11:46 +02:00
parent 86b8164a93
commit f36f04deba
152 changed files with 621 additions and 698 deletions

View File

@@ -38,20 +38,19 @@ namespace Internal {
class OpenDocumentsDelegate : public QStyledItemDelegate
{
public:
explicit OpenDocumentsDelegate(QObject *parent = 0);
explicit OpenDocumentsDelegate(QObject *parent = nullptr);
void setCloseButtonVisible(bool visible);
void handlePressed(const QModelIndex &index);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
const QModelIndex &index) const override;
mutable QModelIndex pressedIndex;
bool closeButtonVisible;
bool closeButtonVisible = true;
};
OpenDocumentsDelegate::OpenDocumentsDelegate(QObject *parent)
: QStyledItemDelegate(parent),
closeButtonVisible(true)
: QStyledItemDelegate(parent)
{
}
@@ -141,7 +140,7 @@ bool OpenDocumentsTreeView::eventFilter(QObject *obj, QEvent *event)
{
if (obj == this && event->type() == QEvent::KeyPress
&& currentIndex().isValid()) {
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
auto ke = static_cast<QKeyEvent*>(event);
if ((ke->key() == Qt::Key_Delete
|| ke->key() == Qt::Key_Backspace)
&& ke->modifiers() == 0) {
@@ -149,7 +148,7 @@ bool OpenDocumentsTreeView::eventFilter(QObject *obj, QEvent *event)
}
} else if (obj == viewport()
&& event->type() == QEvent::MouseButtonRelease) {
QMouseEvent * me = static_cast<QMouseEvent*>(event);
auto me = static_cast<QMouseEvent*>(event);
if (me->button() == Qt::MiddleButton
&& me->modifiers() == Qt::NoModifier) {
QModelIndex index = indexAt(me->pos());