读书人

Qt Assistan 有关问题

发布时间: 2012-12-15 15:16:03 作者: rapoo

Qt Assistan 问题
想为一个Qt软件写帮助文档,在网上查了一下,说用 Qt Assistan 可以编写帮助文档,但我不知道怎么用Qt Assistan ,求助大家!Qt Assistan 如何使用!
[最优解释]
在你制作自己的Qt Assistant程序的时候,加入你是windows系统,那么首先你需要把Qt安装目录的bin目录的assistant.exe拷贝到你的帮助文档的目录里面,如果是Linux的话,一样的做法.这一步不晓得你做了没呢?




MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
assistant = new Assistant;
}

MainWindow::~MainWindow()
{
delete ui;

}

void MainWindow::on_pushButton_clicked()
{
cout<<"help1"<<endl;
assistant->showDocumentation("index.html");
cout<<"help2"<<endl;

}

void MainWindow::closeEvent(QCloseEvent *)
{
delete assistant;
}

assistant.cpp

#include "assistant.h"
#include <QtCore/QByteArray>
#include <QtCore/QDir>
#include <QtCore/QLibraryInfo>
#include <QtCore/QProcess>

#include <QtGui/QMessageBox>

Assistant::Assistant() : proc(0)
{
}
Assistant::~Assistant()
{
if (proc && proc->state() == QProcess::Running) {
proc->terminate();
proc->waitForFinished(3000);
}
delete proc;
}

void Assistant::showDocumentation(const QString &page)
{
bool flag;
if (!(flag=startAssistant()))
{
return;
}
cout<<"showDoc:"<<flag<<endl;
QByteArray ba("SetSource ");
ba.append("qthelp://com.trolltech.examples.simpletextviewr/doc/");

proc->write(ba + page.toLocal8Bit() + '\n');

}

bool Assistant::startAssistant()
{
int floag;
if (!proc)
proc = new QProcess();

if (proc->state() != QProcess::Running) {
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
#if !defined(Q_OS_MAC)
app += QLatin1String("assistant");
#else
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");

#endif

QStringList args;
args << QLatin1String("-collectionFile")
<< QLibraryInfo::location(QLibraryInfo::ExamplesPath)+ QLatin1String("/root/hjm/wroking/Help_File/simpletextviewr.qhc")
<< QLatin1String("-enableRemoteControl");

proc->start(app, args);
floag=1;
cout<<"start"<<endl;
if (!proc->waitForStarted()) {


QMessageBox::critical(0, QObject::tr("Simple Text Viewer"),
QObject::tr("Unable to launch Qt Assistant (%1)").arg(app));
return false;
}
}
cout<<"floag:"<<floag<<endl;
return true;
}



[其他解释]

引用:
这个帮助文档好像并不在Qt Creator的范畴里面,就比如那个Qt linguist制作国际化的qm文件,在工程里是无法加进去的,只能通过外部的tools进行制作.所以,Qt creator附带了很多Qt tools,比如那个Qt Assistant都是一个外部的工具,不过后来Qt Creator的版本把Qt 翻译家还有Qt Assistant都加了进去,但是这个帮助文……


问题能解决后结贴时候的分数全都给你
[其他解释]
我这里有个运行成功的代码,你可以参考下,点击下载便是:
http://jyguagua.com/ypf/myWhatsThis.rar

引用:
引用:这个帮助文档好像并不在Qt Creator的范畴里面,就比如那个Qt linguist制作国际化的qm文件,在工程里是无法加进去的,只能通过外部的tools进行制作.所以,Qt creator附带了很多Qt tools,比如那个Qt Assistant都是一个外部的工具,不过后来Qt Creator的版本把Qt 翻译家还有Qt As……

[其他解释]
对照了你的发的例子,发先我在我在给.qhc文件的路劲出现了错误,所以一直没有显示出来!非茶馆内感谢yuan8222的热心帮助,不过我还有一个小问题想你讨教那就是

图上面的蓝颜色标题点击可以跳转相应页面,这是什么实现的,是在做html文件的时候弄的吗?这样的html文件怎么制作的?我上面做的html文件是用wps做的,没有样的效果!很想知道图上这样的效果该怎么制作?
[其他解释]
引用:
我这里有个运行成功的代码,你可以参考下,点击下载便是:
http://jyguagua.com/ypf/myWhatsThis.rar

引用:引用:这个帮助文档好像并不在Qt Creator的范畴里面,就比如那个Qt linguist制作国际化的qm文件,在工程里是无法加进去的,只……


最后一个问题也解决了,wps也是可以做!
[其他解释]
这些蓝色的字点击打开网页,属于HTML的知识,叫做超链接,是直接写在html里面的.你可以随便弄个文本,保存为.html为后缀的文件,然后里面输入如下:

<html>
<head>
<title>演示超链接</title>
</head>
<body>
<a href="http://www.baidu.com" target="_blank">点击我百度</a>
</body>
</html>

然后这段代码就可以在浏览器里执行了,更多的html的知识,你可以参考这个地方去学习:
http://www.w3school.com.cn/
不用谢的!
引用:
对照了你的发的例子,发先我在我在给.qhc文件的路劲出现了错误,所以一直没有显示出来!非茶馆内感谢yuan8222的热心帮助,不过我还有一个小问题想你讨教那就是

图上面的蓝颜色标题点击可以跳转相应页面,这是什么实现的,是在做html文件的时候弄的吗?这样的html文件怎么制作的?我上面做的html文件是用wps做的,没有样的效果!很想知道图上这样的效果该怎么制作?
……

读书人网 >QT开发

热点推荐