qstring

how to initialize a QString to null?

浪尽此生 提交于 2021-02-04 12:09:25
问题 What is the difference between QString::number(0) and ((const char*) 0) ? I want to initialize a QString say phoneNumber to null . Will phoneNumber(QString::number(0)) and phoneNumber((const char*) 0) both work? 回答1: To create a null QString just default initialize it: QString phoneNumber; // or if you already have a QString variable and want to 'clear' it: phoneNumber = QString(); Note that QString::number(0) is decidedly not null - it creates a QString with the value "0" . You could also

how to initialize a QString to null?

对着背影说爱祢 提交于 2021-02-04 12:08:51
问题 What is the difference between QString::number(0) and ((const char*) 0) ? I want to initialize a QString say phoneNumber to null . Will phoneNumber(QString::number(0)) and phoneNumber((const char*) 0) both work? 回答1: To create a null QString just default initialize it: QString phoneNumber; // or if you already have a QString variable and want to 'clear' it: phoneNumber = QString(); Note that QString::number(0) is decidedly not null - it creates a QString with the value "0" . You could also

how to initialize a QString to null?

别来无恙 提交于 2021-02-04 12:07:33
问题 What is the difference between QString::number(0) and ((const char*) 0) ? I want to initialize a QString say phoneNumber to null . Will phoneNumber(QString::number(0)) and phoneNumber((const char*) 0) both work? 回答1: To create a null QString just default initialize it: QString phoneNumber; // or if you already have a QString variable and want to 'clear' it: phoneNumber = QString(); Note that QString::number(0) is decidedly not null - it creates a QString with the value "0" . You could also

how to initialize a QString to null?

给你一囗甜甜゛ 提交于 2021-02-04 12:07:03
问题 What is the difference between QString::number(0) and ((const char*) 0) ? I want to initialize a QString say phoneNumber to null . Will phoneNumber(QString::number(0)) and phoneNumber((const char*) 0) both work? 回答1: To create a null QString just default initialize it: QString phoneNumber; // or if you already have a QString variable and want to 'clear' it: phoneNumber = QString(); Note that QString::number(0) is decidedly not null - it creates a QString with the value "0" . You could also

Converting QString to std::string

