[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Porting App Using QStyleSheet To Qt4
From: Joaquín Fernández Quiles <joaquinf () cantv ! net>
Date: 2006-10-22 2:16:08
Message-ID: 453AD468.50105 () cantv ! net
[Download RAW message or body]
I have a KDE/Qt3 source code and i want to port it to KDE/Qt4, but i don't know how to implement my
style without QStyleSheet. I have a class derived from QTextBrowser with this code in the
constructor, in order to add some tags to QStyleSheet used by QTextBrowser:
//*******************************************************************************
CNavTB::CNavTB(QWidget *parent, const char *name) : QTextBrowser (parent, name) {
QStyleSheet *ss = new QStyleSheet(this, "HojaDeEstilos_CWBiblias");
QStyleSheetItem *qssi = new QStyleSheetItem(ss, "bbi");
qssi->setAnchor(TRUE);
qssi->setColor("#996633");
qssi->setFontWeight(QFont::Bold);
qssi->setLogicalFontSize(4);
qssi->setVerticalAlignment(QStyleSheetItem::VAlignSuper);
qssi = new QStyleSheetItem(ss, "bbn");
qssi->setAnchor(TRUE);
qssi->setColor("#6699CC");
qssi->setFontWeight(QFont::Bold);
qssi->setLogicalFontSize(4);
qssi->setVerticalAlignment(QStyleSheetItem::VAlignSuper);
qssi = new QStyleSheetItem(ss, "num");
qssi->setColor("#800000");
qssi->setLogicalFontSize(3);
qssi->setVerticalAlignment(QStyleSheetItem::VAlignSuper);
qssi = new QStyleSheetItem(ss, "ver");
qssi->setColor("#000000");
qssi->setFontWeight(QFont::Normal);
qssi->setLogicalFontSize(3);
qssi->setDisplayMode(QStyleSheetItem::DisplayBlock);
qssi->setSelfNesting(FALSE);
setStyleSheet(ss);
setPaletteBackgroundColor("#FFFFFF");
setLinkUnderline(FALSE);
connect(this, SIGNAL(linkClicked(const QString&)), this, SLOT(slotLinkClicked(const QString&)));
}
//*******************************************************************************
Then, when i use this class for showing some text, i set the html text with my tags:
//*******************************************************************************
ListaTB = new CNavTB(this);
QString V = "<table width=100%>";
CAP C = LeeC(Cap);
for (CAP::iterator it = C.begin(); it != C.end(); it++, NumV++) {
V += "<tr><td bgcolor=#";
V += (NumV & 1 ? "FFFFFF>" : "F6F6F6>");
V += "<bbi name=#" + QString::number(NumV) + "></bbi><ver><num>" + QString::number(NumV) +
"</num> " + QString::fromUtf8((*it).c_str());
V += " <bbi href=#V" + QString::number(Cap) + "_" + QString::number(NumV - 1) +
"-" + QString::number(NumV) + ">§</bbi><bbn href=#N0_0-0>¶</bbn></ver></td></tr>";
}
V += "</table>";
ListaTB->setTexto(V);
//*******************************************************************************
How is the way for this using KDE/Qt4?
I need to format my text using my own tags.
I have read some articles from Trolltech about QTextDocument and QTextCursor but i don't understand
them and don't have examples similar to my situation.
Regards
Joaquín
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic