Qt中文手册 之 QTableWidgetItem
来源:互联网 发布:复杂网络画图软件 编辑:程序博客网 时间:2024/05/21 10:47
头文件 #include<QTableWidgetItem>
成员函数
1、QTableWidgetItem::QTableWidgetItem(int type = Type)
使用指定item类型type构造。
item的type
QTableWidgetItem::Type
0
默认的类型:窗口部件QTableWidgetItem::UserType
1000
The minimum value for custom types. Values below UserType are reserved by Qt.2、QTableWidgetItem::QTableWidgetItem(const QString & text, int type = Type)
使用指定文字text 和 type 构造
3、QTableWidgetItem::QTableWidgetItem(const QIcon & icon, const QString & text,int type = Type)
使用图标icon和文字text及类型type构造
4、QTableWidgetItem::QTableWidgetItem(const QTableWidgetItem & other)
复制构造,注意:type()和tableWidget()不复制
5、QBrush QTableWidgetItem::background() const
返回背景色
6、Qt::CheckState QTableWidgetItem::checkState() const
返回当前是否选中的状态:Qt::Unchecked:未选中Qt::Checked:选中等
7、QTableWidgetItem * QTableWidgetItem::clone() const
复制本项
8、int QTableWidgetItem::column() const
返回项所在的列,如果不在表中,返回-1
9、[virtual] QVariant QTableWidgetItem::data(int role) const
返回给定角色的数据。
role:
常用的role
Qt::DisplayRole
0
The key data to be rendered in the form of text. (QString)Qt::DecorationRole
1
The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap)Qt::EditRole
2
The data in a form suitable for editing in an editor. (QString)Qt::ToolTipRole
3
The data displayed in the item's tooltip. (QString)Qt::StatusTipRole
4
The data displayed in the status bar. (QString)Qt::WhatsThisRole
5
The data displayed for the item in "What's This?" mode. (QString)Qt::SizeHintRole
13
The size hint for the item that will be supplied to views. (QSize)
描述外观的role
Qt::FontRole
6
The font used for items rendered with the default delegate. (QFont)Qt::TextAlignmentRole
7
The alignment of the text for items rendered with the default delegate. (Qt::AlignmentFlag)Qt::BackgroundRole
8
The background brush used for items rendered with the default delegate. (QBrush)Qt::BackgroundColorRole
8
This role is obsolete. Use BackgroundRole instead.Qt::ForegroundRole
9
The foreground brush (text color, typically) used for items rendered with the default delegate. (QBrush)Qt::TextColorRole
9
This role is obsolete. Use ForegroundRole instead.Qt::CheckStateRole
10
This role is used to obtain the checked state of an item. (Qt::CheckState)Qt::InitialSortOrderRole
14
This role is used to obtain the initial sort order of a header view section. (Qt::SortOrder). This role was introduced in Qt 4.8.扩展的role
Qt::AccessibleTextRole
11
The text to be used by accessibility extensions and plugins, such as screen readers. (QString)Qt::AccessibleDescriptionRole
12
A description of the item for accessibility purposes. (QString)用户role
Qt::UserRole
32
The first role that can be used for application-specific purposes.10、Qt::ItemFlags QTableWidgetItem::flags() const
返回项目前的标志。包括是否被点击、是否被编辑、是否被选中。
11、QFont QTableWidgetItem::font() const
返回项用的文字的字体
12、QBrush QTableWidgetItem::foreground() const
返回项的前景色(例如:字的颜色)
13、QIcon QTableWidgetItem::icon() const
返回项的图标
14、bool QTableWidgetItem::isSelected() const
返回项是否被选择
15、void QTableWidgetItem::read(QDataStream & in)
从流中读取项???
16、int QTableWidgetItem::row() const
返回项所在的行,如果没有在表中,返回-1
17、void QTableWidgetItem::setBackground(constQBrush & brush)
设置项的背景色
18、void QTableWidgetItem::setCheckState(Qt::CheckState state)
设置项的被点击状态。
19、void QTableWidgetItem::setData(int role, constQVariant & value)
设置给定角色的值。
20、void QTableWidgetItem::setFlags(Qt::ItemFlags flags)
设置项的标志:是否被选择等。
21、void QTableWidgetItem::setFont(constQFont & font)
设置项的字体
22、void QTableWidgetItem::setForeground(constQBrush & brush)
设置项的前景色
23、void QTableWidgetItem::setIcon(constQIcon & icon)
设置项的图标
24、void QTableWidgetItem::setSelected(bool select)
设置项是否被选择
25、void QTableWidgetItem::setSizeHint(constQSize & size)
设置项的提示大小(提示大小有默认大小的意思)
26、void QTableWidgetItem::setStatusTip(constQString & statusTip)
设置项的状态提示
27、void QTableWidgetItem::setText(constQString & text)
设置项显示的文字
28、void QTableWidgetItem::setTextAlignment(int alignment)
设置文字对齐方式
The horizontal flags are:
Qt::AlignLeft
0x0001
Aligns with the left edge.Qt::AlignRight
0x0002
Aligns with the right edge.Qt::AlignHCenter
0x0004
Centers horizontally in the available space.Qt::AlignJustify
0x0008
Justifies the text in the available space.The vertical flags are:
Qt::AlignTop
0x0020
Aligns with the top.Qt::AlignBottom
0x0040
Aligns with the bottom.Qt::AlignVCenter
0x0080
Centers vertically in the available space.You can use only one of the horizontal flags at a time. There is one two-dimensional flag:
Qt::AlignCenter
AlignVCenter | AlignHCenter
Centers in both dimensions.
29、void QTableWidgetItem::setToolTip(constQString & toolTip)
设置工具提示(提示这是项是干什么用的,与状态提示有区别)
30、void QTableWidgetItem::setWhatsThis(constQString & whatsThis)
设置帮助信息
31、QSize QTableWidgetItem::sizeHint() const
返回项的提示大小
32、QString QTableWidgetItem::statusTip() const
返回项的状态提示
33、QTableWidget * QTableWidgetItem::tableWidget() const
返回项所在的表
34、QString QTableWidgetItem::text() const
返回项的显示的文本
35、int QTableWidgetItem::textAlignment() const
返回项文本的对齐方式
36、QString QTableWidgetItem::toolTip() const
返回项的工具提示
37、int QTableWidgetItem::type() const
返回项的类型
38、QString QTableWidgetItem::whatsThis() const
返回项的帮助信息
39、void QTableWidgetItem::write(QDataStream & out) const
将项写入流
40、bool QTableWidgetItem::operator<(constQTableWidgetItem & other) const
项的运算符重载:<
41、QTableWidgetItem & QTableWidgetItem::operator=(constQTableWidgetItem & other)
项的运算符重载:=
- Qt中文手册 之 QTableWidgetItem
- Qt中文手册 之 QHeaderView
- Qt中文手册 之 QApplication
- Qt中文手册 之 QTableWidget
- Qt中文手册 之 QTreeWidget
- Qt中文手册 之 QTreeWidgetItem
- Qt QTableWidget 最后一览自适应宽度 、QTableWidgetItem 文字 居中对其、 显示中文
- QTableWidgetItem
- Qt解读之qmake手册
- 《Doxygen中文手册》之索引
- 《Doxygen中文手册》之安装
- OpenSSL中文手册之命令行
- OpenSSL中文手册之理论基础
- Qt中 QTableWidgetItem设置编辑状态小技巧
- Qt之中文乱码
- 读书笔记之:GNU make中文手册
- xdebug中文手册之相关函数
- xdebug中文手册之相关函数
- ThreadLocal的使用
- linux常用命令
- Cocoapods第三方管理工具的安装
- mysql表空间被占用,同名表无法创建或导入
- dubbo发布webservice服务
- Qt中文手册 之 QTableWidgetItem
- Maven学习记录(三)--实战引入Spring支持
- MongoDB数据库启动和停止
- 网易视频云技术分享:UML调试Linux内核
- 计算原理课堂笔记(二)
- Struts2的国际化和访问资源文件的几种方式
- Activity的生命周期
- iOS设置状态栏样式,statusBarStyle
- leetcode No238. Product of Array Except Self