File indexing completed on 2024-05-19 05:14:37
0001 /* 0002 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QWidget> 0010 0011 class QAbstractItemView; 0012 class QLabel; 0013 class QPushButton; 0014 0015 /** 0016 * @short A widget to switch between the contacts of an contact view. 0017 * 0018 * This widgets provides a 'Next' and 'Previous' button to allow the 0019 * user to switch between the entries of a contact view. 0020 * 0021 * @author Tobias Koenig <tokoe@kde.org> 0022 */ 0023 class ContactSwitcher : public QWidget 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 /** 0029 * Creates a new contact switcher. 0030 * 0031 * @param parent The parent widget. 0032 */ 0033 explicit ContactSwitcher(QWidget *parent = nullptr); 0034 0035 /** 0036 * Sets the @p view the contact switcher shall work on. 0037 */ 0038 void setView(QAbstractItemView *view); 0039 0040 private: 0041 /** 0042 * This slot is called when the 'Next' button is clicked. 0043 */ 0044 void nextClicked(); 0045 0046 /** 0047 * This slot is called when the 'Previous' button is clicked. 0048 */ 0049 void previousClicked(); 0050 0051 /** 0052 * This slot is called whenever the layout of the model has changed 0053 * or the user has clicked a button. 0054 */ 0055 void updateStatus(); 0056 0057 QAbstractItemView *mView = nullptr; 0058 QPushButton *const mNextButton; 0059 QPushButton *const mPreviousButton; 0060 QLabel *const mStatusLabel; 0061 };