生命在于折腾之学习Qt实录

今天下午开始搞Qt.

怎么下载,怎么安装,怎么寻找合适的教程,怎样弄第一个Helloworld程序。一头雾水。

http://blog.163.com/lzgxyq1113@126/blog/static/1721430752011483560154/


点点滴滴

如何在tablewidget的单元格中绘制图标?

A:tableWidget->setItem(0,1,new QTableWidgetItem(QIcon("images/IED.png"), "Jan's month"));

  1. Qt::WindowFlags 使窗口支持无边框 [From Qt Doc:This enum type is used to specify various window-system properties for the widget. They are fairly unusual but necessary in a few cases. Some of these flags depend on whether the underlying window manager supports them.]。使用 Qt::WindowFlags 可以实现一些不同类型的窗口,如:用 Qt::FramelessWindowHint 来实现无边框窗口,用 Qt::Popup 来实现弹出式的窗口,用 Qt::Tool 来实现工具窗口,用Qt::CustomizeWindowHint 来关闭窗口标题栏以及与 Qt::WindowCloseButton(添加关闭按钮),Qt::WindowMaximumButtonSize(添加最大化按钮)联用来建立只有关闭按钮和最大化按钮的窗口,用 Qt::WindowStaysOnTopHint 使窗口永远在最前端等。
  2. Qt::WidgetAttribute 使窗口支持透明背景以及在关闭后主动销毁。其它一些常用的 Attribute 有:Qt::WA_AcceptDrops 使 widget 支持拖拽操作,Qt::WA_MouseTracking 使 widget 及时响应鼠标移动事件(MouseMoveEvent)。
  3. Qt::setMask() 函数对窗口进行部分区域遮掩来实现各种形状的窗口。[From Qt Doc:Causes only the pixels of the widget for whichbitmap has a corresponding 1 bit to be visible. If the region includes pixels outside the rect() of the widget, window system controls in that area may or may not be visible, depending on the platform.]。
  4. Qt::ContextMenuPolicy 来配置窗口的右键菜单方案。[From Qt Doc:This enum type defines the various policies a widget can have with respect to showing a context menu.]。
  5. paintEvent() 回调函数来对窗口进行绘制。
  6. 重写 mousePressEvent() 和 mouseMoveEvent() 函数来实现窗口的拖拽移动(无边框窗口没有标题栏,默认拖拽窗体是没法移动窗口的)。




评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值