QT设置字体与颜色
来源:互联网 发布:淘宝的鹰眼系统 编辑:程序博客网 时间:2024/05/19 19:39
头文件:
#include <QFont>
#include <QFontDialog>
#include <QColor>
#include <QColorDialog>
user interface complier
QColor
QFont
QFontDialog
QDataTime
程序代码:
//设置字体
void MainWindow::setFontSlot()
{
//get user select Font
bool ok;
QFont font = QFontDialog::getFont(&ok,this);
if(ok)
{
ui->textEdit->setFont(font);
//font is set to the font the user selected
}
else
{
QMessageBox::information(this,"Error Message","Eoor Set Font!!!")
//the user canceld the dialog;font is set to the default
//application font,QApplication::font()
}
}
//设置颜色
void MainWindow::setColorSlot()
{
QColor color = QColorDialog::getColor(Qt::red,this); //设置初始化颜色为红色
if(color.isValid())
{
ui->textEdit->setTextColor(color);
}
else
{
QMessageBox::information(this,"Error Message","Color is Invalid");
return;
}
}
#include <QFont>
#include <QFontDialog>
#include <QColor>
#include <QColorDialog>
user interface complier
QColor
QFont
QFontDialog
QDataTime
程序代码:
//设置字体
void MainWindow::setFontSlot()
{
//get user select Font
bool ok;
QFont font = QFontDialog::getFont(&ok,this);
if(ok)
{
ui->textEdit->setFont(font);
//font is set to the font the user selected
}
else
{
QMessageBox::information(this,"Error Message","Eoor Set Font!!!")
//the user canceld the dialog;font is set to the default
//application font,QApplication::font()
}
}
//设置颜色
void MainWindow::setColorSlot()
{
QColor color = QColorDialog::getColor(Qt::red,this); //设置初始化颜色为红色
if(color.isValid())
{
ui->textEdit->setTextColor(color);
}
else
{
QMessageBox::information(this,"Error Message","Color is Invalid");
return;
}
}
阅读全文
0 0
- QT设置字体与颜色
- 设置字体与颜色
- Qt 设置QLabe中字体的颜色
- QT设置QPushButton的Text字体颜色
- QT 文字字体和颜色设置
- Qt creator 设置按键字体颜色
- QT中字体和颜色的设置
- QT设置QLabel中字体的颜色
- Qt 设置QLabe中字体的颜色
- qt的字体和颜色设置对话框
- Qt设置QLabel中字体的颜色
- QT中设置字体和更改字体颜色
- QT中设置字体和更改字体颜色
- SecureCRT 字体颜色与背景设置
- iOS 状态栏隐藏与字体颜色设置
- XCode6 设置代码字体与颜色
- 使用Qt 4如何设置QLabe中字体的颜色
- 使用Qt 4如何设置QLabe中字体的颜色
- 中国移动业务支撑系统简介(BOSS、BASS、BOMC、4A及VGOP)
- [RK3288][Android6.0] 调试笔记 --- Netd测试工具ndc
- fragment 的生命周期的补充说明--特别要注意的四点
- 同时打开多个模拟器
- LightOJ
- QT设置字体与颜色
- php接口文件(token)
- Fragment启动生命周期
- 理解协程的运行流程
- Objective -C
- 字符串的替换空格问题
- 实例3-2 List Leaves
- 用户填表有大量数据的数据提交解决方式
- [ASP.NET]内置对象简介