diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/objects/class_urllabel.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/objects/class_urllabel.cpp')
-rw-r--r-- | src/modules/objects/class_urllabel.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/modules/objects/class_urllabel.cpp b/src/modules/objects/class_urllabel.cpp index 544153c2..8b989236 100644 --- a/src/modules/objects/class_urllabel.cpp +++ b/src/modules/objects/class_urllabel.cpp @@ -33,10 +33,10 @@ #include "kvi_window.h" #include "kvi_kvs_script.h" #ifdef COMPILE_USE_QT4 -#include <QMouseEvent> -#define QT_LEFT_BUTTON Qt::LeftButton +#include <TQMouseEvent> +#define TQT_LEFT_BUTTON Qt::LeftButton #else -#define QT_LEFT_BUTTON QEvent::LeftButton +#define TQT_LEFT_BUTTON Qt::LeftButton #endif //#warning "Functions to change colors for different states" //#warning "$setUnderline(), $underline()" @@ -53,39 +53,39 @@ static KviScriptObject * urlLabelClassCreateInstance(KviScriptObjectClass * c, KviScriptUrlLabelObject::KviScriptUrlLabelObject(KviScriptObjectClass * c, \ KviScriptObject * p, const char *n) : KviScriptLabelObject(c, p, n) { - m_normalClr = QColor("black"); - m_enterClr = QColor("blue"); - m_activeClr = QColor("red"); + m_normalClr = TQColor("black"); + m_enterClr = TQColor("blue"); + m_activeClr = TQColor("red"); m_useSingleClick = true; -// ((QLabel *)widget())->setAutoResize(true); - //widget()->setCursor(Qt::pointingHandCursor); - //((KviScriptWidgetObject: * )p)->widget()->setCursor(Qt::pointingHandCursor); +// ((TQLabel *)widget())->setAutoResize(true); + //widget()->setCursor(TQt::pointingHandCursor); + //((KviScriptWidgetObject: * )p)->widget()->setCursor(TQt::pointingHandCursor); } KviScriptUrlLabelObject::~KviScriptUrlLabelObject() { } -bool KviScriptUrlLabelObject::eventFilter(QObject * o, QEvent * e) +bool KviScriptUrlLabelObject::eventFilter(TQObject * o, TQEvent * e) { - QPalette pal = ((QLabel *)widget())->palette(); + TQPalette pal = ((TQLabel *)widget())->palette(); switch(e->type()) { - case QEvent::Enter: - pal.setColor(QColorGroup::Foreground, m_enterClr); + case TQEvent::Enter: + pal.setColor(TQColorGroup::Foreground, m_enterClr); break; - case QEvent::Leave: + case TQEvent::Leave: // this doesn't work... - if(((QMouseEvent *)e)->state() & QEvent::LeftButton) - pal.setColor(QColorGroup::Foreground, \ + if(((TQMouseEvent *)e)->state() & TQEvent::LeftButton) + pal.setColor(TQColorGroup::Foreground, \ m_activeClr); else - pal.setColor(QColorGroup::Foreground, \ + pal.setColor(TQColorGroup::Foreground, \ m_normalClr); break; - case QEvent::MouseButtonRelease: - pal.setColor(QColorGroup::Foreground, m_enterClr); + case TQEvent::MouseButtonRelease: + pal.setColor(TQColorGroup::Foreground, m_enterClr); // perform actions here if(!m_lastClickWasDbl && !m_useSingleClick) break; @@ -94,24 +94,24 @@ bool KviScriptUrlLabelObject::eventFilter(QObject * o, QEvent * e) } break; - case QEvent::MouseButtonPress: + case TQEvent::MouseButtonPress: m_lastClickWasDbl = false; - if(!((QMouseEvent * )e)->button() & \ - QEvent::LeftButton || !m_useSingleClick) + if(!((TQMouseEvent * )e)->button() & \ + TQEvent::LeftButton || !m_useSingleClick) break; - pal.setColor(QColorGroup::Foreground, m_activeClr); + pal.setColor(TQColorGroup::Foreground, m_activeClr); break; - case QEvent::MouseButtonDblClick: + case TQEvent::MouseButtonDblClick: m_lastClickWasDbl = true; if(m_useSingleClick) break; - pal.setColor(QColorGroup::Foreground, m_activeClr); + pal.setColor(TQColorGroup::Foreground, m_activeClr); break; default: // make gcc happy break; } - ((QLabel *)widget())->setPalette(pal); + ((TQLabel *)widget())->setPalette(pal); return false; } @@ -152,7 +152,7 @@ bool KviScriptUrlLabelObject::eventFilter(QObject * o, QEvent * e) !fn: $setText(<text>) Sets the label's text. Reimplemented from internal reasons. !fn: $setCursorChange(<bEnabled:boolean>) - Tells the label wheather to change or not the shape of cursor, + Tells the label wheather to change or not the tqshape of cursor, when it is above the widget. Default is false. !fn: <boolean> $cursorChange() Returns true if the cursor changes over the label, false if not. @@ -181,9 +181,9 @@ KVSO_END_REGISTERCLASS(KviKvsObject_urlabel) KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_urlabel,KviKvsObject_label) - m_normalClr = QColor("black"); - m_enterClr = QColor("blue"); - m_activeClr = QColor("red"); + m_normalClr = TQColor("black"); + m_enterClr = TQColor("blue"); + m_activeClr = TQColor("red"); m_useSingleClick = true; KVSO_END_CONSTRUCTOR(KviKvsObject_urlabel) @@ -192,26 +192,26 @@ KVSO_BEGIN_DESTRUCTOR(KviKvsObject_urlabel) KVSO_END_CONSTRUCTOR(KviKvsObject_urlabel) -bool KviKvsObject_urlabel::eventFilter(QObject * o, QEvent * e) +bool KviKvsObject_urlabel::eventFilter(TQObject * o, TQEvent * e) { - QPalette pal = ((QLabel *)widget())->palette(); + TQPalette pal = ((TQLabel *)widget())->palette(); switch(e->type()) { - case QEvent::Enter: - pal.setColor(QColorGroup::Foreground, m_enterClr); + case TQEvent::Enter: + pal.setColor(TQColorGroup::Foreground, m_enterClr); break; - case QEvent::Leave: + case TQEvent::Leave: // this doesn't work... - if(((QMouseEvent *)e)->state() & QT_LEFT_BUTTON) - pal.setColor(QColorGroup::Foreground, \ + if(((TQMouseEvent *)e)->state() & TQT_LEFT_BUTTON) + pal.setColor(TQColorGroup::Foreground, \ m_activeClr); else - pal.setColor(QColorGroup::Foreground, \ + pal.setColor(TQColorGroup::Foreground, \ m_normalClr); break; - case QEvent::MouseButtonRelease: - pal.setColor(QColorGroup::Foreground, m_enterClr); + case TQEvent::MouseButtonRelease: + pal.setColor(TQColorGroup::Foreground, m_enterClr); // perform actions here if(!m_lastClickWasDbl && !m_useSingleClick) break; @@ -225,30 +225,30 @@ bool KviKvsObject_urlabel::eventFilter(QObject * o, QEvent * e) kvs.run(g_pActiveWindow,0,0/*,KviKvsScript::AssumeLocals*/); } break; - case QEvent::MouseButtonPress: + case TQEvent::MouseButtonPress: m_lastClickWasDbl = false; - if(!((QMouseEvent * )e)->button() & \ - QT_LEFT_BUTTON || !m_useSingleClick) + if(!((TQMouseEvent * )e)->button() & \ + TQT_LEFT_BUTTON || !m_useSingleClick) break; - pal.setColor(QColorGroup::Foreground, m_activeClr); + pal.setColor(TQColorGroup::Foreground, m_activeClr); break; - case QEvent::MouseButtonDblClick: + case TQEvent::MouseButtonDblClick: m_lastClickWasDbl = true; if(m_useSingleClick) break; - pal.setColor(QColorGroup::Foreground, m_activeClr); + pal.setColor(TQColorGroup::Foreground, m_activeClr); break; default: // make gcc happy break; } - ((QLabel *)widget())->setPalette(pal); + ((TQLabel *)widget())->setPalette(pal); return false; } bool KviKvsObject_urlabel::functionsetUrl(KviKvsObjectFunctionCall *c) { - QString szUrl; + TQString szUrl; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("url",KVS_PT_STRING,0,szUrl) KVSO_PARAMETERS_END(c) @@ -267,7 +267,7 @@ bool KviKvsObject_urlabel::functionurl(KviKvsObjectFunctionCall *c) } bool KviKvsObject_urlabel::functionsetAction(KviKvsObjectFunctionCall *c) { - QString szAction; + TQString szAction; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("action",KVS_PT_STRING,0,szAction) KVSO_PARAMETERS_END(c) @@ -281,13 +281,13 @@ bool KviKvsObject_urlabel::functionsetAction(KviKvsObjectFunctionCall *c) } bool KviKvsObject_urlabel::functionsetText(KviKvsObjectFunctionCall *c) { - QString szText; + TQString szText; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("text",KVS_PT_STRING,0,szText) KVSO_PARAMETERS_END(c) if(!widget()) return true; - ((QLabel *)widget())->setText(szText); - ((QLabel *)widget())->setFixedSize(((QLabel *)widget())->sizeHint()); + ((TQLabel *)widget())->setText(szText); + ((TQLabel *)widget())->setFixedSize(((TQLabel *)widget())->tqsizeHint()); return true; } bool KviKvsObject_urlabel::functionaction(KviKvsObjectFunctionCall *c) @@ -304,9 +304,9 @@ bool KviKvsObject_urlabel::functionsetCursorChange(KviKvsObjectFunctionCall *c) if(!widget()) return true; if(m_changeCursor = bFlag) - widget()->setCursor(Qt::pointingHandCursor); + widget()->setCursor(TQt::pointingHandCursor); else - widget()->setCursor(Qt::arrowCursor); + widget()->setCursor(TQt::arrowCursor); return true; } bool KviKvsObject_urlabel::functionsetUseSingleClick(KviKvsObjectFunctionCall *c) |