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 ...
随机推荐
- XCode7打包上传报错
在XCode7上传应用时,上传失败遇到两个错误,提示如下: ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundl ...
- ubuntu下MySQL安装配置及基本操作
在linux下安装方法: 分为四种:一: 直接用软件仓库自动安装(如:ubuntu下,sudo apt-get install mysql-server; Debain下用yum安装): 二:官网下载 ...
- [Android] 输入系统(一)
Android输入系统是人与机器交互最主要的手段.我们通过按键或者触碰屏幕,会先经由linux产生中断,进行统一的处理过后,转换成Android能识别的事件信息,然后Android的输入系统去获取事件 ...
- Sql语句中IN等方面的用法
select * from txt1 select * from txt2 select * from txt1 where name in (select name from txt2 where ...
- POJ1163——The Triangle
Description 73 88 1 02 7 4 44 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program t ...
- Java NIO 和 IO 的区别详解
Java NIO为jdk1.4提供了新的API,本文主要来比较一下Java中NIO和IO的区别,Java初学者可以了解一下. 下表总结了Java NIO和IO之间的主要差别,我会更详细地描述表中每部分 ...
- 【.NET跨平台】mac上安装VS for mac步骤详解
安装过程中提示以下内容 提示原文如下 It was not possible to complete an automatic installation. This might be due to a ...
- SKPhysicsContact类
继承自 NSObject 符合 NSObject(NSObject) 框架 /System/Library/Frameworks/SpriteKit.framework 可用性 可用于iOS 7.0 ...
- 一个int类型究竟占多少个字节
一个int占多少个字节? 这个问题我们往往得到的答案是4. 可是int究竟占多少个字节,却跟你的机器环境有关. As you can see, the typical data type sizes ...
- 两台Linux机之间传送文件
最近实验室里接管了一台服务器,经常需要用到服务器与自己主机之间进行文件传输,因此,在此介绍一下两台Linux主机之间的一些操作,方便后来者. 1. Linux.Windows主机远程访问Linux服务 ...