網站首頁 編程語言 正文
1.概述
void setFrameShape(Shape)
QFrame繼承QWidget,QFrame類是具有框架的小部件的基類,例如QLabel、QTextEdit,這些直接或間接繼承QFrame類,都擁有框架。
主要有下面幾個作用:
- 改變框架形狀
- 改變框架陰影
- 改變框架的線寬
- 改變框架的樣式
- 改變框架的矩形
2.常用數據接口
2.1設置框架矩形
void setFrameRect(const QRect &)
2.2設置框架陰影
void setFrameShadow(Shadow)
2.3設置框架形狀
void setFrameShape(Shape)
2.4設置樣式
void setFrameStyle(int style)
2.5設置線寬
void setLineWidth(int)
2.6設置中線寬
void setMidLineWidth(int)
以下是組合效果圖
3.示例
下面展示了4種不一樣的邊框樣式
源碼:
#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
Widget::Widget(QWidget *parent) :
? ? QWidget(parent),
? ? ui(new Ui::Widget)
{
? ? ui->setupUi(this);
? ? ui->frame->setStyleSheet("background-color:cyan;");
? ? ui->frame_2->setStyleSheet("background-color:red;");
? ? ui->frame_3->setStyleSheet("background-color:green;");
? ? ui->frame_4->setStyleSheet("background-color:yellow;");
? ? ui->frame->setLineWidth(3);
? ? ui->frame->setMidLineWidth(3);
? ? ui->frame->setFrameShape(QFrame::Box);
? ? ui->frame->setFrameShadow(QFrame::Raised);
? ? ui->frame_2->setLineWidth(3);
? ? ui->frame_2->setMidLineWidth(3);
? ? ui->frame_2->setFrameShape(QFrame::Box);
? ? ui->frame_2->setFrameShadow(QFrame::Sunken);
? ? ui->frame_3->setLineWidth(3);
? ? ui->frame_3->setMidLineWidth(3);
? ? ui->frame_3->setFrameShape(QFrame::Panel);
? ? ui->frame_3->setFrameShadow(QFrame::Raised);
? ? ui->frame_4->setLineWidth(3);
? ? ui->frame_4->setMidLineWidth(3);
? ? ui->frame_4->setFrameShape(QFrame::Panel);
? ? ui->frame_4->setFrameShadow(QFrame::Sunken);
}
Widget::~Widget()
{
? ? delete ui;
}
原文鏈接:https://blog.csdn.net/wzz953200463/article/details/125433624
相關推薦
- 2022-06-12 C語言棧與隊列相互實現詳解_C 語言
- 2022-10-14 el-tree 懶加載,默認加載N級.異步加載子節點
- 2022-08-25 windows下搭建Consul集群_云其它
- 2022-08-15 centos7 redis5安裝
- 2022-10-27 Apache?Hive?通用調優featch抓取機制?mr本地模式_Linux
- 2023-11-19 如何將電腦復制的內容粘貼進MobaXterm?如何復制粘貼
- 2022-04-25 ASP.NET?Core?MVC中使用Tag?Helper組件_實用技巧
- 2022-08-22 Git遠程刪除某個歷史提交記錄方法詳解_相關技巧
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支