flash:
http://www.qtcn.org/bbs/read.php?tid=95&fpage=1main.cpp
#include "ui_browser.h"
#include <QtGui/QtGui>
int main(int argc,char * argv[])
{
QApplication app(argc,argv);
app.setQuitOnLastWindowClosed(true);
QMainWindow * form =new QMainWindow;
Ui::MainWindow ui;
ui.setupUi(form);
ui.textBrowser->setSource(QString("..\\html\\index.html"));
form->show();
return app.exec();
}
borwser.ui
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>252</height>
</rect>
</property>
<property name="windowTitle" >
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>8</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_2" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&Forward</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit" />
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser" />
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>&Close</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections>
<connection>
<sender>textBrowser</sender>
<signal>backwardAvailable(bool)</signal>
<receiver>pushButton_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>51</x>
<y>77</y>
</hint>
<hint type="destinationlabel" >
<x>51</x>
<y>21</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>textBrowser</receiver>
<slot>backward()</slot>
<hints>
<hint type="sourcelabel" >
<x>24</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<x>27</x>
<y>65</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_3</sender>
<signal>clicked()</signal>
<receiver>textBrowser</receiver>
<slot>forward()</slot>
<hints>
<hint type="sourcelabel" >
<x>110</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<x>109</x>
<y>58</y>
</hint>
</hints>
</connection>
<connection>
<sender>textBrowser</sender>
<signal>backwardAvailable(bool)</signal>
<receiver>pushButton_3</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>143</x>
<y>85</y>
</hint>
<hint type="destinationlabel" >
<x>143</x>
<y>23</y>
</hint>
</hints>
</connection>
<connection>
<sender>textBrowser</sender>
<signal>highlighted(QString)</signal>
<receiver>lineEdit</receiver>
<slot>setText(QString)</slot>
<hints>
<hint type="sourcelabel" >
<x>279</x>
<y>151</y>
</hint>
<hint type="destinationlabel" >
<x>282</x>
<y>23</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel" >
<x>348</x>
<y>230</y>
</hint>
<hint type="destinationlabel" >
<x>232</x>
<y>229</y>
</hint>
</hints>
</connection>
</connections>
</ui>
我把doc文档复制到了helpbrowser文件夹中。因为我对程序中设置doc的路径不是很明白。
acefunware
email:acefunware@yahoo.com.cn
blog:
http://acefunware.shineblog.com[ 此贴被XChinux在2005-08-22 21:53重新编辑 ]