在使用Qt5(来自WId)的Windows上获取HWND的答案之一中,建议使用QPlatformNativeInterface以恢复本机窗口处理程序.
要访问QT标头,尽管示例使用其完整路径:
#include <QtGui/5.0.0/QtGui/qpa/qplatformnativeinterface.h>
Run Code Online (Sandbox Code Playgroud)
当然,这不是一个明确的解决方案.有没有办法使用QT的默认包含系统包含QPlatformNativeInterface?
请注意,都没有
#include <QPlatformNativeInterface>
Run Code Online (Sandbox Code Playgroud)
工作(在默认QT构建期间不生成此文件)
也不
#include <QGuiApplication>
Run Code Online (Sandbox Code Playgroud)
作品(仅包含QPlatformNativeInterface的前向声明 )
根据Qt文档,如果我们想在Windows上使用命名管道,我们可以使用QLocalSocket.我正在用Qt编写服务器和客户端程序.如果我尝试使用WIN32 API在管道中写入一些消息,Qt客户端不会显示它.此外,如果客户端再次使用WIN32 API进行写入,则Qt服务器不会回显发送的消息.QLocalSocket真的推荐用于命名管道吗?
这是Win32 Server代码
wcout << "Creating an instance of a named pipe..." << endl;
// Create a pipe to send data
HANDLE pipe = CreateNamedPipeW(
L"\\\\.\\pipe\\ServicePipe", // name of the pipe
PIPE_ACCESS_OUTBOUND, // 1-way pipe -- send only
PIPE_TYPE_BYTE, // send data as a byte stream
100, // only allow 1 instance of this pipe
0, // no outbound buffer
0, // no inbound buffer
0, // use default wait time
NULL // use default security attributes
); …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Qt3D模块在C++/Qt5中编写游戏.
我可以在QGLView上渲染场景(QGLSceneNodes),但现在我不得不用一些GUI元素重复绘制场景.我还没有决定是否使用QML或C++来定义界面的外观,所以我愿意接受两者的解决方案.(注意,QML模块称为QtQuick3D,C++模块称为Qt3D,它们都是Qt5的一部分.)
我非常喜欢基于QML的解决方案.
我该如何做一些过度涂色?
必须具备以下条件:
我认为这只是使用另一个QGLSceneNode用于2D GUI部分.但是我认为定位和定向一些场景节点以便在渲染期间(使用顶点着色器)重新定位和重新定位没有意义,引入数值误差并且看起来效率低下.
是否正确使用另一个"GUI"顶点着色器?
(如何)我可以一起制作后期渲染效果和重复绘画?
如果我可以执行以下后期渲染效果,那将是非常好的:
当我使用特殊的着色器程序实现重绘时,我发现了一个问题:我无法访问GUI后面的像素来应用高斯模糊等效果,使GUI看起来像玻璃.我必须将场景渲染到另一个缓冲区而不是QGLView.这是我的主要问题......
我在Linux环境中使用基于Qt 5.0.1的Qt Creator 2.6.2.应用程序在我编译的计算机上工作正常,但是当我在另一台计算机上执行它时,我得到的错误如下:
error while loading shared libraries: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory
error while loading shared libraries: libxslt.so.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我在这个链接中找到了一些解决方案(一些链接已经死了).
所以我在我的.pro文件中添加了这一行:
CONFIG += static
Run Code Online (Sandbox Code Playgroud)
静态编译我的项目.
我以为我得到的文件会更大,但我有相同的大小和相同的错误.
谢谢.
我正在将一些Qt(C++和QML)代码从Qt4.8升级到Qt5.1.
Qt4.8代码是一个简单的C++"QML查看器"应用程序子类化a QDeclarativeView和一堆QML.
QQuickView除了一件事之外,很容易将其更改为使用Qt5/QtQuick2 :
Qt4.8应用程序有一个打印到PDF的方法:
void MyQMLViewer::printToPDF(const QString& filename) const {
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPageSize(QPrinter::A3);
printer.setOutputFileName(filename);
printer.setOrientation(QPrinter::Landscape);
QPainter painter(&printer);
render(&painter);
}
Run Code Online (Sandbox Code Playgroud)
Qt5.1需要进行一些"环境"更改才能获得QPrinter(即添加QT += printsupport到项目.pro文件中#include <QtPrintSupport>),但似乎有一个更基本的问题,QQuickView它不提供任何明显与QGraphicsView/ 兼容的东西.QPainter/ QPaintDeviceworld of QPrinter(具体来说,QQuickView没有render方法,所有绘图/绘画/渲染相关的方法看起来与OpenGL非常相关).
有关如何从中获得高质量PDF输出的任何建议QQuickView?
(请注意,我not只是希望截图的视图;与QDeclarativeView上面的代码生成的PDF文件与很多更好的分辨率甚至超过了应用程序全屏我最大的显示器上).
我看到"将QML应用程序移植到Qt 5"指南中的"QDeclarativeItem和QDeclarativeView"部分确实提到了QGraphicsView特定功能的丢失,但没有提供任何解决方案(尽管它确实提到了带有自定义项目的工作场所QPainter-基础渲染被买入新政权).
更新一些额外的背景信息:可以在此处找到使用上述代码从QDeclarativeView打印的PDF示例.有一个体面的大小监视器上相同的观点的PNG 这里.(这实际上是一系列幻灯片中的最后一张幻灯片;它实际上是以前幻灯片的一个画廊,它将每张幻灯片反弹到屏幕上;如果我有时间,我会考虑画廊的可行性是唯一的改变每个分散的幻灯片进入Prezi风格的演示视图;怀疑QDeclarative虽然不够真实,这是想要进入QtQuick2 + Qt5.2的新场景图形的一个原因).无论如何,如果你将PDF缩放到100%,你会看到文本是...好吧,它比任何一个大小合适的图像文件管理我认为,尽管倾斜的文本基线可能看起来有点不均匀.还有一个问题,不透明度值没有在PDF中表示(因此阴影和"气泡"变得坚固); …
网上有很多关于尝试制作双范围滑块的帖子
我找到的最常见的答案是使用libqxt.然而,进入网站 它清楚地表明,由于新版本的内部api更改,它没有维护Qt.
是否Qt5为此提供了任何新功能,或者是否有更持久的Qt实现提供此功能而无需大型外部库?
我有一个使用以下模块的Qt Quick应用程序
QT = core gui qml quick widgets \
core-private gui-private \
multimedia printsupport`
Run Code Online (Sandbox Code Playgroud)
我在OS X上部署.现在我的主要二进制文件以及许多Qt Qtick插件显示出对Qt Network的依赖.
otool -L /path/to/My.app/Contents/MacOS/My
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.18)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.16.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
@executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.2)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility …Run Code Online (Sandbox Code Playgroud) 搜索谷歌搜索"Qt5 - Windows 10 - VS 2015"仅在4月份发布了一篇博文,声称对VS 2015的支持正在进行中(链接).
Qt5下载页面(OpenSource版本)目前没有Visual Studio 2015的链接.那么,是否可以在VS 2015中使用Qt5,或者直到新的东西出现?
PS.我只是想避免在VS2015上安装VS2013.如果需要,我可以从源代码构建.
提前致谢
我对Qt QML中的模块感到困惑.我已经阅读了所有的文档,但它没有说明一些基本的想法.
我知道我可以将一堆QML文件放入一个目录中并添加一个qmldir文件来描述一个已识别的模块.当我这样做并调整QML_IMPORT_PATH时,QtCreator很高兴并停止强调导入ModuleName 1.0行.
所以创作者很高兴,但它不起作用.我没有安装模块.我的问题是:
对不起,对于所有这些问题,但这些模块的基础知识还不清楚.我不明白"模块"是仅仅是文件共享还是编译单元.
谢谢你的帮助.
我正在使用qt,正在尝试使用该QInputDialog::getText()功能从用户那里获取输入,根据文档,该功能的定义为:
QString QInputDialog::getText(QWidget * parent, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone)
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
bool ok=0;
newAddress = QInputDialog::getText(0,"Enter an Address to Validate",
"Adress: comma separated (e.g Address line 1, Address line 2, City, Postal Code)"
,&ok);
Run Code Online (Sandbox Code Playgroud)
但我得到了错误:
error: no matching function for call to 'QInputDialog::getText(int, const char [29], const char …Run Code Online (Sandbox Code Playgroud)