日志
-
2022-06-15 08:43
-
原文章出处
阅读全文»分类:默认分类|回复:0|浏览:829
1.不换行:复制代码QJsonObject json;
//...
QJsonDocument doc(json);
QString str_json(doc.toJson(QJsonDocument::Compact));
//写入文件...效果图:
2.换行:复制代码QJsonObject json;
//...
QJsonDocument doc(json);
QString str_json(doc.toJson(QJsonDocument::Indented));
//写入文件...效果图:
-
2022-06-05 12:42
-
复制代码在.pro中添加
阅读全文»分类:默认分类|回复:0|浏览:1654
###朗读模块
QT += texttospeech
复制代码#include <QMainWindow>
//包含头文件
#include <QtTextToSpeech/QTextToSpeech>
//添加用到的头文件
#include <QTimer>
#include <QDateTime>
tts = new QTextToSpeech(this);
tts->setLocale(QLocale::Chinese);//设置语言环境
tts->setRate(0.0);//设置语速-1.0到1.0
tts->setPitch(1.0);//设置音高-1.0到1.0
tts->setVolume(1.0);//设置音量0.0-1.0
if(tts->state()==QTextToSpeech::Ready)
{
for(int i=0;i<10;i++ ..
-
2022-05-06 19:32
-
复制代码auto font = this->font();
阅读全文»分类:QT|回复:0|浏览:1012
//使用自定义字体
QString fontName;
int loadedFontID = QFontDatabase::addApplicationFont("./DroidSansFallback.ttf");
QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(loadedFontID);
if(!loadedFontFamilies.empty()){
fontName = loadedFontFamilies.at(0);
font.setFamily(fontName);
}
-
2022-01-21 19:14
-
.h
阅读全文»分类:QT|回复:0|浏览:972
复制代码第一种获取方法:原作者文章出处
Mac_label = new QLabel;
Mac_label->setFixedSize(1000,80);
QList <QNetworkInterface> interfaces =QNetworkInterface::allInterfaces();
for (auto inter : interfaces)
{
QString Mac=tr("%1").arg(inter.hardwareAddress());
Mac_label->setText("Mac地址:"+Mac);
}
#pragma once#include <QString>class GlobalApiClass{private: GlobalApiClass(); ~GlobalApiClass();public: static GlobalApiClass &GetInstance() { sta ..
-
2022-01-21 09:40
-
复制代码1方法一
阅读全文»分类:QT|回复:0|浏览:851
QString Widget::getIP() //获取ip地址
{
QList<QHostAddress> list = QNetworkInterface::allAddresses();
for (int i=0;i<list.size();i++)
{
if(list.at(i) !=QHostAddress::LocalHost&&list.at(i).toIPv4Address()) //我们使用IPv4地址
{
return list.at(i).toString();
qDebug()<<"本机IP是:"<<list.at(i).toString();
}
}
return 0;
}
2.使用过滤 重庆小倪
复制代码QList<QHostAddress> list = QNetworkInterface::allAddresses();
foreach ( ..
-
2021-11-11 16:49
-
复制代码//方式1 需要主函数中事件循环判断 //qApp->exit(773); //重启代码,773 = 'r'+'e'+'s'+'t'+'a'+'r'+'t' ==>restart
阅读全文»分类:默认分类|回复:0|浏览:1355
//方式2 直接重启
// #ifdef Q_OS_WIN qApp->closeAllWindows();
QProcess::startDetached(qApp->applicationFilePath(), QStringList()); exit(0);
#elif defined (Q_OS_LINUX) qApp->closeAllWindows();
QProcess::startDetached(qApp->applicationFilePath(), QStringList("-qws"));
QProcess::execute("-qws ..
-
2021-08-22 21:23
-
复制代码在ubuntu软件中心搜索byzanz或者通过apt-get下载
阅读全文»分类:默认分类|回复:0|浏览:897
sudo apt-get install byzanz
下载完成后打开命令行输入byzanz-record --help
其中我们重点关注几个参数
* -d 动画录制的时间,默认录制10秒
* -e 动画开始延迟
* -x 录制区域的起始X坐标
* -y 录制区域的起始Y坐标
* -w 录制区域的宽度
* -y 录制区域的高度
那么怎么知道我要录制区域的坐标和高度呢,其实系统自带这个命令工具.
输入xwininfo会提示你选择一个窗口,点击之后会返回这个窗
Absolute upper-left X: 开始的X坐标,绝对值
Absolute upper-left Y: 同上
Width: 窗口宽 ..
-
2021-08-16 22:35
-
复制代码//来自》》》https://www.cnblogs.com/liuyunfeifei/archive/2013/02/21/2919960.html
阅读全文»分类:QT|回复:0|浏览:1474
//拷贝文件:
bool Widget::copyFileToPath(QString sourceDir ,QString toDir, bool coverFileIfExist)
{
toDir.replace("\\","/");
if (sourceDir == toDir){
return true;
}
if (!QFile::exists(sourceDir)){
return false;
}
QDir *createfile = new QDir;
bool exist = createfile->exists(toDir);
if (exist){
if(coverFileIfExist){
createfile->remove(toDir);
}
}//end if
if(!QFile::co ..
-
2021-07-26 22:07
-
Win10完美去除桌面快捷图标小箭头
阅读全文»分类:Win 笔记收藏|回复:1|浏览:1380
这两天笔记本硬盘坏了,一些数据不能恢复了,哎,才买了一年多的电脑,竟然因为硬盘老化突然出现
很多磁盘坏道,尝试各种方式读盘均失败,各种工具都无法检测磁盘的存在。无奈之下,拿到电脑维修
部去修,同样无法恢复数据!!!
还好,有些内容是永久保留在了头脑中,所以,记在头脑中的东西才是永恒的。
今天,给大家分享一个如何完美去除Win10桌面快捷图标小箭头的技巧,希望能够给大家带来帮助。
去掉小箭头
regadd
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ ..
-
2021-07-25 02:27
-
//处理缩放
阅读全文»分类:QT|回复:0|浏览:1078
#include <QScreen>
//处理缩放
public Q_SLOTS:
void onLogicalDotsPerInchChanged(qreal dpi);
private:
void findChild(const QObject &o);
int scaleUI(int spec);
private:
double m_preRate;
double m_scaleFromPreRate;
//处理缩放
ui->next->resize(scaleUI(93), scaleUI(28));
ui->play->resize(scaleUI(186), scaleUI(56));
ui->tableWidget->resize(scaleUI(93), scaleUI((28)));
QList<QScreen*> screens = QApplication::screens();
if (screens.size() &g ..


