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 ...
随机推荐
- setNeedsDisplay 和 setNeedsLayout-b
setNeedsDisplay: Marks the receiver’s entire bounds rectangle as needing to be redrawn. drawRect: Th ...
- JLRoutes--处理复杂的URL schemes-备
关键字:URL,URL schemes,Parse 代码类库:网络(Networking) GitHub链接:https://github.com/joeldev/JLRoutes JLRout ...
- 2、vs2012无法从模型更新到数据库的问题
在模型设计视图空白处选择“从模型生成到数据库…”:不出意外的话应该是打开生成的脚本,当然也可能出现如下的错误,请下载最新的SQL Server Data Tool(我本地VS2012,数据库SQLSe ...
- JAVA与C#关于JSON序列化的比较
JAVA CODE: import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java. ...
- 【HDOJ】2416 Treasure of the Chimp Island
bfs().题目的数据乱码.应该如下: *****#********* *.......$...* *..***.......* *....*****..* *....******37A *****. ...
- 【HDOJ】1208 Pascal's Travels
记忆化搜索.注意当除右下角0外,其余搜索到0则返回. #include <algorithm> #include <cstdio> #include <cstring&g ...
- mapreduce框架详解【转载】
[本文转载自:http://www.cnblogs.com/sharpxiajun/p/3151395.html] 开始聊mapreduce,mapreduce是hadoop的计算框架,我学hadoo ...
- 使用Jekyll搭建免费的Github Pages个人博客
一.Git 1.Git概述 Git is a free and open source distributed version control system designed to handle ev ...
- 让IE6,7,8支持HTML5新标签的方法
很多网站对网页进行重构的时候,提高标签的语义性,在网页中大量使用了section,article,header等HTML5新标签.考虑到目前win7自带的IE浏览器版本是IE8,而IE8不支持HTML ...
- Disposable microfluidic devices: fabrication, function, and application Gina S. Fiorini and Daniel T
Disposable microfluidic devices: fabrication, function, and application Gina S. Fiorini and Daniel T ...