Fix a number of problems and check for known broken Qt4 version

r14.0.x
Timothy Pearson 12 years ago
parent e3be7c7345
commit 8b7e11608c

@ -3,6 +3,7 @@ TEMPLATE = lib
HEADERS = tdeqt4painter.h HEADERS = tdeqt4painter.h
SOURCES = tdeqt4painter.cpp SOURCES = tdeqt4painter.cpp
TARGET = tdeqt4interface TARGET = tdeqt4interface
CONFIG += debug
INCLUDEPATH += /usr/include/tqt3 INCLUDEPATH += /usr/include/tqt3
INCLUDEPATH += /usr/include/tqt3/private INCLUDEPATH += /usr/include/tqt3/private

@ -30,85 +30,46 @@
#undef Qt #undef Qt
/*! /*!
\class TDEQt4PaintDevice ntqpicture.h \class TDEQt4PaintDevice tdeqt4painter.h
\brief The TDEQt4PaintDevice class is a paint device that records and \brief The TDEQt4PaintDevice class is a paint device that translates
replays TQPainter commands. Qt paint events to a TQt painter.
\ingroup graphics \ingroup graphics
\ingroup images
\ingroup shared \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;
}
/*! inline QRect qt4PainterAdjustedRectangle(const QRect &r, QPainter* pd)
Constructs an empty picture. {
QRect rect = r.normalized();
The \a formatVersion parameter may be used to \e create a TDEQt4PaintDevice int subtract = qt4PainterRectSubtraction(pd);
that can be read by applications that are compiled with earlier if (subtract != 0) {
versions of TQt. rect.setSize(QSize(rect.width() - subtract, rect.height() - subtract));
\list }
\i \a formatVersion == 1 is binary compatible with TQt 1.x and later. return rect;
\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.
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 ) TDEQt4PaintDevice::TDEQt4PaintDevice( QPainter *qt4painter )
: TQPaintDevice( TQInternal::Picture | TQInternal::ExternalDevice ) : TQPaintDevice( TQInternal::Picture | TQInternal::ExternalDevice )
{ {
m_qt4painter = qt4painter; 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() TDEQt4PaintDevice::~TDEQt4PaintDevice()
{ {
@ -153,9 +114,11 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
TQRect r = rects[(int)i]; TQRect r = rects[(int)i];
qt4region = qt4region.united(QRegion(QRect(r.x(), r.y(), r.width(), r.height()))); qt4region = qt4region.united(QRegion(QRect(r.x(), r.y(), r.width(), r.height())));
} }
{
#else #else
// SLOW // SLOW
TQRect tqt3br = p[0].rgn->boundingRect(); TQRect tqt3br = p[0].rgn->boundingRect();
if (!tqt3br.isNull()) {
TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height()); TQBitmap regionMask(tqt3br.x()+tqt3br.width(), tqt3br.y()+tqt3br.height());
regionMask.fill(TQt::color0); regionMask.fill(TQt::color0);
TQPainter tqt3brpainter(&regionMask); TQPainter tqt3brpainter(&regionMask);
@ -173,6 +136,7 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
qt4region = m_qt4painter->transform().map(qt4region); qt4region = m_qt4painter->transform().map(qt4region);
} }
} }
}
if (c == PdcSetWMatrix) { if (c == PdcSetWMatrix) {
const TQWMatrix* tqt3matrix = p[0].matrix; const TQWMatrix* tqt3matrix = p[0].matrix;
qt4matrix = QMatrix(tqt3matrix->m11(), tqt3matrix->m12(), tqt3matrix->m21(), tqt3matrix->m22(), tqt3matrix->dx(), tqt3matrix->dy()); qt4matrix = QMatrix(tqt3matrix->m11(), tqt3matrix->m12(), tqt3matrix->m21(), tqt3matrix->m22(), tqt3matrix->dx(), tqt3matrix->dy());
@ -487,11 +451,67 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
} }
} }
if (c == PdcSetFont) { if (c == PdcSetFont) {
// FIXME
printf("[WARNING] QFont conversion is NOT COMPLETE\n\r"); fflush(stdout);
TQFont qt3font = *p[0].font; TQFont qt3font = *p[0].font;
qt4font = QFont(QString::fromUtf8(qt3font.family().utf8().data()), qt3font.pointSize(), qt3font.weight(), qt3font.italic()); 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) { if (c == PdcDrawPixmap) {
qt4rect = QRect(p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); 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 ); m_qt4painter->drawLine( qt4point1, qt4point2 );
break; break;
case PdcDrawRect: case PdcDrawRect:
m_qt4painter->drawRect( qt4rect ); m_qt4painter->drawRect( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter) );
break; break;
case PdcDrawRoundRect: 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; break;
case PdcDrawEllipse: case PdcDrawEllipse:
m_qt4painter->drawEllipse( qt4rect ); m_qt4painter->drawEllipse( qt4PainterAdjustedRectangle(qt4rect, m_qt4painter) );
break; break;
case PdcDrawArc: 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; break;
case PdcDrawPie: 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; break;
case PdcDrawChord: 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; break;
case PdcDrawLineSegments: case PdcDrawLineSegments:
index = 0; index = 0;
@ -674,7 +694,7 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
break; break;
#endif #endif
case PdcSetWXform: case PdcSetWXform:
m_qt4painter->setWorldMatrixEnabled( p[0].ival ); m_qt4painter->setWorldMatrixEnabled( (m_qt4OrigWorldTransformEnabled)?true:p[0].ival );
break; break;
case PdcSetWMatrix: case PdcSetWMatrix:
m_qt4painter->setWorldMatrix( qt4matrix, p[1].ival ); m_qt4painter->setWorldMatrix( qt4matrix, p[1].ival );
@ -690,10 +710,10 @@ bool TDEQt4PaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
#endif #endif
#endif #endif
case PdcSetClip: case PdcSetClip:
m_qt4painter->setClipping( p[0].ival ); m_qt4painter->setClipping( (m_qt4OrigClipping)?true:p[0].ival );
break; break;
case PdcSetClipRegion: case PdcSetClipRegion:
m_qt4painter->setClipRegion( qt4region, Qt::ReplaceClip ); m_qt4painter->setClipRegion( qt4region.intersected(m_qt4OrigClipRegion), Qt::ReplaceClip );
break; break;
default: default:
#if defined(QT_CHECK_RANGE) #if defined(QT_CHECK_RANGE)

@ -41,6 +41,10 @@ protected:
private: private:
QPainter *m_qt4painter; QPainter *m_qt4painter;
bool m_qt4OrigClipping;
QRegion m_qt4OrigClipRegion;
bool m_qt4OrigWorldTransformEnabled;
QTransform m_qt4OrigWorldTransform;
QPoint prevPt; QPoint prevPt;
QPoint curPt; QPoint curPt;

@ -1,6 +1,7 @@
#! [0] #! [0]
TEMPLATE = lib TEMPLATE = lib
CONFIG += plugin # CONFIG += plugin
CONFIG += plugin debug
HEADERS = simplestyle.h \ HEADERS = simplestyle.h \
simplestyleplugin.h simplestyleplugin.h
SOURCES = simplestyle.cpp \ SOURCES = simplestyle.cpp \

@ -19,6 +19,7 @@
#define TQT_NO_COMPAT_NAMES #define TQT_NO_COMPAT_NAMES
#include <tqstyle.h> #include <tqstyle.h>
#include <tqpixmap.h> #include <tqpixmap.h>
#include <tqbitmap.h>
#include <tqpainter.h> #include <tqpainter.h>
#include <tqapplication.h> #include <tqapplication.h>
#include <tqprogressbar.h> #include <tqprogressbar.h>
@ -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(&regionMask);
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; TQString cacheKey;
if (pmCache) { if (pmCache) {
@ -203,18 +243,7 @@ inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCach
QSize qt4size = QSize(iconsize, iconsize); QSize qt4size = QSize(iconsize, iconsize);
QPixmap qt4iconpm = qt4icon.pixmap(qt4size); QPixmap qt4iconpm = qt4icon.pixmap(qt4size);
TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), (copyTransparency)?qt4iconpm.depth():((qt4iconpm.depth()>24)?24:qt4iconpm.depth())); TQPixmap tqtPM = convertQt4ToTQt3Pixmap(qt4iconpm);
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();
if (pmCache) { if (pmCache) {
// Insert this pixmap into the cache // Insert this pixmap into the cache
@ -224,7 +253,7 @@ inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, TQPixmapCach
return tqtPM; return tqtPM;
} }
inline QIcon convertTQt3ToQt4Pixmap(TQPixmap tqt3pixmap) inline QIcon convertTQt3PixmapToQt4Icon(TQPixmap tqt3pixmap)
{ {
QPixmap qt4pm = QPixmap::fromX11Pixmap(tqt3pixmap.handle(), QPixmap::ImplicitlyShared); QPixmap qt4pm = QPixmap::fromX11Pixmap(tqt3pixmap.handle(), QPixmap::ImplicitlyShared);
return QIcon(qt4pm); return QIcon(qt4pm);
@ -280,7 +309,7 @@ inline TQIconSet convertQt4ToTQt3IconSet(QIcon qt4icon, int smallsize, int large
tqt3iconsized = largeIconSize; 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 = new TQPixmapCache();
m_internalTQt3PixmapCache->setCacheLimit(4096); m_internalTQt3PixmapCache->setCacheLimit(4096);
// Initialize the widget cache
m_internalTQt3WidgetCache = new TQWidgetCache();
m_internalTQt3WidgetCache->setMaxCost(4096);
m_internalTQt3WidgetCache->setAutoDelete(true);
// Create interface widgets // Create interface widgets
m_tqt3parent_widget = new TQWidget(); m_tqt3parent_widget = new TQWidget();
@ -812,6 +846,12 @@ Qt4TDEStyle::Qt4TDEStyle()
qt_filedialog_save_filename_hook = &TDEFileDialogSaveName; qt_filedialog_save_filename_hook = &TDEFileDialogSaveName;
qt_filedialog_existing_directory_hook = &TDEFileDialogSelectDirectory; qt_filedialog_existing_directory_hook = &TDEFileDialogSelectDirectory;
#endif // INTEGRATE_WITH_TDE #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() Qt4TDEStyle::~Qt4TDEStyle()
@ -841,6 +881,7 @@ Qt4TDEStyle::~Qt4TDEStyle()
// Verify I'm not leaking memory like a sieve when this is commented out!!! // Verify I'm not leaking memory like a sieve when this is commented out!!!
// delete m_tqt3parent_widget; // delete m_tqt3parent_widget;
delete m_internalTQt3WidgetCache;
delete m_internalTQt3PixmapCache; delete m_internalTQt3PixmapCache;
// FIXME // FIXME
@ -1166,7 +1207,7 @@ QIcon Qt4TDEStyle::standardIconImplementation(StandardPixmap standardIcon, const
// FIXME // FIXME
// This spews tons of "X Error: BadDrawable (invalid Pixmap or Window parameter) 9" errors and fails to work // This spews tons of "X Error: BadDrawable (invalid Pixmap or Window parameter) 9" errors and fails to work
// if (tqt3pixmap.isNull() == false) { // if (tqt3pixmap.isNull() == false) {
// reticon = convertTQt3ToQt4Pixmap(tqt3pixmap); // reticon = convertTQt3PixmapToQt4Icon(tqt3pixmap);
// } // }
// else { // else {
// Tell Qt4 to get the information // 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); m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
} }
else { 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()); m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable());
@ -2427,7 +2468,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
else { else {
bgcolor = convertQt4ToTQt3Palette(qt4styleoptions->palette).inactive().highlight(); 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; break;
case TQT3WT_TQToolBox: case TQT3WT_TQToolBox:
interfaceWidget = m_tqt3toolbox_widget; interfaceWidget = m_tqt3toolbox_widget;
@ -2515,7 +2556,7 @@ QRect Qt4TDEStyle::subElementRect(SubElement element, const QStyleOption *opt, c
if (enable_debug_warnings) { if (enable_debug_warnings) {
#ifdef DEBUG_SPEW #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 #endif
} }
} }
@ -2803,7 +2844,7 @@ void Qt4TDEStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
if (enable_debug_warnings) { if (enable_debug_warnings) {
#ifdef DEBUG_SPEW #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 #endif
} }
} }

@ -21,6 +21,7 @@
#include <QtGui/QWindowsStyle> #include <QtGui/QWindowsStyle>
#include <QFileDialog> #include <QFileDialog>
#include <ntqintcache.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QPalette; class QPalette;
@ -63,6 +64,8 @@ enum TQt3WidgetType {
TQT3WT_TQToolButton TQT3WT_TQToolButton
}; };
typedef TQIntCache<TQWidget> TQWidgetCache;
class Qt4TDEStyle : public QWindowsStyle class Qt4TDEStyle : public QWindowsStyle
{ {
Q_OBJECT Q_OBJECT
@ -131,6 +134,7 @@ private:
KAboutData* m_aboutData; KAboutData* m_aboutData;
TQPixmapCache* m_internalTQt3PixmapCache; TQPixmapCache* m_internalTQt3PixmapCache;
TQWidgetCache* m_internalTQt3WidgetCache;
}; };
#endif #endif

Loading…
Cancel
Save