The .ui file:
<ui version="4.0" >
<class>FormOutput</class>
<widget class="QWidget" name="FormOutput" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>252</width>
<height>260</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<property name="styleSheet" >
<string notr="true" >border: 1 solid black;</string>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QTextBrowser" name="textBrowser" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="html" >
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;">.. initialising program..done</p></body></html></string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<ui version="4.0" >
<class>FormOutput</class>
<widget class="QWidget" name="FormOutput" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>252</width>
<height>260</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<property name="styleSheet" >
<string notr="true" >border: 1 solid black;</string>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QTextBrowser" name="textBrowser" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="html" >
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;">.. initialising program..done</p></body></html></string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
To copy to clipboard, switch view to plain text mode
//end of .ui file
the error message for this piece of code:
expected unqualified-id before '<' token (line 1 )
expected unqualified-id before '<' token (line 16)
expected unqualified-id before '!' token (line 25)
Multiple markers at this line (refering to line 26)
- expected constructor, destructor, or type conversion before '>' token
- 'style' does not name a type
- 'meta' does not name a type
Multiple markers at this line (refering to line 28)
- 'body' does not name a type
- expected unqualified-id before '/' token
- expected constructor, destructor, or type conversion before ';' token
Multiple markers at this line (refering to line 29)
- 'p' does not name a type
- expected unqualified-id before '/' token
My question:
What I don't understand is, why is it giving an error on line 1 for no apparent reason? It doesn't give me that error on the other .ui files.
And why does it seem that it doesn't recognize html-code in the html part.
Does anybody have some clue at what is the problem here?
Edit: posted the .h and .cpp file now
the .h file:
#ifndef FORMOUTPUT_H_
#define FORMOUTPUT_H_
#include "FormOutput.ui"
class FormOutput
: public QWidget,
public Ui_FormOutput
{
Q_OBJECT
public:
FormOutput
(QWidget* parent
= 0, Qt
::WFlags flags
= 0);
virtual ~FormOutput();
public slots:
void appendMessage
(QString message
);
void appendDebugMessage
(QString message
);
void appendCommand
(QString message
);
private:
void addTextAtTop
(QString message
);
};
}
#endif
#ifndef FORMOUTPUT_H_
#define FORMOUTPUT_H_
#include "FormOutput.ui"
class FormOutput : public QWidget, public Ui_FormOutput
{
Q_OBJECT
public:
FormOutput(QWidget* parent = 0, Qt::WFlags flags = 0);
virtual ~FormOutput();
public slots:
void appendError(QString message);
void appendMessage(QString message);
void appendDebugMessage(QString message);
void appendCommand(QString message);
private:
void addTextAtTop(QString message);
};
}
#endif
To copy to clipboard, switch view to plain text mode
the .cpp file:
#include "FormOutput.h"
FormOutput
::FormOutput(QWidget* parent
/*= 0*/, Qt
::WFlags flags
/*= 0*/) : QWidget(parent, flags
){
setupUi(this);
}
FormOutput::~FormOutput()
{
}
void FormOutput
::addTextAtTop(QString message
) {
cursor.insertHtml(message + "<br />");
}
void FormOutput
::appendMessage(QString message
) {
this->addTextAtTop(".. " + message);
}
void FormOutput
::appendDebugMessage(QString message
) {
this->addTextAtTop("<font color=\"grey\"># " + message +"</font>");
}
void FormOutput
::appendCommand(QString message
) {
this->addTextAtTop("<font color=\"green\">-> " + message +"</font>");
}
void FormOutput
::appendError(QString message
) {
this->addTextAtTop("<font color=\"red\">-> <b>" + message +"</b></font>");
}
}
FormOutput::FormOutput(QWidget* parent /*= 0*/, Qt::WFlags flags /*= 0*/) : QWidget(parent, flags)
{
setupUi(this);
}
FormOutput::~FormOutput()
{
}
void FormOutput::addTextAtTop(QString message)
{
QTextCursor cursor = this->textBrowser->textCursor();
cursor.movePosition(QTextCursor::Start);
cursor.insertHtml(message + "<br />");
}
void FormOutput::appendMessage(QString message)
{
this->addTextAtTop(".. " + message);
}
void FormOutput::appendDebugMessage(QString message)
{
this->addTextAtTop("<font color=\"grey\"># " + message +"</font>");
}
void FormOutput::appendCommand(QString message)
{
this->addTextAtTop("<font color=\"green\">-> " + message +"</font>");
}
void FormOutput::appendError(QString message)
{
this->addTextAtTop("<font color=\"red\">-> <b>" + message +"</b></font>");
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks