QT学习心得

1、QPushButton  设置了消息toggled(bool),但是对应的信息褿没反应?

解决方法:要设置属性setCheckable(true);

按钮的名字如何自动变动?

 

2、界面布局根据现有组件自动调中

 只需将布局设置 setSizeConstraint(QLayout::SetFixedSize);

 

3、对Qt中的角色一直不是很清楚,今天看到QListWidgetItem有几个角色,每个角色都关联一个QVariant

   它最常用的角色是Qt::DisplayRole、Qt::EditRole、Qt::IconRole, 并且这些角色都有方便的设置和获取的函数setText()和setIcon()  Qt::UserRole item->setData(Qt::UserRole, i.key())  ??

QDialogButtonBox::ActionRole);????

 

 

4、QDialog  done(int result

void QDialog::done ( int r )   [virtual slot]

Closes the dialog and sets its result code to r. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return r.)

 

 As with QWidget::close(), done() deletes the dialog if the Qt::WA_DeleteOnClose flag is set. If the dialog is the application's main widget, the application terminates. If the dialog is the last window closed, the QApplication::lastWindowClosed() signal is emitted.

 

当点击OK 或是Cancel按钮时会自动调用done()

5、默认情况下,QListWidget是只读的,如果想让用户编辑这些项,则可以是使用QAbstractItemView::setEditTriggers()设置这个编辑的触发器

 

 

6、有空把布局的技巧总结一下

7、QPointF定义平面上的一个点,精度是float

 

 

 

 

你可能感兴趣的:(QT学习心得)