qstring

Totalview get the value of QString

醉酒当歌 提交于 2019-12-06 12:57:13
When I double clicked on QString object in totalview debugger this window appears. How can I get the exact value of it. I have tried command.toUtf8().constData() but it prints Cannot find name "toUtf8" . ::TV::TTF::RTF::build_struct_transform { name {^struct QString$} members { { ascii { $wstring_u16 cast { * { d -> unicode } } } } } } ::TV::TTF::RTF::build_struct_transform { name {^struct QString$} members { { ascii { $wstring_u16 cast {* {d -> data} } } } } } Add this to $HOME/.tvdrc flie. First is for Qt3 and second for Qt4 . For QT5 please add the following to the file $HOME/.tvdrc ::TV:

Qt元对象(Meta-Object)系统与反射

淺唱寂寞╮ 提交于 2019-12-06 12:51:57
反射 -在计算机科学中,反射是指计算机程序在运行时(Run time)可以访问、检测和修改它本身状态或行为的一种能力。[1]用比喻来说,反射就是程序在运行的时候能够“观察”并且修改自己的行为。 要注意术语“反射”和“内省”(type introspection)的关系。内省(或称“自省”)机制仅指程序在运行时对自身信息(称为元数据)的检测;反射机制不仅包括要能在运行时对程序自身信息进行检测,还要求程序能进一步根据这些信息改变程序状态或结构。 C++的反射 C++的标准语法是不提供反射的特性的,不过随着C++17的定稿,估计这个关键词不会加到标准中了。不过这个我们可以用template来实现,这次就不写template了。今天主要是讲的是Qt。 Qt的反射 Qt最大的特点就是增加了moc的过程,个人理解,Qt扩展了C++的语法,以及增强了自己的基本库。 Meta Object System is a part of Qt framework core provided to support Qt extensions to C++ like signals/slots for inter-object communication, run-time type information, and the dynamic property system.[1] Architecture

label vc

烂漫一生 提交于 2019-12-06 10:58:25
#pragma once #include <QWidget> #include <QPaintEvent> #include <QPainter> #include <QPixmap> #include <QBrush> #include <QPen> #include <QRect> #include <QImage> #include <QMouseEvent> #include <QDebug> #include <QString> #include <QPoint> #include <QInputDialog> #include <QMessageBox> #include <vector> #include "vcpoint.h" class VCImgWidget :public QWidget { Q_OBJECT public: VCImgWidget(QWidget *parent); ~VCImgWidget(); void paintEvent(QPaintEvent *event); void paintEvent1(QPaintEvent *event); //const QString imgName = NULL; void SetImgName(QString imgNameParam); QString GetImgName(); std:

QAxBase: Error calling IDispatch member LineStyle: Unknown error

走远了吗. 提交于 2019-12-06 07:49:15
word/Excel版本2007、2010。 wps也适用。 //borders->dynamicCall("SetLineStyle(int,int,int)", 0, 0, 1); //报错 borders->dynamicCall("SetLineStyle(int)", 0); //不报错--不显示边框 borders->dynamicCall("SetLineStyle(int)", 1); //显示边框 //设置表格边框 for (int i=1;i<=6;i++) { QString m_str = QString("Borders(-%1)").arg(i); QAxObject *borders = table->querySubObject(m_str.toLatin1().constData()); borders->dynamicCall("SetLineStyle(int)", 0); //不显示边框 } 来源: https://www.cnblogs.com/azbane/p/11968961.html

用Qt实现一个计算器

你说的曾经没有我的故事 提交于 2019-12-06 05:47:32
一· 介绍 目的: 做一个标准型的计算器。用于学习Qt基础学习。 平台: Qt 5.12.0 二· 结构框架设计 2.1最终产品样式 界面的设计大体按照win系统自带的计算器做模仿。左边是win7 的界面。本次项目是为了熟悉Qt的界面设计,取消掉一些复杂的计算,和一些比较花样的布局。最终实现右边图样的界面。 2.2 架构规则 弱耦合,强内聚,业务逻辑与界面逻辑一定要分离 模块之间使用接口进行关联 模块之间的关系必然是 单项依赖 ,最大力度避免循环依赖关系 2.3 框架结构 ​ 计算器一定包含界面类和 后台计算类。按照上述规则,设计如下: 一个界面类 IOCalculator; 一个后台计算的类 QCalculatorDec; 一个接口类,用来连接 界面类和后台业务计算类 QcalculatorUI; 一个 完整的计算机类 Qcalculator;(实现上述三个类的融合,对外就是一个计算器类) 三· 接口类的设计 接口类主要是实现界面类与业务逻辑的通信。最主要的有两个内容 从界面类中得到 用户输入的计算公式。 由计算公式得到计算结果。 接口类只提供接口,UI 类使用该接口。业务逻辑类 负责具体的实现。 类的结构为: class IOCalculator { public: virtual bool expression(const QString& exp )=0; virtual

QChar to wchar_t

廉价感情. 提交于 2019-12-06 01:48:01
问题 I need to convert a QChar to a wchar_t I've tried the following: #include <cstdlib> #include <QtGui/QApplication> #include <iostream> using namespace std; int main(int argc, char** argv) { QString mystring = "Hello World\n"; wchar_t myArray[mystring.size()]; for (int x=0; x<mystring.size(); x++) { myArray[x] = mystring.at(x).toLatin1(); cout << mystring.at(x).toLatin1(); // checks the char at index x (fine) } cout << "myArray : " << myArray << "\n"; // doesn't give me correct value return 0;

How to get substring from a string in qt?

老子叫甜甜 提交于 2019-12-05 22:15:10
问题 I have a text form: Last Name:SomeName, Day:23 ...etc From Last Name:SomeName, I would like to get Last Name, and separately SomeName. I have tried to use QRegularExpression, QRegularExpression re("(?<label>\\w+):(?<text>\\w+)"); But I am getting the result: QString label = match.captured("label") //it gives me only Name What I want is whatever text till ":" to be label, and after to be text. Any ideas? 回答1: You could use two different methods for this, based on your need: split() section()

Why do QString and vector<unique_ptr<int>> appear incompatible here?

无人久伴 提交于 2019-12-05 11:12:08
I'm trying to compile some code, which reduces to this: #include <memory> #include <vector> #include <QString> class Category { std::vector<std::unique_ptr<int>> data; QString name; }; int main() { std::vector<Category> categories; categories.emplace_back(); }; Compiled as is, it results in the following error from g++ and similar for clang++: In file included from /opt/gcc-4.8/include/c++/4.8.2/memory:64:0, from test.cpp:1: /opt/gcc-4.8/include/c++/4.8.2/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = std::unique_ptr<int>; _Args = {const std:

解析定位标签数据

旧巷老猫 提交于 2019-12-05 09:28:39
void anasysData(QByteArray baRevDataParam) { int Datalen = sizeof(stuDevData); int Revlen = baRevDataParam.size(); int num = 0; int remainder = Revlen%Datalen;//求余 if (remainder != 0) { qDebug() << QString::fromLocal8Bit("数据错误"); return ""; } num = Revlen / Datalen; if (num > 0) { //收到的16进制数先转成字符串 QString Hexstr = baRevDataParam.toHex().toUpper(); QByteArray ba = Hexstr.toLatin1(); uint8_t *pbuf = (uint8_t *)baRevDataParam.data(); stuDevData *stuData = (stuDevData*)pbuf; int tagID = stuData->TAG_ID; int serialNum = stuData->seq_num; int x_value = stuData->pos[0]; int y_value = stuData->pos[1];