我的主页

快递查询 :http://m.kuaidi100.com     爱快递查询 :http://www.aikuaidi.cn/              

http://www.qtcn.org/bbs/u/168050  [收藏] [复制]

w642833823

  • 10

    关注

  • 68

    粉丝

  • 42

    访客

  • 等级:新手上路
  • 总积分:43
  • 保密,2011-12-07

最后登录:2024-04-29

更多资料

日志

2020-05-15 13:13

QString 转C++自带标准string
思路:
使用QString类自带的toStdStirng()函数即可
例子std::string str;QString qStr = "两袖清风";str =qStr.toStdString();//c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同.qDebug()<<str.c_str()<<endl;12345
string 转QString
思路:

使用QString自带的静态构造函数 fromStdString(string &s)即可
例子std::string str="两袖清风";QString qStr=QString::fromStdString(str);qDebug()<<qStr.toUtf8().data()<<endl;头文件:# ..

阅读全文»分类:QT|回复:0|浏览:363
2020-05-09 15:05

//获取当前系统语言环境,并设置语言
static QString find_translation_file()
{
QString locale = QLocale::system().name(); // language code + country code (xx_XX)
QString language = locale.mid(0, 2); // language code (first two chars of locale)
QString translation_file_basename =
//QDir(Paths::translationPath()).absoluteFilePath("mystiq_");
QDir(":/translations/").absoluteFilePath("mystiq_");

// look for mystiq_xx_XX.qm in the translation directory
QString trans ..

阅读全文»分类:QT|回复:0|浏览:631
2020-04-24 13:51

QDir dir3;
//判断以参数中为路径名的路径是否存在,如果存在该路径则返回真
if(dir3.exists(Path)==NULL)
{
//该函数是创建以Path为路径的一个路径,如果父路径不存在的话,则一起同时创建;创建成功返回1,否则返回0
// dir3.mkdir(Path);
dir3.mkpath(Path);
qDebug()<<"路径创建成功";

}
else
qDebug()<<"路径已经存在";

阅读全文»分类:QT|回复:0|浏览:571
2020-04-01 14:56

//复杂的QTJson数组QJsonArray arrays; for (int i = 0; i < 5;i++) { arrays.insert(i, QString("复杂数据组:%1").arg(image)); } QJsonObject json_ct; json_ct.insert("ct","24"); json_ct.insert("cv","10000"); QJsonObject json_albumMid; json_albumMid.insert("albumMid",QString("%1").arg(album_Mid));
QJsonObject json_albumDetail; json_albumDetail.insert("module","music.musichallAlbum.AlbumInfoServer"); json_a ..

阅读全文»分类:QT|回复:0|浏览:551
2019-10-03 23:39

import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtMultimedia 5.4

ApplicationWindow {
title: qsTr("简易视频播放器")
width: 640
height: 480
visible: true
Rectangle {
color: "black"
anchors.fill: parent

MediaPlayer {
id: mediaPlayer
source: "file:///storage/sdcard0/1.mp4"
autoPlay: true
}

Rectangle {
color: "black"
anchors.fill: parent

VideoOutput {
id: video
anchors.fill ..

阅读全文»分类:手机端开发版|回复:0|浏览:1193
2019-09-24 16:50

//需要指定文件路径,和后缀名

QString GetName::set_file_name(QString path,QString suffix_name)
{
//判断路径是否存在
QDir dir(path);
if(!dir.exists())
{
return "文件夹不存在或者路径不正确";
}
dir.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();

int file_count = list.count();
if(file_count <= 0)
{
return "文件不存在";
}
//开始处理

QString string_list;
for(int i=0; i<list.count();i++)
{
QFileInfo file_info = list.at(i ..

阅读全文»分类:QT|回复:0|浏览:744
2019-09-13 17:26

//单独设置背景图片


QString path =QString("background-image:url(../storage/sdcard1/Music/image/%2.png)").arg(name);

song_pic->setStyleSheet(path);

阅读全文»分类:手机端开发版|回复:2|浏览:690
2019-09-12 21:55

#include <QtNetwork>
//#include <QHostInfo>
//#include <QHostAddress>

/*
*获取本机Ip地址
*/

QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
QString ipAddress;
// use the first non-localhost IPv4 address
for (int i = 0; i < ipAddressesList.size(); ++i) {
if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
ipAddressesList.at(i).toIPv4Address()) {
ipAddress = ipAddressesList.at(i).toString();
break;
}
}
// if we did not ..

阅读全文»分类:默认分类|回复:0|浏览:830
2019-09-11 05:25

可以使用setFixedsize函数来指定大小

阅读全文»分类:QT|回复:1|浏览:675
2019-09-11 05:21

###指定moc命令将含Q_OBJECT的头文件转换成标准.h文件的存放目录
MOC_DIR=$$PWD/../temp/moc
RCC_DIR=$$PWD/../temp/rcc
UI_DIR=$$PWD/../temp/ui
OBJECTS_DIR=$$PWD/../temp/obj
DESTDIR=$$PWD/../temp/bin

阅读全文»分类:QT|回复:1|浏览:602

Powered by phpwind v8.7 Certificate Copyright Time now is:05-01 01:21
©2005-2016 QTCN开发网 版权所有 Gzip disabled