QT5-控件-QFontComboBox-字体选择下拉列表,使用一个标签查看效果
#ifndef MAINWINDOW_H
#define MAINWINDOW_H #include <QMainWindow>
#include <QFontComboBox>
#include <QFont>
#include <QLabel> class MainWindow : public QMainWindow
{
Q_OBJECT public:
MainWindow(QWidget *parent = );
~MainWindow(); QFontComboBox* fc[];
QLabel* label ;
public slots:
void changedFont(const QFont& f);
}; #endif // MAINWINDOW_H
#include "mainwindow.h" MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
this->resize(,);
this->centralWidget(); for(int i= ; i<;i++)
{
fc[i] = new QFontComboBox(this);
} fc[]->setFontFilters(QFontComboBox::AllFonts);
fc[]->setFontFilters(QFontComboBox::ScalableFonts);
fc[]->setFontFilters(QFontComboBox::NonScalableFonts);
fc[]->setFontFilters(QFontComboBox::MonospacedFonts);
fc[]->setFontFilters(QFontComboBox::ProportionalFonts); int ypos = ;
for(int i=;i<;i++)
{
fc[i]->setGeometry(,ypos,,);
ypos += ;
} label = new QLabel("用此标签查看字体效果",this);
label->setGeometry(,,,);
connect(fc[],SIGNAL(currentFontChanged(QFont)),this,SLOT(changedFont(QFont)));
} MainWindow::~MainWindow()
{ } void MainWindow::changedFont(const QFont& f)
{
label->setFont(f);
}
#include "mainwindow.h"
#include <QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show(); return a.exec();
}

QT5-控件-QFontComboBox-字体选择下拉列表,使用一个标签查看效果的更多相关文章
- CheckBoxList控件获取多选择,需要遍历
CheckBoxList控件获取多选择,需要遍历,环境:vs2008 在页面上添加CheckBoxList控件,输入项值 a,b,c,d.然后添加按钮 Button2确定,如何获取CheckBoxLi ...
- 背水一战 Windows 10 (6) - 控件 UI: 字体的自动继承的特性, Style, ControlTemplate
[源码下载] 背水一战 Windows 10 (6) - 控件 UI: 字体的自动继承的特性, Style, ControlTemplate 作者:webabcd 介绍背水一战 Windows 10 ...
- [原创]C#按比例缩放窗体控件及字体
按照比例缩放窗体控件及字体,如需等比例缩放,只需将x,y的比例设置成相同即可. 为了减小误差,建议使用原始尺寸来计算比例. private float X, Y; private bool b = f ...
- 重新想象 Windows 8 Store Apps (15) - 控件 UI: 字体继承, Style, ControlTemplate, SystemResource, VisualState, VisualStateManager
原文:重新想象 Windows 8 Store Apps (15) - 控件 UI: 字体继承, Style, ControlTemplate, SystemResource, VisualState ...
- 如何修改全部DevExpress控件的字体
引用:https://www.devexpress.com/Support/Center/Question/Details/A2761 You can change the default font ...
- DS控件库 DS开放式下拉列表
在一些场合中,需要使用组合式下拉列表控件,比如带treeivew的combobox,但是代码较多,使用不便.为此,本人制作了一个超级易用的DS开放式下拉列表. 以下演示使用过程. Private Su ...
- UIWebView控件中 字体大小和字体样式的修改
修改UIWebView控件中字体的样式: NSString *htmlString = [NSString stringWithContentsOfFile:self.webPath encoding ...
- PyQt学习随笔:ListView控件获取当前选择项的方法
通过currentIndex()可以获取listView控件的当前选择元素,如果选择了多个,则可以通过selectedIndexes()来获取选择的元素,不过这两个函数返回的是元素数据,而不是索引编号 ...
- Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,相似图片浏览器
MAC : XCode -> Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,类似图片浏览器 STEP1:将两个目录复制到project里面ImageBrowser ...
随机推荐
- IOS 多个UIImageView 加载高清大图时内存管理
IOS 多个UIImageView 加载高清大图时内存管理 时间:2014-08-27 10:47 浏览:59人 当我们在某一个View多个UIImageView,且UIImageView都显示的是 ...
- js渲染引擎 tempo.js
1.引入tempo.js <script src="js/tempo.js" type="text/javascript"></script& ...
- Keil C51库函数原型列表
//1. CTYPE.H bit isalnum(char c): bit isalpha(char c): bit iscntrl(char c): bit isdigit(char c): bit ...
- SDUT2484 算术表达式的转换(表达式树)
题目链接. 分析: 转换成表达式树,然后先序.中序.后序遍历. AC代码如下: #include <stdio.h> #include <string.h> #define m ...
- 9. memcpy() memccpy() memmove() strcpy() memset()
部分参考: http://www.cppblog.com/kang/archive/2009/04/05/78984.html 表头文件: #include <string.h>定义函数: ...
- cf700A As Fast As Possible
On vacations n pupils decided to go on excursion and gather all together. They need to overcome the ...
- 关于fork函数
这篇文章说得非常好.做个记录: 链接:http://coolshell.cn/articles/7965.html
- N - Marriage Match II - HDU 3081(最大流)
题目大意:有一些男孩和女孩玩一个游戏,每个女孩都可以挑一个男孩来进行这个游戏(所有人都要参加),女孩只会挑选她喜欢的男孩,并且她们认为她们朋友喜欢的男孩她们也是喜欢的(朋友的男朋友也是我的男朋友??? ...
- poj1190 生日蛋糕 dfs
题意:生日蛋糕有m层,总体积是V.从下向上,每一层的半径r和高度h都是递减的. 给m.v,求最小的表面积s.(不算底面接地的面积) 题目链接:poj1190 剪枝都还没加..样例输出都是错的...还没 ...
- 【转】ASP.NET MVC 数据验证及相关内容
原文地址:http://www.jb51.net/article/56713.htm 一.数据验证 数据验证的步骤在模型类中添加与验证相关的特性标记在客户端导入与验证相关的js文件和css文件使用与验 ...