forked from qt-creator/qt-creator
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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user