简体   繁体   English

Qt对VNC的支持

[英]Qt support for VNC

i want to test whether qt is supporting VNC or not. 我想测试qt是否支持VNC。 For that i have written a small layout program using Qt library. 为此,我使用Qt库编写了一个小型布局程序。

the source code for the layout program is as follows: 布局程序的源代码如下:

layout.cpp layout.cpp

#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
        QApplication app(argc, argv);
        QWidget *window = new QWidget;
        window->setWindowTitle("Enter The Age of the person");
        QSpinBox *spinBox = new QSpinBox;
        QSlider *slider = new QSlider(Qt::Horizontal);
        spinBox->setRange(0, 130);
        slider->setRange(0, 130);
        QObject::connect(spinBox, SIGNAL(valueChanged(int)),
        slider, SLOT(setValue(int)));
        QObject::connect(slider, SIGNAL(valueChanged(int)),
        spinBox, SLOT(setValue(int)));
        spinBox->setValue(35);
        QHBoxLayout *layout = new QHBoxLayout;
        layout->addWidget(spinBox);
        layout->addWidget(slider);
        window->setLayout(layout);
        window->show();
        return app.exec();
 }

i want to run this as server application on my linux PC.For that what i configured Qt and installed like this. 我想在Linux PC上将其作为服务器应用程序运行。为此,我配置了Qt并像这样安装。

  1. ./configure -qt-gfx-vnc ./configure -qt-gfx-vnc
  2. make 使
  3. make install 进行安装

The program is working fine. 该程序运行正常。 But if i run the application as VNC server application like 但是如果我将应用程序作为VNC服务器应用程序运行

./layout -qws -display VNC:0 ./layout -qws -display VNC:0

i am encountering an error.it says that "_X11TransSocketINETConnect() can't get address for VNC:6000: Temporary failure in name resolution".. 我遇到一个错误。它说“ _X11TransSocketINETConnect()无法获取VNC:6000的地址:名称解析中的临时失败”。

pls help me what i need to do. 请帮我我需要做的。

Thanks 谢谢

You did not configure Qt to use QWS, which is what you wanted. 您没有将Qt配置为使用QWS,而这正是您想要的。

For this reason, it looks like your app is silently ignoring the -qws option, and the -display VNC:0 option is causing it to try to connect to the X11 display number 0 on host VNC, which doesn't exist. 因此,您的应用似乎无声地忽略了-qws选项,而-display VNC:0选项导致它尝试连接到主机VNC上不存在的X11显示编号0。

You need to pass the -embedded option when configuring Qt if you want to use QWS. 如果要使用QWS,则在配置Qt时需要传递-embedded选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM