问题标签 [qvector]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
586 浏览

windows - 看不到 QVector> qtcreator 3.0 和 gdb 中的值

我正在为家庭作业编写一个 qt 应用程序,我需要对其进行调试以解决问题,但是当我尝试QVector<double>在本地和表达式中查看(例如)时,我遇到了 gdb 问题,但是当我尝试读取时,QVector<QVector<double> >我得到了消息,我试图改变显示格式,但我没有走运。我将 QT 5.2.1 用于带有 Qtcreator 3.0 的 Windows 我有这个示例代码来填充 aQVector<QVector<double> >以将其传递给另一个类(我需要调试)

在 qt creator 我可以读取每个pesos实例,但我无法读取capa,我需要它来解决我的问题

编辑:我尝试了@Nejat 的答案,我可以阅读单个QVector<QVector<double> >但不是当它在里面时QList(所以我可以单独阅读每个capa但不是nPesos

0 投票
2 回答
2716 浏览

c++ - 按内容访问 QVector 元素索引

我有一个QVectorofQStrings并且我想删除元素及其内容,但我不知道如何找到它的索引。你知道我怎样才能删除它吗?我不想迭代它并按我的值比较它的内容。

QVector的声明如下:

我想通过它的内容来删除它,例如值为“万寿菊”的元素:

先感谢您!

0 投票
1 回答
1844 浏览

c++ - 在 qt 中创建 QLabels 的 QVector

我正在尝试创建 QLabels 的 QVector。

我不知道该怎么做。我已经像这样声明了我的 QVector:QVector<QLabel> labels

在我的 .cpp 文件中,我想将每个标签设置为像素图。我应该先通过 for 循环初始化所有实例吗?

在我的构造函数内部:

我在构造函数之外有一个函数,它将每个 QLabel 设置为图像:

在为每个实例初始化调用函数 setplayerpiece 的标签之后,是否应该在构造函数中运行另一个 for 循环?基本上我想做的是为每个玩家分配一个图像。如果我含糊不清或您需要更多信息,请告诉我。感谢您的任何帮助。

0 投票
1 回答
1041 浏览

c++ - QVector 和 QMap。程序崩溃,这是无效代码吗?

我试图将 QMap 中的值放入 QVector,但程序崩溃并且我没有得到好的调试信息。我不习惯 C++ 容器类,并假设我做了一些非法的事情。代码如下所示:

0 投票
1 回答
698 浏览

c++ - Qt Threads Make Error

I am getting some strange errors when building the following lines of Code: (I'm including QVector and QThread).

NodeProcess.h :

Nodeprocess.cpp :

Someone any idea what I'm doing wrong ? Any Hint would help me :).

0 投票
3 回答
3319 浏览

c++ - QVector 与具有参数的自定义对象?

我正在尝试将 QVector 与名为 RoutineItem 的自定义对象一起使用。

但是给出了这个错误:

这是 RoutineItem 构造函数:

如果我删除所有构造函数参数,我将不再收到该错误。如何将 QVector 与具有参数的自定义对象一起使用?

0 投票
2 回答
2686 浏览

c++ - 错误:请求从“QStringList”转换为非标量类型“QString”

这是我的课:

当我调用 undo() 方法时,IDE 会引发此错误:

错误:请求从“QStringList”转换为非标量类型“QString”

我在哪里做错了?

0 投票
3 回答
431 浏览

c++ - QVector 与 'operator=' 不匹配

我在类构造函数中初始化 QVector 时遇到问题。这是我的头文件中的行:

这是我的构造函数中的行:

这是错误:

我不知道有什么问题。

0 投票
2 回答
3010 浏览

c++ - Why QVector::size returns int?

std::vector::size() returns a size_type which is unsigned and usually the same as size_t, e.g. it is 8 bytes on 64bit platforms.

In constrast, QVector::size() returns an int which is usually 4 bytes even on 64bit platforms, and at that it is signed, which means it can only go half way to 2^32.

Why is that? This seems quite illogical and also technically limiting, and while it is nor very likely that you may ever need more than 2^32 number of elements, the usage of signed int cuts that range in half for no apparent good reason. Perhaps to avoid compiler warnings for people too lazy to declare i as a uint rather than an int who decided that making all containers return a size type that makes no sense is a better solution? The reason could not possibly be that dumb?

0 投票
1 回答
654 浏览

visual-studio-2012 - Qt5 Visual Studio 2012 插件不允许调试到 QStack/QVector

我正在使用最新的插件(1.2.3),但是当我尝试查看 QVector(Qt 5.3.2)中的值时,它显示为 0(错误)。它仍在 Qt 4.8.4 中工作。有人有适用于 VS2012 的可视化工具吗?

gitorious 存储库中 autoexp.dat 的代码仍然显示“4.6”: