X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractitemview.h;h=d7fd4881f19b0503d9596a62653c3578981ce729;hp=bffc35b09e1827f774cfe3adcae7f200a3b70811;hb=45645a28bdc5b6c1052b3e4cebf8cc80832d205a;hpb=1b2d3ea62867220d7bffc3b23dda1dc14d429007 diff --git a/src/uisupport/abstractitemview.h b/src/uisupport/abstractitemview.h index bffc35b0..d7fd4881 100644 --- a/src/uisupport/abstractitemview.h +++ b/src/uisupport/abstractitemview.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,45 +15,47 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef ABSTRACTITEMVIEW_H -#define ABSTRACTITEMVIEW_H +#pragma once -#include +#include "uisupport-export.h" + +#include #include +#include #include #include -#include -#include #include +#include -class AbstractItemView : public QWidget { - Q_OBJECT +class UISUPPORT_EXPORT AbstractItemView : public QWidget +{ + Q_OBJECT public: - AbstractItemView(QWidget *parent = 0); + AbstractItemView(QWidget* parent = nullptr); - inline QAbstractItemModel *model() { return _model; } - void setModel(QAbstractItemModel *model); + inline QAbstractItemModel* model() { return _model; } + void setModel(QAbstractItemModel* model); - inline QItemSelectionModel *selectionModel() const { return _selectionModel; } - void setSelectionModel(QItemSelectionModel *selectionModel); + inline QItemSelectionModel* selectionModel() const { return _selectionModel; } + void setSelectionModel(QItemSelectionModel* selectionModel); + + inline QModelIndex currentIndex() const { return _selectionModel->currentIndex(); } protected slots: - virtual void closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint) {}; - virtual void commitData(QWidget *) {}; - virtual void currentChanged(const QModelIndex &, const QModelIndex &) {}; - virtual void dataChanged(const QModelIndex &, const QModelIndex &) {}; - virtual void editorDestroyed(QObject *) {}; - virtual void rowsAboutToBeRemoved(const QModelIndex &, int, int) {}; - virtual void rowsInserted(const QModelIndex &, int, int) {}; - virtual void selectionChanged(const QItemSelection &, const QItemSelection &) {}; + virtual void closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint){}; + virtual void commitData(QWidget*){}; + virtual void currentChanged(const QModelIndex&, const QModelIndex&){}; + virtual void dataChanged(const QModelIndex&, const QModelIndex&){}; + virtual void editorDestroyed(QObject*){}; + virtual void rowsAboutToBeRemoved(const QModelIndex&, int, int){}; + virtual void rowsInserted(const QModelIndex&, int, int){}; + virtual void selectionChanged(const QItemSelection&, const QItemSelection&){}; protected: - QPointer _model; - QPointer _selectionModel; + QPointer _model; + QPointer _selectionModel; }; - -#endif // ABSTRACTITEMVIEW_H