1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : A KCompletion for AbstractAlbumModels
9
* Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
* Copyright (C) 2009-2010 by Johannes Wienke <languitar at semipol dot de>
11
* Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
13
* This program is free software; you can redistribute it
14
* and/or modify it under the terms of the GNU General
15
* Public License as published by the Free Software Foundation;
16
* either version 2, or (at your option)
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
24
* ============================================================ */
26
#ifndef ALBUMMODELCOMPLETION_H
27
#define ALBUMMODELCOMPLETION_H
31
#include <qabstractitemmodel.h>
35
#include <kcompletion.h>
39
#include "digikam_export.h"
44
class ModelCompletionPriv;
46
class DIGIKAM_EXPORT ModelCompletion : public KCompletion
56
* If the given model is != null, the model is used to populate the
57
* completion for this text field.
59
* @param model to fill from or null for manual mode
60
* @param uniqueIdRole a role for which the model will return a unique integer for each entry
61
* @param displayRole the role to retrieve the text for completion, default is Qt::DisplayRole.
63
void setModel(QAbstractItemModel *model, int uniqueIdRole, int displayRole = Qt::DisplayRole);
64
QAbstractItemModel *model() const;
68
void slotRowsInserted(const QModelIndex &parent, int start, int end);
69
void slotRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
70
void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
71
void slotModelReset();
75
void connectToModel(QAbstractItemModel *model);
76
void disconnectFromModel(QAbstractItemModel *model);
77
void sync(QAbstractItemModel *model);
78
void sync(QAbstractItemModel *model, const QModelIndex &index);
82
ModelCompletionPriv* const d;
85
} // namespace Digikam
87
#endif /* ALBUMMODELCOMPLETION_H */