Qt5学习(1)
1. In Qt, if you want to apply styles to the main window itself, you must apply it to
its central widget instead of the main window itself because the window is just
a container.
2.设计时先添加垂直布局,再添加水平布局。
固定控件大小时,把水平政策和垂直政策设为‘’‘fixed’,然后在mininum里输入大小。
3.布局 只有margin属性,可以 ‘’变形为’’ Widget,以求调整大小。
4 Qt的样式表跟CSS语法一样
5新建qt资源文件
To add a new .qrc file to our project, go to File | New File or Project. Then, select Qt under
the Files and Classes category and select Qt Resources File. After that, give it a name (that
is, resources) and click the Next button followed by the Finish button. The .qrc file will not
be created and automatically opened by Qt Creator。
6. Add Prefix 给资源文件添加目录
7.设置button的icon属性。改变iconsize来改变大小
pixmap属性 :You will now see the logo size no longer follow the dimension you set previously and follow the actual dimension of the image instead. We cannot change its dimension because this is simply how pixmap works。
8要想不用pixmap的方式 border-image: url(:/images/logo.png);
复制路径:To obtain the path of the image, right click the image name on the file list window
and choose Copy path.
9pseudo states:
例如:
QPushButton:hover
{
color: white;
background-color: #66c011;
border-width: 0px;
border-radius: 3px;
}
进一步自定义属性
QPushButton[pagematches=true]
{
color: white;
background-color: red;
border-width: 0px;
border-radius: 3px;
}
然后再mainwindow.cpp的构造函数下:
ui->pushButton->setProperty("pagematches",true);
读属性: QObject::property().
10 sub-controls(用双引号引入)
QSpinBox::down-button
{ image: url(:/images/spindown.png);
subcontrol-origin: padding;
subcontrol-position: right bottom;
}
Qt5学习(1)的更多相关文章
- 我的QT5学习之路(目录)
说明:本目录内容为自己学习的心得和记录,参考资料来源于网络,学习过程中多方汲取,如有错误,欢迎指正和批评. Qt开发相关文章目录 一.我的Qt学习之路系列 1.[笔记]我的Qt学习之路(一)——浅谈Q ...
- Qt5学习笔记(1)-环境配置(win+64bit+VS2013)
Qt5学习笔记(1)-环境配置 工欲善其事必先-不装-所以装软件 久不露面,赶紧打下酱油. 下载 地址:http://download.qt.io/ 这个小网页就可以下载到跟Qt有关的几乎所有大部分东 ...
- 我的QT5学习之路(三)——模板库、工具类和控件(下)
一.前言 作为第三篇的最后一部分,我们来看一下Qt的控件,谈到控件,就会让人想到界面的美观性和易操作性,进而想到开发的便捷性.作为windows界面开发的MFC曾经是盛行了多少年,但是其弊端也随着其他 ...
- 我的QT5学习之路(一)——浅谈QT的安装和配置
一.前言 说到Qt,不能不说到C++,这门伟大的语言.因为其面向对象的编程思想和陡峭的学习曲线,一开始学习起来很是吃力.Qt从QT4开始基本封装了很多C++的工具库和界面库,而且支持跨平台,这是它最大 ...
- QT5学习记录(一)
学习环境:Windows10 + QT5.13 + QT Creater4.9.1(2019-08-10 22:02:30) 1.基本工程创建操作 常规操作创建画面,可选择QDialog.MainWi ...
- qt5学习目录
qt5下载与安装,VS2017的环境配置 q ...
- 我的QT5学习之路(二)——第一个程序
一.前言 “工欲善其事,必先利其器”,上一节,我介绍了Qt的安装和配置方法,搭建了基本的开发平台.这一节,来通过一个简单的例子来了解Qt的编程样式和规范,开始喽~~~ 二.第一个程序——Hello W ...
- Qt5学习(2)
1.学习了qt quick application 这是一种跟application不同的设计方式.主要就是靠“拖拖拽拽”,然后设置属性(颜色,大小),布局(margins等),然后要注意控件的从属关 ...
- Qt5学习记录:QString与int值互相转换
1)QString转int 直接调用toInt()函数 例: QString str("100"); int tmp = str.toInt(); 或者: bool ok; QSt ...
- Qt5学习笔记(基础)
按钮 #include <QApplication> /*应用程序抽象类*/ #include <QWidget> //窗口类 #include <QPushButton ...
随机推荐
- GPU选型
1-基本概念 显存带宽 是指显示芯片与显存之间的数据传输速率,它以字节/秒为单位.显存带宽是决定显卡性能和速度最重要的因素之一. 2-常见GPU性能参数 GPU型号 单卡显存 cuda 计算能 ...
- 深入理解String、StringBuffer、StringBuilder(转)
文章系转载,非原创,原地址: http://www.cnblogs.com/dolphin0520/p/3778589.html 相信String这个类是Java中使用得最频繁的类之一,并且又是各大公 ...
- jackson java转json hibernate懒加载造成的无限递归问题
@JsonIgnore @JsonFilter @JsonBackReference @JsonManagedReference @JsonIgnoreProperties jackson中的@Jso ...
- Python--day31--TCP的长链接
- 2019-8-24-win10-uwp-读取文本GBK错误
title author date CreateTime categories win10 uwp 读取文本GBK错误 lindexi 2019-8-24 16:2:27 +0800 2018-2-1 ...
- Layout 实现三栏布局的几种方法
https://github.com/ljianshu/Blog/issues/14 布局参考 https://github.com/ljianshu/Blog/issues/38 响应式那点 ...
- 如何读取redis中的key值中的结果
redis的值有5种类型,不同的类型有不同的命令来获取: 字符直接 get key 队列 左端弹出一个元素 LPOP key 哈希 HGET key field 集合 SMEMBERS key 返回 ...
- tf.contrib.learn.preprocessing.VocabularyProcessor()
tf.contrib.learn.preprocessing.VocabularyProcessor (max_document_length, min_frequency=0, vocabulary ...
- HTTP请求各参数详解
HTTP Request的Header信息 1.HTTP请求方式 如下表: GET 向Web服务器请求一个文件 POST 向Web服务器发送数据让Web服务器进行处理 PUT 向Web服务器发送数据并 ...
- 快排java代码
定一个基准位,递归左右两边排序. public void fun(){ int arr[] = {2,3,4,5,6,7,822,3,4,5,8,6,5,4,2,1}; //System.out.pr ...