QFrame类的使用

今天在写一个程序的时候需要使用QFrame类,在这里总结一下常用的用法。
为什么要总结这个呢?虽然可以随用随查文档,但是当你真正写代码的时候,是很难沉浸下来好好研究文档的,所以我趁现在有时间好好学一下这个框架

这也是一个窗口框架,他的父类是QWidget

setFrameShape(QFrame::Shape)

这个函数的功能是设置窗体的形状,其中的QFrame::Shape有一下几种
在这里插入图片描述一共七种形状可以设置,在这七种形状之外,还有三种阴影

setFrameShadow(QFrame::Shadow)

这个可以设置窗口的阴影效果,有以下三种样式
在这里插入图片描述这里由张表可以展示不同的效果
在这里插入图片描述

setFrameStyle(int style)

这个函数呀,就比较方便了,可以同时设置shadowshape,要通过|符号进行连接

frame->setFrameStyle(QFrame::Sunken | QFrame::Box)

QFrame的三种宽度属性

A frame widget has three attributes that describe the thickness of the border: lineWidth, midLineWidth, and frameWidth.

The line width is the width of the frame border. It can be modified to customize the frame’s appearance.

The mid-line width specifies the width of an extra line in the middle of the frame, which uses a third color to obtain a special 3D effect. Notice that a mid-line is only drawn for Box, HLine and VLine frames that are raised or sunken.

The frame width is determined by the frame style, and the frameWidth() function is used to obtain the value defined for the style used.这个好像没有直接设置他的函数

The margin between the frame and the contents of the frame can be customized with the QWidget::setContentsMargins()function.这里的contentsMargins是距离Frame边缘的距离,函数原型为:

void QWidget::setContentsMargins(int left, int top, int right, int bottom)

一看就知道怎么用了吧

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值