diff --git a/plugins/documentswitcher/documentswitchertreeview.cpp b/plugins/documentswitcher/documentswitchertreeview.cpp index 25e0a7968e..321563489f 100644 --- a/plugins/documentswitcher/documentswitchertreeview.cpp +++ b/plugins/documentswitcher/documentswitchertreeview.cpp @@ -1,48 +1,47 @@ /*************************************************************************** * Copyright 2009 Andreas Pakulat * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "documentswitchertreeview.h" #include #include "documentswitcherplugin.h" DocumentSwitcherTreeView::DocumentSwitcherTreeView(DocumentSwitcherPlugin* plugin_ ) - : QListView( 0 ), plugin( plugin_ ) + : QListView(nullptr) + , plugin(plugin_) { - setWindowFlags( Qt::Popup | Qt::FramelessWindowHint ); + setWindowFlags(Qt::Popup | Qt::FramelessWindowHint); } -void DocumentSwitcherTreeView::keyPressEvent( QKeyEvent* event ) +void DocumentSwitcherTreeView::keyPressEvent(QKeyEvent* event) { QListView::keyPressEvent(event); } -void DocumentSwitcherTreeView::keyReleaseEvent( QKeyEvent* event ) +void DocumentSwitcherTreeView::keyReleaseEvent(QKeyEvent* event) { - if( event->key() == Qt::Key_Control ) - { - plugin->itemActivated( selectionModel()->currentIndex() ); + if (event->key() == Qt::Key_Control) { + plugin->itemActivated(selectionModel()->currentIndex()); event->accept(); hide(); - } else - { + } else { QListView::keyReleaseEvent(event); } } diff --git a/plugins/documentswitcher/documentswitchertreeview.h b/plugins/documentswitcher/documentswitchertreeview.h index 0b4e3c2355..3d4aa609b9 100644 --- a/plugins/documentswitcher/documentswitchertreeview.h +++ b/plugins/documentswitcher/documentswitchertreeview.h @@ -1,39 +1,42 @@ /*************************************************************************** * Copyright 2009 Andreas Pakulat * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ + #ifndef KDEVPLATFORM_PLUGIN_DOCUMENTSWITCHERTREEVIEW_H #define KDEVPLATFORM_PLUGIN_DOCUMENTSWITCHERTREEVIEW_H #include class DocumentSwitcherPlugin; class DocumentSwitcherTreeView : public QListView { Q_OBJECT + public: - explicit DocumentSwitcherTreeView( DocumentSwitcherPlugin* ); + explicit DocumentSwitcherTreeView(DocumentSwitcherPlugin* plugin); protected: -void keyPressEvent(QKeyEvent* event) override; -void keyReleaseEvent(QKeyEvent* ) override; + void keyPressEvent(QKeyEvent* event) override; + void keyReleaseEvent(QKeyEvent* event) override; + private: DocumentSwitcherPlugin* plugin; }; #endif // KDEVPLATFORM_PLUGIN_DOCUMENTSWITCHERTREEVIEW_H