1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2010 Denis Mingulov.
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef CLASSVIEWUTILS_H
34 #define CLASSVIEWUTILS_H
36 #include "classviewsymbollocation.h"
37 #include "classviewsymbolinformation.h"
38 #include <QtCore/QVariant>
39 #include <QtCore/QList>
40 #include <QtCore/QSet>
42 QT_FORWARD_DECLARE_CLASS(QStandardItem)
49 \brief Some common utils
54 //! Private constructor
59 \brief convert internal location container to QVariant compatible
60 \param locations Set of SymbolLocations
61 \return List of variant locations (can be added to an item's data)
63 static QList<QVariant> locationsToRole(const QSet<SymbolLocation> &locations);
66 \brief convert QVariant location container to internal
67 \param locations List of variant locations (from an item's data)
68 \return Set of SymbolLocations
70 static QSet<SymbolLocation> roleToLocations(const QList<QVariant> &locations);
73 \brief Returns sort order value for the icon type
74 \param iconType Icon type
75 \return Sort order value for the provided icon type
77 static int iconTypeSortOrder(int iconType);
80 \brief Get symbol information for the \a QStandardItem
82 \return Filled symbol information.
84 static SymbolInformation symbolInformationFromItem(const QStandardItem *item);
87 \brief Set symbol information to the \a QStandardItem
92 static QStandardItem *setSymbolInformationToItem(const SymbolInformation &information,
96 \brief Update an item to the target. (sorted, for fetching)
97 \param item Source item
98 \param target Target item
100 static void fetchItemToTarget(QStandardItem *item, const QStandardItem *target);
103 \brief Move an item to the target. (sorted)
104 \param item Source item
105 \param target Target item
107 static void moveItemToTarget(QStandardItem *item, const QStandardItem *target);
110 } // namespace Internal
111 } // namespace ClassView
113 #endif // CLASSVIEWUTILS_H