使用 Visual Studio 2015 设置 Qt5
Posted
技术标签:
【中文标题】使用 Visual Studio 2015 设置 Qt5【英文标题】:Setting up Qt5 with Visual Studio 2015 【发布时间】:2015-12-01 12:44:15 【问题描述】:在 Google 中搜索“Qt5 - Windows 10 - VS 2015”时,只发现了 4 月份的一篇博文,指出对 VS 2015 的支持正在开发中 (link)。
Qt5 下载页面(开源版本)目前没有 Visual Studio 2015 的链接。那么,是否可以在 VS 2015 中使用 Qt5,还是只有在出现新内容之前才有?
PS。我只是想避免在 VS2015 之上安装 VS2013。如果需要,我可以从源代码构建。
提前致谢
【问题讨论】:
从源代码构建它。 Qt 的下一次更新将包含 2015 msvc 的构建。 对于那些在 Qt 添加 2015 支持后于 2016 年到达此帖子的人: 1. 下载/安装 Visual Studio 2015。如果您已经拥有它并且它已过期,请使用良好的“ol MSN/Hotmail”登录账号激活社区版。 2. 启动一个新的 Visual C++ 项目,该项目将提供安装 MSVC 编译器的链接。 3. 安装实用程序将要求关闭 Visual Studio 以安装一些项目。按照屏幕上的说明进行操作,然后 4. 重新启动 Qt;应该高兴。另外,过时但相关:***.com/questions/31897847/… 【参考方案1】:我刚刚写了a small article explaining how to compile Qt 5.5.1 (with QtWebkit) with Visual Studio 2015。
我意识到这绝不是一个好的答案:虽然它可以完成这项工作,但该文章主要依赖于帮助 Windows 批处理文件,您可以从我的网站下载。因此,虽然我不打算删除我的网站或文章本身,但其他 SO 用户或管理员有权将此答案标记为太不稳定...
无论如何,在 Qt 人员提供使用 Visual Studio 2015 构建的官方预构建二进制文件之前,我相信我的文章可以挽救这一天。希望对您有所帮助。
【讨论】:
谢谢你,尽管我问这个问题已经过去了很长时间,但我从来没有真正找到解决办法。 格雷格,谢谢你的帖子。它为我指明了正确的方向。从头开始构建这样的 C++ 库我不是很有经验,而且事情似乎总是出错。我不明白为什么 QT 团队还没有为 VS2015 托管预编译的二进制文件。这是相当令人沮丧的。关于你的 bat 文件,我让它在一夜之间运行并且它工作。但是,nmake install 没有执行,所以在更改目录时似乎有问题。 如果nmake install
没有被执行,这意味着nmake
失败并且某些东西没有正确编译
不错的综合文章。您能否保存我们的过程并将构建的库放在某个地方以供下载?
很抱歉,由于不同的原因,我不会托管 Qt 预构建的二进制文件:1. 我没有针对该任务的适当托管计划(32 位和 64 位构建的重量为 3.34GB) 2. 它是根据我自己对应该应用哪些配置设置的看法预先构建的 3. 从互联网上盲目下载非官方二进制文件是一个相当糟糕的主意【参考方案2】:
构建 Qt
-
调用具有正确架构的 vcvarsall 批处理,例如:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
-
调用 Qt 环境批处理,例如,
call C:\Qt\x64\vs2015\qt561-1_x64\5.6\msvc2015_64\bin\qtenv2.bat
-
如果使用
jom
,请将jom
添加到路径中,例如,
Set PATH=C:\Qt\x64\vs2015\qt561-1_x64\Tools\QtCreator\bin;%PATH%
-
设置您的 Qt Makespec,例如,
Set QMAKESPEC=win32-msvc2015
-
将目录更改为您要构建的源,例如,
cd C:\Qt\x64\vs2015\qt561-1_x64\5.6\Src\qtbase
-
使用您可能需要的任何选项运行
configure
,例如,
configure -platform win32-msvc2015 -nomake tests -nomake examples
如果构建开源 Qt,请将 -opensource
添加到您的 configure
命令中。
-
运行
nmake
或jom -j %NUMBER_OF_PROCESSORS%
或将%NUMBER_OF_PROCESSORS%
替换为您要使用的线程数。
集成 Qt
获取此代码块的内容并将其保存到名为qt.natvis
的文件中,如果此处是这样,请放置C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers\qt.natvis
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="QPoint">
<AlternativeType Name="QPointF"/>
<DisplayString> x = xp, y = yp </DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
</Expand>
</Type>
<Type Name="QRect">
<DisplayString> x = x1, y = y1, width = x2 - x1 + 1, height = y2 - y1 + 1 </DisplayString>
<Expand>
<Item Name="[x]">x1</Item>
<Item Name="[y]">y1</Item>
<Item Name="[width]">x2 - x1 + 1</Item>
<Item Name="[height]">y2 - y1 + 1</Item>
</Expand>
</Type>
<Type Name="QRectF">
<DisplayString> x = xp, y = yp, width = w, height = h </DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[width]">w</Item>
<Item Name="[height]">h</Item>
</Expand>
</Type>
<Type Name="QSize">
<AlternativeType Name="QSizeF"/>
<DisplayString> width = wd, height = ht </DisplayString>
<Expand>
<Item Name="[width]">wd</Item>
<Item Name="[height]">ht</Item>
</Expand>
</Type>
<Type Name="QLine">
<AlternativeType Name="QLineF"/>
<DisplayString> start point = pt1, end point = pt2 </DisplayString>
<Expand>
<Synthetic Name="[start point]">
<DisplayString>pt1</DisplayString>
<Expand>
<ExpandedItem>pt1</ExpandedItem>
</Expand>
</Synthetic>
<Synthetic Name="[end point]">
<DisplayString>pt2</DisplayString>
<Expand>
<ExpandedItem>pt2</ExpandedItem>
</Expand>
</Synthetic>
</Expand>
</Type>
<Type Name="QPolygon">
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>(QPoint*)((reinterpret_cast<char*>(d)) + d->offset)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QPolygonF">
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[closed]">
d->size > 0
&& ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).xp
== (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).xp)
&& ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).yp
== (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).yp)
</Item>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>(QPointF*)((reinterpret_cast<char*>(d)) + d->offset)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name ="QVector2D">
<DisplayString> x = xp, y = yp </DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
</Expand>
</Type>
<Type Name ="QVector3D">
<DisplayString> x = xp, y = yp, z = zp </DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[z]">zp</Item>
</Expand>
</Type>
<Type Name ="QVector4D">
<DisplayString> x = xp, y = yp, z = zp, w = wp </DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[z]">zp</Item>
<Item Name="[w]">wp</Item>
</Expand>
</Type>
<Type Name ="QMatrix">
<DisplayString>
m11 = _m11, m12 = _m12, m21 = _m21, m22 = _m22, ...
</DisplayString>
<Expand>
<Item Name="[m11]">_m11</Item>
<Item Name="[m12]">_m12</Item>
<Item Name="[m21]">_m21</Item>
<Item Name="[m22]">_m22</Item>
<Item Name="[dx]">_dx</Item>
<Item Name="[dy]">_dy</Item>
</Expand>
</Type>
<Type Name ="QMatrix4x4">
<DisplayString>
m11 = m[0][0], m12 = m[1][0], m13 = m[2][0], m14 = m[3][0], ...
</DisplayString>
<Expand>
<Item Name="[m11]">m[0][0]</Item>
<Item Name="[m12]">m[1][0]</Item>
<Item Name="[m13]">m[2][0]</Item>
<Item Name="[m14]">m[3][0]</Item>
<Item Name="[m21]">m[0][1]</Item>
<Item Name="[m22]">m[1][1]</Item>
<Item Name="[m23]">m[2][1]</Item>
<Item Name="[m24]">m[3][1]</Item>
<Item Name="[m31]">m[0][2]</Item>
<Item Name="[m32]">m[1][2]</Item>
<Item Name="[m33]">m[2][2]</Item>
<Item Name="[m34]">m[3][2]</Item>
<Item Name="[m41]">m[0][3]</Item>
<Item Name="[m42]">m[1][3]</Item>
<Item Name="[m43]">m[2][3]</Item>
<Item Name="[m44]">m[3][3]</Item>
</Expand>
</Type>
<Type Name="QSizePolicy">
<DisplayString>
horizontal = static_cast<Policy>(bits.horPolicy), vertical = static_cast<Policy>(bits.verPolicy), type = ControlType(1 << bits.ctype)
</DisplayString>
<Expand>
<Synthetic Name="[vertical policy]">
<DisplayString>QSizePolicy::Policy::static_cast<Policy>(bits.verPolicy)</DisplayString>
</Synthetic>
<Synthetic Name="[horizontal policy]">
<DisplayString>QSizePolicy::Policy::static_cast<Policy>(bits.horPolicy)</DisplayString>
</Synthetic>
<Synthetic Name="[control type]">
<DisplayString>QSizePolicy::ControlType::ControlType(1 << bits.ctype)</DisplayString>
</Synthetic>
<Synthetic Name="[expanding directions]">
<DisplayString
Condition="(static_cast<Policy>(bits.verPolicy) & ExpandFlag)">
Qt::Vertical (2)
</DisplayString>
<DisplayString
Condition="(static_cast<Policy>(bits.horPolicy) & ExpandFlag)">
Qt::Horizontal (1)
</DisplayString>
</Synthetic>
<Item Name="[vertical stretch]">static_cast<int>(bits.verStretch)</Item>
<Item Name="[horizontal stretch]">static_cast<int>(bits.horStretch)</Item>
<Item Name="[has height for width]">bits.hfw == 1</Item>
<Item Name="[has width for height]">bits.wfh == 1</Item>
</Expand>
</Type>
<Type Name="QChar">
<DisplayString>ucs,c</DisplayString>
<StringView>ucs,c</StringView>
<Expand>
<Item Name="[latin 1]">ucs > 0xff ? '\0' : char(ucs),c</Item>
<Item Name="[unicode]">ucs,c</Item>
</Expand>
</Type>
<Type Name="QString">
<DisplayString>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub</DisplayString>
<StringView>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub</StringView>
<Expand>
<Item Name="[size]">d->size</Item>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),c</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QByteArray">
<DisplayString>((reinterpret_cast<char*>(d)) + d->offset),sb</DisplayString>
<StringView>((reinterpret_cast<char*>(d)) + d->offset),sb</StringView>
<Expand>
<Item Name="[size]">d->size</Item>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>((reinterpret_cast<char*>(d)) + d->offset),c</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QBitArray">
<DisplayString> size = (d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset) </DisplayString>
<Expand>
<Item Name="[referenced]">d.d->ref.atomic._q_value</Item>
<IndexListItems>
<Size>(d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset)</Size>
<ValueNode>
(*(reinterpret_cast<const unsigned char*>((reinterpret_cast<char*>(d.d)) + d.d->offset) + 1
+ ($i >> 3)) & (1 << ($i & 7))) != 0
</ValueNode>
</IndexListItems>
</Expand>
</Type>
<Type Name="QVarLengthArray<*>">
<AlternativeType Name="QVarLengthArray<*, int>"/>
<DisplayString> size = s </DisplayString>
<Expand>
<Item Name="[capacity]">a</Item>
<ArrayItems>
<Size>s</Size>
<ValuePointer>ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QDate">
<DisplayString> julian day = jd </DisplayString>
<Expand></Expand>
</Type>
<Type Name="QTime">
<DisplayString
Condition="mds == 1"> millisecond = mds </DisplayString>
<DisplayString
Condition="mds != 1"> milliseconds = mds </DisplayString>
<Expand>
<Item Name="[hour]"
Condition="(mds / 3600000) == 1">mds / 3600000, d</Item>
<Item Name="[hours]"
Condition="(mds / 3600000) != 1">mds / 3600000, d</Item>
<Item Name="[minute]"
Condition="((mds % 3600000) / 60000) == 1">(mds % 3600000) / 60000, d</Item>
<Item Name="[minutes]"
Condition="((mds % 3600000) / 60000) != 1">(mds % 3600000) / 60000, d</Item>
<Item Name="[second]"
Condition="((mds / 1000) % 60) == 1">(mds / 1000) % 60, d</Item>
<Item Name="[seconds]"
Condition="((mds / 1000) % 60) != 1">(mds / 1000) % 60, d</Item>
<Item Name="[millisecond]"
Condition="(mds % 1000) == 1">mds % 1000, d</Item>
<Item Name="[milliseconds]"
Condition="(mds % 1000) != 1">mds % 1000, d</Item>
</Expand>
</Type>
<Type Name="QRegularExpression">
<DisplayString>d.pattern</DisplayString>
</Type>
<Type Name="QSharedData">
<Expand>
<Item Name="[referenced]">ref._q_value</Item>
</Expand>
</Type>
<Type Name="QSharedPointer<*>">
<DisplayString>strong reference to shared pointer of type "$T1"</DisplayString>
<Expand>
<Item Name="[is null]">value == 0</Item>
<Item Name="[weak referenced]">d->weakref._q_value</Item>
<Item Name="[strong referenced]">d->strongref._q_value</Item>
</Expand>
</Type>
<Type Name="QSharedDataPointer<*>">
<DisplayString>pointer to implicit shared object of type "$T1"</DisplayString>
<Expand>
<ExpandedItem>d</ExpandedItem>
</Expand>
</Type>
<Type Name="QExplicitlySharedDataPointer<*>">
<DisplayString>pointer to explicit shared object of type "$T1"</DisplayString>
<Expand>
<ExpandedItem>d</ExpandedItem>
</Expand>
</Type>
<Type Name="QPointer<*>">
<DisplayString>guarded pointer to subclass of QObject of type "$T1"</DisplayString>
<Expand>
<Item Name="[is null]">wp.d == 0 || wp.d->strongref._q_value == 0 || wp.value == 0</Item>
</Expand>
</Type>
<Type Name="QWeakPointer<*>">
<DisplayString>weak reference to shared pointer of type "$T1"</DisplayString>
<Expand>
<Item Name="[is null]">d == 0 || d->strongref._q_value == 0 || value == 0</Item>
<Item Name="[weak referenced]">d->weakref._q_value</Item>
<Item Name="[strong referenced]">d->strongref._q_value</Item>
</Expand>
</Type>
<Type Name="QScopedPointer<*>">
<DisplayString>scoped pointer to a dynamically allocated object of type "$T1"</DisplayString>
<Expand>
<Item Name="[is null]">!d</Item>
</Expand>
</Type>
<Type Name="QScopedArrayPointer<*>">
<DisplayString>scoped pointer to dynamically allocated array of objects of type "$T1"</DisplayString>
<Expand>
<Item Name="[is null]">!d</Item>
</Expand>
</Type>
<Type Name="QPair<*,*>">
<DisplayString>(first, second)</DisplayString>
<Expand>
<Item Name="[first]">first</Item>
<Item Name="[second]">second</Item>
</Expand>
</Type>
<Type Name="QVector<*>">
<AlternativeType Name="QStack<*>"></AlternativeType>
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>($T1*)((reinterpret_cast<char*>(d)) + d->offset)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QList<*>">
<AlternativeType Name="QStringList"></AlternativeType>
<AlternativeType Name="QQueue<*>"></AlternativeType>
<DisplayString> size = d->end - d->begin </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<IndexListItems>
<Size>d->end - d->begin</Size>
<ValueNode>*reinterpret_cast<$T1*>((sizeof($T1) > sizeof(void*))
? reinterpret_cast<Node*>(d->array + d->begin + $i)->v
: reinterpret_cast<$T1*>(d->array + d->begin + $i))
</ValueNode>
</IndexListItems>
</Expand>
</Type>
<Type Name="QLinkedList<*>">
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<LinkedListItems>
<Size>d->size</Size>
<HeadPointer>d->n</HeadPointer>
<NextPointer>n</NextPointer>
<ValueNode>(*(QLinkedListNode<$T1>*)this).t</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="QMapNode<*,*>">
<DisplayString>(key, value)</DisplayString>
<Expand>
<Item Name="[key]">key</Item>
<Item Name="[value]">value</Item>
</Expand>
</Type>
<Type Name="QMap<*,*>">
<AlternativeType Name="QMultiMap<*,*>"/>
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<TreeItems>
<Size>d->size</Size>
<HeadPointer>d->header.left</HeadPointer>
<LeftPointer>left</LeftPointer>
<RightPointer>right</RightPointer>
<ValueNode>*((QMapNode<$T1,$T2>*)this)</ValueNode>
</TreeItems>
</Expand>
</Type>
<Type Name="QHashNode<*,*>">
<DisplayString Condition="next == 0">(empty)</DisplayString>
<DisplayString Condition="next != 0">(key, value)</DisplayString>
<Expand>
<Item Name="[key]" Condition="next != 0">key</Item>
<Item Name="[value]" Condition="next != 0">value</Item>
</Expand>
</Type>
<Type Name="QHash<*,*>">
<AlternativeType Name="QMultiHash<*,*>"/>
<DisplayString> size = d->size </DisplayString>
<Expand>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<IndexListItems>
<Size>d->numBuckets</Size>
<ValueNode>*((QHashNode<$T1,$T2>*)d->buckets[$i])</ValueNode>
</IndexListItems>
</Expand>
</Type>
<Type Name="QHashNode<*,QHashDummyValue>">
<DisplayString Condition="next == 0">(empty)</DisplayString>
<DisplayString Condition="next != 0">(key)</DisplayString>
<Expand>
<Item Name="[key]" Condition="next != 0">key</Item>
</Expand>
</Type>
<Type Name="QSet<*>">
<DisplayString> size = q_hash.d->size </DisplayString>
<Expand>
<ExpandedItem>q_hash</ExpandedItem>
</Expand>
</Type>
<Type Name="QCache<*,*>::Node">
<DisplayString>(*keyPtr, *t)</DisplayString>
<Expand>
<Item Name="[key]">*keyPtr</Item>
<Item Name="[value]">*t</Item>
</Expand>
</Type>
<Type Name="QCache<*,*>">
<DisplayString> size = hash.d->size </DisplayString>
<Expand>
<Item Name="[max coast]">mx</Item>
<Item Name="[total coast]">total</Item>
<Item Name="[referenced]">hash.d->ref.atomic._q_value</Item>
<LinkedListItems>
<Size>hash.d->size</Size>
<HeadPointer>f</HeadPointer>
<NextPointer>n</NextPointer>
<ValueNode>*((Node*)this)</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="QVariant">
<!--Region DisplayString QVariant-->
<DisplayString Condition="d.type == QMetaType::UnknownType">Invalid</DisplayString>
<DisplayString Condition="d.type == QMetaType::Bool">d.data.b</DisplayString>
<DisplayString Condition="d.type == QMetaType::Int">d.data.i</DisplayString>
<DisplayString Condition="d.type == QMetaType::UInt">d.data.u</DisplayString>
<DisplayString Condition="d.type == QMetaType::LongLong">d.data.ll</DisplayString>
<DisplayString Condition="d.type == QMetaType::ULongLong">d.data.ull</DisplayString>
<DisplayString Condition="d.type == QMetaType::Double">d.data.d</DisplayString>
<DisplayString Condition="d.type == QMetaType::QChar">d.data.c</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVariantMap">
*((QMap<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVariantList">
*((QList<QVariant>*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QString">
*((QString*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QStringList">
*((QStringList*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QByteArray">
*((QByteArray*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QBitArray">
*((QBitArray*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QDate">
*((QDate*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QTime">
*((QTime*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QDateTime">DateTime</DisplayString>
<DisplayString Condition="d.type == QMetaType::QUrl">Url</DisplayString>
<DisplayString Condition="d.type == QMetaType::QLocale">Locale</DisplayString>
<DisplayString Condition="d.type == QMetaType::QRect">
*((QRect*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QRectF">
*((QRectF*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QSize">
*((QSize*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QSizeF">
*((QSizeF*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QLine">
*((QLine*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QLineF">
*((QLineF*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPoint">
*((QPoint*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPointF">
*((QPointF*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QRegExp">RegExp</DisplayString>
<DisplayString Condition="d.type == QMetaType::QRegularExpression">RegularExpression</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVariantHash">
*((QHash<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</DisplayString>
<DisplayString Condition="d.type == QMetaType::QEasingCurve">EasingCurve</DisplayString>
<DisplayString Condition="d.type == QMetaType::QUuid">Uuid</DisplayString>
<DisplayString Condition="d.type == QMetaType::QModelIndex">ModelIndex</DisplayString>
<DisplayString Condition="d.type == QMetaType::LastCoreType">LastCoreType</DisplayString>
<DisplayString Condition="d.type == QMetaType::QFont">Font</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPixmap">Pixmap</DisplayString>
<DisplayString Condition="d.type == QMetaType::QBrush">Brush</DisplayString>
<DisplayString Condition="d.type == QMetaType::QColor">Color</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPalette">Palette</DisplayString>
<DisplayString Condition="d.type == QMetaType::QImage">Image</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPolygon">Polygon</DisplayString>
<DisplayString Condition="d.type == QMetaType::QRegion">Region</DisplayString>
<DisplayString Condition="d.type == QMetaType::QBitmap">Bitmap</DisplayString>
<DisplayString Condition="d.type == QMetaType::QCursor">Cursor</DisplayString>
<DisplayString Condition="d.type == QMetaType::QKeySequence">KeySequence</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPen">Pen</DisplayString>
<DisplayString Condition="d.type == QMetaType::QTextLength">TextLength</DisplayString>
<DisplayString Condition="d.type == QMetaType::QTextFormat">TextFormat</DisplayString>
<DisplayString Condition="d.type == QMetaType::QMatrix">Matrix</DisplayString>
<DisplayString Condition="d.type == QMetaType::QTransform">Transform</DisplayString>
<DisplayString Condition="d.type == QMetaType::QMatrix4x4">Matrix4x4</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVector2D">Vector2D</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVector3D">Vector3D</DisplayString>
<DisplayString Condition="d.type == QMetaType::QVector4D">Vector4D</DisplayString>
<DisplayString Condition="d.type == QMetaType::QQuaternion">Quaternion</DisplayString>
<DisplayString Condition="d.type == QMetaType::QPolygonF">PolygonF</DisplayString>
<DisplayString Condition="d.type == QMetaType::QIcon">Icon</DisplayString>
<DisplayString Condition="d.type == QMetaType::LastGuiType">LastGuiType</DisplayString>
<DisplayString Condition="d.type == QMetaType::QSizePolicy">SizePolicy</DisplayString>
<DisplayString Condition="d.type == QMetaType::User">UserType</DisplayString>
<DisplayString Condition="d.type == 0xffffffff">LastType</DisplayString>
<!--End region DisplayString QVariant-->
<!--Region DisplayView QVariant-->
<StringView Condition="d.type == QMetaType::QChar">d.data.c</StringView>
<StringView Condition="d.type == QMetaType::QString">
*((QString*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</StringView>
<StringView Condition="d.type == QMetaType::QByteArray">
*((QByteArray*)(d.is_shared ? d.data.shared->ptr
: reinterpret_cast<const void *>(&d.data.ptr)))
</StringView>
<!--End region DisplayView QVariant-->
</Type>
</AutoVisualizer>
您现在应该可以在 Visual Studio 中使用 Qt 进行调试了。
警告
尽管 Qt 提到了这一点,但他们并没有强调在构建失败时正确清理的重要性。这是what the site says,我在引用的文本下方添加了我自己的派生注释:
注意:如果您以后需要重新配置和重建 Qt 位置,确保之前配置的所有痕迹都是 通过进入构建目录并输入
nmake distclean
删除 在再次运行配置之前。
-
如果您使用
configure
的配置需要更改,您必须运行nmake distclean
或jom -j %NUMBER_OF_PROCESSORS% distclean
如果你的构建失败,运行干净,例如,nmake clean
或 jom -j %NUMBER_OF_PROCESSORS% clean
然后您应该使用所需的任何选项运行configure
,然后运行nmake
或jom -j %NUMBER_OF_PROCESSORS%
。
【讨论】:
【参考方案3】:我遇到了同样的问题。但我刚刚找到了魔法钥匙。以下链接中的包几乎完全具有 Qt Visual Studio Add-in 1.2.4 for Qt5 的行为。它包括使用 Qt 完成工作所需的一切:
https://visualstudiogallery.msdn.microsoft.com/c89ff880-8509-47a4-a262-e4fa07168408
【讨论】:
【参考方案4】:Qt5.6.0 Beta 包含 Visual Studio 2015 的预构建映像。但是,不再支持 Qt Visual Studio 加载项。您可以安装一个名为 Qt5Package 的扩展程序。
我发现当我尝试在扩展中添加 Qt 5.6.0 Beta 时出现错误“此 Qt 版本使用不支持的 makefile 生成器(使用:MSVC.NETMSBUILD,支持:MSVC.NET、MSBUILD)”。解决方法位于 C:\Qt\Qt5.6.0\5.6\msvc2015\mkspecs\common\msvc-desktop.conf Qt 5.6.0 将所有特定于版本的更改拆分为单独的文件 msvc-base.conf。如果您复制此文件的内容并替换 mscv-desktop.conf 中的“include(msvc-base.conf)”行,则 Qt5Package 可以毫无问题地识别 Qt 5.6.0 Beta。
请注意,这仍然需要在 Qt5Package 中修复。
【讨论】:
谢谢,这对我来说开箱即用。我添加 Qt 5.6.0 beta 没有问题。以上是关于使用 Visual Studio 2015 设置 Qt5的主要内容,如果未能解决你的问题,请参考以下文章
如何设置[ZeroMQ]以在Visual Studio 2015 Enterprise中使用?
Visual Studio2015设置Android SDK路径