00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TEXTBROWSERTAB_H
00023 #define TEXTBROWSERTAB_H TEXTBROWSERTAB_H
00024
00025 #include <QtGui/QWidget>
00026 #include <QtGui/QHBoxLayout>
00027 #include <QtGui/QTextBrowser>
00028
00029 #include "phrasehunter/tokencontext.h"
00030
00031 #include "qt_utils.h"
00032
00033
00034 class TextBrowserTab: public QWidget
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 TextBrowserTab(QWidget* parent, PhraseHunter::TokenContextPtr output):
00040 QWidget(parent)
00041 {
00042 setupUi();
00043
00044 QString sourceText("%1<font color='#00C000'><b>%2</b></font> %3");
00045
00046 textBrowser->setHtml(sourceText
00047 .arg(icuToQString(output->leftContext()))
00048 .arg(icuToQString(output->token()))
00049 .arg(icuToQString(output->rightContext())));
00050 ;
00051 }
00052
00053 void setupUi()
00054 {
00055 QHBoxLayout* layout = new QHBoxLayout(this);
00056 textBrowser = new QTextBrowser(this);
00057 layout->addWidget(textBrowser);
00058 }
00059
00060 private:
00061 QTextBrowser* textBrowser;
00062 };
00063
00064
00065 #endif // TEXTBROWSERTAB_H