瘦欲@ 提交于 2021-01-27 04:37:09
问题 I've seen several other posts about converting QString to std::string, and it should be simple. But somehow I'm getting an error. My code is compiled into a VS project using cmake (I'm using VS express), so there's no issue with the QT libraries, and the GUI that I wrote works besides this part. I have a QComboBox cb that holds the names to some objects, and a QLineEdit lineEdit that allows me to specify the name of the object that I am looking for. It should run a function that is tested and

QT 打开文件对话框总结

限于喜欢 提交于 2020-03-21 08:19:45
一: Qstring fileName = QFileDialog::getOpenFileName(this, tr("open file"), " ", tr("Allfile(*.*);;mp3file(*.mp3)")); 说明:这样就会产生一个对话框,和系统的资源管理器差不多的。返回的是你选择文件的 绝对路径。 参数1:父窗口 参数2:对话框的标题 参数3:默认的打开的位置,如”我的文档“等 参数4:文件的过滤器,注意文件类型之间用 ;; 分开 二: QStringList fileNameList; QString fileName0; QFileDialog* fd = new QFileDialog(this);//创建对话框 fd->resize(240,320); //设置显示的大小 fd->setFilter( "Allfile(*.*);;mp3file(*.mp3);;wmafile(*.wma);;wavefile(*.wav)"); //设置文件过滤器 fd->setViewMode(QFileDialog::List); //设置浏览模式,有 列表(list) 模式和 详细信息(detail)两种方式 if ( fd->exec() == QDialog::Accepted ) //如果成功的执行 { fileName0 = fd-

简单的多屏播放器示例(vlc+qt)

穿精又带淫゛_ 提交于 2020-03-20 07:27:07
简单的多屏播放器示例(vlc+qt) 介绍 简单的多屏播放器 最多同时播放16个视频 支持本地文件和rtsp、rtmp等流媒体播放 VS2015工程,依赖Qt+VLC 练手作品 截图 下载 程序: download.csdn.net/detail/u014755412/9908787 源码: github.com/FutaAlice/QtPlayer 代码分析 IMediaPlayer是为规定接口的基类 提供了播放和控制的几个常用函数 其中打开媒体部分拆分为了OpenURL和OpenFile,并在cpp中实现 若为Windows环境,则对QFileDialog获取的路径进行替换 /******************************************************************* IMediaPlayer.h(接口类) 构造时传入QWidget* 调用OpenFile或OpenURL或Open打开文件并渲染窗体 *******************************************************************/ #ifndef IMEDIAPLAYER_H #define IMEDIAPLAYER_H class QWidget; class IMediaPlayer { public: IMediaPlayer

简单的多屏播放器示例(vlc+qt)

强颜欢笑 提交于 2020-03-20 07:26:30
介绍 简单的多屏播放器 最多同时播放16个视频 支持本地文件和rtsp、rtmp等流媒体播放 VS2015工程,依赖Qt+VLC 练手作品 截图 下载 程序: download.csdn.net/detail/u014755412/9908787 源码: github.com/FutaAlice/QtPlayer 代码分析 IMediaPlayer是为规定接口的基类 提供了播放和控制的几个常用函数 其中打开媒体部分拆分为了OpenURL和OpenFile,并在cpp中实现 若为Windows环境,则对QFileDialog获取的路径进行替换 /******************************************************************* IMediaPlayer.h(接口类) 构造时传入QWidget* 调用OpenFile或OpenURL或Open打开文件并渲染窗体 *******************************************************************/ #ifndef IMEDIAPLAYER_H #define IMEDIAPLAYER_H class QWidget; class IMediaPlayer { public: IMediaPlayer(QWidget* pWidget);

Qt高级——Qt日志信息处理

风流意气都作罢 提交于 2020-03-19 08:16:59
Qt高级——Qt日志信息处理 一、Qt日志功能简介 Qt有Debug、Warning、Critical、Fatal四种级别的调试信息。 qDebug:调试信息 qWarning:警告信息 qCritical:严重错误 qFatal:致命错误 Qt4提供了qInstallMsgHandler(Qt5:qInstallMessageHandler)对qDebug、qWarning、qCritical、qFatal等函数输出信息的重定向处理。 qInstallMsgHandler是一个回调函数,由qDebug、qWarnng、qCritical、qFatal函数进行触发,qDebug、qWarnng、qCritical、qFatal函数处理的消息文本会被qInstallMsgHandler所指向的回调函数截获,允许用户自己来处理输出的消息文本。 二、Qt日志输出组件 1、Qt日志输出组件定义 定制一个日志信息输出组件。 LogWidget.h文件: #ifndef LOGWIDGET_H #define LOGWIDGET_H #include <QWidget> #include <QTextEdit> #include <QHBoxLayout> #include <QApplication> #include <QMutex> #include <QDateTime> /** *

QT学习OpenGL序列-HelloTransformations

坚强是说给别人听的谎言 提交于 2020-03-17 04:04:24
学习OpenGL变换 (1) 头文件 #ifndef COPENGLWIDGETHELLOTRANSFORMATIONS_H #define COPENGLWIDGETHELLOTRANSFORMATIONS_H /* * 控件名称:Hello Transformations * * * 注意:STD C++ Version >= C++11 * * Author: hsw * */ #include <QPainter> #include <QPaintEngine> #include <QKeyEvent> #include <QDebug> #include <QCoreApplication> #include <QOpenGLWidget> // OpenGLWidget #include <QOpenGLFunctions> // OpenGL函数 #include <QOpenGLShaderProgram> #include <QOpenGLShader> #include <QOpenGLBuffer> #include <QOpenGLTexture> #include <QMatrix4x4> class COpenGLWidgetHelloTransformations : public QOpenGLWidget, public