source: trunk/src/gui/itemviews/qtablewidget.h@ 1014

Last change on this file since 1014 was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 13.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QTABLEWIDGET_H
43#define QTABLEWIDGET_H
44
45#include <QtGui/qtableview.h>
46#include <QtCore/qvariant.h>
47#include <QtCore/qvector.h>
48//#include <QtGui/qitemselectionmodel.h>
49
50QT_BEGIN_HEADER
51
52QT_BEGIN_NAMESPACE
53
54QT_MODULE(Gui)
55
56#ifndef QT_NO_TABLEWIDGET
57
58class Q_GUI_EXPORT QTableWidgetSelectionRange
59{
60public:
61 QTableWidgetSelectionRange();
62 QTableWidgetSelectionRange(int top, int left, int bottom, int right);
63 QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other);
64 ~QTableWidgetSelectionRange();
65
66 inline int topRow() const { return top; }
67 inline int bottomRow() const { return bottom; }
68 inline int leftColumn() const { return left; }
69 inline int rightColumn() const { return right; }
70 inline int rowCount() const { return bottom - top + 1; }
71 inline int columnCount() const { return right - left + 1; }
72
73private:
74 int top, left, bottom, right;
75};
76
77class QTableWidget;
78class QTableModel;
79class QWidgetItemData;
80class QTableWidgetItemPrivate;
81
82class Q_GUI_EXPORT QTableWidgetItem
83{
84 friend class QTableWidget;
85 friend class QTableModel;
86public:
87 enum ItemType { Type = 0, UserType = 1000 };
88 QTableWidgetItem(int type = Type);
89 explicit QTableWidgetItem(const QString &text, int type = Type);
90 explicit QTableWidgetItem(const QIcon &icon, const QString &text, int type = Type);
91 QTableWidgetItem(const QTableWidgetItem &other);
92 virtual ~QTableWidgetItem();
93
94 virtual QTableWidgetItem *clone() const;
95
96 inline QTableWidget *tableWidget() const { return view; }
97
98 inline int row() const;
99 inline int column() const;
100
101 inline void setSelected(bool select);
102 inline bool isSelected() const;
103
104 inline Qt::ItemFlags flags() const { return itemFlags; }
105 void setFlags(Qt::ItemFlags flags);
106
107 inline QString text() const
108 { return data(Qt::DisplayRole).toString(); }
109 inline void setText(const QString &text);
110
111 inline QIcon icon() const
112 { return qvariant_cast<QIcon>(data(Qt::DecorationRole)); }
113 inline void setIcon(const QIcon &icon);
114
115 inline QString statusTip() const
116 { return data(Qt::StatusTipRole).toString(); }
117 inline void setStatusTip(const QString &statusTip);
118
119#ifndef QT_NO_TOOLTIP
120 inline QString toolTip() const
121 { return data(Qt::ToolTipRole).toString(); }
122 inline void setToolTip(const QString &toolTip);
123#endif
124
125#ifndef QT_NO_WHATSTHIS