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

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值