diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-12 01:36:19 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-12 01:36:19 +0000 |
commit | 99a2774ca6f1cab334de5d43fe36fc44ae889a4c (patch) | |
tree | eff34cf0762227f6baf2a93e8fef48d4bed2651c /scheck/scheck.cpp | |
parent | 1c104292188541106338d4940b0f04beeb4301a0 (diff) | |
download | tdesdk-99a2774ca6f1cab334de5d43fe36fc44ae889a4c.tar.gz tdesdk-99a2774ca6f1cab334de5d43fe36fc44ae889a4c.zip |
TQt4 convert kdesdk
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1236185 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'scheck/scheck.cpp')
-rw-r--r-- | scheck/scheck.cpp | 306 |
1 files changed, 153 insertions, 153 deletions
diff --git a/scheck/scheck.cpp b/scheck/scheck.cpp index 263a77ce..4e4dd724 100644 --- a/scheck/scheck.cpp +++ b/scheck/scheck.cpp @@ -8,14 +8,14 @@ * * Based on the KDE3 HighColor Style (version 1.0): * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> - * (C) 2001-2002 Fredrik Höglund <fredrik@kde.org> + * (C) 2001-2002 Fredrik H�glund <fredrik@kde.org> * * Drawing routines adapted from the KDE2 HCStyle, * Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> * (C) 2000 Dirk Mueller <mueller@kde.org> * (C) 2001 Martijn Klingens <klingens@kde.org> * - * Portions of code are from the Qt GUI Toolkit, Copyright (C) 1992-2003 Trolltech AS. + * Portions of code are from the TQt GUI Toolkit, Copyright (C) 1992-2003 Trolltech AS. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -74,7 +74,7 @@ #include "bitmaps.h" // -- Style Plugin Interface ------------------------- -class StyleCheckStylePlugin : public QStylePlugin +class StyleCheckStylePlugin : public TQStylePlugin { public: StyleCheckStylePlugin() {} @@ -104,7 +104,7 @@ static TQBitmap lightBmp; static TQBitmap grayBmp; static TQBitmap dgrayBmp; static TQBitmap centerBmp; -static TQBitmap maskBmp; +static TQBitmap tqmaskBmp; static TQBitmap xBmp; static const int itemFrame = 1; @@ -269,7 +269,7 @@ namespace m_words->insert( "ctrl", "Ctrl"); m_words->insert( "java", "Java"); m_words->insert( "javascript", "JavaScript"); - m_words->insert( "qt", "Qt"); + m_words->insert( "qt", "TQt"); m_words->insert( "doxygen", "Doxygen"); m_words->insert( "linux", "Linux"); m_words->insert( "unix", "UNIX"); @@ -306,7 +306,7 @@ static TQColor severityColor(int severity) { if (severity == StyleGuideViolation::Error) { - return Qt::red; + return TQt::red; } else if (severity == StyleGuideViolation::AccelConflict) { @@ -314,7 +314,7 @@ static TQColor severityColor(int severity) } else if (severity == StyleGuideViolation::AccelSuggestion) { - return Qt::green; + return TQt::green; } else if (severity == StyleGuideViolation::Untranslated) { @@ -322,7 +322,7 @@ static TQColor severityColor(int severity) } else { - return Qt::yellow; + return TQt::yellow; } } @@ -343,7 +343,7 @@ static void removeAccelerators(TQString &str) static void removeXX(TQString &str) { - str.replace("xx",""); // simple but atm best working + str.tqreplace("xx",""); // simple but atm best working } static TQString removedXX(TQString str) @@ -355,13 +355,13 @@ static TQString removedXX(TQString str) static TQString stripAccelViolations(TQString str) { - int conflict_pos = str.find("(&&)"); + int conflict_pos = str.tqfind("(&&)"); if (conflict_pos >= 0) { str = str.mid(0, conflict_pos) + str.mid(conflict_pos+4); } - int suggestion_pos = str.find("(!)"); + int suggestion_pos = str.tqfind("(!)"); if (suggestion_pos >= 0) { str = str.mid(0, suggestion_pos) + str.mid(suggestion_pos+3); @@ -373,12 +373,12 @@ static TQString stripAccelViolations(TQString str) // Must be passed a string with its accelerators removed TQString findAccelViolations(TQString str, TQValueVector<StyleGuideViolation> &violations) { - int conflict_pos = str.find("(&)"); + int conflict_pos = str.tqfind("(&)"); if (conflict_pos >= 0) str = str.mid(0, conflict_pos) + str.mid(conflict_pos+3); - int suggestion_pos = str.find("(!)"); + int suggestion_pos = str.tqfind("(!)"); if (suggestion_pos >= 0) { str = str.mid(0, suggestion_pos) + str.mid(suggestion_pos+3); @@ -399,7 +399,7 @@ TQString findAccelViolations(TQString str, TQValueVector<StyleGuideViolation> &v TQString findUntranslatedViolations(TQString str, TQValueVector<StyleGuideViolation> &violations) { - if (str.find("xx")!=-1) + if (str.tqfind("xx")!=-1) removeXX(str); else { for (unsigned int c=0; c<str.length(); c++) @@ -486,7 +486,7 @@ static TQValueVector<StyleGuideViolation> checkSentenceStyle(TQString str, Colo if (afterWhiteSpace) //We don't check for fOO and things like that, just first letters.. { // Try to extract the whole word.. - TQString word = TQString::null; + TQString word = TQString(); for (unsigned int l = c+1; l<str.length(); l++) { if (!str[l].isLetter() && !str[l].isNumber() && str[l] != '&' && str[l] != '-') @@ -502,7 +502,7 @@ static TQValueVector<StyleGuideViolation> checkSentenceStyle(TQString str, Colo } // Check if it's in the explicit case word list - const char *correctWord = ExplicitCaseWords::words()->find(word.lower()); + const char *correctWord = ExplicitCaseWords::words()->tqfind(word.lower()); // Actual captialization checking if (correctWord) @@ -646,7 +646,7 @@ static TQValueVector<StyleGuideViolation> checkTitleStyle(TQString str, TitleTy bool lastWord = false; //Now, try to extract the whole word.. - TQString word = TQString::null; + TQString word = TQString(); for (unsigned int l = c+1; l<str.length(); l++) { if (!str[l].isLetter() && !str[l].isNumber() && str[l] != '&' && str[l] != '-') @@ -667,7 +667,7 @@ static TQValueVector<StyleGuideViolation> checkTitleStyle(TQString str, TitleTy TQString lower_word = word.lower(); // Check if it's in the explicit case word list - const char *correctWord = ExplicitCaseWords::words()->find(lower_word); + const char *correctWord = ExplicitCaseWords::words()->tqfind(lower_word); if ((titleType == ShortTitle) && (lower_word=="and" || lower_word=="a" || lower_word=="an" || lower_word=="the")) { @@ -686,7 +686,7 @@ static TQValueVector<StyleGuideViolation> checkTitleStyle(TQString str, TitleTy violations.push_back(c + x); } } - else if (c && !lastWord && LowerCaseWords::words()->find(word.lower())) + else if (c && !lastWord && LowerCaseWords::words()->tqfind(word.lower())) { // We're a lowercase word if (str[c].category() == TQChar::Letter_Uppercase) @@ -729,7 +729,7 @@ static void renderViolations(const TQValueVector<StyleGuideViolation>& violation // str.setLength() always does a deep copy, so the replacement code below is safe. parStr.setLength( len ); // compatible behaviour to the old implementation. Replace tabs by spaces - TQChar *chr = (TQChar*)parStr.unicode(); + TQChar *chr = (TQChar*)parStr.tqunicode(); int l = len; while ( l-- ) { @@ -739,7 +739,7 @@ static void renderViolations(const TQValueVector<StyleGuideViolation>& violation } - if ( flags & Qt::ShowPrefix ) + if ( flags & TQt::ShowPrefix ) { parStr = removedXX(stripAccelViolations(parStr)); removeAccelerators(parStr); @@ -751,13 +751,13 @@ static void renderViolations(const TQValueVector<StyleGuideViolation>& violation int xoff = r.x(); int yoff = r.y() + qfm.ascent(); - if ( flags & Qt::AlignBottom ) + if ( flags & TQt::AlignBottom ) yoff += r.height() - h; - else if ( flags & Qt::AlignVCenter ) + else if ( flags & TQt::AlignVCenter ) yoff += ( r.height() - h ) / 2; - if ( flags & Qt::AlignRight ) + if ( flags & TQt::AlignRight ) xoff += r.width() - w; - else if ( flags & Qt::AlignHCenter ) + else if ( flags & TQt::AlignHCenter ) xoff += ( r.width() - w ) / 2; @@ -894,22 +894,22 @@ StyleCheckStyle::~StyleCheckStyle() //We walk down the widget tree until we find something we render, and sic KAccelManager in programmer's mode on those void StyleCheckStyle::accelManageRecursive(TQWidget* widget) { - if (&widget->style() == this) + if (&widget->tqstyle() == this) { KAcceleratorManager::manage(widget, true); return; } - const TQObjectList* children = widget->children(); - if (!children) + const TQObjectList tqchildren = widget->childrenListObject(); + if (tqchildren.isEmpty()) return; - TQObjectListIterator iter(*children); + TQObjectListIterator iter(tqchildren); TQObject* walk; while ((walk = iter.current())) { if (walk->isWidgetType()) - accelManageRecursive(static_cast<TQWidget*>(walk)); + accelManageRecursive(TQT_TQWIDGET(walk)); ++iter; } } @@ -918,7 +918,7 @@ void StyleCheckStyle::accelManageRecursive(TQWidget* widget) void StyleCheckStyle::slotAccelManage() { //Walk through top-levels - TQWidgetList* topLevels = TQApplication::topLevelWidgets(); + TQWidgetList* topLevels = TQApplication::tqtopLevelWidgets(); if (!topLevels) return; @@ -991,7 +991,7 @@ void StyleCheckStyle::unPolish(TQWidget* widget) -// This function draws primitive elements as well as their masks. +// This function draws primitive elements as well as their tqmasks. void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, const TQRect &r, @@ -1058,7 +1058,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, if ( sunken ) kDrawBeButton( p, x, y, w, h, cg, true, - &cg.brush(TQColorGroup::Mid) ); + &cg.tqbrush(TQColorGroup::Mid) ); else if ( flags & Style_MouseOver ) { TQBrush brush(cg.button().light(110)); @@ -1071,7 +1071,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, else kDrawBeButton(p, x, y, w, h, cg, false, - &cg.brush(TQColorGroup::Button)); + &cg.tqbrush(TQColorGroup::Button)); break; } @@ -1124,7 +1124,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, if (p && p->device()->devType() == TQInternal::Widget) { TQHeader* hdr = dynamic_cast<TQHeader*>(p->device()); if (hdr) - horizontal = hdr->orientation() == Horizontal; + horizontal = hdr->orientation() ==Qt::Horizontal; } int x,y,w,h; @@ -1341,16 +1341,16 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, } - // RADIOBUTTON (exclusive indicator) mask + // RADIOBUTTON (exclusive indicator) tqmask // ------------------------------------------------------------------- case PE_ExclusiveIndicatorMask: { - if (maskBmp.isNull()) { - maskBmp = TQBitmap(13, 13, radiomask_bits, true); - maskBmp.setMask(maskBmp); + if (tqmaskBmp.isNull()) { + tqmaskBmp = TQBitmap(13, 13, radiotqmask_bits, true); + tqmaskBmp.setMask(tqmaskBmp); } - p->setPen(Qt::color1); - p->drawPixmap(r.x(), r.y(), maskBmp); + p->setPen(TQt::color1); + p->drawPixmap(r.x(), r.y(), tqmaskBmp); break; } @@ -1392,7 +1392,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, case PE_WindowFrame: case PE_PanelLineEdit: { bool sunken = flags & Style_Sunken; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? tqpixelMetric(PM_DefaultFrameWidth) : opt.lineWidth(); if (lw == 2) { @@ -1415,7 +1415,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, p->drawLine(x+1, y+1, x+1, y2-1); p->setPen(oldPen); } else - KStyle::drawPrimitive(pe, p, r, cg, flags, opt); + KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); break; } @@ -1437,7 +1437,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, p->drawLine(r.x(), y2, x2, y2); p->drawLine(x2, r.y(), x2, y2); - // ### Qt should specify Style_Horizontal where appropriate + // ### TQt should specify Style_Horizontal where appropriate renderGradient( p, TQRect(r.x()+1, r.y()+1, x2-1, y2-1), cg.button(), (r.width() < r.height()) && (pe != PE_PanelMenuBar) ); @@ -1485,25 +1485,25 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, // HighColor & Default arrows switch(pe) { case PE_ArrowUp: - a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); + a.setPoints(TQCOORDARRLEN(u_arrow), u_arrow); break; case PE_ArrowDown: - a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); + a.setPoints(TQCOORDARRLEN(d_arrow), d_arrow); break; case PE_ArrowLeft: - a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); + a.setPoints(TQCOORDARRLEN(l_arrow), l_arrow); break; default: - a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); + a.setPoints(TQCOORDARRLEN(r_arrow), r_arrow); } p->save(); if ( flags & Style_Down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal ), - pixelMetric( PM_ButtonShiftVertical ) ); + p->translate( tqpixelMetric( PM_ButtonShiftHorizontal ), + tqpixelMetric( PM_ButtonShiftVertical ) ); if ( flags & Style_Enabled ) { a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); @@ -1520,7 +1520,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe, p->restore(); } else - KStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); } } } @@ -1614,7 +1614,7 @@ void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe, // ------------------------------------------------------------------- case KPE_SliderGroove: { const TQSlider* slider = (const TQSlider*)widget; - bool horizontal = slider->orientation() == Horizontal; + bool horizontal = slider->orientation() ==Qt::Horizontal; int gcenter = (horizontal ? r.height() : r.width()) / 2; TQRect gr; @@ -1648,7 +1648,7 @@ void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe, // ------------------------------------------------------------------- case KPE_SliderHandle: { const TQSlider* slider = (const TQSlider*)widget; - bool horizontal = slider->orientation() == Horizontal; + bool horizontal = slider->orientation() ==Qt::Horizontal; int x,y,w,h; r.rect(&x, &y, &w, &h); int x2 = x+w-1; @@ -1705,7 +1705,7 @@ void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe, } -void StyleCheckStyle::drawControl( ControlElement element, +void StyleCheckStyle::tqdrawControl( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, @@ -1727,7 +1727,7 @@ void StyleCheckStyle::drawControl( ControlElement element, if ( btnDefault || button->autoDefault() ) { // Compensate for default indicator - static int di = pixelMetric( PM_ButtonDefaultIndicator ); + static int di = tqpixelMetric( PM_ButtonDefaultIndicator ); br.addCoords( di, di, -di, -di ); } @@ -1750,14 +1750,14 @@ void StyleCheckStyle::drawControl( ControlElement element, // Shift button contents if pushed. if ( active ) { - x += pixelMetric(PM_ButtonShiftHorizontal, widget); - y += pixelMetric(PM_ButtonShiftVertical, widget); + x += tqpixelMetric(PM_ButtonShiftHorizontal, widget); + y += tqpixelMetric(PM_ButtonShiftVertical, widget); flags |= Style_Sunken; } // Does the button have a popup menu? if ( button->isMenuButton() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ); + int dx = tqpixelMetric( PM_MenuButtonIndicator, widget ); drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), cg, flags, opt ); w -= dx; @@ -1786,7 +1786,7 @@ void StyleCheckStyle::drawControl( ControlElement element, // Make the label indicate if the button is a default button or not if ( active || button->isDefault() ) { // Draw "fake" bold text - this enables the font metrics to remain - // the same as computed in TQPushButton::sizeHint(), but gives + // the same as computed in TQPushButton::tqsizeHint(), but gives // a reasonable bold effect. int i; @@ -1794,25 +1794,25 @@ void StyleCheckStyle::drawControl( ControlElement element, if (button->isEnabled()) // Don't draw double-shadow when disabled for(i=0; i<2; i++) drawItem( p, TQRect(x+i+1, y+1, w, h), AlignCenter | ShowPrefix, - button->colorGroup(), button->isEnabled(), button->pixmap(), + button->tqcolorGroup(), button->isEnabled(), button->pixmap(), removedXX(stripAccelViolations(button->text())), -1, - active ? &button->colorGroup().dark() : &button->colorGroup().mid() ); + active ? &button->tqcolorGroup().dark() : &button->tqcolorGroup().mid() ); // Normal Text for(i=0; i<2; i++) drawItem( p, TQRect(x+i, y, w, h), AlignCenter | ShowPrefix, - button->colorGroup(), button->isEnabled(), button->pixmap(), + button->tqcolorGroup(), button->isEnabled(), button->pixmap(), removedXX(stripAccelViolations(button->text())), -1, - active ? &button->colorGroup().light() : &button->colorGroup().buttonText() ); + active ? &button->tqcolorGroup().light() : &button->tqcolorGroup().buttonText() ); } else - drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, button->colorGroup(), + drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, button->tqcolorGroup(), button->isEnabled(), button->pixmap(), removedXX(stripAccelViolations(button->text())), -1, - active ? &button->colorGroup().light() : &button->colorGroup().buttonText() ); + active ? &button->tqcolorGroup().light() : &button->tqcolorGroup().buttonText() ); // Draw a focus rect if the button has focus if ( flags & Style_HasFocus ) drawPrimitive( PE_FocusRect, p, - TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget), + TQStyle::tqvisualRect(subRect(SR_PushButtonFocusRect, widget), widget), cg, flags ); break; } @@ -1828,7 +1828,7 @@ void StyleCheckStyle::drawControl( ControlElement element, TQRect tr = r; if ( t->identifier() == tb->currentTab() ) tr.setBottom( tr.bottom() - - pixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) ); + tqpixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) ); TQValueVector<StyleGuideViolation> violations = checkTitleStyle(t->text(), ShortTitle, HasAccels); renderViolations(violations, p, r, AlignCenter |ShowPrefix, t->text()); @@ -1846,18 +1846,18 @@ void StyleCheckStyle::drawControl( ControlElement element, { const TQCheckBox* checkbox = static_cast<const TQCheckBox*>(widget); - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + int tqalignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; TQValueVector<StyleGuideViolation> violations = checkSentenceStyle(checkbox->text()); - renderViolations(violations, p, r, alignment | AlignVCenter | ShowPrefix, checkbox->text()); + renderViolations(violations, p, r, tqalignment | AlignVCenter | ShowPrefix, checkbox->text()); - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + drawItem(p, r, tqalignment | AlignVCenter | ShowPrefix, cg, flags & Style_Enabled, checkbox->pixmap(), removedXX(stripAccelViolations(checkbox->text()))); if (flags & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget); + TQRect fr = tqvisualRect(subRect(SR_CheckBoxFocusRect, widget), widget); drawPrimitive(PE_FocusRect, p, fr, cg, flags); } break; @@ -1867,18 +1867,18 @@ void StyleCheckStyle::drawControl( ControlElement element, { const TQRadioButton* rb = static_cast<const TQRadioButton*>(widget); - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + int tqalignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; TQValueVector<StyleGuideViolation> violations = checkSentenceStyle(rb->text()); - renderViolations(violations, p, r,alignment | AlignVCenter | ShowPrefix, rb->text()); + renderViolations(violations, p, r,tqalignment | AlignVCenter | ShowPrefix, rb->text()); - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + drawItem(p, r, tqalignment | AlignVCenter | ShowPrefix, cg, flags & Style_Enabled, rb->pixmap(), removedXX(stripAccelViolations(rb->text()))); if (flags & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget); + TQRect fr = tqvisualRect(subRect(SR_CheckBoxFocusRect, widget), widget); drawPrimitive(PE_FocusRect, p, fr, cg, flags); } break; @@ -1933,13 +1933,13 @@ void StyleCheckStyle::drawControl( ControlElement element, bool enabled = mi->isEnabled(); bool checkable = popupmenu->isCheckable(); bool active = flags & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = tqstyleHint( SH_EtchDisabledText ); bool reverse = TQApplication::reverseLayout(); int x, y, w, h; r.rect( &x, &y, &w, &h ); if ( checkable ) - checkcol = QMAX( checkcol, 20 ); + checkcol = TQMAX( checkcol, 20 ); // Are we a menu item separator? if ( mi->isSeparator() ) { @@ -1964,7 +1964,7 @@ void StyleCheckStyle::drawControl( ControlElement element, // Do we have an icon? if ( mi->iconSet() ) { TQIconSet::Mode mode; - TQRect cr = visualRect( TQRect(x, y, checkcol, h), r ); + TQRect cr = tqvisualRect( TQRect(x, y, checkcol, h), r ); // Select the correct icon from the iconset if ( active ) @@ -2050,7 +2050,7 @@ void StyleCheckStyle::drawControl( ControlElement element, // Does the menu item have a text label? if ( !s.isNull() ) { - int t = s.find( '\t' ); + int t = s.tqfind( '\t' ); int m = itemVMargin; int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine; text_flags |= reverse ? AlignRight : AlignLeft; @@ -2096,22 +2096,22 @@ void StyleCheckStyle::drawControl( ControlElement element, // Draw the pixmap if ( pixmap->depth() == 1 ) - p->setBackgroundMode( OpaqueMode ); + p->setBackgroundMode( Qt::OpaqueMode ); int diffw = ( ( w - pixmap->width() ) / 2 ) + ( ( w - pixmap->width() ) % 2 ); p->drawPixmap( x+diffw, y+itemFrame, *pixmap ); if ( pixmap->depth() == 1 ) - p->setBackgroundMode( TransparentMode ); + p->setBackgroundMode( Qt::TransparentMode ); } } // Does the menu item have a submenu? if ( mi->popup() ) { PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator); - TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, + int dim = tqpixelMetric(PM_MenuButtonIndicator); + TQRect vr = tqvisualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, y + h / 2 - dim / 2, dim, dim), r ); // Draw an arrow at the far end of the menu item @@ -2147,7 +2147,7 @@ void StyleCheckStyle::drawControl( ControlElement element, TQRect pixRect = rect; pixRect.setY( rect.center().y() - (pixh - 1) / 2 ); drawItem ( p, pixRect, AlignVCenter, cg, flags & Style_Enabled, - &pixmap, TQString::null ); + &pixmap, TQString() ); rect.setLeft( rect.left() + pixw + 2 ); } @@ -2164,12 +2164,12 @@ void StyleCheckStyle::drawControl( ControlElement element, } default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::tqdrawControl(element, p, widget, r, cg, flags, opt); } } -void StyleCheckStyle::drawControlMask( ControlElement element, +void StyleCheckStyle::tqdrawControlMask( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, @@ -2182,7 +2182,7 @@ void StyleCheckStyle::drawControlMask( ControlElement element, case CE_PushButton: { int x1, y1, x2, y2; r.coords( &x1, &y1, &x2, &y2 ); - QCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 }; + TQCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 }; p->fillRect( r, color1 ); p->setPen( color0 ); p->drawPoints( TQPointArray(4, corners) ); @@ -2190,12 +2190,12 @@ void StyleCheckStyle::drawControlMask( ControlElement element, } default: - KStyle::drawControlMask(element, p, widget, r, opt); + KStyle::tqdrawControlMask(element, p, widget, r, opt); } } -void StyleCheckStyle::drawComplexControl( ComplexControl control, +void StyleCheckStyle::tqdrawComplexControl( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, @@ -2246,7 +2246,7 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control, p->drawLine(x+1, y+2, x+1, y2-2); // Get the button bounding box - TQRect ar = TQStyle::visualRect( + TQRect ar = TQStyle::tqvisualRect( querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow), widget ); @@ -2265,7 +2265,7 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control, if ( controls & SC_ComboBoxEditField ) { const TQComboBox * cb = (const TQComboBox *) widget; - TQRect re = TQStyle::visualRect( + TQRect re = TQStyle::tqvisualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField), widget ); @@ -2289,7 +2289,7 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control, p->fillRect( re.x(), re.y(), re.width(), re.height(), cg.brush( TQColorGroup::Highlight ) ); - TQRect re = TQStyle::visualRect( + TQRect re = TQStyle::tqvisualRect( subRect(SR_ComboBoxFocusRect, cb), widget); drawPrimitive( PE_FocusRect, p, re, cg, @@ -2323,28 +2323,28 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control, drawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); // Check whether to draw a background pixmap - else if ( toolbutton->parentWidget() && - toolbutton->parentWidget()->backgroundPixmap() && - !toolbutton->parentWidget()->backgroundPixmap()->isNull() ) + else if ( toolbutton->tqparentWidget() && + toolbutton->tqparentWidget()->backgroundPixmap() && + !toolbutton->tqparentWidget()->backgroundPixmap()->isNull() ) { - TQPixmap pixmap = *(toolbutton->parentWidget()->backgroundPixmap()); + TQPixmap pixmap = *(toolbutton->tqparentWidget()->backgroundPixmap()); p->drawTiledPixmap( r, pixmap, toolbutton->pos() ); } - else if (widget->parent()) + else if (widget->tqparent()) { - if (widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) + if (widget->tqparent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) { - TQToolBar* parent = (TQToolBar*)widget->parent(); - TQRect pr = parent->rect(); + TQToolBar* tqparent = (TQToolBar*)widget->tqparent(); + TQRect pr = tqparent->rect(); renderGradient( p, r, cg.button(), - parent->orientation() == Qt::Vertical, + tqparent->orientation() == Qt::Vertical, r.x(), r.y(), pr.width()-2, pr.height()-2); } - else if (widget->parent()->inherits("QToolBarExtensionWidget")) + else if (widget->tqparent()->inherits("TQToolBarExtensionWidget")) { - TQWidget* parent = (TQWidget*)widget->parent(); - TQToolBar* toolbar = (TQToolBar*)parent->parent(); + TQWidget* tqparent = (TQWidget*)widget->tqparent(); + TQToolBar* toolbar = (TQToolBar*)tqparent->tqparent(); TQRect tr = toolbar->rect(); if ( toolbar->orientation() == Qt::Horizontal ) { @@ -2377,14 +2377,14 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control, default: - KStyle::drawComplexControl(control, p, widget, + KStyle::tqdrawComplexControl(control, p, widget, r, cg, flags, controls, active, opt); break; } } -void StyleCheckStyle::drawComplexControlMask( ComplexControl control, +void StyleCheckStyle::tqdrawComplexControlMask( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, @@ -2398,7 +2398,7 @@ void StyleCheckStyle::drawComplexControlMask( ComplexControl control, case CC_ToolButton: { int x1, y1, x2, y2; r.coords( &x1, &y1, &x2, &y2 ); - QCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 }; + TQCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 }; p->fillRect( r, color1 ); p->setPen( color0 ); p->drawPoints( TQPointArray(4, corners) ); @@ -2406,7 +2406,7 @@ void StyleCheckStyle::drawComplexControlMask( ComplexControl control, } default: - KStyle::drawComplexControlMask(control, p, widget, r, opt); + KStyle::tqdrawComplexControlMask(control, p, widget, r, opt); } } @@ -2414,7 +2414,7 @@ void StyleCheckStyle::drawComplexControlMask( ComplexControl control, TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const { // We want the focus rect for buttons to be adjusted from - // the Qt3 defaults to be similar to Qt 2's defaults. + // the TQt3 defaults to be similar to TQt 2's defaults. // ------------------------------------------------------------------- if (r == SR_PushButtonFocusRect ) { const TQPushButton* button = (const TQPushButton*) widget; @@ -2422,11 +2422,11 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const int dbw1 = 0, dbw2 = 0; if (button->isDefault() || button->autoDefault()) { - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); + dbw1 = tqpixelMetric(PM_ButtonDefaultIndicator, widget); dbw2 = dbw1 * 2; } - int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2, + int dfw1 = tqpixelMetric(PM_DefaultFrameWidth, widget) * 2, dfw2 = dfw1 * 2; return TQRect(wrect.x() + dfw1 + dbw1 + 1, @@ -2438,7 +2438,7 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const } -int StyleCheckStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int StyleCheckStyle::tqpixelMetric(PixelMetric m, const TQWidget *widget) const { switch(m) { @@ -2465,7 +2465,7 @@ int StyleCheckStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return KStyle::pixelMetric(m, widget); + return KStyle::tqpixelMetric(m, widget); } } @@ -2483,8 +2483,8 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents, const TQPushButton* button = (const TQPushButton*) widget; int w = contentSize.width(); int h = contentSize.height(); - int bm = pixelMetric( PM_ButtonMargin, widget ); - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; + int bm = tqpixelMetric( PM_ButtonMargin, widget ); + int fw = tqpixelMetric( PM_DefaultFrameWidth, widget ) * 2; w += bm + fw + 6; // ### Add 6 to make way for bold font. h += bm + fw; @@ -2495,7 +2495,7 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents, w = 80; // Compensate for default indicator - int di = pixelMetric( PM_ButtonDefaultIndicator ); + int di = tqpixelMetric( PM_ButtonDefaultIndicator ); w += di * 2; h += di * 2; } @@ -2520,8 +2520,8 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents, int w = contentSize.width(), h = contentSize.height(); if ( mi->custom() ) { - w = mi->custom()->sizeHint().width(); - h = mi->custom()->sizeHint().height(); + w = mi->custom()->tqsizeHint().width(); + h = mi->custom()->tqsizeHint().height(); if ( ! mi->custom()->fullSpan() ) h += 2*itemVMargin + 2*itemFrame; } @@ -2532,22 +2532,22 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents, } else { if ( mi->pixmap() ) - h = QMAX( h, mi->pixmap()->height() + 2*itemFrame ); + h = TQMAX( h, mi->pixmap()->height() + 2*itemFrame ); else { // Ensure that the minimum height for text-only menu items // is the same as the icon size used by KDE. - h = QMAX( h, 16 + 2*itemFrame ); - h = QMAX( h, popup->fontMetrics().height() + h = TQMAX( h, 16 + 2*itemFrame ); + h = TQMAX( h, popup->fontMetrics().height() + 2*itemVMargin + 2*itemFrame ); } if ( mi->iconSet() ) - h = QMAX( h, mi->iconSet()->pixmap( + h = TQMAX( h, mi->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal).height() + 2 * itemFrame ); } - if ( ! mi->text().isNull() && mi->text().find('\t') >= 0 ) + if ( ! mi->text().isNull() && mi->text().tqfind('\t') >= 0 ) w += 12; else if ( mi->popup() ) w += 2 * arrowHMargin; @@ -2566,12 +2566,12 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents, default: - return KStyle::sizeFromContents( contents, widget, contentSize, opt ); + return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); } } -// Fix Qt's wacky image alignment +// Fix TQt's wacky image tqalignment TQPixmap StyleCheckStyle::stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const @@ -2602,20 +2602,20 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) if ( (event->type() == TQEvent::Enter) && (button->isEnabled()) ) { hoverWidget = button; - button->repaint( false ); + button->tqrepaint( false ); } else if ( (event->type() == TQEvent::Leave) && - (object == hoverWidget) ) { + (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) ) { hoverWidget = 0L; - button->repaint( false ); + button->tqrepaint( false ); } } if ( event->type() == TQEvent::Paint && object->inherits(TQLABEL_OBJECT_NAME_STRING) ) { - TQLabel* lb = static_cast<TQLabel*>(object); - if (lb->pixmap() || lb->picture() || lb->movie() || (lb->textFormat() == Qt::RichText) || - (lb->textFormat() == Qt::AutoText && TQStyleSheet::mightBeRichText(lb->text())) ) + TQLabel* lb = static_cast<TQLabel*>(TQT_TQWIDGET(object)); + if (lb->pixmap() || lb->picture() || lb->movie() || (lb->textFormat() == TQt::RichText) || + (lb->textFormat() == TQt::AutoText && TQStyleSheet::mightBeRichText(lb->text())) ) { return false; } @@ -2629,14 +2629,14 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) m = lb->fontMetrics().width('x') / 2 - lb->margin(); if ( m > 0 ) { - int hAlign = TQApplication::horizontalAlignment( lb->alignment() ); + int hAlign = TQApplication::horizontalAlignment( lb->tqalignment() ); if ( hAlign & AlignLeft ) cr.setLeft( cr.left() + m ); if ( hAlign & AlignRight ) cr.setRight( cr.right() - m ); - if ( lb->alignment() & AlignTop ) + if ( lb->tqalignment() & AlignTop ) cr.setTop( cr.top() + m ); - if ( lb->alignment() & AlignBottom ) + if ( lb->tqalignment() & AlignBottom ) cr.setBottom( cr.bottom() - m ); } @@ -2656,17 +2656,17 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) if (lb->buddy()) { - renderViolations(violations, &p, cr,lb->alignment() | ShowPrefix, lb->text() ); + renderViolations(violations, &p, cr,lb->tqalignment() | ShowPrefix, lb->text() ); // ordinary text or pixmap label - drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(), + drawItem( &p, cr, lb->tqalignment(), lb->tqcolorGroup(), lb->isEnabled(), 0, removedXX(stripAccelViolations(lb->text())) ); } else { - renderViolations(violations, &p, cr,lb->alignment(), lb->text() ); + renderViolations(violations, &p, cr,lb->tqalignment(), lb->text() ); // ordinary text or pixmap label - drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(), + drawItem( &p, cr, lb->tqalignment(), lb->tqcolorGroup(), lb->isEnabled(), 0, removedXX(stripAccelViolations(lb->text())) ); } @@ -2677,19 +2677,19 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) if ( event->type() == TQEvent::Paint && object->inherits(TQGROUPBOX_OBJECT_NAME_STRING) ) { - TQPaintEvent * pevent = static_cast<TQPaintEvent*>(event); - TQGroupBox* gb = static_cast<TQGroupBox*>(object); + TQPaintEvent * pevent = TQT_TQPAINTEVENT(event); + TQGroupBox* gb = static_cast<TQGroupBox*>(TQT_TQWIDGET(object)); bool nestedGroupBox = false; TQString stripped_title = removedXX(stripAccelViolations(gb->title())); - //Walk parent hierarchy to check whether any are groupboxes too.. - TQObject* parent = gb; + //Walk tqparent hierarchy to check whether any are groupboxes too.. + TQObject* tqparent = TQT_TQOBJECT(gb); - // GCC suggested parentheses around assignment used as truth value + // GCC suggested tqparentheses around assignment used as truth value // I suggested that it could eat me. GCC won. - while ( (parent = parent->parent()) ) + while ( (tqparent = tqparent->tqparent()) ) { - if (parent->inherits(TQGROUPBOX_OBJECT_NAME_STRING)) + if (tqparent->inherits(TQGROUPBOX_OBJECT_NAME_STRING)) { nestedGroupBox = true; break; @@ -2704,11 +2704,11 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) int h = fm.height(); int tw = fm.width( stripped_title, stripped_title.length() ) + 2*fm.width(TQChar(' ')); int x; - if ( gb->alignment() & AlignHCenter ) // center alignment + if ( gb->tqalignment() & AlignHCenter ) // center tqalignment x = gb->frameRect().width()/2 - tw/2; - else if ( gb->alignment() & AlignRight ) // right alignment + else if ( gb->tqalignment() & AlignRight ) // right tqalignment x = gb->frameRect().width() - tw - 8; - else if ( gb->alignment() & AlignLeft ) // left alignment + else if ( gb->tqalignment() & AlignLeft ) // left tqalignment x = 8; else { // auto align @@ -2723,7 +2723,7 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) renderViolations( violations, &paint, r, AlignCenter | ShowPrefix, gb->title() ); - drawItem(&paint, r, AlignCenter | ShowPrefix, gb->colorGroup(), + drawItem(&paint, r, AlignCenter | ShowPrefix, gb->tqcolorGroup(), gb->isEnabled(), 0, stripped_title ); paint.setClipRegion( pevent->region().subtract( r ) ); @@ -2732,15 +2732,15 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event ) if (nestedGroupBox) { paint.save(); - TQPen errorPen(Qt::red, 4, TQPen::DashDotDotLine); + TQPen errorPen(TQt::red, 4, TQPen::DashDotDotLine); paint.setPen(errorPen); paint.drawRect( gb->frameRect() ); paint.restore(); } else { - drawPrimitive( TQStyle::PE_GroupBoxFrame, &paint, gb->frameRect(), - gb->colorGroup(), TQStyle::Style_Default, + tqdrawPrimitive( TQStyle::PE_GroupBoxFrame, &paint, gb->frameRect(), + gb->tqcolorGroup(), TQStyle::Style_Default, TQStyleOption(gb->lineWidth(), gb->midLineWidth(), gb->frameShape(), gb->frameShadow()) ); } @@ -2759,4 +2759,4 @@ void StyleCheckStyle::renderGradient( TQPainter* p, const TQRect& r, } // vim: set noet ts=4 sw=4: -// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; +// kate: indent-width 4; tqreplace-tabs off; tab-width 4; space-indent off; |