summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/forms/widgets/kexidbimagebox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidbimagebox.cpp')
-rw-r--r--kexi/plugins/forms/widgets/kexidbimagebox.cpp316
1 files changed, 158 insertions, 158 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbimagebox.cpp b/kexi/plugins/forms/widgets/kexidbimagebox.cpp
index 82e700869..5f2f20e3b 100644
--- a/kexi/plugins/forms/widgets/kexidbimagebox.cpp
+++ b/kexi/plugins/forms/widgets/kexidbimagebox.cpp
@@ -20,15 +20,15 @@
#include "kexidbimagebox.h"
-#include <qapplication.h>
-#include <qpixmap.h>
-#include <qstyle.h>
-#include <qclipboard.h>
-#include <qtooltip.h>
-#include <qimage.h>
-#include <qbuffer.h>
-#include <qfiledialog.h>
-#include <qpainter.h>
+#include <tqapplication.h>
+#include <tqpixmap.h>
+#include <tqstyle.h>
+#include <tqclipboard.h>
+#include <tqtooltip.h>
+#include <tqimage.h>
+#include <tqbuffer.h>
+#include <tqfiledialog.h>
+#include <tqpainter.h>
#include <kdebug.h>
#include <kpopupmenu.h>
@@ -51,7 +51,7 @@
#include <kexidb/queryschema.h>
#include <formeditor/widgetlibrary.h>
-#ifdef Q_WS_WIN
+#ifdef TQ_WS_WIN
#include <win32_utils.h>
#include <krecentdirs.h>
#endif
@@ -59,15 +59,15 @@
#include "kexidbutils.h"
#include "../kexiformpart.h"
-static KStaticDeleter<QPixmap> KexiDBImageBox_pmDeleter;
-static QPixmap* KexiDBImageBox_pm = 0;
-static KStaticDeleter<QPixmap> KexiDBImageBox_pmSmallDeleter;
-static QPixmap* KexiDBImageBox_pmSmall = 0;
+static KStaticDeleter<TQPixmap> KexiDBImageBox_pmDeleter;
+static TQPixmap* KexiDBImageBox_pm = 0;
+static KStaticDeleter<TQPixmap> KexiDBImageBox_pmSmallDeleter;
+static TQPixmap* KexiDBImageBox_pmSmall = 0;
-KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *name )
- : KexiFrame( parent, name, Qt::WNoAutoErase )
+KexiDBImageBox::KexiDBImageBox( bool designMode, TQWidget *tqparent, const char *name )
+ : KexiFrame( tqparent, name, TQt::WNoAutoErase )
, KexiFormDataItemInterface()
- , m_alignment(Qt::AlignAuto|Qt::AlignTop)
+ , m_tqalignment(TQt::AlignAuto|TQt::AlignTop)
, m_designMode(designMode)
, m_readOnly(false)
, m_scaledContents(false)
@@ -80,7 +80,7 @@ KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *na
, m_insideSetPalette(false)
{
installEventFilter(this);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Preferred);
//setup popup menu
m_popupMenu = new KexiImageContextMenu(this);
@@ -91,47 +91,47 @@ KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *na
}
else {
m_chooser = new KexiDropDownButton(this);
- m_chooser->setFocusPolicy(StrongFocus);
+ m_chooser->setFocusPolicy(TQ_StrongFocus);
m_chooser->setPopup(m_popupMenu);
setFocusProxy(m_chooser);
m_chooser->installEventFilter(this);
-// m_chooser->setPalette(qApp->palette());
+// m_chooser->setPalette(tqApp->palette());
// hlyr->addWidget(m_chooser);
}
- setBackgroundMode(Qt::NoBackground);
- setFrameShape(QFrame::Box);
- setFrameShadow(QFrame::Plain);
- setFrameColor(Qt::black);
+ setBackgroundMode(TQt::NoBackground);
+ setFrameShape(TQFrame::Box);
+ setFrameShadow(TQFrame::Plain);
+ setFrameColor(TQt::black);
m_paletteBackgroundColorChanged = false; //set this here, not before
- connect(m_popupMenu, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)),
- this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&)));
- connect(m_popupMenu, SIGNAL(insertFromFileRequested(const KURL&)),
- this, SLOT(handleInsertFromFileAction(const KURL&)));
- connect(m_popupMenu, SIGNAL(saveAsRequested(const QString&)),
- this, SLOT(handleSaveAsAction(const QString&)));
- connect(m_popupMenu, SIGNAL(cutRequested()),
- this, SLOT(handleCutAction()));
- connect(m_popupMenu, SIGNAL(copyRequested()),
- this, SLOT(handleCopyAction()));
- connect(m_popupMenu, SIGNAL(pasteRequested()),
- this, SLOT(handlePasteAction()));
- connect(m_popupMenu, SIGNAL(clearRequested()),
- this, SLOT(clear()));
- connect(m_popupMenu, SIGNAL(showPropertiesRequested()),
- this, SLOT(handleShowPropertiesAction()));
-
-// connect(m_popupMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu()));
+ connect(m_popupMenu, TQT_SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)),
+ this, TQT_SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&)));
+ connect(m_popupMenu, TQT_SIGNAL(insertFromFileRequested(const KURL&)),
+ this, TQT_SLOT(handleInsertFromFileAction(const KURL&)));
+ connect(m_popupMenu, TQT_SIGNAL(saveAsRequested(const TQString&)),
+ this, TQT_SLOT(handleSaveAsAction(const TQString&)));
+ connect(m_popupMenu, TQT_SIGNAL(cutRequested()),
+ this, TQT_SLOT(handleCutAction()));
+ connect(m_popupMenu, TQT_SIGNAL(copyRequested()),
+ this, TQT_SLOT(handleCopyAction()));
+ connect(m_popupMenu, TQT_SIGNAL(pasteRequested()),
+ this, TQT_SLOT(handlePasteAction()));
+ connect(m_popupMenu, TQT_SIGNAL(clearRequested()),
+ this, TQT_SLOT(clear()));
+ connect(m_popupMenu, TQT_SIGNAL(showPropertiesRequested()),
+ this, TQT_SLOT(handleShowPropertiesAction()));
+
+// connect(m_popupMenu, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(slotAboutToHidePopupMenu()));
// if (m_chooser) {
//we couldn't use m_chooser->setPopup() because of drawing problems
-// connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed()));
-// connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased()));
-// connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool)));
+// connect(m_chooser, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotChooserPressed()));
+// connect(m_chooser, TQT_SIGNAL(released()), this, TQT_SLOT(slotChooserReleased()));
+// connect(m_chooser, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotToggled(bool)));
// }
- setDataSource( QString::null ); //to initialize popup menu and actions availability
+ setDataSource( TQString() ); //to initialize popup menu and actions availability
}
KexiDBImageBox::~KexiDBImageBox()
@@ -143,29 +143,29 @@ KexiImageContextMenu* KexiDBImageBox::contextMenu() const
return m_popupMenu;
}
-QVariant KexiDBImageBox::value()
+TQVariant KexiDBImageBox::value()
{
if (dataSource().isEmpty()) {
//not db-aware
- return QVariant();
+ return TQVariant();
}
//db-aware mode
return m_value; //todo
- //return QVariant(); //todo
+ //return TQVariant(); //todo
}
-void KexiDBImageBox::setValueInternal( const QVariant& add, bool removeOld, bool loadPixmap )
+void KexiDBImageBox::setValueInternal( const TQVariant& add, bool removeOld, bool loadPixmap )
{
if (isReadOnly())
return;
m_popupMenu->hide();
if (removeOld)
m_value = add.toByteArray();
- else //do not add "m_origValue" to "add" as this is QByteArray
+ else //do not add "m_origValue" to "add" as this is TQByteArray
m_value = m_origValue.toByteArray();
bool ok = !m_value.isEmpty();
if (ok) {
- ///unused (m_valueMimeType is not available unless the px is inserted) QString type( KImageIO::typeForMime(m_valueMimeType) );
+ ///unused (m_valueMimeType is not available unless the px is inserted) TQString type( KImageIO::typeForMime(m_valueMimeType) );
///ok = KImageIO::canRead( type );
ok = loadPixmap ? m_pixmap.loadFromData(m_value) : true; //, type.latin1());
if (!ok) {
@@ -173,22 +173,22 @@ void KexiDBImageBox::setValueInternal( const QVariant& add, bool removeOld, bool
}
}
if (!ok) {
- m_valueMimeType = QString::null;
- m_pixmap = QPixmap();
+ m_valueMimeType = TQString();
+ m_pixmap = TQPixmap();
}
- repaint();
+ tqrepaint();
}
-void KexiDBImageBox::setInvalidState( const QString& displayText )
+void KexiDBImageBox::setInvalidState( const TQString& displayText )
{
Q_UNUSED( displayText );
-// m_pixmapLabel->setPixmap(QPixmap());
+// m_pixmapLabel->setPixmap(TQPixmap());
if (!dataSource().isEmpty()) {
- m_value = QByteArray();
+ m_value = TQByteArray();
}
-// m_pixmap = QPixmap();
-// m_originalFileName = QString::null;
+// m_pixmap = TQPixmap();
+// m_originalFileName = TQString();
//! @todo m_pixmapLabel->setText( displayText );
@@ -218,7 +218,7 @@ void KexiDBImageBox::setReadOnly(bool set)
m_readOnly = set;
}
-QPixmap KexiDBImageBox::pixmap() const
+TQPixmap KexiDBImageBox::pixmap() const
{
if (dataSource().isEmpty()) {
//not db-aware
@@ -242,7 +242,7 @@ void KexiDBImageBox::setPixmapId(uint id)
if (m_insideSetData) //avoid recursion
return;
setData(KexiBLOBBuffer::self()->objectForId( id, /*unstored*/false ));
- repaint();
+ tqrepaint();
}
uint KexiDBImageBox::storedPixmapId() const
@@ -257,7 +257,7 @@ uint KexiDBImageBox::storedPixmapId() const
void KexiDBImageBox::setStoredPixmapId(uint id)
{
setData(KexiBLOBBuffer::self()->objectForId( id, /*stored*/true ));
- repaint();
+ tqrepaint();
}
bool KexiDBImageBox::hasScaledContents() const
@@ -266,27 +266,27 @@ bool KexiDBImageBox::hasScaledContents() const
// return m_pixmapLabel->hasScaledContents();
}
-/*void KexiDBImageBox::setPixmap(const QByteArray& pixmap)
+/*void KexiDBImageBox::setPixmap(const TQByteArray& pixmap)
{
setValueInternal(pixmap, true);
-// setBackgroundMode(pixmap.isNull() ? Qt::NoBackground : Qt::PaletteBackground);
+// setBackgroundMode(pixmap.isNull() ? TQt::NoBackground : TQt::PaletteBackground);
}*/
void KexiDBImageBox::setScaledContents(bool set)
{
//todo m_pixmapLabel->setScaledContents(set);
m_scaledContents = set;
- repaint();
+ tqrepaint();
}
void KexiDBImageBox::setKeepAspectRatio(bool set)
{
m_keepAspectRatio = set;
if (m_scaledContents)
- repaint();
+ tqrepaint();
}
-QWidget* KexiDBImageBox::widget()
+TQWidget* KexiDBImageBox::widget()
{
//! @todo
// return m_pixmapLabel;
@@ -303,7 +303,7 @@ bool KexiDBImageBox::cursorAtEnd()
return true;
}
-QByteArray KexiDBImageBox::data() const
+TQByteArray KexiDBImageBox::data() const
{
if (dataSource().isEmpty()) {
//static mode
@@ -331,19 +331,19 @@ void KexiDBImageBox::handleInsertFromFileAction(const KURL& url)
if (!h)
return;
setData(h);
- repaint();
+ tqrepaint();
}
else {
//db-aware
- QString fileName( url.isLocalFile() ? url.path() : url.prettyURL() );
+ TQString fileName( url.isLocalFile() ? url.path() : url.prettyURL() );
//! @todo download the file if remote, then set fileName properly
- QFile f(fileName);
+ TQFile f(fileName);
if (!f.open(IO_ReadOnly)) {
//! @todo err msg
return;
}
- QByteArray ba = f.readAll();
+ TQByteArray ba = f.readAll();
if (f.status()!=IO_Ok) {
//! @todo err msg
f.close();
@@ -359,7 +359,7 @@ void KexiDBImageBox::handleInsertFromFileAction(const KURL& url)
}
}
-void KexiDBImageBox::handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty)
+void KexiDBImageBox::handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty)
{
if (data().isEmpty()) {
kdWarning() << "KexiDBImageBox::handleAboutToSaveAs(): no pixmap!" << endl;
@@ -369,15 +369,15 @@ void KexiDBImageBox::handleAboutToSaveAsAction(QString& origFilename, QString& f
if (dataSource().isEmpty()) { //for static images filename and mimetype can be available
origFilename = m_data.originalFileName();
if (!origFilename.isEmpty())
- origFilename = QString("/") + origFilename;
+ origFilename = TQString("/") + origFilename;
if (!m_data.mimeType().isEmpty())
fileExtension = KImageIO::typeForMime(m_data.mimeType()).lower();
}
}
-void KexiDBImageBox::handleSaveAsAction(const QString& fileName)
+void KexiDBImageBox::handleSaveAsAction(const TQString& fileName)
{
- QFile f(fileName);
+ TQFile f(fileName);
if (!f.open(IO_WriteOnly)) {
//! @todo err msg
return;
@@ -401,14 +401,14 @@ void KexiDBImageBox::handleCutAction()
void KexiDBImageBox::handleCopyAction()
{
- qApp->clipboard()->setPixmap(pixmap(), QClipboard::Clipboard);
+ tqApp->tqclipboard()->setPixmap(pixmap(), TQClipboard::Clipboard);
}
void KexiDBImageBox::handlePasteAction()
{
if (isReadOnly() || (!m_designMode && !hasFocus()))
return;
- QPixmap pm( qApp->clipboard()->pixmap(QClipboard::Clipboard) );
+ TQPixmap pm( tqApp->tqclipboard()->pixmap(TQClipboard::Clipboard) );
// if (!pm.isNull())
// setValueInternal(pm, true);
if (dataSource().isEmpty()) {
@@ -418,18 +418,18 @@ void KexiDBImageBox::handlePasteAction()
else {
//db-aware mode
m_pixmap = pm;
- QByteArray ba;
- QBuffer buffer( ba );
+ TQByteArray ba;
+ TQBuffer buffer( ba );
buffer.open( IO_WriteOnly );
if (m_pixmap.save( &buffer, "PNG" )) {// write pixmap into ba in PNG format
setValueInternal( ba, true, false/* !loadPixmap */ );
}
else {
- setValueInternal( QByteArray(), true );
+ setValueInternal( TQByteArray(), true );
}
}
- repaint();
+ tqrepaint();
if (!dataSource().isEmpty()) {
// emit pixmapChanged();
signalValueChanged();
@@ -446,16 +446,16 @@ void KexiDBImageBox::clear()
if (isReadOnly())
return;
//db-aware mode
- setValueInternal(QByteArray(), true);
- //m_pixmap = QPixmap();
+ setValueInternal(TQByteArray(), true);
+ //m_pixmap = TQPixmap();
}
-// m_originalFileName = QString::null;
+// m_originalFileName = TQString();
//! @todo emit signal for setting "dirty" flag within the design
-// m_pixmap = QPixmap(); //will be loaded on demand
- repaint();
+// m_pixmap = TQPixmap(); //will be loaded on demand
+ tqrepaint();
if (!dataSource().isEmpty()) {
// emit pixmapChanged();//valueChanged(data());
signalValueChanged();
@@ -492,7 +492,7 @@ void KexiDBImageBox::slotAboutToHidePopupMenu()
}
}*/
-void KexiDBImageBox::contextMenuEvent( QContextMenuEvent * e )
+void KexiDBImageBox::contextMenuEvent( TQContextMenuEvent * e )
{
if (popupMenuAvailable())
m_popupMenu->exec( e->globalPos(), -1 );
@@ -519,20 +519,20 @@ void KexiDBImageBox::slotToggled(bool on)
return;
}
m_chooser->disableMousePress = false;
- QRect screen = qApp->desktop()->availableGeometry( m_chooser );
- QPoint p;
- if ( QApplication::reverseLayout() ) {
- if ( (mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->sizeHint().height()) <= screen.height() )
+ TQRect screen = tqApp->desktop()->availableGeometry( m_chooser );
+ TQPoint p;
+ if ( TQApplication::reverseLayout() ) {
+ if ( (mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->tqsizeHint().height()) <= screen.height() )
p = m_chooser->mapToGlobal( m_chooser->rect().bottomRight() );
else
- p = m_chooser->mapToGlobal( m_chooser->rect().topRight() - QPoint( 0, m_popupMenu->sizeHint().height() ) );
- p.rx() -= m_popupMenu->sizeHint().width();
+ p = m_chooser->mapToGlobal( m_chooser->rect().topRight() - TQPoint( 0, m_popupMenu->tqsizeHint().height() ) );
+ p.rx() -= m_popupMenu->tqsizeHint().width();
}
else {
- if ( (m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->sizeHint().height()) <= screen.height() )
+ if ( (m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->tqsizeHint().height()) <= screen.height() )
p = m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() );
else
- p = m_chooser->mapToGlobal( m_chooser->rect().topLeft() - QPoint( 0, m_popupMenu->sizeHint().height() ) );
+ p = m_chooser->mapToGlobal( m_chooser->rect().topLeft() - TQPoint( 0, m_popupMenu->tqsizeHint().height() ) );
}
if (!m_popupMenu->isVisible() && on) {
m_popupMenu->exec( p, -1 );
@@ -546,7 +546,7 @@ void KexiDBImageBox::updateActionStrings()
if (!m_popupMenu)
return;
if (m_designMode) {
-/* QString titleString( i18n("Image Box") );
+/* TQString titleString( i18n("Image Box") );
if (!dataSource().isEmpty())
titleString.prepend(dataSource() + " : ");
m_popupMenu->changeTitle(m_popupMenu->idAt(0), m_popupMenu->titlePixmap(m_popupMenu->idAt(0)), titleString);*/
@@ -561,19 +561,19 @@ void KexiDBImageBox::updateActionStrings()
if (m_chooser) {
if (popupMenuAvailable() && dataSource().isEmpty()) { //this may work in the future (see @todo below)
- QToolTip::add(m_chooser, i18n("Click to show actions for this image box"));
+ TQToolTip::add(m_chooser, i18n("Click to show actions for this image box"));
} else {
- QString beautifiedImageBoxName;
+ TQString beautifiedImageBoxName;
if (m_designMode) {
beautifiedImageBoxName = dataSource();
}
else {
- beautifiedImageBoxName = columnInfo() ? columnInfo()->captionOrAliasOrName() : QString::null;
+ beautifiedImageBoxName = columnInfo() ? columnInfo()->captionOrAliasOrName() : TQString();
/*! @todo look at makeFirstCharacterUpperCaseInCaptions setting [bool]
(see doc/dev/settings.txt) */
beautifiedImageBoxName = beautifiedImageBoxName[0].upper() + beautifiedImageBoxName.mid(1);
}
- QToolTip::add(m_chooser, i18n("Click to show actions for \"%1\" image box").arg(beautifiedImageBoxName));
+ TQToolTip::add(m_chooser, i18n("Click to show actions for \"%1\" image box").tqarg(beautifiedImageBoxName));
}
}
}
@@ -586,7 +586,7 @@ bool KexiDBImageBox::popupMenuAvailable()
return !dataSource().isEmpty();
}
-void KexiDBImageBox::setDataSource( const QString &ds )
+void KexiDBImageBox::setDataSource( const TQString &ds )
{
KexiFormDataItemInterface::setDataSource( ds );
setData(KexiBLOBBuffer::Handle());
@@ -608,96 +608,96 @@ void KexiDBImageBox::setDataSource( const QString &ds )
if (!m_lineWidthChanged) {
KexiFrame::setLineWidth( ds.isEmpty() ? 0 : 1 );
}
- if (!m_paletteBackgroundColorChanged && parentWidget()) {
+ if (!m_paletteBackgroundColorChanged && tqparentWidget()) {
KexiFrame::setPaletteBackgroundColor(
- dataSource().isEmpty() ? parentWidget()->paletteBackgroundColor() : palette().active().base() );
+ dataSource().isEmpty() ? tqparentWidget()->paletteBackgroundColor() : tqpalette().active().base() );
}
}
-QSize KexiDBImageBox::sizeHint() const
+TQSize KexiDBImageBox::tqsizeHint() const
{
if (pixmap().isNull())
- return QSize(80, 80);
+ return TQSize(80, 80);
return pixmap().size();
}
int KexiDBImageBox::realLineWidth() const
{
- if (frameShape()==QFrame::Box && (frameShadow()==QFrame::Sunken || frameShadow()==QFrame::Raised))
+ if (frameShape()==TQFrame::Box && (frameShadow()==TQFrame::Sunken || frameShadow()==TQFrame::Raised))
return 2 * lineWidth();
else
return lineWidth();
}
-void KexiDBImageBox::paintEvent( QPaintEvent *pe )
+void KexiDBImageBox::paintEvent( TQPaintEvent *pe )
{
if (!m_paintEventEnabled)
return;
- QPainter p(this);
+ TQPainter p(this);
p.setClipRect(pe->rect());
const int m = realLineWidth() + margin();
- QColor bg(eraseColor());
+ TQColor bg(eraseColor());
if (m_designMode && pixmap().isNull()) {
- QPixmap pm(size()-QSize(m, m));
- QPainter p2;
- p2.begin(&pm, this);
+ TQPixmap pm(size()-TQSize(m, m));
+ TQPainter p2;
+ p2.tqbegin(TQT_TQPAINTDEVICE(&pm), this);
p2.fillRect(0,0,width(),height(), bg);
updatePixmap();
- QPixmap *imagBoxPm;
+ TQPixmap *imagBoxPm;
const bool tooLarge = (height()-m-m) <= KexiDBImageBox_pm->height();
if (tooLarge || (width()-m-m) <= KexiDBImageBox_pm->width())
imagBoxPm = KexiDBImageBox_pmSmall;
else
imagBoxPm = KexiDBImageBox_pm;
- QImage img(imagBoxPm->convertToImage());
+ TQImage img(imagBoxPm->convertToImage());
img = KImageEffect::flatten(img, bg.dark(150),
- qGray( bg.rgb() ) <= 20 ? QColor(Qt::gray).dark(150) : bg.light(105));
+ tqGray( bg.rgb() ) <= 20 ? TQColor(TQt::gray).dark(150) : bg.light(105));
- QPixmap converted;
+ TQPixmap converted;
converted.convertFromImage(img);
// if (tooLarge)
// p2.drawPixmap(2, 2, converted);
// else
p2.drawPixmap(2, height()-m-m-imagBoxPm->height()-2, converted);
- QFont f(qApp->font());
+ TQFont f(tqApp->font());
p2.setFont(f);
p2.setPen( KexiUtils::contrastColor( bg ) );
- p2.drawText(pm.rect(), Qt::AlignCenter,
+ p2.drawText(pm.rect(), TQt::AlignCenter,
dataSource().isEmpty()
- ? QString::fromLatin1(name())+"\n"+i18n("Unbound Image Box", "(unbound)") //i18n("No Image")
+ ? TQString::tqfromLatin1(name())+"\n"+i18n("Unbound Image Box", "(unbound)") //i18n("No Image")
: dataSource());
p2.end();
bitBlt(this, m, m, &pm);
}
else {
- QSize internalSize(size());
+ TQSize internalSize(size());
if (m_chooser && m_dropDownButtonVisible && !dataSource().isEmpty())
internalSize.setWidth( internalSize.width() - m_chooser->width() );
//clearing needed here because we may need to draw a pixmap with transparency
p.fillRect(0,0,width(),height(), bg);
- KexiUtils::drawPixmap( p, m, QRect(QPoint(0,0), internalSize), pixmap(), m_alignment,
+ KexiUtils::drawPixmap( p, m, TQRect(TQPoint(0,0), internalSize), pixmap(), m_tqalignment,
m_scaledContents, m_keepAspectRatio );
}
KexiFrame::drawFrame( &p );
// if the widget is focused, draw focus indicator rect _if_ there is no chooser button
if (!m_designMode && !dataSource().isEmpty() && hasFocus() && (!m_chooser || !m_chooser->isVisible())) {
- style().drawPrimitive(
- QStyle::PE_FocusRect, &p, style().subRect(QStyle::SR_PushButtonContents, this),
- palette().active() );
+ tqstyle().tqdrawPrimitive(
+ TQStyle::PE_FocusRect, &p, tqstyle().subRect(TQStyle::SR_PushButtonContents, this),
+ tqpalette().active() );
}
}
-/* virtual void KexiDBImageBox::paletteChange ( const QPalette & oldPalette )
+/* virtual void KexiDBImageBox::paletteChange ( const TQPalette & oldPalette )
{
- QFrame::paletteChange(oldPalette);
+ TQFrame::paletteChange(oldPalette);
if (oldPalette.active().background()!=palette().active().background()) {
delete KexiDBImageBox_pm;
KexiDBImageBox_pm = 0;
- repaint();
+ tqrepaint();
}
}*/
@@ -707,19 +707,19 @@ void KexiDBImageBox::updatePixmap()
return;
if (!KexiDBImageBox_pm) {
- QString fname( locate("data", QString("kexi/pics/imagebox.png")) );
- KexiDBImageBox_pmDeleter.setObject( KexiDBImageBox_pm, new QPixmap(fname, "PNG") );
- QImage img(KexiDBImageBox_pm->convertToImage());
+ TQString fname( locate("data", TQString("kexi/pics/imagebox.png")) );
+ KexiDBImageBox_pmDeleter.setObject( KexiDBImageBox_pm, new TQPixmap(fname, "PNG") );
+ TQImage img(KexiDBImageBox_pm->convertToImage());
KexiDBImageBox_pmSmallDeleter.setObject( KexiDBImageBox_pmSmall,
- new QPixmap( img.smoothScale(img.width()/2, img.height()/2, QImage::ScaleMin) ) );
+ new TQPixmap( img.smoothScale(img.width()/2, img.height()/2, TQ_ScaleMin) ) );
}
}
-void KexiDBImageBox::setAlignment(int alignment)
+void KexiDBImageBox::tqsetAlignment(int tqalignment)
{
- m_alignment = alignment;
+ m_tqalignment = tqalignment;
if (!m_scaledContents || m_keepAspectRatio)
- repaint();
+ tqrepaint();
}
void KexiDBImageBox::setData(const KexiBLOBBuffer::Handle& handle)
@@ -733,23 +733,23 @@ void KexiDBImageBox::setData(const KexiBLOBBuffer::Handle& handle)
update();
}
-void KexiDBImageBox::resizeEvent( QResizeEvent * e )
+void KexiDBImageBox::resizeEvent( TQResizeEvent * e )
{
KexiFrame::resizeEvent(e);
if (m_chooser) {
- QSize s( m_chooser->sizeHint() );
- QSize margin( realLineWidth(), realLineWidth() );
+ TQSize s( m_chooser->tqsizeHint() );
+ TQSize margin( realLineWidth(), realLineWidth() );
s.setHeight( height() - 2*margin.height() );
s = s.boundedTo( size()-2*margin );
m_chooser->resize( s );
- m_chooser->move( QRect(QPoint(0,0), e->size() - m_chooser->size() - margin + QSize(1,1)).bottomRight() );
+ m_chooser->move( TQRect(TQPoint(0,0), e->size() - m_chooser->size() - margin + TQSize(1,1)).bottomRight() );
}
}
/*
-bool KexiDBImageBox::setProperty( const char * name, const QVariant & value )
+bool KexiDBImageBox::setProperty( const char * name, const TQVariant & value )
{
- const bool ret = QLabel::setProperty(name, value);
+ const bool ret = TQLabel::setProperty(name, value);
if (p_shadowEnabled) {
if (0==qstrcmp("indent", name) || 0==qstrcmp("font", name) || 0==qstrcmp("margin", name)
|| 0==qstrcmp("frameShadow", name) || 0==qstrcmp("frameShape", name)
@@ -770,16 +770,16 @@ void KexiDBImageBox::setColumnInfo(KexiDB::QueryColumnInfo* cinfo)
updateActionStrings();
}
-bool KexiDBImageBox::keyPressed(QKeyEvent *ke)
+bool KexiDBImageBox::keyPressed(TQKeyEvent *ke)
{
// Esc key should close the popup
- if (ke->state() == Qt::NoButton && ke->key() == Qt::Key_Escape) {
+ if (ke->state() == Qt::NoButton && ke->key() == TQt::Key_Escape) {
if (m_popupMenu->isVisible()) {
m_setFocusOnButtonAfterClosingPopup = true;
return true;
}
}
-// else if (ke->state() == Qt::ControlButton && KStdAccel::shortcut(KStdAccel::Copy).keyCodeQt() == (ke->key()|Qt::CTRL)) {
+// else if (ke->state() == TQt::ControlButton && KStdAccel::shortcut(KStdAccel::Copy).keyCodeTQt() == (ke->key()|TQt::CTRL)) {
// }
return false;
}
@@ -790,7 +790,7 @@ void KexiDBImageBox::setLineWidth( int width )
KexiFrame::setLineWidth(width);
}
-void KexiDBImageBox::setPalette( const QPalette &pal )
+void KexiDBImageBox::setPalette( const TQPalette &pal )
{
KexiFrame::setPalette(pal);
if (m_insideSetPalette)
@@ -801,13 +801,13 @@ void KexiDBImageBox::setPalette( const QPalette &pal )
m_insideSetPalette = false;
}
-void KexiDBImageBox::setPaletteBackgroundColor( const QColor & color )
+void KexiDBImageBox::setPaletteBackgroundColor( const TQColor & color )
{
- kexipluginsdbg << "KexiDBImageBox::setPaletteBackgroundColor(): " << color.name() << endl;
+ kexipluginsdbg << "KexiDBImageBox::setPaletteBackgroundColor(): " << TQString(color.name()) << endl;
m_paletteBackgroundColorChanged = true;
KexiFrame::setPaletteBackgroundColor(color);
if (m_chooser)
- m_chooser->setPalette( qApp->palette() );
+ m_chooser->setPalette( tqApp->palette() );
}
bool KexiDBImageBox::dropDownButtonVisible() const
@@ -835,33 +835,33 @@ bool KexiDBImageBox::subwidgetStretchRequired(KexiDBAutoField* autoField) const
return true;
}
-bool KexiDBImageBox::eventFilter( QObject * watched, QEvent * e )
+bool KexiDBImageBox::eventFilter( TQObject * watched, TQEvent * e )
{
- if (watched==this || watched==m_chooser) { //we're watching chooser as well because it's a focus proxy even if invisible
- if (e->type()==QEvent::FocusIn || e->type()==QEvent::FocusOut || e->type()==QEvent::MouseButtonPress) {
- update(); //to repaint focus rect
+ if (TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(this) || TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(m_chooser)) { //we're watching chooser as well because it's a focus proxy even if invisible
+ if (e->type()==TQEvent::FocusIn || e->type()==TQEvent::FocusOut || e->type()==TQEvent::MouseButtonPress) {
+ update(); //to tqrepaint focus rect
}
}
// hide popup menu as soon as it loses focus
- if (watched==m_popupMenu && e->type()==QEvent::FocusOut) {
+ if (TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(m_popupMenu) && e->type()==TQEvent::FocusOut) {
m_popupMenu->hide();
}
return KexiFrame::eventFilter(watched, e);
}
-QWidget::FocusPolicy KexiDBImageBox::focusPolicy() const
+TQ_FocusPolicy KexiDBImageBox::focusPolicy() const
{
if (dataSource().isEmpty())
- return NoFocus;
+ return TQ_NoFocus;
return m_focusPolicyInternal;
}
-QWidget::FocusPolicy KexiDBImageBox::focusPolicyInternal() const
+TQ_FocusPolicy KexiDBImageBox::focusPolicyInternal() const
{
return m_focusPolicyInternal;
}
-void KexiDBImageBox::setFocusPolicy( FocusPolicy policy )
+void KexiDBImageBox::setFocusPolicy( TQ_FocusPolicy policy )
{
m_focusPolicyInternal = policy;
KexiFrame::setFocusPolicy( focusPolicy() ); //set modified policy