From 8b7e11608c0b4057d6aa8aad832b9b101ae66f59 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 13 Sep 2012 09:53:37 -0500 Subject: [PATCH] Fix a number of problems and check for known broken Qt4 version --- lib/lib.pro | 1 + lib/tdeqt4painter.cpp | 196 +++++++++++++++++++++++------------------ lib/tdeqt4painter.h | 4 + plugin/plugin.pro | 3 +- plugin/simplestyle.cpp | 81 ++++++++++++----- plugin/simplestyle.h | 4 + 6 files changed, 180 insertions(+), 109 deletions(-) diff --git a/lib/lib.pro b/lib/lib.pro index e24c2f5..665fb0d 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -3,6 +3,7 @@ TEMPLATE = lib HEADERS = tdeqt4painter.h SOURCES = tdeqt4painter.cpp TARGET = tdeqt4interface +CONFIG += debug INCLUDEPATH += /usr/include/tqt3 INCLUDEPATH += /usr/include/tqt3/private diff --git a/lib/tdeqt4painter.cpp b/lib/tdeqt4painter.cpp index 6c8d4c0..072c4d8 100644 --- a/lib/tdeqt4painter.cpp +++ b/lib/tdeqt4painter.cpp @@ -30,85 +30,46 @@ #undef Qt /*! - \class TDEQt4PaintDevice ntqpicture.h - \brief The TDEQt4PaintDevice class is a paint device that records and - replays TQPainter commands. + \class TDEQt4PaintDevice tdeqt4painter.h + \brief The TDEQt4PaintDevice class is a paint device that translates + Qt paint events to a TQt painter. \ingroup graphics - \ingroup images \ingroup shared - A picture serializes painter commands to an IO device in a - platform-independent format. For example, a picture created under - Windows can be read on a Sun SPARC. - - Pictures are called meta-files on some platforms. - - TQt pictures use a proprietary binary format. Unlike native picture - (meta-file) formats on many window systems, TQt pictures have no - limitations regarding their contents. Everything that can be - painted can also be stored in a picture, e.g. fonts, pixmaps, - regions, transformed graphics, etc. - - TDEQt4PaintDevice is an \link shclass.html implicitly shared\endlink class. - - Example of how to record a picture: - \code - TDEQt4PaintDevice pic; - TQPainter p; - p.begin( &pic ); // paint in picture - p.drawEllipse( 10,20, 80,70 ); // draw an ellipse - p.end(); // painting done - pic.save( "drawing.pic" ); // save picture - \endcode - - Example of how to replay a picture: - \code - TDEQt4PaintDevice pic; - pic.load( "drawing.pic" ); // load picture - TQPainter p; - p.begin( &myWidget ); // paint in myWidget - p.drawPicture( pic ); // draw the picture - p.end(); // painting done - \endcode - - Pictures can also be drawn using play(). Some basic data about a - picture is available, for example, size(), isNull() and - boundingRect(). - */ +inline int qt4PainterRectSubtraction(QPainter* pd) { + QPen pen = pd->pen(); + return pen.style() != Qt::NoPen && pen.width() == 0 ? 1 : 0; +} -/*! - Constructs an empty picture. - - The \a formatVersion parameter may be used to \e create a TDEQt4PaintDevice - that can be read by applications that are compiled with earlier - versions of TQt. - \list - \i \a formatVersion == 1 is binary compatible with TQt 1.x and later. - \i \a formatVersion == 2 is binary compatible with TQt 2.0.x and later. - \i \a formatVersion == 3 is binary compatible with TQt 2.1.x and later. - \i \a formatVersion == 4 is binary compatible with TQt 3.0.x and later. - \i \a formatVersion == 5 is binary compatible with TQt 3.1. - \endlist - - Note that the default formatVersion is -1 which signifies the - current release, i.e. for TQt 3.1 a formatVersion of 5 is the same - as the default formatVersion of -1. +inline QRect qt4PainterAdjustedRectangle(const QRect &r, QPainter* pd) +{ + QRect rect = r.normalized(); + int subtract = qt4PainterRectSubtraction(pd); + if (subtract != 0) { + rect.setSize(QSize(rect.width() - subtract, rect.height() - subtract)); + } + return rect; +} - Reading pictures generated by earlier versions of TQt is supported - and needs no special coding; the format is automatically detected. +/*! + Constructs TDEQt4PaintDevice on an existing QPainter */ TDEQt4PaintDevice::TDEQt4PaintDevice( QPainter *qt4painter ) : TQPaintDevice( TQInternal::Picture | TQInternal::ExternalDevice ) { m_qt4painter = qt4painter; + m_qt4OrigClipping = m_qt4painter->hasClipping(); + m_qt4OrigClipRegion = m_qt4painter->clipRegion(); + m_qt4OrigWorldTransformEnabled = m_qt4painter->worldMatrixEnabled(); + m_qt4OrigWorldTransform = m_qt4painter->worldTransform(); } /*! - Destroys the picture. + Destroys the TDEQt4PaintDevice. */ TDEQt4PaintDevice::~TDEQt4PaintDevice() { @@ -153,24 +114,27 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) TQRect r = rects[(int)i]; qt4region = qt4region.united(QRegion(QRect(r.x(), r.y(), r.width(), r.height()))); } + { #else // SLOW TQRect tqt3br = p[0].rgn->boundingRect(); - TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height()); - regionMask.fill(TQt::color0); - TQPainter tqt3brpainter(®ionMask); - tqt3brpainter.setClipRegion(*p[0].rgn); - tqt3brpainter.fillRect(0,0,regionMask.width(),regionMask.height(),TQt::color1); - tqt3brpainter.end(); - QBitmap qt4RegionMask = QPixmap::fromX11Pixmap(regionMask.handle(), QPixmap::ImplicitlyShared); - qt4region = QRegion(qt4RegionMask); + if (!tqt3br.isNull()) { + TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height()); + regionMask.fill(TQt::color0); + TQPainter tqt3brpainter(®ionMask); + tqt3brpainter.setClipRegion(*p[0].rgn); + tqt3brpainter.fillRect(0,0,regionMask.width(),regionMask.height(),TQt::color1); + tqt3brpainter.end(); + QBitmap qt4RegionMask = QPixmap::fromX11Pixmap(regionMask.handle(), QPixmap::ImplicitlyShared); + qt4region = QRegion(qt4RegionMask); #endif - TQPainter::CoordinateMode tqt3coordmode = (TQPainter::CoordinateMode)p[1].ival; - if ( tqt3coordmode == TQPainter::CoordDevice ) { - qt4region = qt4region; - } - else { - qt4region = m_qt4painter->transform().map(qt4region); + TQPainter::CoordinateMode tqt3coordmode = (TQPainter::CoordinateMode)p[1].ival; + if ( tqt3coordmode == TQPainter::CoordDevice ) { + qt4region = qt4region; + } + else { + qt4region = m_qt4painter->transform().map(qt4region); + } } } if (c == PdcSetWMatrix) { @@ -487,11 +451,67 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) } } if (c == PdcSetFont) { - // FIXME - printf("[WARNING] QFont conversion is NOT COMPLETE\n\r"); fflush(stdout); - TQFont qt3font = *p[0].font; qt4font = QFont(QString::fromUtf8(qt3font.family().utf8().data()), qt3font.pointSize(), qt3font.weight(), qt3font.italic()); + + qt4font.setBold(qt3font.bold()); +// qt4font.setCapitalization ( Capitalization caps ) + qt4font.setFamily(QString::fromUtf8(qt3font.family().utf8().data())); + qt4font.setFixedPitch(qt3font.fixedPitch()); + qt4font.setItalic(qt3font.italic()); +// qt4font.setKerning ( bool enable ) +// qt4font.setLetterSpacing ( SpacingType type, qreal spacing ) + qt4font.setOverline(qt3font.overline()); + int pixelSize = qt3font.pixelSize(); + if (pixelSize < 0) { + float pointSizeFloat = qt3font.pointSizeFloat(); + if (pointSizeFloat < 0) { + qt4font.setPointSize(qt3font.pointSize()); + } + else { + qt4font.setPointSizeF(pointSizeFloat); + } + } + else { + qt4font.setPixelSize(pixelSize); + } +// qt4font.setRawMode ( bool enable ) +// qt4font.setRawName(QString::fromUtf8(qt3font.rawName().utf8().data())); + qt4font.setStretch(qt3font.stretch()); + qt4font.setStrikeOut(qt3font.strikeOut()); +// qt4font.setStyle ( Style style ) + + TQFont::StyleHint qt3fontstylehint = qt3font.styleHint(); + QFont::StyleHint qt4fontstylehint = QFont::AnyStyle; + if (qt3fontstylehint == TQFont::Helvetica) qt4fontstylehint = QFont::Helvetica; + else if (qt3fontstylehint == TQFont::SansSerif) qt4fontstylehint = QFont::SansSerif; + else if (qt3fontstylehint == TQFont::Times) qt4fontstylehint = QFont::Times; + else if (qt3fontstylehint == TQFont::Serif) qt4fontstylehint = QFont::Serif; + else if (qt3fontstylehint == TQFont::Courier) qt4fontstylehint = QFont::Courier; + else if (qt3fontstylehint == TQFont::TypeWriter) qt4fontstylehint = QFont::TypeWriter; + else if (qt3fontstylehint == TQFont::OldEnglish) qt4fontstylehint = QFont::OldEnglish; + else if (qt3fontstylehint == TQFont::Decorative) qt4fontstylehint = QFont::Decorative; + else if (qt3fontstylehint == TQFont::System) qt4fontstylehint = QFont::System; + else if (qt3fontstylehint == TQFont::AnyStyle) qt4fontstylehint = QFont::AnyStyle; + + TQFont::StyleStrategy qt3fontstrategy = qt3font.styleStrategy(); + QFont::StyleStrategy qt4fontstrategy = (QFont::StyleStrategy)0; + if (qt3fontstrategy & TQFont::PreferDefault) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferDefault); + if (qt3fontstrategy & TQFont::PreferBitmap) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferBitmap); + if (qt3fontstrategy & TQFont::PreferDevice) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferDevice); + if (qt3fontstrategy & TQFont::PreferOutline) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferOutline); + if (qt3fontstrategy & TQFont::ForceOutline) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::ForceOutline); + if (qt3fontstrategy & TQFont::PreferMatch) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferMatch); + if (qt3fontstrategy & TQFont::PreferQuality) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferQuality); + if (qt3fontstrategy & TQFont::PreferAntialias) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::PreferAntialias); + if (qt3fontstrategy & TQFont::NoAntialias) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::NoAntialias); + if (qt3fontstrategy & TQFont::OpenGLCompatible) qt4fontstrategy = (QFont::StyleStrategy)(qt4fontstrategy | QFont::OpenGLCompatible); + + qt4font.setStyleHint (qt4fontstylehint, qt4fontstrategy); +// qt4font.setStyleStrategy ( StyleStrategy s ) + qt4font.setUnderline(qt3font.underline()); + qt4font.setWeight(qt3font.weight()); +// qt4font.setWordSpacing ( qreal spacing ) } if (c == PdcDrawPixmap) { qt4rect = QRect(p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); @@ -527,22 +547,22 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) m_qt4painter->drawLine( qt4point1, qt4point2 ); break; case PdcDrawRect: - m_qt4painter->drawRect( qt4rect ); + m_qt4painter->drawRect( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter) ); break; case PdcDrawRoundRect: - m_qt4painter->drawRoundedRect( qt4rect, p[1].ival, p[2].ival ); + m_qt4painter->drawRoundedRect( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter), p[1].ival, p[2].ival ); break; case PdcDrawEllipse: - m_qt4painter->drawEllipse( qt4rect ); + m_qt4painter->drawEllipse( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter) ); break; case PdcDrawArc: - m_qt4painter->drawArc( qt4rect, p[1].ival, p[2].ival ); + m_qt4painter->drawArc( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter), p[1].ival, p[2].ival ); break; case PdcDrawPie: - m_qt4painter->drawPie( qt4rect, p[1].ival, p[2].ival ); + m_qt4painter->drawPie( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter), p[1].ival, p[2].ival ); break; case PdcDrawChord: - m_qt4painter->drawChord( qt4rect, p[1].ival, p[2].ival ); + m_qt4painter->drawChord( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter), p[1].ival, p[2].ival ); break; case PdcDrawLineSegments: index = 0; @@ -674,7 +694,7 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) break; #endif case PdcSetWXform: - m_qt4painter->setWorldMatrixEnabled( p[0].ival ); + m_qt4painter->setWorldMatrixEnabled( (m_qt4OrigWorldTransformEnabled)?true:p[0].ival ); break; case PdcSetWMatrix: m_qt4painter->setWorldMatrix( qt4matrix, p[1].ival ); @@ -690,10 +710,10 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) #endif #endif case PdcSetClip: - m_qt4painter->setClipping( p[0].ival ); + m_qt4painter->setClipping( (m_qt4OrigClipping)?true:p[0].ival ); break; case PdcSetClipRegion: - m_qt4painter->setClipRegion( qt4region, Qt::ReplaceClip ); + m_qt4painter->setClipRegion( qt4region.intersected(m_qt4OrigClipRegion), Qt::ReplaceClip ); break; default: #if defined(QT_CHECK_RANGE) diff --git a/lib/tdeqt4painter.h b/lib/tdeqt4painter.h index ccb5f70..9e1a609 100644 --- a/lib/tdeqt4painter.h +++ b/lib/tdeqt4painter.h @@ -41,6 +41,10 @@ protected: private: QPainter *m_qt4painter; + bool m_qt4OrigClipping; + QRegion m_qt4OrigClipRegion; + bool m_qt4OrigWorldTransformEnabled; + QTransform m_qt4OrigWorldTransform; QPoint prevPt; QPoint curPt; diff --git a/plugin/plugin.pro b/plugin/plugin.pro index 488274a..64aa477 100644 --- a/plugin/plugin.pro +++ b/plugin/plugin.pro @@ -1,6 +1,7 @@ #! [0] TEMPLATE = lib -CONFIG += plugin +# CONFIG += plugin +CONFIG += plugin debug HEADERS = simplestyle.h \ simplestyleplugin.h SOURCES = simplestyle.cpp \ diff --git a/plugin/simplestyle.cpp b/plugin/simplestyle.cpp index f897579..7d9eccd 100644 --- a/plugin/simplestyle.cpp +++ b/plugin/simplestyle.cpp @@ -19,6 +19,7 @@ #define TQT_NO_COMPAT_NAMES #include #include +#include #include #include #include @@ -188,7 +189,46 @@ inline TQString generateTQt3CacheKey(QIcon qt4icon, int iconsize, bool transpare } } -inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCache* pmCache = 0, bool copyTransparency = true, TQColor* bgcolor = 0) +inline TQPixmap convertQt4ToTQt3Pixmap(QPixmap qt4pixmap, bool copyTransparency = true, TQColor* bgcolor = 0) +{ + TQPixmap tqtPM(qt4pixmap.width(), qt4pixmap.height(), (copyTransparency)?qt4pixmap.depth():((qt4pixmap.depth()>24)?24:qt4pixmap.depth())); + QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared); + + if (copyTransparency) { + qtPM.fill(Qt::transparent); + } + else { + tqtPM.fill(*bgcolor); + } + QPainter qt4painter(&qtPM); + qt4painter.drawPixmap(0, 0, qt4pixmap); + qt4painter.end(); + + return tqtPM; +} + +inline TQRegion convertQt4ToTQt3Region(QRegion qt4region) +{ + TQRegion tqt3region; + + QRect qt4br = qt4region.boundingRect(); + // SLOW + if (!qt4br.isNull()) { + QBitmap regionMask(qt4br.x()+qt4br.width(), qt4br.y()+qt4br.height()); + regionMask.fill(Qt::color0); + QPainter qt4brpainter(®ionMask); + qt4brpainter.setClipRegion(qt4region); + qt4brpainter.fillRect(0,0,regionMask.width(),regionMask.height(),Qt::color1); + qt4brpainter.end(); + TQBitmap tqt3RegionMask; + tqt3RegionMask = convertQt4ToTQt3Pixmap(regionMask); + tqt3region = TQRegion(tqt3RegionMask); + } + + return tqt3region; +} + +inline TQPixmap convertQt4IconToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCache* pmCache = 0, bool copyTransparency = true, TQColor* bgcolor = 0) { TQString cacheKey; if (pmCache) { @@ -203,18 +243,7 @@ inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCach QSize qt4size = QSize(iconsize, iconsize); QPixmap qt4iconpm = qt4icon.pixmap(qt4size); - TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), (copyTransparency)?qt4iconpm.depth():((qt4iconpm.depth()>24)?24:qt4iconpm.depth())); - QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared); - - if (copyTransparency) { - qtPM.fill(Qt::transparent); - } - else { - tqtPM.fill(*bgcolor); - } - QPainter qt4painter(&qtPM); - qt4painter.drawPixmap(0, 0, qt4iconpm); - qt4painter.end(); + TQPixmap tqtPM = convertQt4ToTQt3Pixmap(qt4iconpm); if (pmCache) { // Insert this pixmap into the cache @@ -224,7 +253,7 @@ inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCach return tqtPM; } -inline QIcon convertTQt3ToQt4Pixmap(TQPixmap tqt3pixmap) +inline QIcon convertTQt3PixmapToQt4Icon(TQPixmap tqt3pixmap) { QPixmap qt4pm = QPixmap::fromX11Pixmap(tqt3pixmap.handle(), QPixmap::ImplicitlyShared); return QIcon(qt4pm); @@ -280,7 +309,7 @@ inline TQIconSet convertQt4ToTQt3IconSet(QIcon qt4icon, int smallsize, int large tqt3iconsized = largeIconSize; } - tqt3iconset.setPixmap(convertQt4ToTQt3Pixmap(qt4icon, tqt3iconsized.width(), pmCache), tqt3iconsize, tqt3iconmode, tqt3iconstate); + tqt3iconset.setPixmap(convertQt4IconToTQt3Pixmap(qt4icon, tqt3iconsized.width(), pmCache), tqt3iconsize, tqt3iconmode, tqt3iconstate); } } } @@ -786,6 +815,11 @@ Qt4TDEStyle::Qt4TDEStyle() m_internalTQt3PixmapCache = new TQPixmapCache(); m_internalTQt3PixmapCache->setCacheLimit(4096); + // Initialize the widget cache + m_internalTQt3WidgetCache = new TQWidgetCache(); + m_internalTQt3WidgetCache->setMaxCost(4096); + m_internalTQt3WidgetCache->setAutoDelete(true); + // Create interface widgets m_tqt3parent_widget = new TQWidget(); @@ -812,6 +846,12 @@ Qt4TDEStyle::Qt4TDEStyle() qt_filedialog_save_filename_hook = &TDEFileDialogSaveName; qt_filedialog_existing_directory_hook = &TDEFileDialogSelectDirectory; #endif // INTEGRATE_WITH_TDE + +#if QT_VERSION > 0x040800 + // How a bug of this magnitude could go undetected in a major Qt4 release is beyond me...I guess cell phones don't generally use thin lines in their widgets!? + // This is Yet Another Example of why TDE cannot rely on Qt4 for anything of any real importance + printf("[WARNING] Qt4 >= Qt 4.8.0 detected; you are likely affected by this Qt4 bug:\n\r[WARNING] https://bugreports.qt-project.org/browse/QTBUG-26013\n\r[WARNING] There is no known workaround for this problem; your Qt4 application will display with numerous graphical glitches.\n\r"); fflush(stdout); +#endif } Qt4TDEStyle::~Qt4TDEStyle() @@ -841,6 +881,7 @@ Qt4TDEStyle::~Qt4TDEStyle() // Verify I'm not leaking memory like a sieve when this is commented out!!! // delete m_tqt3parent_widget; + delete m_internalTQt3WidgetCache; delete m_internalTQt3PixmapCache; // FIXME @@ -1166,7 +1207,7 @@ QIcon Qt4TDEStyle::standardIconImplementation(StandardPixmap standardIcon, const // FIXME // This spews tons of "X Error: BadDrawable (invalid Pixmap or Window parameter) 9" errors and fails to work // if (tqt3pixmap.isNull() == false) { -// reticon = convertTQt3ToQt4Pixmap(tqt3pixmap); +// reticon = convertTQt3PixmapToQt4Icon(tqt3pixmap); // } // else { // Tell Qt4 to get the information @@ -2244,7 +2285,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); } else { - m_tqt3combobox_widget->insertItem(convertQt4ToTQt3Pixmap(qt4combobox_widget->itemIcon(i), m_tqt3IconSize_Small, m_internalTQt3PixmapCache), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); + m_tqt3combobox_widget->insertItem(convertQt4IconToTQt3Pixmap(qt4combobox_widget->itemIcon(i), m_tqt3IconSize_Small, m_internalTQt3PixmapCache), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); } } m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable()); @@ -2427,7 +2468,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge else { bgcolor = convertQt4ToTQt3Palette(qt4styleoptions->palette).inactive().highlight(); } - m_tqt3titlebar_widget->setIcon(convertQt4ToTQt3Pixmap(qt4titlebar_options->icon, m_tqt3IconSize_Small, m_internalTQt3PixmapCache, false, &bgcolor)); + m_tqt3titlebar_widget->setIcon(convertQt4IconToTQt3Pixmap(qt4titlebar_options->icon, m_tqt3IconSize_Small, m_internalTQt3PixmapCache, false, &bgcolor)); break; case TQT3WT_TQToolBox: interfaceWidget = m_tqt3toolbox_widget; @@ -2515,7 +2556,7 @@ QRect Qt4TDEStyle::subElementRect(SubElement element, const QStyleOption *opt, c if (enable_debug_warnings) { #ifdef DEBUG_SPEW - printf("Used Qt3 subelement rect %d to handle Qt4 subelement rect %d\n\r", tqtSR, control); fflush(stdout); + printf("Used Qt3 subelement rect %d to handle Qt4 subelement rect %d\n\r", tqtSR, element); fflush(stdout); #endif } } @@ -2803,7 +2844,7 @@ void Qt4TDEStyle::drawComplexControl(ComplexControl control, const QStyleOptionC if (enable_debug_warnings) { #ifdef DEBUG_SPEW - printf("Used Qt3 complex control %d to draw Qt4 complex control %d\n\r", tqtCE, control); fflush(stdout); + printf("Used Qt3 complex control %d to draw Qt4 complex control %d\n\r", tqtCC, control); fflush(stdout); #endif } } diff --git a/plugin/simplestyle.h b/plugin/simplestyle.h index 0b302de..cb79f22 100644 --- a/plugin/simplestyle.h +++ b/plugin/simplestyle.h @@ -21,6 +21,7 @@ #include #include +#include QT_BEGIN_NAMESPACE class QPalette; @@ -63,6 +64,8 @@ enum TQt3WidgetType { TQT3WT_TQToolButton }; +typedef TQIntCache TQWidgetCache; + class Qt4TDEStyle : public QWindowsStyle { Q_OBJECT @@ -131,6 +134,7 @@ private: KAboutData* m_aboutData; TQPixmapCache* m_internalTQt3PixmapCache; + TQWidgetCache* m_internalTQt3WidgetCache; }; #endif