diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/widget/utils | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/widget/utils')
24 files changed, 863 insertions, 817 deletions
diff --git a/kexi/widget/utils/kexiarrowtip.cpp b/kexi/widget/utils/kexiarrowtip.cpp index cdffcb02..a805f5e3 100644 --- a/kexi/widget/utils/kexiarrowtip.cpp +++ b/kexi/widget/utils/kexiarrowtip.cpp @@ -19,44 +19,44 @@ #include "kexiarrowtip.h" -#include <qpixmap.h> -#include <qbitmap.h> -#include <qpainter.h> -#include <qimage.h> -#include <qtooltip.h> -#include <qfont.h> -#include <qfontmetrics.h> -#include <qtimer.h> +#include <tqpixmap.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqtooltip.h> +#include <tqfont.h> +#include <tqfontmetrics.h> +#include <tqtimer.h> #include <kexiutils/utils.h> -KexiArrowTip::KexiArrowTip(const QString& text, QWidget* parent) - : KexiToolTip(text, parent) +KexiArrowTip::KexiArrowTip(const TQString& text, TQWidget* tqparent) + : KexiToolTip(text, tqparent) , m_opacity(0.0) { - QPalette pal( palette() ); - QColorGroup cg(pal.active()); - cg.setColor(QColorGroup::Foreground, Qt::red); + TQPalette pal( palette() ); + TQColorGroup cg(pal.active()); + cg.setColor(TQColorGroup::Foreground, TQt::red); pal.setActive(cg); setPalette(pal); - QFontMetrics fm(font()); - QSize sz(fm.boundingRect(m_value.toString()).size()); - sz += QSize(14, 10); //+margins + TQFontMetrics fm(font()); + TQSize sz(fm.boundingRect(m_value.toString()).size()); + sz += TQSize(14, 10); //+margins m_arrowHeight = sz.height()/2; - sz += QSize(0, m_arrowHeight); //+arrow height + sz += TQSize(0, m_arrowHeight); //+arrow height resize(sz); setAutoMask( false ); - //generate mask - QPixmap maskPm(size()); - maskPm.fill( black ); - QPainter maskPainter(&maskPm); - drawFrame(maskPainter); - QImage maskImg( maskPm.convertToImage() ); - QBitmap bm; - bm = maskImg.createHeuristicMask(); + //generate tqmask + TQPixmap tqmaskPm(size()); + tqmaskPm.fill( black ); + TQPainter tqmaskPainter(&tqmaskPm); + drawFrame(tqmaskPainter); + TQImage tqmaskImg( tqmaskPm.convertToImage() ); + TQBitmap bm; + bm = tqmaskImg.createHeuristicMask(); setMask( bm ); } @@ -88,7 +88,7 @@ void KexiArrowTip::increaseOpacity() m_opacity += 0.10; setWindowOpacity(m_opacity); if (m_opacity < 1.0) - QTimer::singleShot(25, this, SLOT(increaseOpacity())); + TQTimer::singleShot(25, this, TQT_SLOT(increaseOpacity())); } void KexiArrowTip::decreaseOpacity() @@ -100,7 +100,7 @@ void KexiArrowTip::decreaseOpacity() } m_opacity -= 0.10; setWindowOpacity(m_opacity); - QTimer::singleShot(25, this, SLOT(decreaseOpacity())); + TQTimer::singleShot(25, this, TQT_SLOT(decreaseOpacity())); } bool KexiArrowTip::close ( bool alsoDelete ) @@ -115,16 +115,16 @@ bool KexiArrowTip::close ( bool alsoDelete ) return m_opacity<=0.0; } -void KexiArrowTip::drawContents(QPainter& p) +void KexiArrowTip::drawContents(TQPainter& p) { - p.setPen( QPen(palette().active().foreground(), 1) ); - p.drawText(QRect(0,m_arrowHeight,width(),height()-m_arrowHeight), - Qt::AlignCenter, m_value.toString()); + p.setPen( TQPen(tqpalette().active().foreground(), 1) ); + p.drawText(TQRect(0,m_arrowHeight,width(),height()-m_arrowHeight), + TQt::AlignCenter, m_value.toString()); } -void KexiArrowTip::drawFrame(QPainter& p) +void KexiArrowTip::drawFrame(TQPainter& p) { - QPen pen(palette().active().foreground(), 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); + TQPen pen(tqpalette().active().foreground(), 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); p.setPen( pen ); /* /\ @@ -134,7 +134,7 @@ void KexiArrowTip::drawFrame(QPainter& p) */ //1st line const int arrowOffset = 5; //5 pixels to right - QPointArray pa(8); + TQPointArray pa(8); pa.setPoint(0, 0, m_arrowHeight-1); pa.setPoint(1, 0, height()-1); pa.setPoint(2, width()-1, height()-1); diff --git a/kexi/widget/utils/kexiarrowtip.h b/kexi/widget/utils/kexiarrowtip.h index d6de6186..791535fa 100644 --- a/kexi/widget/utils/kexiarrowtip.h +++ b/kexi/widget/utils/kexiarrowtip.h @@ -29,11 +29,12 @@ class KEXIGUIUTILS_EXPORT KexiArrowTip : public KexiToolTip { Q_OBJECT + TQ_OBJECT public: - KexiArrowTip(const QString& text, QWidget* parent); + KexiArrowTip(const TQString& text, TQWidget* tqparent); virtual ~KexiArrowTip(); - inline QString text() const { return m_value.toString(); } + inline TQString text() const { return m_value.toString(); } virtual bool close() { return close(false); } virtual bool close( bool alsoDelete ); @@ -46,8 +47,8 @@ class KEXIGUIUTILS_EXPORT KexiArrowTip : public KexiToolTip void decreaseOpacity(); protected: - virtual void drawFrame(QPainter& p); - virtual void drawContents(QPainter& p); + virtual void drawFrame(TQPainter& p); + virtual void drawContents(TQPainter& p); int m_arrowHeight; double m_opacity; diff --git a/kexi/widget/utils/kexicomboboxdropdownbutton.cpp b/kexi/widget/utils/kexicomboboxdropdownbutton.cpp index 407bc6fe..b5c22372 100644 --- a/kexi/widget/utils/kexicomboboxdropdownbutton.cpp +++ b/kexi/widget/utils/kexicomboboxdropdownbutton.cpp @@ -23,18 +23,18 @@ #include <kdebug.h> #include <kcombobox.h> -#include <qstyle.h> -#include <qapplication.h> +#include <tqstyle.h> +#include <tqapplication.h> -KexiComboBoxDropDownButton::KexiComboBoxDropDownButton( QWidget *parent ) - : KPushButton(parent) +KexiComboBoxDropDownButton::KexiComboBoxDropDownButton( TQWidget *tqparent ) + : KPushButton(tqparent) { m_paintedCombo = new KComboBox(this); m_paintedCombo->hide(); m_paintedCombo->setEditable(true); setToggleButton(true); - styleChange(style()); + styleChange(tqstyle()); m_paintedCombo->move(0,0); m_paintedCombo->setFixedSize(size()); } @@ -43,45 +43,45 @@ KexiComboBoxDropDownButton::~KexiComboBoxDropDownButton() { } -void KexiComboBoxDropDownButton::drawButton(QPainter *p) +void KexiComboBoxDropDownButton::drawButton(TQPainter *p) { - int flags = QStyle::Style_Enabled | QStyle::Style_HasFocus; + int flags = TQStyle::Style_Enabled | TQStyle::Style_HasFocus; if (isDown()) - flags |= QStyle::Style_Down; + flags |= TQStyle::Style_Down; KPushButton::drawButton(p); - QRect r = rect(); + TQRect r = rect(); r.setHeight(r.height()+m_fixForHeight); - if (m_drawComplexControl) { + if (m_tqdrawComplexControl) { if (m_fixForHeight>0 && m_paintedCombo->size()!=size()) { m_paintedCombo->move(0,0); - m_paintedCombo->setFixedSize(size()+QSize(0, m_fixForHeight)); //last chance to fix size + m_paintedCombo->setFixedSize(size()+TQSize(0, m_fixForHeight)); //last chance to fix size } - style().drawComplexControl( QStyle::CC_ComboBox, p, - m_fixForHeight>0 ? (const QWidget*)m_paintedCombo : this, r, colorGroup(), - flags, (uint)(QStyle::SC_ComboBoxArrow), QStyle::SC_None ); + tqstyle().tqdrawComplexControl( TQStyle::CC_ComboBox, p, + m_fixForHeight>0 ? (const TQWidget*)m_paintedCombo : this, r, tqcolorGroup(), + flags, (uint)(TQStyle::SC_ComboBoxArrow), TQStyle::SC_None ); } else { r.setWidth(r.width()+2); - style().drawPrimitive( QStyle::PE_ArrowDown, p, r, colorGroup(), flags); + tqstyle().tqdrawPrimitive( TQStyle::PE_ArrowDown, p, r, tqcolorGroup(), flags); } } -void KexiComboBoxDropDownButton::styleChange( QStyle & oldStyle ) +void KexiComboBoxDropDownButton::styleChange( TQStyle & oldStyle ) { //<hack> - if (qstricmp(style().name(),"thinkeramik")==0) { + if (qstricmp(tqstyle().name(),"thinkeramik")==0) { m_fixForHeight = 3; } else m_fixForHeight = 0; //</hack> - m_drawComplexControl = - (style().inherits("KStyle") && qstricmp(style().name(),"qtcurve")!=0) - || qstricmp(style().name(),"platinum")==0; + m_tqdrawComplexControl = + (tqstyle().inherits("KStyle") && qstricmp(tqstyle().name(),"qtcurve")!=0) + || qstricmp(tqstyle().name(),"platinum")==0; if (m_fixForHeight==0) - setFixedWidth( style().querySubControlMetrics( QStyle::CC_ComboBox, - (const QWidget*)m_paintedCombo, QStyle::SC_ComboBoxArrow ).width() +1 ); + setFixedWidth( tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, + (const TQWidget*)m_paintedCombo, TQStyle::SC_ComboBoxArrow ).width() +1 ); KPushButton::styleChange(oldStyle); } diff --git a/kexi/widget/utils/kexicomboboxdropdownbutton.h b/kexi/widget/utils/kexicomboboxdropdownbutton.h index da53a7e2..970e46c3 100644 --- a/kexi/widget/utils/kexicomboboxdropdownbutton.h +++ b/kexi/widget/utils/kexicomboboxdropdownbutton.h @@ -30,19 +30,19 @@ class KComboBox; class KEXIGUIUTILS_EXPORT KexiComboBoxDropDownButton : public KPushButton { public: - KexiComboBoxDropDownButton( QWidget *parent ); + KexiComboBoxDropDownButton( TQWidget *tqparent ); virtual ~KexiComboBoxDropDownButton(); protected: /*! Reimplemented after @ref KPushButton to draw drop-down arrow. */ - virtual void drawButton(QPainter *p); + virtual void drawButton(TQPainter *p); /*! Reimplemented after @ref KPushButton to adapt size to style changes. */ - virtual void styleChange( QStyle & oldStyle ); + virtual void styleChange( TQStyle & oldStyle ); int m_fixForHeight; - bool m_drawComplexControl : 1; - KComboBox *m_paintedCombo; //!< fake combo used only to pass it as 'this' for QStyle + bool m_tqdrawComplexControl : 1; + KComboBox *m_paintedCombo; //!< fake combo used only to pass it as 'this' for TQStyle //!< (because styles use \<static_cast\>) }; diff --git a/kexi/widget/utils/kexicontextmenuutils.cpp b/kexi/widget/utils/kexicontextmenuutils.cpp index 727cef6f..8c6c3ab2 100644 --- a/kexi/widget/utils/kexicontextmenuutils.cpp +++ b/kexi/widget/utils/kexicontextmenuutils.cpp @@ -27,10 +27,10 @@ #include <kdebug.h> #include <kmessagebox.h> -#include <qfiledialog.h> -#include <qapplication.h> +#include <tqfiledialog.h> +#include <tqapplication.h> -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN #include <win32_utils.h> #include <krecentdirs.h> #endif @@ -39,8 +39,8 @@ class KexiImageContextMenu::Private { public: - Private(QWidget *parent) - : actionCollection(parent) + Private(TQWidget *tqparent) + : actionCollection(tqparent) { } @@ -55,38 +55,38 @@ public: //------------ -KexiImageContextMenu::KexiImageContextMenu(QWidget* parent) - : KPopupMenu(parent) +KexiImageContextMenu::KexiImageContextMenu(TQWidget* tqparent) + : KPopupMenu(tqparent) , d( new Private(this) ) { setName("KexiImageContextMenu"); - insertTitle(QString::null); + insertTitle(TQString()); d->insertFromFileAction = new KAction(i18n("Insert From &File..."), SmallIconSet("fileopen"), 0, - this, SLOT(insertFromFile()), &d->actionCollection, "insert"); + TQT_TQOBJECT(this), TQT_SLOT(insertFromFile()), &d->actionCollection, "insert"); d->insertFromFileAction->plug(this); - d->saveAsAction = KStdAction::saveAs(this, SLOT(saveAs()), &d->actionCollection); + d->saveAsAction = KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(saveAs()), &d->actionCollection); // d->saveAsAction->setText(i18n("&Save &As...")); d->saveAsAction->plug(this); insertSeparator(); - d->cutAction = KStdAction::cut(this, SLOT(cut()), &d->actionCollection); + d->cutAction = KStdAction::cut(TQT_TQOBJECT(this), TQT_SLOT(cut()), &d->actionCollection); d->cutAction->plug(this); - d->copyAction = KStdAction::copy(this, SLOT(copy()), &d->actionCollection); + d->copyAction = KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(copy()), &d->actionCollection); d->copyAction->plug(this); - d->pasteAction = KStdAction::paste(this, SLOT(paste()), &d->actionCollection); + d->pasteAction = KStdAction::paste(TQT_TQOBJECT(this), TQT_SLOT(paste()), &d->actionCollection); d->pasteAction->plug(this); d->deleteAction = new KAction(i18n("&Clear"), SmallIconSet("editdelete"), 0, - this, SLOT(clear()), &d->actionCollection, "delete"); + TQT_TQOBJECT(this), TQT_SLOT(clear()), &d->actionCollection, "delete"); d->deleteAction->plug(this); #ifdef KEXI_NO_UNFINISHED d->propertiesAction = 0; #else insertSeparator(); d->propertiesAction = new KAction(i18n("Properties"), 0, 0, - this, SLOT(showProperties()), &d->actionCollection, "properties"); + this, TQT_SLOT(showProperties()), &d->actionCollection, "properties"); d->propertiesAction->plug(this); #endif - connect(this, SIGNAL(aboutToShow()), this, SLOT(updateActionsAvailability())); + connect(this, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(updateActionsAvailability())); } KexiImageContextMenu::~KexiImageContextMenu() @@ -96,12 +96,12 @@ KexiImageContextMenu::~KexiImageContextMenu() void KexiImageContextMenu::insertFromFile() { -// QWidget *focusWidget = qApp->focusWidget(); -#ifdef Q_WS_WIN - QString recentDir; - QString fileName = QFileDialog::getOpenFileName( +// TQWidget *tqfocusWidget = tqApp->tqfocusWidget(); +#ifdef TQ_WS_WIN + TQString recentDir; + TQString fileName = TQFileDialog::getOpenFileName( KFileDialog::getStartURL(":LastVisitedImagePath", recentDir).path(), - convertKFileDialogFilterToQFileDialogFilter(KImageIO::pattern(KImageIO::Reading)), + convertKFileDialogFilterToTQFileDialogFilter(KImageIO::pattern(KImageIO::Reading)), this, 0, i18n("Insert Image From File")); KURL url; if (!fileName.isEmpty()) @@ -109,22 +109,22 @@ void KexiImageContextMenu::insertFromFile() #else KURL url( KFileDialog::getImageOpenURL( ":LastVisitedImagePath", this, i18n("Insert Image From File")) ); -// 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 #endif if (!url.isValid()) { //focus the app again because to avoid annoying the user with unfocused main window - if (qApp->mainWidget()) { - //focusWidget->raise(); - //focusWidget->setFocus(); - qApp->mainWidget()->raise(); + if (tqApp->mainWidget()) { + //tqfocusWidget->raise(); + //tqfocusWidget->setFocus(); + tqApp->mainWidget()->raise(); } return; } kexipluginsdbg << "fname=" << url.prettyURL() << endl; -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN //save last visited path // KURL url(fileName); if (url.isLocalFile()) @@ -132,16 +132,16 @@ void KexiImageContextMenu::insertFromFile() #endif emit insertFromFileRequested(url); - if (qApp->mainWidget()) { -// focusWidget->raise(); -// focusWidget->setFocus(); - qApp->mainWidget()->raise(); + if (tqApp->mainWidget()) { +// tqfocusWidget->raise(); +// tqfocusWidget->setFocus(); + tqApp->mainWidget()->raise(); } } void KexiImageContextMenu::saveAs() { - QString origFilename, fileExtension; + TQString origFilename, fileExtension; bool dataIsEmpty = false; emit aboutToSaveAsRequested(origFilename, fileExtension, dataIsEmpty); @@ -150,44 +150,44 @@ void KexiImageContextMenu::saveAs() return; } if (!origFilename.isEmpty()) - origFilename = QString("/") + origFilename; + origFilename = TQString("/") + origFilename; if (fileExtension.isEmpty()) { // PNG data is the default fileExtension = "png"; } -#ifdef Q_WS_WIN - QString recentDir; - QString fileName = QFileDialog::getSaveFileName( +#ifdef TQ_WS_WIN + TQString recentDir; + TQString fileName = TQFileDialog::getSaveFileName( KFileDialog::getStartURL(":LastVisitedImagePath", recentDir).path() + origFilename, - convertKFileDialogFilterToQFileDialogFilter(KImageIO::pattern(KImageIO::Writing)), + convertKFileDialogFilterToTQFileDialogFilter(KImageIO::pattern(KImageIO::Writing)), this, 0, i18n("Save Image to File")); #else //! @todo add originalFileName! (requires access to KRecentDirs) - QString fileName = KFileDialog::getSaveFileName( + TQString fileName = KFileDialog::getSaveFileName( ":LastVisitedImagePath", KImageIO::pattern(KImageIO::Writing), this, i18n("Save Image to File")); #endif if (fileName.isEmpty()) return; - if (QFileInfo(fileName).extension().isEmpty()) - fileName += (QString(".")+fileExtension); + if (TQFileInfo(fileName).extension().isEmpty()) + fileName += (TQString(".")+fileExtension); kdDebug() << fileName << endl; KURL url; url.setPath( fileName ); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN //save last visited path if (url.isLocalFile()) KRecentDirs::add(":LastVisitedImagePath", url.directory()); #endif - QFile f(fileName); + TQFile f(fileName); if (f.exists() && KMessageBox::Yes != KMessageBox::warningYesNo(this, "<qt>"+i18n("File \"%1\" already exists." "<p>Do you want to replace it with a new one?") - .arg(QDir::convertSeparators(fileName))+"</qt>",0, + .tqarg(TQDir::convertSeparators(fileName))+"</qt>",0, KGuiItem(i18n("&Replace")), KGuiItem(i18n("&Don't Replace")))) { return; @@ -244,7 +244,7 @@ KActionCollection* KexiImageContextMenu::actionCollection() const } //static -bool KexiImageContextMenu::updateTitle(QPopupMenu *menu, const QString& title, const QString& iconName) +bool KexiImageContextMenu::updateTitle(TQPopupMenu *menu, const TQString& title, const TQString& iconName) { return KexiContextMenuUtils::updateTitle(menu, title, i18n("Image"), iconName); } @@ -252,13 +252,13 @@ bool KexiImageContextMenu::updateTitle(QPopupMenu *menu, const QString& title, c // ------------------------------------------- //static -bool KexiContextMenuUtils::updateTitle(QPopupMenu *menu, const QString& objectName, - const QString& objectTypeName, const QString& iconName) +bool KexiContextMenuUtils::updateTitle(TQPopupMenu *menu, const TQString& objectName, + const TQString& objectTypeName, const TQString& iconName) { if (!menu || objectName.isEmpty() || objectTypeName.isEmpty()) return false; const int id = menu->idAt(0); - QMenuItem *item = menu->findItem(id); + TQMenuItem *item = menu->tqfindItem(id); if (!item) return false; KPopupTitle *title = dynamic_cast<KPopupTitle *>(item->widget()); @@ -267,14 +267,14 @@ bool KexiContextMenuUtils::updateTitle(QPopupMenu *menu, const QString& objectNa /*! @todo look at makeFirstCharacterUpperCaseInCaptions setting [bool] (see doc/dev/settings.txt) */ - QString realTitle( i18n("Object name : Object type", "%1 : %2") - .arg( objectName[0].upper() + objectName.mid(1) ) - .arg( objectTypeName )); + TQString realTitle( i18n("Object name : Object type", "%1 : %2") + .tqarg( objectName[0].upper() + objectName.mid(1) ) + .tqarg( objectTypeName )); if (iconName.isEmpty()) title->setTitle(realTitle); else { - QPixmap pixmap(SmallIcon( iconName )); + TQPixmap pixmap(SmallIcon( iconName )); title->setTitle(realTitle, &pixmap); } return true; diff --git a/kexi/widget/utils/kexicontextmenuutils.h b/kexi/widget/utils/kexicontextmenuutils.h index 95258e96..2f73b18e 100644 --- a/kexi/widget/utils/kexicontextmenuutils.h +++ b/kexi/widget/utils/kexicontextmenuutils.h @@ -35,8 +35,8 @@ class KEXIGUIUTILS_EXPORT KexiContextMenuUtils public: /*! Updates title for context menu. \return true if the title has been updated. */ - static bool updateTitle(QPopupMenu *menu, const QString& objectName, - const QString& objectTypeName, const QString& iconName); + static bool updateTitle(TQPopupMenu *menu, const TQString& objectName, + const TQString& objectTypeName, const TQString& iconName); }; //! @short A context menu used for images within form and table views @@ -50,17 +50,18 @@ class KEXIGUIUTILS_EXPORT KexiContextMenuUtils class KEXIGUIUTILS_EXPORT KexiImageContextMenu : public KPopupMenu { Q_OBJECT + TQ_OBJECT public: - KexiImageContextMenu(QWidget *parent); + KexiImageContextMenu(TQWidget *tqparent); virtual ~KexiImageContextMenu(); KActionCollection* actionCollection() const; /*! Updates title for context menu. - Used in KexiDBWidgetContextMenuExtender::createTitle(QPopupMenu *menu) and KexiDBImageBox. + Used in KexiDBWidgetContextMenuExtender::createTitle(TQPopupMenu *menu) and KexiDBImageBox. \return true if the title has been updated. */ - static bool updateTitle(QPopupMenu *menu, const QString& title, const QString& iconName = QString::null); + static bool updateTitle(TQPopupMenu *menu, const TQString& title, const TQString& iconName = TQString()); public slots: void updateActionsAvailability(); @@ -84,10 +85,10 @@ class KEXIGUIUTILS_EXPORT KexiImageContextMenu : public KPopupMenu /*! Emitted before "saveAs" action was requested. You should fill \a origFilename, \a fileExtension and \a dataIsEmpty values. If \a dataIsEmpty is false, saving will be cancelled. */ - void aboutToSaveAsRequested(QString& origFilename, QString& fileExtension, bool& dataIsEmpty); + void aboutToSaveAsRequested(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty); //! Emitted when "saveAs" action was requested - void saveAsRequested(const QString& fileName); + void saveAsRequested(const TQString& fileName); //! Emitted when "cut" action was requested void cutRequested(); diff --git a/kexi/widget/utils/kexidatetimeformatter.cpp b/kexi/widget/utils/kexidatetimeformatter.cpp index d8f642ca..430d2f8f 100644 --- a/kexi/widget/utils/kexidatetimeformatter.cpp +++ b/kexi/widget/utils/kexidatetimeformatter.cpp @@ -32,69 +32,69 @@ KexiDateFormatter::KexiDateFormatter() { // use "short date" format system settings //! @todo allow to override the format using column property and/or global app settings - QString df( KGlobal::locale()->dateFormatShort() ); + TQString df( KGlobal::locale()->dateFormatShort() ); if (df.length()>2) m_separator = df.mid(2,1); else m_separator = "-"; const int separatorLen = m_separator.length(); - QString yearMask("9999"); - QString yearDateFormat("yyyy"), + TQString yearMask("9999"); + TQString yearDateFormat("yyyy"), monthDateFormat("MM"), dayDateFormat("dd"); //for setting up m_dateFormat bool ok = df.length()>=8; - int yearpos, monthpos, daypos; //result of df.find() + int yearpos, monthpos, daypos; //result of df.tqfind() if (ok) {//look at % variables //! @todo more variables are possible here, see void KLocale::setDateFormatShort() docs //! http://developer.kde.org/documentation/library/3.5-api/kdelibs-apidocs/kdecore/html/classKLocale.html#a59 - yearpos = df.find("%y", 0, false); //&y or %y + yearpos = df.tqfind("%y", 0, false); //&y or %y m_longYear = !(yearpos>=0 && df.mid(yearpos+1, 1)=="y"); if (!m_longYear) { yearMask = "99"; yearDateFormat = "yy"; } - monthpos = df.find("%m", 0, true); //%m or %n + monthpos = df.tqfind("%m", 0, true); //%m or %n m_monthWithLeadingZero = true; if (monthpos<0) { - monthpos = df.find("%n", 0, false); + monthpos = df.tqfind("%n", 0, false); m_monthWithLeadingZero = false; monthDateFormat = "M"; } - daypos = df.find("%d", 0, true);//%d or %e + daypos = df.tqfind("%d", 0, true);//%d or %e m_dayWithLeadingZero = true; if (daypos<0) { - daypos = df.find("%e", 0, false); + daypos = df.tqfind("%e", 0, false); m_dayWithLeadingZero = false; dayDateFormat = "d"; } ok = (yearpos>=0 && monthpos>=0 && daypos>=0); } - m_order = QDateEdit::YMD; //default + m_order = TQDateEdit::YMD; //default if (ok) { if (yearpos<monthpos && monthpos<daypos) { //will be set in "default: YMD" } else if (yearpos<daypos && daypos<monthpos) { - m_order = QDateEdit::YDM; -//! @todo use QRegExp (to replace %Y by %1, etc.) instead of hardcoded "%1%299%399" + m_order = TQDateEdit::YDM; +//! @todo use TQRegExp (to tqreplace %Y by %1, etc.) instead of hardcoded "%1%299%399" //! because df may contain also other characters - m_inputMask = QString("%1%299%399").arg(yearMask).arg(m_separator).arg(m_separator); + m_inputMask = TQString("%1%299%399").tqarg(yearMask).tqarg(m_separator).tqarg(m_separator); m_qtFormat = yearDateFormat+m_separator+dayDateFormat+m_separator+monthDateFormat; m_yearpos = 0; m_daypos = yearMask.length()+separatorLen; m_monthpos = m_daypos+2+separatorLen; } else if (daypos<monthpos && monthpos<yearpos) { - m_order = QDateEdit::DMY; - m_inputMask = QString("99%199%2%3").arg(m_separator).arg(m_separator).arg(yearMask); + m_order = TQDateEdit::DMY; + m_inputMask = TQString("99%199%2%3").tqarg(m_separator).tqarg(m_separator).tqarg(yearMask); m_qtFormat = dayDateFormat+m_separator+monthDateFormat+m_separator+yearDateFormat; m_daypos = 0; m_monthpos = 2+separatorLen; m_yearpos = m_monthpos+2+separatorLen; } else if (monthpos<daypos && daypos<yearpos) { - m_order = QDateEdit::MDY; - m_inputMask = QString("99%199%2%3").arg(m_separator).arg(m_separator).arg(yearMask); + m_order = TQDateEdit::MDY; + m_inputMask = TQString("99%199%2%3").tqarg(m_separator).tqarg(m_separator).tqarg(yearMask); m_qtFormat = monthDateFormat+m_separator+dayDateFormat+m_separator+yearDateFormat; m_monthpos = 0; m_daypos = 2+separatorLen; @@ -103,8 +103,8 @@ KexiDateFormatter::KexiDateFormatter() else ok = false; } - if (!ok || m_order == QDateEdit::YMD) {//default: YMD - m_inputMask = QString("%1%299%399").arg(yearMask).arg(m_separator).arg(m_separator); + if (!ok || m_order == TQDateEdit::YMD) {//default: YMD + m_inputMask = TQString("%1%299%399").tqarg(yearMask).tqarg(m_separator).tqarg(m_separator); m_qtFormat = yearDateFormat+m_separator+monthDateFormat+m_separator+dayDateFormat; m_yearpos = 0; m_monthpos = yearMask.length()+separatorLen; @@ -117,12 +117,12 @@ KexiDateFormatter::~KexiDateFormatter() { } -QDate KexiDateFormatter::stringToDate( const QString& str ) const +TQDate KexiDateFormatter::stringToDate( const TQString& str ) const { bool ok = true; int year = str.mid(m_yearpos, m_longYear ? 4 : 2).toInt(&ok); if (!ok) - return QDate(); + return TQDate(); if (year < 30) {//2000..2029 year = 2000 + year; } @@ -132,35 +132,35 @@ QDate KexiDateFormatter::stringToDate( const QString& str ) const int month = str.mid(m_monthpos, 2).toInt(&ok); if (!ok) - return QDate(); + return TQDate(); int day = str.mid(m_daypos, 2).toInt(&ok); if (!ok) - return QDate(); + return TQDate(); - QDate date(year, month, day); + TQDate date(year, month, day); if (!date.isValid()) - return QDate(); + return TQDate(); return date; } -QVariant KexiDateFormatter::stringToVariant( const QString& str ) const +TQVariant KexiDateFormatter::stringToVariant( const TQString& str ) const { if (isEmpty(str)) - return QVariant(); - const QDate date( stringToDate( str ) ); + return TQVariant(); + const TQDate date( stringToDate( str ) ); if (date.isValid()) return date; - return QVariant(); + return TQVariant(); } -bool KexiDateFormatter::isEmpty( const QString& str ) const +bool KexiDateFormatter::isEmpty( const TQString& str ) const { - QString s(str); - return s.replace(m_separator,"").stripWhiteSpace().isEmpty(); + TQString s(str); + return s.tqreplace(m_separator,"").stripWhiteSpace().isEmpty(); } -QString KexiDateFormatter::dateToString( const QDate& date ) const +TQString KexiDateFormatter::dateToString( const TQDate& date ) const { return date.toString(m_qtFormat); } @@ -168,35 +168,35 @@ QString KexiDateFormatter::dateToString( const QDate& date ) const //------------------------------------------------ KexiTimeFormatter::KexiTimeFormatter() -: m_hmsRegExp( new QRegExp("(\\d*):(\\d*):(\\d*).*( am| pm){,1}", false/*!CS*/) ) - , m_hmRegExp( new QRegExp("(\\d*):(\\d*).*( am| pm){,1}", false/*!CS*/) ) +: m_hmsRegExp( new TQRegExp("(\\d*):(\\d*):(\\d*).*( am| pm){,1}", false/*!CS*/) ) + , m_hmRegExp( new TQRegExp("(\\d*):(\\d*).*( am| pm){,1}", false/*!CS*/) ) { - QString tf( KGlobal::locale()->timeFormat() ); - //m_hourpos, m_minpos, m_secpos; are result of tf.find() - QString hourVariable, minVariable, secVariable; + TQString tf( KGlobal::locale()->timeFormat() ); + //m_hourpos, m_minpos, m_secpos; are result of tf.tqfind() + TQString hourVariable, minVariable, secVariable; - //detect position of HOUR section: find %H or %k or %I or %l + //detect position of HOUR section: tqfind %H or %k or %I or %l m_24h = true; m_hoursWithLeadingZero = true; - m_hourpos = tf.find("%H", 0, true); + m_hourpos = tf.tqfind("%H", 0, true); if (m_hourpos>=0) { m_24h = true; m_hoursWithLeadingZero = true; } else { - m_hourpos = tf.find("%k", 0, true); + m_hourpos = tf.tqfind("%k", 0, true); if (m_hourpos>=0) { m_24h = true; m_hoursWithLeadingZero = false; } else { - m_hourpos = tf.find("%I", 0, true); + m_hourpos = tf.tqfind("%I", 0, true); if (m_hourpos>=0) { m_24h = false; m_hoursWithLeadingZero = true; } else { - m_hourpos = tf.find("%l", 0, true); + m_hourpos = tf.tqfind("%l", 0, true); if (m_hourpos>=0) { m_24h = false; m_hoursWithLeadingZero = false; @@ -204,9 +204,9 @@ KexiTimeFormatter::KexiTimeFormatter() } } } - m_minpos = tf.find("%M", 0, true); - m_secpos = tf.find("%S", 0, true); //can be -1 - m_ampmpos = tf.find("%p", 0, true); //can be -1 + m_minpos = tf.tqfind("%M", 0, true); + m_secpos = tf.tqfind("%S", 0, true); //can be -1 + m_ampmpos = tf.tqfind("%p", 0, true); //can be -1 if (m_hourpos<0 || m_minpos<0) { //set default: hr and min are needed, sec are optional @@ -221,13 +221,13 @@ KexiTimeFormatter::KexiTimeFormatter() hourVariable = tf.mid(m_hourpos, 2); m_inputMask = tf; -// m_inputMask.replace( hourVariable, "00" ); -// m_inputMask.replace( "%M", "00" ); -// m_inputMask.replace( "%S", "00" ); //optional - m_inputMask.replace( hourVariable, "99" ); - m_inputMask.replace( "%M", "99" ); - m_inputMask.replace( "%S", "00" ); //optional - m_inputMask.replace( "%p", "AA" ); //am or pm +// m_inputMask.tqreplace( hourVariable, "00" ); +// m_inputMask.tqreplace( "%M", "00" ); +// m_inputMask.tqreplace( "%S", "00" ); //optional + m_inputMask.tqreplace( hourVariable, "99" ); + m_inputMask.tqreplace( "%M", "99" ); + m_inputMask.tqreplace( "%S", "00" ); //optional + m_inputMask.tqreplace( "%p", "AA" ); //am or pm m_inputMask += ";_"; m_outputFormat = tf; @@ -239,7 +239,7 @@ KexiTimeFormatter::~KexiTimeFormatter() delete m_hmRegExp; } -QTime KexiTimeFormatter::stringToTime( const QString& str ) const +TQTime KexiTimeFormatter::stringToTime( const TQString& str ) const { int hour, min, sec; bool pm = false; @@ -257,7 +257,7 @@ QTime KexiTimeFormatter::stringToTime( const QString& str ) const } if (tryWithoutSeconds) { if (-1 == m_hmRegExp->search(str)) - return QTime(99,0,0); + return TQTime(99,0,0); hour = m_hmRegExp->cap(1).toInt(); min = m_hmRegExp->cap(2).toInt(); sec = 0; @@ -267,98 +267,98 @@ QTime KexiTimeFormatter::stringToTime( const QString& str ) const if (pm && hour < 12) hour += 12; //PM - return QTime(hour, min, sec); + return TQTime(hour, min, sec); } -QVariant KexiTimeFormatter::stringToVariant( const QString& str ) +TQVariant KexiTimeFormatter::stringToVariant( const TQString& str ) { if (isEmpty( str )) - return QVariant(); - const QTime time( stringToTime( str ) ); + return TQVariant(); + const TQTime time( stringToTime( str ) ); if (time.isValid()) return time; - return QVariant(); + return TQVariant(); } -bool KexiTimeFormatter::isEmpty( const QString& str ) const +bool KexiTimeFormatter::isEmpty( const TQString& str ) const { - QString s(str); - return s.replace(':',"").stripWhiteSpace().isEmpty(); + TQString s(str); + return s.tqreplace(':',"").stripWhiteSpace().isEmpty(); } -QString KexiTimeFormatter::timeToString( const QTime& time ) const +TQString KexiTimeFormatter::timeToString( const TQTime& time ) const { if (!time.isValid()) - return QString::null; + return TQString(); - QString s(m_outputFormat); + TQString s(m_outputFormat); if (m_24h) { if (m_hoursWithLeadingZero) - s.replace( "%H", QString::fromLatin1(time.hour()<10 ? "0" : "") + QString::number(time.hour()) ); + s.tqreplace( "%H", TQString::tqfromLatin1(time.hour()<10 ? "0" : "") + TQString::number(time.hour()) ); else - s.replace( "%k", QString::number(time.hour()) ); + s.tqreplace( "%k", TQString::number(time.hour()) ); } else { int time12 = (time.hour()>12) ? (time.hour()-12) : time.hour(); if (m_hoursWithLeadingZero) - s.replace( "%I", QString::fromLatin1(time12<10 ? "0" : "") + QString::number(time12) ); + s.tqreplace( "%I", TQString::tqfromLatin1(time12<10 ? "0" : "") + TQString::number(time12) ); else - s.replace( "%l", QString::number(time12) ); + s.tqreplace( "%l", TQString::number(time12) ); } - s.replace( "%M", QString::fromLatin1(time.minute()<10 ? "0" : "") + QString::number(time.minute()) ); + s.tqreplace( "%M", TQString::tqfromLatin1(time.minute()<10 ? "0" : "") + TQString::number(time.minute()) ); if (m_secpos>=0) - s.replace( "%S", QString::fromLatin1(time.second()<10 ? "0" : "") + QString::number(time.second()) ); + s.tqreplace( "%S", TQString::tqfromLatin1(time.second()<10 ? "0" : "") + TQString::number(time.second()) ); if (m_ampmpos>=0) - s.replace( "%p", KGlobal::locale()->translate( time.hour()>=12 ? "pm" : "am") ); + s.tqreplace( "%p", KGlobal::locale()->translate( time.hour()>=12 ? "pm" : "am") ); return s; } //------------------------------------------------ -QString dateTimeInputMask(const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter) +TQString dateTimeInputMask(const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter) { - QString mask(dateFormatter.inputMask()); - mask.truncate(dateFormatter.inputMask().length()-2); - return mask + " " + timeFormatter.inputMask(); + TQString tqmask(dateFormatter.inputMask()); + tqmask.truncate(dateFormatter.inputMask().length()-2); + return tqmask + " " + timeFormatter.inputMask(); } -QDateTime stringToDateTime( - const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter, const QString& str) +TQDateTime stringToDateTime( + const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter, const TQString& str) { - QString s( str.stripWhiteSpace() ); - const int timepos = s.find(" "); - const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(s.mid(timepos+1)); //.replace(':',"").stripWhiteSpace().isEmpty(); + TQString s( str.stripWhiteSpace() ); + const int timepos = s.tqfind(" "); + const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(s.mid(timepos+1)); //.tqreplace(':',"").stripWhiteSpace().isEmpty(); if (emptyTime) s = s.left(timepos); if (timepos>0 && !emptyTime) { - return QDateTime( + return TQDateTime( dateFormatter.stringToDate( s.left(timepos) ), timeFormatter.stringToTime( s.mid(timepos+1) ) ); } else { - return QDateTime( + return TQDateTime( dateFormatter.stringToDate( s ), - QTime(0,0,0) + TQTime(0,0,0) ); } } bool dateTimeIsEmpty( const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter, - const QString& str ) + const TQString& str ) { - int timepos = str.find(" "); - const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(str.mid(timepos+1)); //s.mid(timepos+1).replace(':',"").stripWhiteSpace().isEmpty(); - return (timepos >= 0 && dateFormatter.isEmpty(str.left(timepos)) //s.left(timepos).replace(m_dateFormatter.separator(), "").stripWhiteSpace().isEmpty() + int timepos = str.tqfind(" "); + const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(str.mid(timepos+1)); //s.mid(timepos+1).tqreplace(':',"").stripWhiteSpace().isEmpty(); + return (timepos >= 0 && dateFormatter.isEmpty(str.left(timepos)) //s.left(timepos).tqreplace(m_dateFormatter.separator(), "").stripWhiteSpace().isEmpty() && emptyTime); } bool dateTimeIsValid( const KexiDateFormatter& dateFormatter, - const KexiTimeFormatter& timeFormatter, const QString& str ) + const KexiTimeFormatter& timeFormatter, const TQString& str ) { - int timepos = str.find(" "); - const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(str.mid(timepos+1)); //s.mid(timepos+1).replace(':',"").stripWhiteSpace().isEmpty(); - if (timepos >= 0 && dateFormatter.isEmpty(str.left(timepos)) // s.left(timepos).replace(m_dateFormatter.separator(), "").stripWhiteSpace().isEmpty() + int timepos = str.tqfind(" "); + const bool emptyTime = timepos >= 0 && timeFormatter.isEmpty(str.mid(timepos+1)); //s.mid(timepos+1).tqreplace(':',"").stripWhiteSpace().isEmpty(); + if (timepos >= 0 && dateFormatter.isEmpty(str.left(timepos)) // s.left(timepos).tqreplace(m_dateFormatter.separator(), "").stripWhiteSpace().isEmpty() && emptyTime) //empty date/time is valid return true; diff --git a/kexi/widget/utils/kexidatetimeformatter.h b/kexi/widget/utils/kexidatetimeformatter.h index 252bc535..1340320b 100644 --- a/kexi/widget/utils/kexidatetimeformatter.h +++ b/kexi/widget/utils/kexidatetimeformatter.h @@ -20,8 +20,8 @@ #ifndef KEXIDATETIMEFORMATTER_H #define KEXIDATETIMEFORMATTER_H -#include <qdatetimeedit.h> -#include <qregexp.h> +#include <tqdatetimeedit.h> +#include <tqregexp.h> //! @short Date formatter used by KexiDateTableEdit and KexiDateTimeTableEdit class KEXIGUIUTILS_EXPORT KexiDateFormatter @@ -37,36 +37,36 @@ class KEXIGUIUTILS_EXPORT KexiDateFormatter //! Converts string \a str to date using predefined settings. //! \return invalid date if the conversion is impossible - QDate stringToDate( const QString& str ) const; + TQDate stringToDate( const TQString& str ) const; /*! Converts string \a str to date using predefined settings - and returns QVariant containing the date value. + and returns TQVariant containing the date value. This method does the same as stringToDate() but if \a string contains invalid date representation, e.g. contains only spaces - and separators, null QVariant() is returned. */ - QVariant stringToVariant( const QString& str ) const; + and separators, null TQVariant() is returned. */ + TQVariant stringToVariant( const TQString& str ) const; //! Converts \a date to string using predefined settings. //! \return null string if \a date is invalid - QString dateToString( const QDate& date ) const; + TQString dateToString( const TQDate& date ) const; - //! \return Input mask generated using the formatter settings. - //! Can be used in QLineEdit::setInputMask(). - QString inputMask() const { return m_inputMask; } + //! \return Input tqmask generated using the formatter settings. + //! Can be used in TQLineEdit::setInputMask(). + TQString inputMask() const { return m_inputMask; } //! \return separator for this date format, a single character like "-" or "/" - QString separator() const { return m_separator; } + TQString separator() const { return m_separator; } //! \return true if \a str contains only spaces //! and separators according to the date format. - bool isEmpty( const QString& str ) const; + bool isEmpty( const TQString& str ) const; protected: - //! Input mask generated using the formatter settings. Can be used in QLineEdit::setInputMask(). - QString m_inputMask; + //! Input tqmask generated using the formatter settings. Can be used in TQLineEdit::setInputMask(). + TQString m_inputMask; //! Order of date sections - QDateEdit::Order m_order; + TQDateEdit::Order m_order; //! 4 or 2 digits bool m_longYear; @@ -74,12 +74,12 @@ class KEXIGUIUTILS_EXPORT KexiDateFormatter bool m_monthWithLeadingZero, m_dayWithLeadingZero; //! Date format used in dateToString() - QString m_qtFormat; + TQString m_qtFormat; - //! Used in stringToDate() to convert string back to QDate + //! Used in stringToDate() to convert string back to TQDate int m_yearpos, m_monthpos, m_daypos; - QString m_separator; + TQString m_separator; }; /*! @short Time formatter used by KexiTimeTableEdit and KexiDateTimeTableEdit @@ -98,33 +98,33 @@ class KEXIGUIUTILS_EXPORT KexiTimeFormatter //! converts string \a str to time using predefined settings //! \return invalid time if the conversion is impossible - QTime stringToTime( const QString& str ) const; + TQTime stringToTime( const TQString& str ) const; /*! Converts string \a str to time using predefined settings - and returns QVariant containing the time value. + and returns TQVariant containing the time value. This method does the same as stringToTime() but if \a string contains invalid time representation, e.g. contains only spaces - and separators, null QVariant() is returned. */ - QVariant stringToVariant( const QString& str ); + and separators, null TQVariant() is returned. */ + TQVariant stringToVariant( const TQString& str ); //! converts \a time to string using predefined settings //! \return null string if \a time is invalid - QString timeToString( const QTime& time ) const; + TQString timeToString( const TQTime& time ) const; - //! \return Input mask generated using the formatter settings. - //! Can be used in QLineEdit::setInputMask(). - QString inputMask() const { return m_inputMask; } + //! \return Input tqmask generated using the formatter settings. + //! Can be used in TQLineEdit::setInputMask(). + TQString inputMask() const { return m_inputMask; } //! \return true if \a str contains only spaces //! and separators according to the time format. - bool isEmpty( const QString& str ) const; + bool isEmpty( const TQString& str ) const; protected: - //! Input mask generated using the formatter settings. Can be used in QLineEdit::setInputMask(). - QString m_inputMask; + //! Input tqmask generated using the formatter settings. Can be used in TQLineEdit::setInputMask(). + TQString m_inputMask; // //! Order of date sections -// QDateEdit::Order m_order; +// TQDateEdit::Order m_order; //! 12 or 12h bool m_24h; @@ -132,34 +132,34 @@ class KEXIGUIUTILS_EXPORT KexiTimeFormatter bool m_hoursWithLeadingZero; //! Time format used in timeToString(). Notation from KLocale::setTimeFormat() is used. - QString m_outputFormat; + TQString m_outputFormat; - //! Used in stringToTime() to convert string back to QTime + //! Used in stringToTime() to convert string back to TQTime int m_hourpos, m_minpos, m_secpos, m_ampmpos; - QRegExp *m_hmsRegExp, *m_hmRegExp; + TQRegExp *m_hmsRegExp, *m_hmRegExp; }; -//! \return a date/time input mask using date and time formatter. +//! \return a date/time input tqmask using date and time formatter. //! Date is separated from time by one space character. -KEXIGUIUTILS_EXPORT QString dateTimeInputMask( +KEXIGUIUTILS_EXPORT TQString dateTimeInputMask( const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter); -/*! \return a QDateTime value converted from string using \a dateFormatter and \a timeFormatter. +/*! \return a TQDateTime value converted from string using \a dateFormatter and \a timeFormatter. A single space between date and time is assumed. Invalid value is returned when \a str contains no valid date or \a str contains invalid time. Value with time equal 00:00:00 is returned if \a str contains empty time part. */ -KEXIGUIUTILS_EXPORT QDateTime stringToDateTime( - const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter, const QString& str); +KEXIGUIUTILS_EXPORT TQDateTime stringToDateTime( + const KexiDateFormatter& dateFormatter, const KexiTimeFormatter& timeFormatter, const TQString& str); /*! \return true if \a str contains only spaces and separators according to formats provided by \a dateFormatter and \a timeFormatter. */ KEXIGUIUTILS_EXPORT bool dateTimeIsEmpty( const KexiDateFormatter& dateFormatter, - const KexiTimeFormatter& timeFormatter, const QString& str ); + const KexiTimeFormatter& timeFormatter, const TQString& str ); /*! \return true if \a str gives valid date/time value according to formats provided by \a dateFormatter and \a timeFormatter. */ KEXIGUIUTILS_EXPORT bool dateTimeIsValid( const KexiDateFormatter& dateFormatter, - const KexiTimeFormatter& timeFormatter, const QString& str ); + const KexiTimeFormatter& timeFormatter, const TQString& str ); #endif diff --git a/kexi/widget/utils/kexidisplayutils.cpp b/kexi/widget/utils/kexidisplayutils.cpp index c7d238b1..1943b086 100644 --- a/kexi/widget/utils/kexidisplayutils.cpp +++ b/kexi/widget/utils/kexidisplayutils.cpp @@ -19,19 +19,19 @@ #include "kexidisplayutils.h" -#include <qpixmap.h> -#include <qpainter.h> -#include <qimage.h> -#include <qwidget.h> +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqwidget.h> #include <klocale.h> #include <kstaticdeleter.h> // a color for displaying default values or autonumbers -#define SPECIAL_TEXT_COLOR Qt::blue +#define SPECIAL_TEXT_COLOR TQt::blue -static KStaticDeleter<QPixmap> KexiDisplayUtils_autonum_deleter; -QPixmap* KexiDisplayUtils_autonum = 0; +static KStaticDeleter<TQPixmap> KexiDisplayUtils_autonum_deleter; +TQPixmap* KexiDisplayUtils_autonum = 0; static const unsigned int autonumber_png_len = 245; static const unsigned char autonumber_png_data[] = { @@ -56,8 +56,8 @@ static const unsigned char autonumber_png_data[] = { }; /* Generated by qembed */ -#include <qcstring.h> -#include <qdict.h> +#include <tqcstring.h> +#include <tqdict.h> static struct Embed { unsigned int size; const unsigned char *data; @@ -67,11 +67,11 @@ static struct Embed { { 0, 0, 0 } }; -QPixmap* getPix(int id) +TQPixmap* getPix(int id) { -// QByteArray ba; +// TQByteArray ba; // ba.setRawData( (char*)embed_vec[id].data, embed_vec[id].size ); - QPixmap *pix = new QPixmap(); + TQPixmap *pix = new TQPixmap(); pix->loadFromData( embed_vec[id].data, embed_vec[id].size ); return pix; } @@ -90,14 +90,14 @@ KexiDisplayUtils::DisplayParameters::DisplayParameters() { } -KexiDisplayUtils::DisplayParameters::DisplayParameters(QWidget *w) +KexiDisplayUtils::DisplayParameters::DisplayParameters(TQWidget *w) { - textColor = w->palette().active().foreground(); - selectedTextColor = w->palette().active().highlightedText(); + textColor = w->tqpalette().active().foreground(); + selectedTextColor = w->tqpalette().active().highlightedText(); font = w->font(); } -void KexiDisplayUtils::initDisplayForAutonumberSign(DisplayParameters& par, QWidget *widget) +void KexiDisplayUtils::initDisplayForAutonumberSign(DisplayParameters& par, TQWidget *widget) { initDisplayUtilsImages(); @@ -105,20 +105,20 @@ void KexiDisplayUtils::initDisplayForAutonumberSign(DisplayParameters& par, QWid par.selectedTextColor = SPECIAL_TEXT_COLOR; //hmm, unused anyway par.font = widget->font(); par.font.setItalic(true); - QFontMetrics fm(par.font); + TQFontMetrics fm(par.font); par.textWidth = fm.width(i18n("(autonumber)")); par.textHeight = fm.height(); } -void KexiDisplayUtils::initDisplayForDefaultValue(DisplayParameters& par, QWidget *widget) +void KexiDisplayUtils::initDisplayForDefaultValue(DisplayParameters& par, TQWidget *widget) { par.textColor = SPECIAL_TEXT_COLOR; - par.selectedTextColor = widget->palette().active().highlightedText(); + par.selectedTextColor = widget->tqpalette().active().highlightedText(); par.font = widget->font(); par.font.setItalic(true); } -void KexiDisplayUtils::paintAutonumberSign(const DisplayParameters& par, QPainter* painter, +void KexiDisplayUtils::paintAutonumberSign(const DisplayParameters& par, TQPainter* painter, int x, int y, int width, int height, int align, bool overrideColor) { painter->save(); @@ -128,37 +128,37 @@ void KexiDisplayUtils::paintAutonumberSign(const DisplayParameters& par, QPainte painter->setPen(par.textColor); // int text_x = x; - if (!(align & Qt::AlignVertical_Mask)) - align |= Qt::AlignVCenter; - if (!(align & Qt::AlignHorizontal_Mask)) - align |= Qt::AlignLeft; + if (!(align & TQt::AlignVertical_Mask)) + align |= TQt::AlignVCenter; + if (!(align & TQt::AlignHorizontal_Mask)) + align |= TQt::AlignLeft; int y_pixmap_pos = 0; - if (align & Qt::AlignVCenter) { - y_pixmap_pos = QMAX(0, y+1 + (height - KexiDisplayUtils_autonum->height())/2); + if (align & TQt::AlignVCenter) { + y_pixmap_pos = TQMAX(0, y+1 + (height - KexiDisplayUtils_autonum->height())/2); } - else if (align & Qt::AlignTop) { - y_pixmap_pos = y + QMAX(0, (par.textHeight - KexiDisplayUtils_autonum->height())/2); + else if (align & TQt::AlignTop) { + y_pixmap_pos = y + TQMAX(0, (par.textHeight - KexiDisplayUtils_autonum->height())/2); } - else if (align & Qt::AlignBottom) { + else if (align & TQt::AlignBottom) { y_pixmap_pos = y+1 + height - KexiDisplayUtils_autonum->height() - - QMAX(0, (par.textHeight - KexiDisplayUtils_autonum->height())/2); + - TQMAX(0, (par.textHeight - KexiDisplayUtils_autonum->height())/2); } - if (align & (Qt::AlignLeft | Qt::AlignJustify)) { + if (align & (TQt::AlignLeft | TQt::AlignJustify)) { // text_x = x + KexiDisplayUtils_autonum->width() + 2; if (!overrideColor) { painter->drawPixmap( x, y_pixmap_pos, *KexiDisplayUtils_autonum ); x += (KexiDisplayUtils_autonum->width() + 4); } } - else if (align & Qt::AlignRight) { + else if (align & TQt::AlignRight) { if (!overrideColor) { painter->drawPixmap( x + width - par.textWidth - KexiDisplayUtils_autonum->width() - 4, y_pixmap_pos, *KexiDisplayUtils_autonum ); } } - else if (align & Qt::AlignCenter) { + else if (align & TQt::AlignCenter) { //! @todo if (!overrideColor) painter->drawPixmap( x + (width - par.textWidth)/2 - KexiDisplayUtils_autonum->width() - 4, diff --git a/kexi/widget/utils/kexidisplayutils.h b/kexi/widget/utils/kexidisplayutils.h index 8790b662..9d4974cd 100644 --- a/kexi/widget/utils/kexidisplayutils.h +++ b/kexi/widget/utils/kexidisplayutils.h @@ -20,9 +20,9 @@ #ifndef KEXIDISPUTILS_H #define KEXIDISPUTILS_H -#include <qfont.h> -#include <qcolor.h> -class QWidget; +#include <tqfont.h> +#include <tqcolor.h> +class TQWidget; //! \brief A set of utilities related to displaying common elements in Kexi, like e.g. (autonumber) sign class KEXIGUIUTILS_EXPORT KexiDisplayUtils @@ -36,22 +36,22 @@ class KEXIGUIUTILS_EXPORT KexiDisplayUtils DisplayParameters(); //! Copies properties from \a w. - DisplayParameters(QWidget *w); + DisplayParameters(TQWidget *w); - QColor textColor, selectedTextColor; - QFont font; + TQColor textColor, selectedTextColor; + TQFont font; int textWidth, textHeight; //!< used for "(autonumber)" text only }; //! Initializes display parameters for autonumber sign - static void initDisplayForAutonumberSign(DisplayParameters& par, QWidget *widget); + static void initDisplayForAutonumberSign(DisplayParameters& par, TQWidget *widget); //! Paints autonumber sign using \a par parameters - static void paintAutonumberSign(const DisplayParameters& par, QPainter* painter, + static void paintAutonumberSign(const DisplayParameters& par, TQPainter* painter, int x, int y, int width, int height, int align, bool overrideColor = false); //! Initializes display parameters for default value - static void initDisplayForDefaultValue(DisplayParameters& par, QWidget *widget); + static void initDisplayForDefaultValue(DisplayParameters& par, TQWidget *widget); }; #endif diff --git a/kexi/widget/utils/kexidropdownbutton.cpp b/kexi/widget/utils/kexidropdownbutton.cpp index a17e5cfb..b2ed022e 100644 --- a/kexi/widget/utils/kexidropdownbutton.cpp +++ b/kexi/widget/utils/kexidropdownbutton.cpp @@ -22,22 +22,22 @@ #include <kpopupmenu.h> #include <kdebug.h> -#include <qstyle.h> -#include <qapplication.h> +#include <tqstyle.h> +#include <tqapplication.h> -KexiDropDownButton::KexiDropDownButton(QWidget *parent) - : QToolButton(parent, "KexiDBImageBox::Button") +KexiDropDownButton::KexiDropDownButton(TQWidget *tqparent) + : TQToolButton(tqparent, "KexiDBImageBox::Button") { - setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + tqsetSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding); //! @todo get this from a KStyle -// setFixedWidth(QMAX(18, qApp->globalStrut().width())); +// setFixedWidth(TQMAX(18, tqApp->globalStrut().width())); int fixedWidth; //hack - if (qstricmp(style().name(),"thinkeramik")==0) + if (qstricmp(tqstyle().name(),"thinkeramik")==0) fixedWidth = 18; //typical width as in "windows" style else - fixedWidth = style().querySubControlMetrics( QStyle::CC_ComboBox, - this, QStyle::SC_ComboBoxArrow ).width(); + fixedWidth = tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, + this, TQStyle::SC_ComboBoxArrow ).width(); setFixedWidth( fixedWidth ); setPopupDelay(10/*ms*/); } @@ -46,37 +46,37 @@ KexiDropDownButton::~KexiDropDownButton() { } -void KexiDropDownButton::drawButton( QPainter *p ) +void KexiDropDownButton::drawButton( TQPainter *p ) { - QToolButton::drawButton(p); - QStyle::SFlags arrowFlags = QStyle::Style_Default; + TQToolButton::drawButton(p); + TQStyle::SFlags arrowFlags = TQStyle::Style_Default; if (isDown() || state()==On) - arrowFlags |= QStyle::Style_Down; + arrowFlags |= TQStyle::Style_Down; if (isEnabled()) - arrowFlags |= QStyle::Style_Enabled; - style().drawPrimitive(QStyle::PE_ArrowDown, p, - QRect((width()-7)/2, height()-9, 7, 7), colorGroup(), - arrowFlags, QStyleOption() ); + arrowFlags |= TQStyle::Style_Enabled; + tqstyle().tqdrawPrimitive(TQStyle::PE_ArrowDown, p, + TQRect((width()-7)/2, height()-9, 7, 7), tqcolorGroup(), + arrowFlags, TQStyleOption() ); } -QSize KexiDropDownButton::sizeHint () const +TQSize KexiDropDownButton::tqsizeHint () const { - return QSize( fontMetrics().maxWidth() + 2*2, fontMetrics().height()*2 + 2*2 ); + return TQSize( fontMetrics().maxWidth() + 2*2, fontMetrics().height()*2 + 2*2 ); } -void KexiDropDownButton::keyPressEvent( QKeyEvent * e ) +void KexiDropDownButton::keyPressEvent( TQKeyEvent * e ) { const int k = e->key(); - const bool dropDown = (e->state() == Qt::NoButton && (k==Qt::Key_Space || k==Qt::Key_Enter || k==Qt::Key_Return || k==Qt::Key_F2 || k==Qt::Key_F4)) - || (e->state() == Qt::AltButton && k==Qt::Key_Down); + const bool dropDown = (e->state() == Qt::NoButton && (k==TQt::Key_Space || k==TQt::Key_Enter || k==TQt::Key_Return || k==TQt::Key_F2 || k==TQt::Key_F4)) + || (e->state() == TQt::AltButton && k==TQt::Key_Down); if (dropDown) { e->accept(); animateClick(); - QMouseEvent me( QEvent::MouseButtonPress, QPoint(2,2), Qt::LeftButton, Qt::NoButton ); - QApplication::sendEvent( this, &me ); + TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(2,2), Qt::LeftButton, Qt::NoButton ); + TQApplication::sendEvent( this, &me ); return; } - QToolButton::keyPressEvent(e); + TQToolButton::keyPressEvent(e); } #include "kexidropdownbutton.moc" diff --git a/kexi/widget/utils/kexidropdownbutton.h b/kexi/widget/utils/kexidropdownbutton.h index fccbd409..a2d280a7 100644 --- a/kexi/widget/utils/kexidropdownbutton.h +++ b/kexi/widget/utils/kexidropdownbutton.h @@ -20,26 +20,27 @@ #ifndef KexiDropDownButton_H #define KexiDropDownButton_H -#include <qtoolbutton.h> -#include <qguardedptr.h> +#include <tqtoolbutton.h> +#include <tqguardedptr.h> //! @short A button for drop-down "Image" menu /*! Used in KexiDBImageBox and KexiBlobTableEdit. Additionally, the button reacts on pressing space, return, enter, F2, F4 and alt+down buttons. */ -class KEXIGUIUTILS_EXPORT KexiDropDownButton : public QToolButton +class KEXIGUIUTILS_EXPORT KexiDropDownButton : public TQToolButton { Q_OBJECT + TQ_OBJECT public: - KexiDropDownButton(QWidget *parent); + KexiDropDownButton(TQWidget *tqparent); virtual ~KexiDropDownButton(); - virtual void drawButton( QPainter *p ); + virtual void drawButton( TQPainter *p ); - virtual QSize sizeHint () const; + virtual TQSize tqsizeHint () const; - virtual void keyPressEvent ( QKeyEvent * e ); + virtual void keyPressEvent ( TQKeyEvent * e ); }; #endif diff --git a/kexi/widget/utils/kexiflowlayout.cpp b/kexi/widget/utils/kexiflowlayout.cpp index b8a8601e..d7150c6b 100644 --- a/kexi/widget/utils/kexiflowlayout.cpp +++ b/kexi/widget/utils/kexiflowlayout.cpp @@ -23,20 +23,20 @@ /// Iterator class -class KexiFlowLayoutIterator : public QGLayoutIterator +class KexiFlowLayoutIterator : public TQGLayoutIterator { public: - KexiFlowLayoutIterator( QPtrList<QLayoutItem> *list ) + KexiFlowLayoutIterator( TQPtrList<TQLayoutItem> *list ) : m_idx(0), m_list( list ) {} uint count() const; - QLayoutItem *current(); - QLayoutItem *next(); - QLayoutItem *takeCurrent(); + TQLayoutItem *current(); + TQLayoutItem *next(); + TQLayoutItem *takeCurrent(); private: int m_idx; - QPtrList<QLayoutItem> *m_list; + TQPtrList<TQLayoutItem> *m_list; }; uint @@ -45,47 +45,47 @@ KexiFlowLayoutIterator::count() const return m_list->count(); } -QLayoutItem * +TQLayoutItem * KexiFlowLayoutIterator::current() { return (m_idx < (int)count()) ? m_list->at(m_idx) : 0; } -QLayoutItem * +TQLayoutItem * KexiFlowLayoutIterator::next() { m_idx++; return current(); } -QLayoutItem * +TQLayoutItem * KexiFlowLayoutIterator::takeCurrent() { return (m_idx < (int)count()) ? m_list->take(m_idx) : 0; } -//// The layout itself +//// The tqlayout itself -KexiFlowLayout::KexiFlowLayout(QWidget *parent, int border, int space, const char *name) - : QLayout(parent, border, space, name) +KexiFlowLayout::KexiFlowLayout(TQWidget *tqparent, int border, int space, const char *name) + : TQLayout(tqparent, border, space, name) { - m_orientation = Horizontal; + m_orientation =Qt::Horizontal; m_justify = false; m_cached_width = 0; } -KexiFlowLayout::KexiFlowLayout(QLayout* parent, int space, const char *name) - : QLayout( parent, space, name ) +KexiFlowLayout::KexiFlowLayout(TQLayout* tqparent, int space, const char *name) + : TQLayout( tqparent, space, name ) { - m_orientation = Horizontal; + m_orientation =Qt::Horizontal; m_justify = false; m_cached_width = 0; } KexiFlowLayout::KexiFlowLayout(int space, const char *name) - : QLayout(space, name) + : TQLayout(space, name) { - m_orientation = Horizontal; + m_orientation =Qt::Horizontal; m_justify = false; m_cached_width = 0; } @@ -98,29 +98,35 @@ KexiFlowLayout::~KexiFlowLayout() void KexiFlowLayout::addItem(QLayoutItem *item) { - m_list.append(item); + m_list.append(TQT_TQLAYOUTITEM(item)); } void KexiFlowLayout::addSpacing(int size) { - if (m_orientation == Horizontal) - addItem( new QSpacerItem( size, 0, QSizePolicy::Fixed, QSizePolicy::Minimum ) ); + if (m_orientation ==Qt::Horizontal) + addItem( TQT_TQLAYOUTITEM(new TQSpacerItem( size, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum )) ); else - addItem( new QSpacerItem( 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed ) ); + addItem( TQT_TQLAYOUTITEM(new TQSpacerItem( 0, size, TQSizePolicy::Minimum, TQSizePolicy::Fixed )) ); } -QLayoutIterator +TQLayoutIterator KexiFlowLayout::iterator() { - return QLayoutIterator( new KexiFlowLayoutIterator(&m_list) ); + // [FIXME] +#ifdef USE_QT4 + #warning [FIXME] ContainerAreaLayout iterators may not function correctly under Qt4 + return TQLayoutIterator( this ); // [FIXME] +#else // USE_QT4 + return TQLayoutIterator( new KexiFlowLayoutIterator(&m_list) ); +#endif // USE_QT4 } -QPtrList<QWidget>* +TQPtrList<TQWidget>* KexiFlowLayout::widgetList() const { - QPtrList<QWidget> *list = new QPtrList<QWidget>(); - for (QPtrListIterator<QLayoutItem> it(m_list); it.current(); ++it) { + TQPtrList<TQWidget> *list = new TQPtrList<TQWidget>(); + for (TQPtrListIterator<TQLayoutItem> it(m_list); it.current(); ++it) { if(it.current()->widget()) list->append(it.current()->widget()); } @@ -128,11 +134,11 @@ KexiFlowLayout::widgetList() const } void -KexiFlowLayout::invalidate() +KexiFlowLayout::tqinvalidate() { - QLayout::invalidate(); - m_cached_sizeHint = QSize(); - m_cached_minSize = QSize(); + TQLayout::tqinvalidate(); + m_cached_tqsizeHint = TQSize(); + m_cached_minSize = TQSize(); m_cached_width = 0; } @@ -145,7 +151,7 @@ KexiFlowLayout::isEmpty() bool KexiFlowLayout::hasHeightForWidth() const { - return (m_orientation == Horizontal); + return (m_orientation ==Qt::Horizontal); } int @@ -154,7 +160,7 @@ KexiFlowLayout::heightForWidth(int w) const if(m_cached_width != w) { // workaround to allow this method to stay 'const' KexiFlowLayout *mthis = (KexiFlowLayout*)this; - int h = mthis->simulateLayout( QRect(0,0,w,0) ); + int h = mthis->simulateLayout( TQRect(0,0,w,0) ); mthis->m_cached_hfw = h; mthis->m_cached_width = w; return h; @@ -162,73 +168,73 @@ KexiFlowLayout::heightForWidth(int w) const return m_cached_hfw; } -QSize -KexiFlowLayout::sizeHint() const +TQSize +KexiFlowLayout::tqsizeHint() const { - if(m_cached_sizeHint.isEmpty()) { + if(m_cached_tqsizeHint.isEmpty()) { KexiFlowLayout *mthis = (KexiFlowLayout*)this; - QRect r = QRect(0, 0, 2000, 2000); + TQRect r = TQRect(0, 0, 2000, 2000); mthis->simulateLayout(r); } - return m_cached_sizeHint; + return m_cached_tqsizeHint; } -QSize -KexiFlowLayout::minimumSize() const +TQSize +KexiFlowLayout::tqminimumSize() const { -//js: do we really need to simulate layout here? -// I commented this out because it was impossible to stretch layout conveniently. -// Now, minimum size is computed automatically based on item's minimumSize... +//js: do we really need to simulate tqlayout here? +// I commented this out because it was impossible to stretch tqlayout conveniently. +// Now, minimum size is computed automatically based on item's tqminimumSize... #if 0 if(m_cached_minSize.isEmpty()) { KexiFlowLayout *mthis = (KexiFlowLayout*)this; - QRect r = QRect(0, 0, 2000, 2000); + TQRect r = TQRect(0, 0, 2000, 2000); mthis->simulateLayout(r); } #endif return m_cached_minSize; } -QSizePolicy::ExpandData +TQSizePolicy::ExpandData KexiFlowLayout::expanding() const { - if(m_orientation == Vertical) - return QSizePolicy::Vertically; + if(m_orientation == Qt::Vertical) + return TQ_SPVertically; else - return QSizePolicy::Horizontally; + return TQ_SPHorizontally; } void -KexiFlowLayout::setGeometry(const QRect &r) +KexiFlowLayout::setGeometry(const TQRect &r) { - QLayout::setGeometry(r); - if(m_orientation == Horizontal) + TQLayout::setGeometry(r); + if(m_orientation ==Qt::Horizontal) doHorizontalLayout(r); else doVerticalLayout(r); } int -KexiFlowLayout::simulateLayout(const QRect &r) +KexiFlowLayout::simulateLayout(const TQRect &r) { - if(m_orientation == Horizontal) + if(m_orientation ==Qt::Horizontal) return doHorizontalLayout(r, true); else return doVerticalLayout(r, true); } int -KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly) +KexiFlowLayout::doHorizontalLayout(const TQRect &r, bool testOnly) { int x = r.x(); int y = r.y(); int h = 0; // height of this line int availableSpace = r.width() + spacing(); - int expandingWidgets=0; // number of widgets in the line with QSizePolicy == Expanding - QPtrListIterator<QLayoutItem> it(m_list); - QPtrList<QLayoutItem> currentLine; - QLayoutItem *o; - QSize minSize, sizeHint(20, 20); + int expandingWidgets=0; // number of widgets in the line with TQSizePolicy == Expanding + TQPtrListIterator<TQLayoutItem> it(m_list); + TQPtrList<TQLayoutItem> currentLine; + TQLayoutItem *o; + TQSize minSize, tqsizeHint(20, 20); int minSizeHeight = 0 - spacing(); while ( (o = it.current()) != 0 ) { @@ -238,41 +244,41 @@ KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly) } // kdDebug() << "- doHorizontalLayout(): " << o->widget()->className() << " " << o->widget()->name() << endl; - QSize oSizeHint = o->sizeHint(); // we cache these ones because it can take a while to get it (eg for child layouts) + TQSize oSizeHint = o->tqsizeHint(); // we cache these ones because it can take a while to get it (eg for child tqlayouts) if ((x + oSizeHint.width()) > r.right() && h > 0) { - // do the layout of current line - QPtrListIterator<QLayoutItem> it2(currentLine); - QLayoutItem *item; + // do the tqlayout of current line + TQPtrListIterator<TQLayoutItem> it2(currentLine); + TQLayoutItem *item; int wx = r.x(); - int sizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0; + int tqsizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0; while( (item = it2.current()) != 0 ) { - QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take - QSize itemMinSize = item->minimumSize(); // a while to get them - QSize s; + TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take + TQSize itemMinSize = item->tqminimumSize(); // a while to get them + TQSize s; if(m_justify) { if(expandingWidgets != 0) { - if(item->expanding() == QSizePolicy::Horizontally || item->expanding() == QSizePolicy::BothDirections) - s = QSize( QMIN(itemSizeHint.width() + availableSpace / expandingWidgets + if(item->expandingDirections() == TQSizePolicy::Horizontally || item->expandingDirections() == TQSizePolicy::BothDirections) + s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / expandingWidgets , r.width()), itemSizeHint.height() ); else - s = QSize( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); + s = TQSize( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); } else - s = QSize( QMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count() + s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count() , r.width()), itemSizeHint.height() ); } else - s = QSize ( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); + s = TQSize ( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); if(!testOnly) - item->setGeometry( QRect(QPoint(wx, y), s) ); + item->setGeometry( TQRect(TQPoint(wx, y), s) ); wx = wx + s.width() + spacing(); minSizeWidth = minSizeWidth + spacing() + itemMinSize.width(); - sizeHintWidth = sizeHintWidth + spacing() + itemSizeHint.width(); - lineMinHeight = QMAX( lineMinHeight, itemMinSize.height() ); + tqsizeHintWidth = tqsizeHintWidth + spacing() + itemSizeHint.width(); + lineMinHeight = TQMAX( lineMinHeight, itemMinSize.height() ); ++it2; } - sizeHint = sizeHint.expandedTo( QSize(sizeHintWidth, 0) ); - minSize = minSize.expandedTo( QSize(minSizeWidth, 0) ); + tqsizeHint = tqsizeHint.expandedTo( TQSize(tqsizeHintWidth, 0) ); + minSize = minSize.expandedTo( TQSize(minSizeWidth, 0) ); minSizeHeight = minSizeHeight + spacing() + lineMinHeight; // start a new line y = y + spacing() + h; @@ -284,68 +290,68 @@ KexiFlowLayout::doHorizontalLayout(const QRect &r, bool testOnly) } x = x + spacing() + oSizeHint.width(); - h = QMAX( h, oSizeHint.height() ); + h = TQMAX( h, oSizeHint.height() ); currentLine.append(o); - if(o->expanding() == QSizePolicy::Horizontally || o->expanding() == QSizePolicy::BothDirections) + if(o->expandingDirections() == TQSizePolicy::Horizontally || o->expandingDirections() == TQSizePolicy::BothDirections) ++expandingWidgets; - availableSpace = QMAX(0, availableSpace - spacing() - oSizeHint.width()); + availableSpace = TQMAX(0, availableSpace - spacing() - oSizeHint.width()); ++it; } - // don't forget to layout the last line - QPtrListIterator<QLayoutItem> it2(currentLine); - QLayoutItem *item; + // don't forget to tqlayout the last line + TQPtrListIterator<TQLayoutItem> it2(currentLine); + TQLayoutItem *item; int wx = r.x(); - int sizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0; + int tqsizeHintWidth = 0 -spacing(), minSizeWidth=0 - spacing(), lineMinHeight=0; while( (item = it2.current()) != 0 ) { - QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take - QSize itemMinSize = item->minimumSize(); // a while to get them - QSize s; + TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take + TQSize itemMinSize = item->tqminimumSize(); // a while to get them + TQSize s; if(m_justify) { if(expandingWidgets != 0) { - if(item->expanding() == QSizePolicy::Horizontally || item->expanding() == QSizePolicy::BothDirections) - s = QSize( QMIN(itemSizeHint.width() + availableSpace / expandingWidgets + if(item->expandingDirections() == TQSizePolicy::Horizontally || item->expandingDirections() == TQSizePolicy::BothDirections) + s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / expandingWidgets , r.width()), itemSizeHint.height() ); else - s = QSize( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); + s = TQSize( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); } else - s = QSize( QMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count() + s = TQSize( TQMIN(itemSizeHint.width() + availableSpace / (int)currentLine.count() , r.width()), itemSizeHint.height() ); } else - s = QSize ( QMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); + s = TQSize ( TQMIN(itemSizeHint.width(), r.width()), itemSizeHint.height() ); if(!testOnly) - item->setGeometry( QRect(QPoint(wx, y), s) ); + item->setGeometry( TQRect(TQPoint(wx, y), s) ); wx = wx + s.width() + spacing(); minSizeWidth = minSizeWidth + spacing() + itemMinSize.width(); - sizeHintWidth = sizeHintWidth + spacing() + itemSizeHint.width(); - lineMinHeight = QMAX( lineMinHeight, itemMinSize.height() ); + tqsizeHintWidth = tqsizeHintWidth + spacing() + itemSizeHint.width(); + lineMinHeight = TQMAX( lineMinHeight, itemMinSize.height() ); ++it2; } - sizeHint = sizeHint.expandedTo( QSize(sizeHintWidth, y + spacing() + h) ); + tqsizeHint = tqsizeHint.expandedTo( TQSize(tqsizeHintWidth, y + spacing() + h) ); minSizeHeight = minSizeHeight + spacing() + lineMinHeight; - minSize = minSize.expandedTo( QSize(minSizeWidth, minSizeHeight) ); + minSize = minSize.expandedTo( TQSize(minSizeWidth, minSizeHeight) ); - // store sizeHint() and minimumSize() - m_cached_sizeHint = sizeHint + QSize(2* margin(), 2*margin()); - m_cached_minSize = minSize + QSize(2* margin() , 2*margin()); + // store tqsizeHint() and tqminimumSize() + m_cached_tqsizeHint = tqsizeHint + TQSize(2* margin(), 2*margin()); + m_cached_minSize = minSize + TQSize(2* margin() , 2*margin()); // return our height return y + h - r.y(); } int -KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly) +KexiFlowLayout::doVerticalLayout(const TQRect &r, bool testOnly) { int x = r.x(); int y = r.y(); int w = 0; // width of this line int availableSpace = r.height() + spacing(); - int expandingWidgets=0; // number of widgets in the line with QSizePolicy == Expanding - QPtrListIterator<QLayoutItem> it(m_list); - QPtrList<QLayoutItem> currentLine; - QLayoutItem *o; - QSize minSize, sizeHint(20, 20); + int expandingWidgets=0; // number of widgets in the line with TQSizePolicy == Expanding + TQPtrListIterator<TQLayoutItem> it(m_list); + TQPtrList<TQLayoutItem> currentLine; + TQLayoutItem *o; + TQSize minSize, tqsizeHint(20, 20); int minSizeWidth = 0 - spacing(); while ( (o = it.current()) != 0 ) { @@ -354,41 +360,41 @@ KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly) continue; } - QSize oSizeHint = o->sizeHint(); // we cache these ones because it can take a while to get it (eg for child layouts) + TQSize oSizeHint = o->tqsizeHint(); // we cache these ones because it can take a while to get it (eg for child tqlayouts) if (y + oSizeHint.height() > r.bottom() && w > 0) { - // do the layout of current line - QPtrListIterator<QLayoutItem> it2(currentLine); - QLayoutItem *item; + // do the tqlayout of current line + TQPtrListIterator<TQLayoutItem> it2(currentLine); + TQLayoutItem *item; int wy = r.y(); - int sizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0; + int tqsizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0; while( (item = it2.current()) != 0 ) { - QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take - QSize itemMinSize = item->minimumSize(); // a while to get them - QSize s; + TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take + TQSize itemMinSize = item->tqminimumSize(); // a while to get them + TQSize s; if(m_justify) { if(expandingWidgets != 0) { - if(item->expanding() == QSizePolicy::Vertically || item->expanding() == QSizePolicy::BothDirections) - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / expandingWidgets + if(item->expandingDirections() == TQSizePolicy::Vertically || item->expandingDirections() == TQSizePolicy::BothDirections) + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / expandingWidgets , r.height()) ); else - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) ); + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) ); } else - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count() + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count() , r.height()) ); } else - s = QSize ( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) ); + s = TQSize ( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) ); if(!testOnly) - item->setGeometry( QRect(QPoint(x, wy), s) ); + item->setGeometry( TQRect(TQPoint(x, wy), s) ); wy = wy + s.height() + spacing(); minSizeHeight = minSizeHeight + spacing() + itemMinSize.height(); - sizeHintHeight = sizeHintHeight + spacing() + itemSizeHint.height(); - colMinWidth = QMAX( colMinWidth, itemMinSize.width() ); + tqsizeHintHeight = tqsizeHintHeight + spacing() + itemSizeHint.height(); + colMinWidth = TQMAX( colMinWidth, itemMinSize.width() ); ++it2; } - sizeHint = sizeHint.expandedTo( QSize(0, sizeHintHeight) ); - minSize = minSize.expandedTo( QSize(0, minSizeHeight) ); + tqsizeHint = tqsizeHint.expandedTo( TQSize(0, tqsizeHintHeight) ); + minSize = minSize.expandedTo( TQSize(0, minSizeHeight) ); minSizeWidth = minSizeWidth + spacing() + colMinWidth; // start a new column x = x + spacing() + w; @@ -400,53 +406,82 @@ KexiFlowLayout::doVerticalLayout(const QRect &r, bool testOnly) } y = y + spacing() + oSizeHint.height(); - w = QMAX( w, oSizeHint.width() ); + w = TQMAX( w, oSizeHint.width() ); currentLine.append(o); - if(o->expanding() == QSizePolicy::Vertically || o->expanding() == QSizePolicy::BothDirections) + if(o->expandingDirections() == TQSizePolicy::Vertically || o->expandingDirections() == TQSizePolicy::BothDirections) ++expandingWidgets; - availableSpace = QMAX(0, availableSpace - spacing() - oSizeHint.height()); + availableSpace = TQMAX(0, availableSpace - spacing() - oSizeHint.height()); ++it; } - // don't forget to layout the last line - QPtrListIterator<QLayoutItem> it2(currentLine); - QLayoutItem *item; + // don't forget to tqlayout the last line + TQPtrListIterator<TQLayoutItem> it2(currentLine); + TQLayoutItem *item; int wy = r.y(); - int sizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0; + int tqsizeHintHeight = 0 - spacing(), minSizeHeight = 0 - spacing(), colMinWidth=0; while( (item = it2.current()) != 0 ) { - QSize itemSizeHint = item->sizeHint(); // we cache these ones because it can take - QSize itemMinSize = item->minimumSize(); // a while to get them - QSize s; + TQSize itemSizeHint = item->tqsizeHint(); // we cache these ones because it can take + TQSize itemMinSize = item->tqminimumSize(); // a while to get them + TQSize s; if(m_justify) { if(expandingWidgets != 0) { - if(item->expanding() == QSizePolicy::Vertically || item->expanding() == QSizePolicy::BothDirections) - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / expandingWidgets + if(item->expandingDirections() == TQSizePolicy::Vertically || item->expandingDirections() == TQSizePolicy::BothDirections) + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / expandingWidgets , r.height()) ); else - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) ); + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) ); } else - s = QSize( itemSizeHint.width(), QMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count() + s = TQSize( itemSizeHint.width(), TQMIN(itemSizeHint.height() + availableSpace / (int)currentLine.count() , r.height()) ); } else - s = QSize ( itemSizeHint.width(), QMIN(itemSizeHint.height(), r.height()) ); + s = TQSize ( itemSizeHint.width(), TQMIN(itemSizeHint.height(), r.height()) ); if(!testOnly) - item->setGeometry( QRect(QPoint(x, wy), s) ); + item->setGeometry( TQRect(TQPoint(x, wy), s) ); wy = wy + s.height() + spacing(); minSizeHeight = minSizeHeight + spacing() + itemMinSize.height(); - sizeHintHeight = sizeHintHeight + spacing() + itemSizeHint.height(); - colMinWidth = QMAX( colMinWidth, itemMinSize.width() ); + tqsizeHintHeight = tqsizeHintHeight + spacing() + itemSizeHint.height(); + colMinWidth = TQMAX( colMinWidth, itemMinSize.width() ); ++it2; } - sizeHint = sizeHint.expandedTo( QSize( x + spacing() + w, sizeHintHeight) ); + tqsizeHint = tqsizeHint.expandedTo( TQSize( x + spacing() + w, tqsizeHintHeight) ); minSizeWidth = minSizeWidth + spacing() + colMinWidth; - minSize = minSize.expandedTo( QSize(minSizeWidth, minSizeHeight) ); + minSize = minSize.expandedTo( TQSize(minSizeWidth, minSizeHeight) ); - // store sizeHint() and minimumSize() - m_cached_sizeHint = sizeHint + QSize(2* margin(), 2*margin()); - m_cached_minSize = minSize + QSize(2* margin(), 2*margin()); + // store tqsizeHint() and tqminimumSize() + m_cached_tqsizeHint = tqsizeHint + TQSize(2* margin(), 2*margin()); + m_cached_minSize = minSize + TQSize(2* margin(), 2*margin()); // return our width return x + w - r.x(); } +#ifdef USE_QT4 +/*! + \reimp +*/ +int KexiFlowLayout::count() const { + return m_list.count(); +} + +/*! + \reimp +*/ +TQLayoutItem* KexiFlowLayout::itemAt(int index) const { + return index >= 0 && index < m_list.count() ? (const_cast<TQPtrList<TQLayoutItem>&>(m_list).tqat(index)) : 0; +} + +/*! + \reimp +*/ +TQLayoutItem* KexiFlowLayout::takeAt(int index) { + if (index < 0 || index >= m_list.count()) + return 0; + TQLayoutItem *item = m_list.tqat(index); + m_list.remove(m_list.tqat(index)); + delete item; + + invalidate(); + return item; +} +#endif // USE_QT4
\ No newline at end of file diff --git a/kexi/widget/utils/kexiflowlayout.h b/kexi/widget/utils/kexiflowlayout.h index 173ddad5..e410fb83 100644 --- a/kexi/widget/utils/kexiflowlayout.h +++ b/kexi/widget/utils/kexiflowlayout.h @@ -20,27 +20,27 @@ #ifndef KEXIFLOWLAYOUT_H #define KEXIFLOWLAYOUT_H -#include <qlayout.h> -#include <qptrlist.h> +#include <tqlayout.h> +#include <tqptrlist.h> -//! @short a special "flow" layout -class KEXIGUIUTILS_EXPORT KexiFlowLayout : public QLayout +//! @short a special "flow" tqlayout +class KEXIGUIUTILS_EXPORT KexiFlowLayout : public TQLayout { public: - KexiFlowLayout(QWidget *parent, int border=0, int space=-1, const char *name=0); - KexiFlowLayout(QLayout* parent, int space=-1, const char *name=0); + KexiFlowLayout(TQWidget *tqparent, int border=0, int space=-1, const char *name=0); + KexiFlowLayout(TQLayout* tqparent, int space=-1, const char *name=0); KexiFlowLayout(int space=-1, const char *name=0); ~KexiFlowLayout(); - /*! \return the widgets in the order of the layout, + /*! \return the widgets in the order of the tqlayout, ie as it is stored in m_list. You must delete the list after using it. */ - QPtrList<QWidget>* widgetList() const; + TQPtrList<TQWidget>* widgetList() const; - /*! Sets layout's orientation to \a orientation. Default orientation is Vertical. */ - void setOrientation(Orientation orientation) { m_orientation = orientation; } + /*! Sets tqlayout's orientation to \a orientation. Default orientation isQt::Vertical. */ + void setOrientation(Qt::Orientation orientation) { m_orientation = orientation; } - /*! \return layout's orientation. */ + /*! \return tqlayout's orientation. */ Qt::Orientation orientation() const { return m_orientation; } void setJustified(bool justify) { m_justify = justify; } @@ -48,31 +48,35 @@ class KEXIGUIUTILS_EXPORT KexiFlowLayout : public QLayout virtual void addItem(QLayoutItem *item); virtual void addSpacing(int size); - virtual QLayoutIterator iterator(); - virtual void invalidate(); + virtual TQLayoutIterator iterator(); + virtual void tqinvalidate(); virtual bool hasHeightForWidth() const; virtual int heightForWidth(int width) const; - virtual QSize sizeHint() const; - virtual QSize minimumSize() const; - virtual QSizePolicy::ExpandData expanding() const; + virtual TQSize tqsizeHint() const; + virtual TQSize tqminimumSize() const; + virtual TQSizePolicy::ExpandData expanding() const; virtual bool isEmpty(); +#ifdef USE_QT4 + QLAYOUT_REQUIRED_METHOD_DECLARATIONS +#endif // USE_QT4 + protected: - virtual void setGeometry(const QRect&); - int simulateLayout(const QRect &r); - int doHorizontalLayout(const QRect&, bool testonly = false); - int doVerticalLayout(const QRect&, bool testonly = false); + virtual void setGeometry(const TQRect&); + int simulateLayout(const TQRect &r); + int doHorizontalLayout(const TQRect&, bool testonly = false); + int doVerticalLayout(const TQRect&, bool testonly = false); private: - QPtrList<QLayoutItem> m_list; + TQPtrList<TQLayoutItem> m_list; int m_cached_width; int m_cached_hfw; bool m_justify; - Orientation m_orientation; - QSize m_cached_sizeHint; - QSize m_cached_minSize; + Qt::Orientation m_orientation; + TQSize m_cached_tqsizeHint; + TQSize m_cached_minSize; }; #endif diff --git a/kexi/widget/utils/kexigradientwidget.cpp b/kexi/widget/utils/kexigradientwidget.cpp index 0411318d..2a1a3ba3 100644 --- a/kexi/widget/utils/kexigradientwidget.cpp +++ b/kexi/widget/utils/kexigradientwidget.cpp @@ -17,30 +17,30 @@ * Boston, MA 02110-1301, USA. */ -#include <qapplication.h> -#include <qbitmap.h> -#include <qimage.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qstyle.h> +#include <tqapplication.h> +#include <tqbitmap.h> +#include <tqimage.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqstyle.h> #include <kimageeffect.h> #include <kpixmap.h> #include "kexigradientwidget.h" -KexiGradientWidget::KexiGradientWidget( QWidget *parent, const char *name, WFlags f ) - : QWidget( parent, name, f ), p_displayMode( NoGradient ), +KexiGradientWidget::KexiGradientWidget( TQWidget *tqparent, const char *name, WFlags f ) + : TQWidget( tqparent, name, f ), p_displayMode( NoGradient ), p_gradientType( VerticalGradient ), - p_color1( Qt::white ), p_color2( Qt::blue ), p_currentChild( 0 ), + p_color1( TQt::white ), p_color2( TQt::blue ), p_currentChild( 0 ), p_opacity( 0.5 ), p_cacheDirty( true ) { p_customBackgroundWidgets.setAutoDelete( false ); p_knownWidgets.setAutoDelete( false ); - p_backgroundColor = QWidget::paletteBackgroundColor(); + p_backgroundColor = TQWidget::paletteBackgroundColor(); - connect ( &p_rebuildDelayTimer, SIGNAL( timeout() ), this, SLOT( setCacheDirty() ) ); + connect ( &p_rebuildDelayTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( setCacheDirty() ) ); installEventFilter( this ); } @@ -49,17 +49,17 @@ KexiGradientWidget::~KexiGradientWidget() { } -bool KexiGradientWidget::isValidChildWidget( QObject* child ) { - const QWidget* wgt = dynamic_cast<QWidget*>( child ); +bool KexiGradientWidget::isValidChildWidget( TQObject* child ) { + const TQWidget* wgt = dynamic_cast<TQWidget*>( child ); if ( wgt == 0L ) return false; - if ( wgt->inherits( "QScrollView" ) ) + if ( wgt->inherits( TQSCROLLVIEW_OBJECT_NAME_STRING ) ) return false; - if ( wgt->inherits( "QComboBox" ) ) + if ( wgt->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) return false; - if ( wgt->inherits( "QLineEdit" ) ) + if ( wgt->inherits( TQLINEEDIT_OBJECT_NAME_STRING ) ) return false; if ( wgt->inherits( "KexiDBForm" ) ) return false; @@ -67,14 +67,14 @@ bool KexiGradientWidget::isValidChildWidget( QObject* child ) { return true; } -void KexiGradientWidget::buildChildrenList( WidgetList& list, QWidget* p ) { - QObjectList* objects = p->queryList( "QWidget", 0, false, false ); +void KexiGradientWidget::buildChildrenList( WidgetList& list, TQWidget* p ) { + TQObjectList* objects = p->queryList( TQWIDGET_OBJECT_NAME_STRING, 0, false, false ); - for ( QObjectList::Iterator it = objects->begin(); it != objects->end(); ++it ) { + for ( TQObjectList::Iterator it = objects->begin(); it != objects->end(); ++it ) { if ( isValidChildWidget( ( *it ) ) == false ) continue; - list.append( dynamic_cast<QWidget*>( ( *it ) ) ); - buildChildrenList( list, dynamic_cast<QWidget*>( ( *it ) ) ); + list.append( dynamic_cast<TQWidget*>( ( *it ) ) ); + buildChildrenList( list, dynamic_cast<TQWidget*>( ( *it ) ) ); } delete objects; @@ -85,20 +85,20 @@ void KexiGradientWidget::rebuildCache( void ) { buildChildrenList( childWidgetList, this ); /** - Disable the effect and behave like a normal QWidget. + Disable the effect and behave like a normal TQWidget. */ if ( p_displayMode == NoGradient ) { // if ( p_backgroundPixmap.isNull() ) { //unsetPalette(); //} else { - QWidget::setPaletteBackgroundPixmap( p_backgroundPixmap ); + TQWidget::setPaletteBackgroundPixmap( p_backgroundPixmap ); //} - QWidget::setPaletteBackgroundColor( p_backgroundColor ); + TQWidget::setPaletteBackgroundColor( p_backgroundColor ); for ( WidgetList::Iterator it = childWidgetList.begin(); it != childWidgetList.end(); ++it ) { - if ( p_customBackgroundWidgets.contains( ( *it ) ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( ( *it ) ) == false ) { ( *it )->unsetPalette(); } } @@ -110,8 +110,8 @@ void KexiGradientWidget::rebuildCache( void ) { } KPixmap tempPixmap; - QImage gradientImage; - QImage bgImage; + TQImage gradientImage; + TQImage bgImage; /** Draw the gradient @@ -124,7 +124,7 @@ void KexiGradientWidget::rebuildCache( void ) { */ if ( p_displayMode == FadedGradient ) { tempPixmap.resize( size() ); - QPainter p( &tempPixmap, this ); + TQPainter p( &tempPixmap, this ); if ( p_backgroundPixmap.isNull() ) { /* @@ -133,8 +133,8 @@ void KexiGradientWidget::rebuildCache( void ) { */ unsetPalette(); p.fillRect( 0, 0, width(), height(), palette().brush( - isEnabled() ? QPalette::Active : QPalette::Disabled, - QColorGroup::Background ) ); + isEnabled() ? TQPalette::Active : TQPalette::Disabled, + TQColorGroup::Background ) ); } else { p.drawTiledPixmap( 0, 0, width(), height(), p_backgroundPixmap ); } @@ -155,12 +155,12 @@ void KexiGradientWidget::rebuildCache( void ) { } /** - All children need to have our background set. + All tqchildren need to have our background set. */ KPixmap partPixmap; - QRect area; - QWidget* childWidget = 0; - const QPoint topLeft( 0, 0 ); + TQRect area; + TQWidget* childWidget = 0; + const TQPoint topLeft( 0, 0 ); for ( WidgetList::Iterator it = childWidgetList.begin(); it != childWidgetList.end(); ++it ) { @@ -170,7 +170,7 @@ void KexiGradientWidget::rebuildCache( void ) { /** Exclude widgets with a custom palette. */ - if ( p_customBackgroundWidgets.contains( childWidget ) ) { + if ( p_customBackgroundWidgets.tqcontains( childWidget ) ) { continue; } @@ -179,8 +179,8 @@ void KexiGradientWidget::rebuildCache( void ) { Get the part of the tempPixmap that is under the current child-widget. */ - if ( childWidget->parent() == this ) { - area = childWidget->geometry(); + if ( TQT_BASE_OBJECT(childWidget->tqparent()) == TQT_BASE_OBJECT(this) ) { + area = childWidget->tqgeometry(); } else { area.setTopLeft( childWidget->mapTo( this, childWidget->clipRegion().boundingRect().topLeft() ) ); @@ -192,17 +192,17 @@ void KexiGradientWidget::rebuildCache( void ) { childWidget->setPaletteBackgroundPixmap( partPixmap ); } - QWidget::setPaletteBackgroundPixmap( tempPixmap ); + TQWidget::setPaletteBackgroundPixmap( tempPixmap ); /** Unset the dirty-flag at the end of the method. - QWidget::setPaletteBackgroundPixmap() causes this + TQWidget::setPaletteBackgroundPixmap() causes this to get set to true again, so set it to false right after setting the pixmap. */ p_cacheDirty = false; } -void KexiGradientWidget::paintEvent( QPaintEvent* e ) { +void KexiGradientWidget::paintEvent( TQPaintEvent* e ) { /** Rebuild the background-pixmap if necessary. */ @@ -213,19 +213,19 @@ void KexiGradientWidget::paintEvent( QPaintEvent* e ) { /** Draw the widget as usual */ - QWidget::paintEvent( e ); + TQWidget::paintEvent( e ); } -bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { - QWidget* child = dynamic_cast<QWidget*>( object ); +bool KexiGradientWidget::eventFilter( TQObject* object, TQEvent* event ) { + TQWidget* child = dynamic_cast<TQWidget*>( object ); /** Manage list of child-widgets. */ - if ( object == this ) { - if ( event->type() == QEvent::ChildInserted ) { - child = dynamic_cast<QWidget*>( dynamic_cast<QChildEvent*>( event )->child() ); - if ( isValidChildWidget( child ) == false ) { + if ( TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(this) ) { + if ( event->type() == TQEvent::ChildInserted ) { + child = dynamic_cast<TQWidget*>( dynamic_cast<TQChildEvent*>( event )->child() ); + if ( isValidChildWidget( TQT_TQOBJECT(child) ) == false ) { return false; } /** @@ -236,11 +236,11 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { ... and install 'this' as the child's event-filter. */ child->installEventFilter( this ); - } else if ( event->type() == QEvent::ChildRemoved ) { + } else if ( event->type() == TQEvent::ChildRemoved ) { /** Remove the child-widget from the list of known widgets. */ - p_knownWidgets.remove( dynamic_cast<QWidget*>( dynamic_cast<QChildEvent*>( event )->child() ) ); + p_knownWidgets.remove( dynamic_cast<TQWidget*>( dynamic_cast<TQChildEvent*>( event )->child() ) ); } return false; } @@ -248,14 +248,14 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { /** Manage custombackground-list. */ - if ( event->type() == QEvent::PaletteChange ) { + if ( event->type() == TQEvent::PaletteChange ) { /** p_currentChild will be == 0L, when the user sets it's palette manually. In this case, it has to be added to the customBackground-list. */ if ( p_currentChild == 0L && child != 0L ) { - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { p_customBackgroundWidgets.append( child ); return false; } @@ -269,7 +269,7 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { Add the new child to the list of widgets, we don't set the background ourselves if it isn't in the list. */ - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { if ( child->paletteBackgroundPixmap() != 0L ) { p_customBackgroundWidgets.append( child ); } @@ -290,37 +290,37 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { p_currentChild = 0; } - if ( event->type() == QEvent::Move ) { - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( event->type() == TQEvent::Move ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { updateChildBackground( child ); } } return false; } -void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) +void KexiGradientWidget::updateChildBackground( TQWidget* childWidget ) { KPixmap partPixmap; KPixmap bgPixmap; - QRect area; - const QPoint topLeft( 0, 0 ); + TQRect area; + const TQPoint topLeft( 0, 0 ); - bgPixmap = paletteBackgroundPixmap() ? (*paletteBackgroundPixmap()) : QPixmap(); + bgPixmap = paletteBackgroundPixmap() ? (*paletteBackgroundPixmap()) : TQPixmap(); if ( bgPixmap.isNull() ) return; /** - Exclude widgtes that don't have a parent. - This happens when children are removed + Exclude widgtes that don't have a tqparent. + This happens when tqchildren are removed which are in the knownWidgets-list. */ - if ( childWidget->parent() == 0L ) + if ( childWidget->tqparent() == 0L ) return; /** Exclude widgets with a custom palette. */ - if ( p_customBackgroundWidgets.contains( childWidget ) ) { + if ( p_customBackgroundWidgets.tqcontains( childWidget ) ) { return; } @@ -329,8 +329,8 @@ void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) Get the part of the tempPixmap that is under the current child-widget. */ - if ( childWidget->parent() == this ) { - area = childWidget->geometry(); + if ( TQT_BASE_OBJECT(childWidget->tqparent()) == TQT_BASE_OBJECT(this) ) { + area = childWidget->tqgeometry(); } else { area.setTopLeft( childWidget->mapTo( this, childWidget->clipRegion().boundingRect().topLeft() ) ); @@ -342,15 +342,15 @@ void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) childWidget->setPaletteBackgroundPixmap( partPixmap ); } -void KexiGradientWidget::setPaletteBackgroundColor( const QColor& color ) +void KexiGradientWidget::setPaletteBackgroundColor( const TQColor& color ) { p_backgroundColor = color; if ( p_displayMode == NoGradient ) { - QWidget::setPaletteBackgroundColor( p_backgroundColor ); + TQWidget::setPaletteBackgroundColor( p_backgroundColor ); } } -const QColor& KexiGradientWidget::paletteBackgroundColor() const +const TQColor& KexiGradientWidget::paletteBackgroundColor() const { return p_backgroundColor; } diff --git a/kexi/widget/utils/kexigradientwidget.h b/kexi/widget/utils/kexigradientwidget.h index 0032e7b1..3a90add8 100644 --- a/kexi/widget/utils/kexigradientwidget.h +++ b/kexi/widget/utils/kexigradientwidget.h @@ -20,8 +20,8 @@ #ifndef KEXIGRADIENTWIDGET_H #define KEXIGRADIENTWIDGET_H -#include <qtimer.h> -#include <qwidget.h> +#include <tqtimer.h> +#include <tqwidget.h> #include <kimageeffect.h> #include <kpixmap.h> @@ -32,15 +32,16 @@ /*! @author Christian Nitschkowski */ -class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { - typedef QPtrList<QWidget> WidgetList; +class KEXIGUIUTILS_EXPORT KexiGradientWidget : public TQWidget { + typedef TQPtrList<TQWidget> WidgetList; Q_OBJECT - Q_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode DESIGNABLE true) - Q_PROPERTY(GradientType gradientType READ gradientType WRITE setGradientType DESIGNABLE true) - Q_PROPERTY(QColor gradientColor1 READ gradientColor1 WRITE setGradientColor1 DESIGNABLE true) - Q_PROPERTY(QColor gradientColor2 READ gradientColor2 WRITE setGradientColor2 DESIGNABLE true) - Q_PROPERTY(double blendOpacity READ blendOpacity WRITE setBlendOpacity DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode DESIGNABLE true) + TQ_PROPERTY(GradientType gradientType READ gradientType WRITE setGradientType DESIGNABLE true) + TQ_PROPERTY(TQColor gradientColor1 READ gradientColor1 WRITE setGradientColor1 DESIGNABLE true) + TQ_PROPERTY(TQColor gradientColor2 READ gradientColor2 WRITE setGradientColor2 DESIGNABLE true) + TQ_PROPERTY(double blendOpacity READ blendOpacity WRITE setBlendOpacity DESIGNABLE true) Q_ENUMS( DisplayMode GradientType ) public: @@ -48,7 +49,7 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { Modes for displaying the gradient. */ enum DisplayMode { - NoGradient, //!< No gradient at all. Will behave just like a QWidget + NoGradient, //!< No gradient at all. Will behave just like a TQWidget FadedGradient, //!< Gradient will be faded with the widgets background SimpleGradient //!< Gradient will replace the usual widget background }; @@ -68,16 +69,16 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { EllipticGradient = KImageEffect::EllipticGradient }; - KexiGradientWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); + KexiGradientWidget( TQWidget *tqparent = 0, const char *name = 0, WFlags f = 0 ); virtual ~KexiGradientWidget(); - virtual void setPaletteBackgroundPixmap( const QPixmap& pixmap ) { + virtual void setPaletteBackgroundPixmap( const TQPixmap& pixmap ) { p_backgroundPixmap = pixmap; p_rebuildDelayTimer.start( REBUILD_DELAY, true ); } - virtual const QColor& paletteBackgroundColor() const; + virtual const TQColor& paletteBackgroundColor() const; /*! Set the displaymode \a mode. @@ -114,14 +115,14 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { /*! Set color #1 for the gradient-effect. \a color is the new color. */ - void setGradientColor1( const QColor& color ) { + void setGradientColor1( const TQColor& color ) { p_color1 = color; p_cacheDirty = true; } /*! Set color #2 for the gradient-effect. \a color is the new color. */ - void setGradientColor2( const QColor& color ) { + void setGradientColor2( const TQColor& color ) { p_color2 = color; p_cacheDirty = true; } @@ -131,17 +132,17 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { \a color1 is the first color, \a color2 the second. */ - void setGradientColors( const QColor& color1, const QColor& color2 ) { + void setGradientColors( const TQColor& color1, const TQColor& color2 ) { p_color1 = color1; p_color2 = color2; p_cacheDirty = true; } /*! \return the color #1 used for the gradient. */ - QColor gradientColor1() const { return p_color1; } + TQColor gradientColor1() const { return p_color1; } /*! \return the color #2 used for the gradient. */ - QColor gradientColor2() const { return p_color2; } + TQColor gradientColor2() const { return p_color2; } /*! Sets the opacity of the gradient when fading with background. @@ -155,47 +156,47 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { double blendOpacity() const { return p_opacity; } public slots: - virtual void setPaletteBackgroundColor( const QColor& color ); + virtual void setPaletteBackgroundColor( const TQColor& color ); protected: - virtual bool eventFilter( QObject* object, QEvent* event ); + virtual bool eventFilter( TQObject* object, TQEvent* event ); virtual void enabledChange( bool enabled ) { p_cacheDirty = true; - QWidget::enabledChange( enabled ); + TQWidget::enabledChange( enabled ); } - virtual void paletteChange( const QPalette& pal ) { + virtual void paletteChange( const TQPalette& pal ) { p_cacheDirty = true; - QWidget::paletteChange( pal ); + TQWidget::paletteChange( pal ); } - virtual void paintEvent( QPaintEvent* e ); + virtual void paintEvent( TQPaintEvent* e ); - virtual void resizeEvent( QResizeEvent* e ) { + virtual void resizeEvent( TQResizeEvent* e ) { p_rebuildDelayTimer.start( REBUILD_DELAY, true ); - QWidget::resizeEvent( e ); + TQWidget::resizeEvent( e ); } - virtual void styleChange( QStyle& style ) { + virtual void styleChange( TQStyle& style ) { p_cacheDirty = true; - QWidget::styleChange( style ); + TQWidget::styleChange( style ); } private: /*! - Builds a list of children of \a p. + Builds a list of tqchildren of \a p. Only widgets that work correctly with KexiGradientWidget will be in this list. The results will be stored in \a list. - The method recursively calls itself until all children of \a p + The method recursively calls itself until all tqchildren of \a p have been found and stored in the list. */ - static void buildChildrenList( WidgetList& list, QWidget* p ); + static void buildChildrenList( WidgetList& list, TQWidget* p ); /*! \a return if the \a child is a widget that should get a background set. */ - static bool isValidChildWidget( QObject* child ); + static bool isValidChildWidget( TQObject* child ); /*! Rebuilds the cache completely. @@ -210,7 +211,7 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { The same code is used for PaletteChange-events, but in a different location. */ - void updateChildBackground( QWidget* childWidget ); + void updateChildBackground( TQWidget* childWidget ); private: WidgetList p_knownWidgets; @@ -218,14 +219,14 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { DisplayMode p_displayMode; GradientType p_gradientType; KPixmap p_backgroundPixmap; - QColor p_color1; - QColor p_color2; - QTimer p_rebuildDelayTimer; - QWidget* p_currentChild; + TQColor p_color1; + TQColor p_color2; + TQTimer p_rebuildDelayTimer; + TQWidget* p_currentChild; double p_opacity; bool p_cacheDirty; - QColor p_backgroundColor; + TQColor p_backgroundColor; public slots: /*! @@ -233,7 +234,7 @@ class KEXIGUIUTILS_EXPORT KexiGradientWidget : public QWidget { is set up completely. */ virtual void polish() { - QWidget::polish(); + TQWidget::polish(); rebuildCache(); } diff --git a/kexi/widget/utils/kexirecordmarker.cpp b/kexi/widget/utils/kexirecordmarker.cpp index d434fcaf..654f3be7 100644 --- a/kexi/widget/utils/kexirecordmarker.cpp +++ b/kexi/widget/utils/kexirecordmarker.cpp @@ -22,20 +22,20 @@ #include "kexirecordmarker.h" -#include <qcolor.h> -#include <qstyle.h> -#include <qpixmap.h> -#include <qpainter.h> -#include <qimage.h> -#include <qapplication.h> +#include <tqcolor.h> +#include <tqstyle.h> +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqapplication.h> #include <kdebug.h> #include <kstaticdeleter.h> #include <kexiutils/utils.h> -static KStaticDeleter<QImage> KexiRecordMarker_pen_deleter, KexiRecordMarker_plus_deleter; -QImage* KexiRecordMarker_pen = 0, *KexiRecordMarker_plus = 0; +static KStaticDeleter<TQImage> KexiRecordMarker_pen_deleter, KexiRecordMarker_plus_deleter; +TQImage* KexiRecordMarker_pen = 0, *KexiRecordMarker_plus = 0; static const unsigned char img_pen_data[] = { 0x00,0x00,0x03,0x30,0x78,0x9c,0xfb,0xff,0xff,0x3f,0xc3,0x7f,0x32,0x30, @@ -56,7 +56,7 @@ static struct EmbedImage { const unsigned char *data; ulong compressed; int numColors; - const QRgb *colorTable; + const TQRgb *colorTable; bool alpha; const char *name; } embed_image[] = { @@ -64,14 +64,14 @@ static struct EmbedImage { { 10, 10, 32, (const unsigned char*)img_pen_data, 50, 0, 0, true, "tableview_plus.png" } }; -QImage* getImg(const unsigned char* data, int id) +TQImage* getImg(const unsigned char* data, int id) { - QByteArray baunzip; - baunzip = qUncompress( data, embed_image[id].compressed ); - QImage *img = new QImage( QImage((uchar*)baunzip.data(), + TQByteArray baunzip; + baunzip = tqUncompress( data, embed_image[id].compressed ); + TQImage *img = new TQImage( TQImage((uchar*)baunzip.data(), embed_image[id].width, embed_image[id].height, - embed_image[id].depth, (QRgb*)embed_image[id].colorTable, - embed_image[id].numColors, QImage::BigEndian + embed_image[id].depth, (TQRgb*)embed_image[id].colorTable, + embed_image[id].numColors, TQImage::BigEndian ).copy() ); if ( embed_image[id].alpha ) img->setAlphaBuffer(true); @@ -100,7 +100,7 @@ public: , highlightedRow(-1) , editRow(-1) , rows(0) - , selectionBackgroundColor(qApp->palette().active().highlight()) + , selectionBackgroundColor(tqApp->tqpalette().active().highlight()) , showInsertRow(true) { } @@ -110,14 +110,14 @@ public: int highlightedRow; int editRow; int rows; - QColor selectionBackgroundColor; + TQColor selectionBackgroundColor; bool showInsertRow : 1; }; //---------------------------------------------------------------- -KexiRecordMarker::KexiRecordMarker(QWidget *parent, const char* name) - : QWidget(parent, name) +KexiRecordMarker::KexiRecordMarker(TQWidget *tqparent, const char* name) + : TQWidget(tqparent, name) , d( new Private() ) { initRecordMarkerImages(); @@ -128,13 +128,13 @@ KexiRecordMarker::~KexiRecordMarker() delete d; } -QImage* KexiRecordMarker::penImage() +TQImage* KexiRecordMarker::penImage() { initRecordMarkerImages(); return KexiRecordMarker_pen; } -QImage* KexiRecordMarker::plusImage() +TQImage* KexiRecordMarker::plusImage() { initRecordMarkerImages(); return KexiRecordMarker_plus; @@ -178,36 +178,36 @@ int KexiRecordMarker::rows() const return d->rows; } -void KexiRecordMarker::paintEvent(QPaintEvent *e) +void KexiRecordMarker::paintEvent(TQPaintEvent *e) { - QPainter p(this); - QRect r(e->rect()); + TQPainter p(this); + TQRect r(e->rect()); int first = (r.top() + d->offset) / d->rowHeight; int last = (r.bottom() + d->offset) / d->rowHeight; if(last > (d->rows-1+(d->showInsertRow?1:0))) last = d->rows-1+(d->showInsertRow?1:0); - QColorGroup selectedColorGroup(colorGroup()); - selectedColorGroup.setColor( QColorGroup::Button, - KexiUtils::blendedColors( selectedColorGroup.color(QColorGroup::Background), + TQColorGroup selectedColorGroup(tqcolorGroup()); + selectedColorGroup.setColor( TQColorGroup::Button, + KexiUtils::blendedColors( selectedColorGroup.color(TQColorGroup::Background), d->selectionBackgroundColor, 2, 1) ); - selectedColorGroup.setColor( QColorGroup::Background, - selectedColorGroup.color(QColorGroup::Button) ); //set background color as well (e.g. for thinkeramik) - QColorGroup highlightedColorGroup(colorGroup()); - highlightedColorGroup.setColor( QColorGroup::Button, - KexiUtils::blendedColors( highlightedColorGroup.color(QColorGroup::Background), + selectedColorGroup.setColor( TQColorGroup::Background, + selectedColorGroup.color(TQColorGroup::Button) ); //set background color as well (e.g. for thinkeramik) + TQColorGroup highlightedColorGroup(tqcolorGroup()); + highlightedColorGroup.setColor( TQColorGroup::Button, + KexiUtils::blendedColors( highlightedColorGroup.color(TQColorGroup::Background), d->selectionBackgroundColor, 4, 1) ); - highlightedColorGroup.setColor( QColorGroup::Background, - highlightedColorGroup.color(QColorGroup::Button) ); //set background color as well (e.g. for thinkeramik) + highlightedColorGroup.setColor( TQColorGroup::Background, + highlightedColorGroup.color(TQColorGroup::Button) ); //set background color as well (e.g. for thinkeramik) for(int i=first; i <= last; i++) { int y = ((d->rowHeight * i)-d->offset); - QRect r(0, y, width(), d->rowHeight); + TQRect r(0, y, width(), d->rowHeight); p.drawRect(r); - style().drawPrimitive( QStyle::PE_HeaderSection, &p, r, - (d->currentRow == i) ? selectedColorGroup : (d->highlightedRow == i ? highlightedColorGroup : colorGroup()), - QStyle::Style_Raised | (isEnabled() ? QStyle::Style_Enabled : 0)); + tqstyle().tqdrawPrimitive( TQStyle::PE_HeaderSection, &p, r, + (d->currentRow == i) ? selectedColorGroup : (d->highlightedRow == i ? highlightedColorGroup : tqcolorGroup()), + TQStyle::Style_Raised | (isEnabled() ? TQStyle::Style_Enabled : 0)); } if (d->editRow!=-1 && d->editRow >= first && d->editRow <= (last/*+1 for insert row*/)) { //show pen when editing @@ -220,9 +220,9 @@ void KexiRecordMarker::paintEvent(QPaintEvent *e) && (!d->showInsertRow || (d->showInsertRow && d->currentRow < last)))/*don't display marker for 'insert' row*/ { //show marker - p.setBrush(colorGroup().foreground()); - p.setPen(QPen(Qt::NoPen)); - QPointArray points(3); + p.setBrush(tqcolorGroup().foreground()); + p.setPen(TQPen(TQt::NoPen)); + TQPointArray points(3); int ofs = d->rowHeight / 4; int ofs2 = (width() - ofs) / 2 -1; int pos = ((d->rowHeight*d->currentRow)-d->offset)-ofs/2+2; @@ -294,12 +294,12 @@ void KexiRecordMarker::showInsertRow(bool show) update(); } -void KexiRecordMarker::setSelectionBackgroundColor(const QColor &color) +void KexiRecordMarker::setSelectionBackgroundColor(const TQColor &color) { d->selectionBackgroundColor = color; } -QColor KexiRecordMarker::selectionBackgroundColor() const +TQColor KexiRecordMarker::selectionBackgroundColor() const { return d->selectionBackgroundColor; } diff --git a/kexi/widget/utils/kexirecordmarker.h b/kexi/widget/utils/kexirecordmarker.h index 1408f83b..1348ca1d 100644 --- a/kexi/widget/utils/kexirecordmarker.h +++ b/kexi/widget/utils/kexirecordmarker.h @@ -23,23 +23,24 @@ #ifndef KEXIRECORDMARKER_H #define KEXIRECORDMARKER_H -#include <qwidget.h> +#include <tqwidget.h> -class QImage; +class TQImage; //! \brief Record marker, usually displayed at the left side of a table view or a continuous form. -class KEXIGUIUTILS_EXPORT KexiRecordMarker : public QWidget +class KEXIGUIUTILS_EXPORT KexiRecordMarker : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KexiRecordMarker(QWidget *parent, const char* name = 0); + KexiRecordMarker(TQWidget *tqparent, const char* name = 0); ~KexiRecordMarker(); int rows() const; - static QImage* penImage(); - static QImage* plusImage(); + static TQImage* penImage(); + static TQImage* plusImage(); public slots: void setOffset(int offset); @@ -51,8 +52,8 @@ class KEXIGUIUTILS_EXPORT KexiRecordMarker : public QWidget void setEditRow(int row); void showInsertRow(bool show); - QColor selectionBackgroundColor() const; - void setSelectionBackgroundColor(const QColor &color); + TQColor selectionBackgroundColor() const; + void setSelectionBackgroundColor(const TQColor &color); void addLabel(bool upd=true); void removeLabel(bool upd=true); @@ -63,7 +64,7 @@ class KEXIGUIUTILS_EXPORT KexiRecordMarker : public QWidget void clear(bool upd=true); protected: - virtual void paintEvent(QPaintEvent *e); + virtual void paintEvent(TQPaintEvent *e); class Private; Private * const d; diff --git a/kexi/widget/utils/kexirecordnavigator.cpp b/kexi/widget/utils/kexirecordnavigator.cpp index f0dff087..6fe7fbdc 100644 --- a/kexi/widget/utils/kexirecordnavigator.cpp +++ b/kexi/widget/utils/kexirecordnavigator.cpp @@ -18,12 +18,12 @@ * Boston, MA 02110-1301, USA. */ -#include <qtoolbutton.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qvalidator.h> -#include <qtooltip.h> -#include <qscrollview.h> +#include <tqtoolbutton.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqvalidator.h> +#include <tqtooltip.h> +#include <tqscrollview.h> #include <klocale.h> #include <kiconloader.h> @@ -46,9 +46,9 @@ class KexiRecordNavigatorPrivate { } KexiRecordNavigatorHandler *handler; - QHBoxLayout *lyr; + TQHBoxLayout *lyr; - QLabel *editingIndicatorLabel; + TQLabel *editingIndicatorLabel; bool editingIndicatorEnabled : 1; bool editingIndicatorVisible : 1; }; @@ -65,103 +65,103 @@ KexiRecordNavigatorHandler::~KexiRecordNavigatorHandler() //-------------------------------------------------- -KexiRecordNavigator::KexiRecordNavigator(QWidget *parent, int leftMargin, const char *name) - : QFrame(parent, name) +KexiRecordNavigator::KexiRecordNavigator(TQWidget *tqparent, int leftMargin, const char *name) + : TQFrame(tqparent, name) , m_view(0) , m_isInsertingEnabled(true) , d( new KexiRecordNavigatorPrivate() ) { - if (parent->inherits("QScrollView")) - setParentView( dynamic_cast<QScrollView*>(parent) ); - setFrameStyle(QFrame::NoFrame); - d->lyr = new QHBoxLayout(this,0,0,"nav_lyr"); + if (tqparent->inherits(TQSCROLLVIEW_OBJECT_NAME_STRING)) + setParentView( dynamic_cast<TQScrollView*>(tqparent) ); + setFrameStyle(TQFrame::NoFrame); + d->lyr = new TQHBoxLayout(this,0,0,"nav_lyr"); - m_textLabel = new QLabel(this); + m_textLabel = new TQLabel(this); d->lyr->addWidget( m_textLabel ); setLabelText(i18n("Row:")); - int bw = 6+SmallIcon("navigator_first").width(); //QMIN( horizontalScrollBar()->height(), 20); - QFont f = font(); + int bw = 6+SmallIcon("navigator_first").width(); //TQMIN( horizontalScrollBar()->height(), 20); + TQFont f = font(); f.setPixelSize((bw > 12) ? 12 : bw); - QFontMetrics fm(f); + TQFontMetrics fm(f); m_nav1DigitWidth = fm.width("8"); - d->lyr->addWidget( m_navBtnFirst = new QToolButton(this) ); + d->lyr->addWidget( m_navBtnFirst = new TQToolButton(this) ); m_navBtnFirst->setFixedWidth(bw); - m_navBtnFirst->setFocusPolicy(NoFocus); + m_navBtnFirst->setFocusPolicy(TQ_NoFocus); m_navBtnFirst->setIconSet( SmallIconSet("navigator_first") ); - QToolTip::add(m_navBtnFirst, i18n("First row")); + TQToolTip::add(m_navBtnFirst, i18n("First row")); - d->lyr->addWidget( m_navBtnPrev = new QToolButton(this) ); + d->lyr->addWidget( m_navBtnPrev = new TQToolButton(this) ); m_navBtnPrev->setFixedWidth(bw); - m_navBtnPrev->setFocusPolicy(NoFocus); + m_navBtnPrev->setFocusPolicy(TQ_NoFocus); m_navBtnPrev->setIconSet( SmallIconSet("navigator_prev") ); m_navBtnPrev->setAutoRepeat(true); - QToolTip::add(m_navBtnPrev, i18n("Previous row")); + TQToolTip::add(m_navBtnPrev, i18n("Previous row")); d->lyr->addSpacing( 6 ); d->lyr->addWidget( m_navRecordNumber = new KLineEdit(this) ); - m_navRecordNumber->setAlignment(AlignRight | AlignVCenter); - m_navRecordNumber->setFocusPolicy(ClickFocus); + m_navRecordNumber->tqsetAlignment(AlignRight | AlignVCenter); + m_navRecordNumber->setFocusPolicy(TQ_ClickFocus); m_navRecordNumber->installEventFilter(this); // m_navRowNumber->setFixedWidth(fw); - m_navRecordNumberValidator = new QIntValidator(1, INT_MAX, this); + m_navRecordNumberValidator = new TQIntValidator(1, INT_MAX, TQT_TQOBJECT(this)); m_navRecordNumber->setValidator(m_navRecordNumberValidator); m_navRecordNumber->installEventFilter(this); - QToolTip::add(m_navRecordNumber, i18n("Current row number")); + TQToolTip::add(m_navRecordNumber, i18n("Current row number")); KLineEdit *lbl_of = new KLineEdit(i18n("of"), this); - lbl_of->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); + lbl_of->tqsetSizePolicy(TQSizePolicy::Fixed,TQSizePolicy::Preferred); lbl_of->setMaximumWidth(fm.width(lbl_of->text())+8); lbl_of->setReadOnly(true); lbl_of->setLineWidth(0); - lbl_of->setFocusPolicy(NoFocus); - lbl_of->setAlignment(AlignCenter); + lbl_of->setFocusPolicy(TQ_NoFocus); + lbl_of->tqsetAlignment(AlignCenter); d->lyr->addWidget( lbl_of ); d->lyr->addWidget( m_navRecordCount = new KLineEdit(this) ); - m_navRecordCount->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); + m_navRecordCount->tqsetSizePolicy(TQSizePolicy::Fixed,TQSizePolicy::Preferred); m_navRecordCount->setReadOnly(true); m_navRecordCount->setLineWidth(0); - m_navRecordCount->setFocusPolicy(NoFocus); - m_navRecordCount->setAlignment(AlignLeft | AlignVCenter); - QToolTip::add(m_navRecordCount, i18n("Number of rows")); + m_navRecordCount->setFocusPolicy(TQ_NoFocus); + m_navRecordCount->tqsetAlignment(AlignLeft | AlignVCenter); + TQToolTip::add(m_navRecordCount, i18n("Number of rows")); lbl_of->setFont(f); m_navRecordNumber->setFont(f); m_navRecordCount->setFont(f); setFont(f); - d->lyr->addWidget( m_navBtnNext = new QToolButton(this) ); + d->lyr->addWidget( m_navBtnNext = new TQToolButton(this) ); m_navBtnNext->setFixedWidth(bw); - m_navBtnNext->setFocusPolicy(NoFocus); + m_navBtnNext->setFocusPolicy(TQ_NoFocus); m_navBtnNext->setIconSet( SmallIconSet("navigator_next") ); m_navBtnNext->setAutoRepeat(true); - QToolTip::add(m_navBtnNext, i18n("Next row")); + TQToolTip::add(m_navBtnNext, i18n("Next row")); - d->lyr->addWidget( m_navBtnLast = new QToolButton(this) ); + d->lyr->addWidget( m_navBtnLast = new TQToolButton(this) ); m_navBtnLast->setFixedWidth(bw); - m_navBtnLast->setFocusPolicy(NoFocus); + m_navBtnLast->setFocusPolicy(TQ_NoFocus); m_navBtnLast->setIconSet( SmallIconSet("navigator_last") ); - QToolTip::add(m_navBtnLast, i18n("Last row")); + TQToolTip::add(m_navBtnLast, i18n("Last row")); d->lyr->addSpacing( 6 ); - d->lyr->addWidget( m_navBtnNew = new QToolButton(this) ); + d->lyr->addWidget( m_navBtnNew = new TQToolButton(this) ); m_navBtnNew->setFixedWidth(bw); - m_navBtnNew->setFocusPolicy(NoFocus); + m_navBtnNew->setFocusPolicy(TQ_NoFocus); m_navBtnNew->setIconSet( SmallIconSet("navigator_new") ); - QToolTip::add(m_navBtnNew, i18n("New row")); + TQToolTip::add(m_navBtnNew, i18n("New row")); m_navBtnNext->setEnabled(isInsertingEnabled()); d->lyr->addSpacing( 6 ); d->lyr->addStretch(10); - connect(m_navBtnPrev,SIGNAL(clicked()),this,SLOT(slotPrevButtonClicked())); - connect(m_navBtnNext,SIGNAL(clicked()),this,SLOT(slotNextButtonClicked())); - connect(m_navBtnLast,SIGNAL(clicked()),this,SLOT(slotLastButtonClicked())); - connect(m_navBtnFirst,SIGNAL(clicked()),this,SLOT(slotFirstButtonClicked())); - connect(m_navBtnNew,SIGNAL(clicked()),this,SLOT(slotNewButtonClicked())); + connect(m_navBtnPrev,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotPrevButtonClicked())); + connect(m_navBtnNext,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotNextButtonClicked())); + connect(m_navBtnLast,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotLastButtonClicked())); + connect(m_navBtnFirst,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotFirstButtonClicked())); + connect(m_navBtnNew,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotNewButtonClicked())); setRecordCount(0); setCurrentRecordNumber(0); @@ -185,30 +185,30 @@ void KexiRecordNavigator::setInsertingEnabled(bool set) void KexiRecordNavigator::setEnabled( bool set ) { - QFrame::setEnabled(set); + TQFrame::setEnabled(set); if (set && !m_isInsertingEnabled) m_navBtnNew->setEnabled( false ); } -bool KexiRecordNavigator::eventFilter( QObject *o, QEvent *e ) +bool KexiRecordNavigator::eventFilter( TQObject *o, TQEvent *e ) { - if (o==m_navRecordNumber) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(m_navRecordNumber)) { bool recordEntered = false; bool ret; - if (e->type()==QEvent::KeyPress) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + if (e->type()==TQEvent::KeyPress) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); switch (ke->key()) { - case Qt::Key_Escape: { + case TQt::Key_Escape: { ke->accept(); m_navRecordNumber->undo(); if (m_view) m_view->setFocus(); return true; } - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Tab: - case Qt::Key_BackTab: + case TQt::Key_Enter: + case TQt::Key_Return: + case TQt::Key_Tab: + case TQt::Key_BackTab: { recordEntered=true; ke->accept(); //to avoid pressing Enter later @@ -217,10 +217,10 @@ bool KexiRecordNavigator::eventFilter( QObject *o, QEvent *e ) default:; } } - else if (e->type()==QEvent::FocusOut) { - if (static_cast<QFocusEvent*>(e)->reason()!=QFocusEvent::Tab - && static_cast<QFocusEvent*>(e)->reason()!=QFocusEvent::Backtab - && static_cast<QFocusEvent*>(e)->reason()!=QFocusEvent::Other) + else if (e->type()==TQEvent::FocusOut) { + if (TQT_TQFOCUSEVENT(e)->reason()!=TQFocusEvent::Tab + && TQT_TQFOCUSEVENT(e)->reason()!=TQFocusEvent::Backtab + && TQT_TQFOCUSEVENT(e)->reason()!=TQFocusEvent::Other) recordEntered=true; ret = false; } @@ -230,7 +230,7 @@ bool KexiRecordNavigator::eventFilter( QObject *o, QEvent *e ) uint r = m_navRecordNumber->text().toUInt(&ok); if (!ok || r<1) r = (recordCount()>0)?1:0; - if (m_view && (hasFocus() || e->type()==QEvent::KeyPress)) + if (m_view && (hasFocus() || e->type()==TQEvent::KeyPress)) m_view->setFocus(); setCurrentRecordNumber(r); emit recordNumberEntered(r); @@ -253,14 +253,14 @@ void KexiRecordNavigator::setCurrentRecordNumber(uint r) uint recCnt = recordCount(); if (r>(recCnt+(m_isInsertingEnabled?1:0))) r = recCnt+(m_isInsertingEnabled?1:0); - QString n; + TQString n; if (r>0) - n = QString::number(r); + n = TQString::number(r); else n = " "; // if (d->navRecordNumber->text().length() != n.length()) {//resize // d->navRecordNumber->setFixedWidth( -// d->nav1DigitWidth*QMAX( QMAX(n.length(),2)+1,d->navRecordCount->text().length()+1)+6 +// d->nav1DigitWidth*TQMAX( TQMAX(n.length(),2)+1,d->navRecordCount->text().length()+1)+6 // ); // } @@ -283,7 +283,7 @@ void KexiRecordNavigator::updateButtons(uint recCnt) void KexiRecordNavigator::setRecordCount(uint count) { - const QString & n = QString::number(count); + const TQString & n = TQString::number(count); if (m_isInsertingEnabled && currentRecordNumber()==0) { setCurrentRecordNumber(1); } @@ -297,7 +297,7 @@ void KexiRecordNavigator::setRecordCount(uint count) } } //update row number widget's width - const int w = m_nav1DigitWidth*QMAX( QMAX(n.length(),2)+1,m_navRecordNumber->text().length()+1)+6; + const int w = m_nav1DigitWidth*TQMAX( TQMAX(n.length(),2)+1,m_navRecordNumber->text().length()+1)+6; if (m_navRecordNumber->width()!=w) //resize m_navRecordNumber->setFixedWidth(w); @@ -326,18 +326,18 @@ uint KexiRecordNavigator::recordCount() const return r; } -void KexiRecordNavigator::setParentView(QScrollView *view) +void KexiRecordNavigator::setParentView(TQScrollView *view) { m_view = view; } void KexiRecordNavigator::updateGeometry(int leftMargin) { - QFrame::updateGeometry(); + TQFrame::updateGeometry(); if (m_view) { int navWidth; if (m_view->horizontalScrollBar()->isVisible()) { - navWidth = sizeHint().width(); + navWidth = tqsizeHint().width(); } else { navWidth = leftMargin + m_view->clipper()->width(); @@ -345,23 +345,23 @@ void KexiRecordNavigator::updateGeometry(int leftMargin) setGeometry( m_view->frameWidth(), - m_view->height() - m_view->horizontalScrollBar()->sizeHint().height()-m_view->frameWidth(), + m_view->height() - m_view->horizontalScrollBar()->tqsizeHint().height()-m_view->frameWidth(), navWidth, - m_view->horizontalScrollBar()->sizeHint().height() + m_view->horizontalScrollBar()->tqsizeHint().height() ); m_view->updateScrollBars(); } } -void KexiRecordNavigator::setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h ) +void KexiRecordNavigator::setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h ) { hbar.setGeometry( x + width(), y, w - width(), h ); } -void KexiRecordNavigator::setLabelText(const QString& text) +void KexiRecordNavigator::setLabelText(const TQString& text) { - m_textLabel->setText(text.isEmpty() ? QString::null : (QString::fromLatin1(" ")+text+" ")); + m_textLabel->setText(text.isEmpty() ? TQString() : (TQString::tqfromLatin1(" ")+text+" ")); } void KexiRecordNavigator::setInsertingButtonVisible(bool set) @@ -428,9 +428,9 @@ void KexiRecordNavigator::setEditingIndicatorEnabled(bool set) d->editingIndicatorEnabled = set; if (d->editingIndicatorEnabled) { if (!d->editingIndicatorLabel) { - d->editingIndicatorLabel = new QLabel(this); - d->editingIndicatorLabel->setAlignment(Qt::AlignCenter); - QPixmap pix; + d->editingIndicatorLabel = new TQLabel(this); + d->editingIndicatorLabel->tqsetAlignment(TQt::AlignCenter); + TQPixmap pix; pix.convertFromImage( *KexiRecordMarker::penImage() ); d->editingIndicatorLabel->setFixedWidth( pix.width() + 2*2 ); d->lyr->insertWidget( 0, d->editingIndicatorLabel ); @@ -451,14 +451,14 @@ void KexiRecordNavigator::showEditingIndicator(bool show) if (!d->editingIndicatorEnabled) return; if (d->editingIndicatorVisible) { - QPixmap pix; + TQPixmap pix; pix.convertFromImage( *KexiRecordMarker::penImage() ); d->editingIndicatorLabel->setPixmap( pix ); - QToolTip::add( d->editingIndicatorLabel, i18n("Editing indicator") ); + TQToolTip::add( d->editingIndicatorLabel, i18n("Editing indicator") ); } else { - d->editingIndicatorLabel->setPixmap( QPixmap() ); - QToolTip::remove( d->editingIndicatorLabel ); + d->editingIndicatorLabel->setPixmap( TQPixmap() ); + TQToolTip::remove( d->editingIndicatorLabel ); } } diff --git a/kexi/widget/utils/kexirecordnavigator.h b/kexi/widget/utils/kexirecordnavigator.h index 674746e2..29faf115 100644 --- a/kexi/widget/utils/kexirecordnavigator.h +++ b/kexi/widget/utils/kexirecordnavigator.h @@ -21,14 +21,14 @@ #ifndef KEXIRECORDNAVIGATOR_H #define KEXIRECORDNAVIGATOR_H -#include <qframe.h> +#include <tqframe.h> #include <kexi_export.h> -class QToolButton; -class QIntValidator; -class QScrollView; -class QScrollBar; -class QLabel; +class TQToolButton; +class TQIntValidator; +class TQScrollView; +class TQScrollBar; +class TQLabel; class KLineEdit; class KGuiItem; class KexiRecordNavigatorPrivate; @@ -62,15 +62,16 @@ class KEXIGUIUTILS_EXPORT KexiRecordNavigatorHandler Note that using this way, you can allow to exist more than one navigator widget connected with your data-aware object (don't matter if this is sane). */ -class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame +class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public TQFrame { Q_OBJECT + TQ_OBJECT public: - KexiRecordNavigator(QWidget *parent, int leftMargin = 0, const char *name=0); + KexiRecordNavigator(TQWidget *tqparent, int leftMargin = 0, const char *name=0); virtual ~KexiRecordNavigator(); - void setParentView(QScrollView *view); + void setParentView(TQScrollView *view); /*! Sets record navigator handler. This allows to react on actions performed within navigator and vice versa. */ @@ -86,15 +87,15 @@ class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame /*! \return record count displayed for this navigator. */ uint recordCount() const; - /*! Sets horizontal bar's \a hbar (at the bottom) geometry so this record navigator + /*! Sets horizontal bar's \a hbar (at the bottom) tqgeometry so this record navigator is properly positioned together with horizontal scroll bar. This method is used - in QScrollView::setHBarGeometry() implementations: + in TQScrollView::setHBarGeometry() implementations: see KexiTableView::setHBarGeometry() and KexiFormScrollView::setHBarGeometry() for usage examples. */ - void setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h ); + void setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h ); /*! @internal used for keyboard handling. */ - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); /*! \return true if "editing" indicator is visible for this navigator. @see showEditingIndicator() */ @@ -149,7 +150,7 @@ class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame /*! Sets label text at the left of the for record navigator's button. By default this label contains translated "Row:" text. */ - void setLabelText(const QString& text); + void setLabelText(const TQString& text); signals: void prevButtonClicked(); @@ -165,23 +166,23 @@ class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame void slotLastButtonClicked(); void slotFirstButtonClicked(); void slotNewButtonClicked(); - //void slotRecordNumberReturnPressed(const QString& text); + //void slotRecordNumberReturnPressed(const TQString& text); protected: void updateButtons(uint recCnt); - QLabel *m_textLabel; - QToolButton *m_navBtnFirst; - QToolButton *m_navBtnPrev; - QToolButton *m_navBtnNext; - QToolButton *m_navBtnLast; - QToolButton *m_navBtnNew; + TQLabel *m_textLabel; + TQToolButton *m_navBtnFirst; + TQToolButton *m_navBtnPrev; + TQToolButton *m_navBtnNext; + TQToolButton *m_navBtnLast; + TQToolButton *m_navBtnNew; KLineEdit *m_navRecordNumber; - QIntValidator *m_navRecordNumberValidator; + TQIntValidator *m_navRecordNumberValidator; KLineEdit *m_navRecordCount; //!< readonly counter uint m_nav1DigitWidth; // uint m_recordCount; - QScrollView *m_view; + TQScrollView *m_view; bool m_isInsertingEnabled : 1; KexiRecordNavigatorPrivate *d; diff --git a/kexi/widget/utils/kexisharedactionclient.h b/kexi/widget/utils/kexisharedactionclient.h index 80181bc7..58b3bd6a 100644 --- a/kexi/widget/utils/kexisharedactionclient.h +++ b/kexi/widget/utils/kexisharedactionclient.h @@ -20,7 +20,7 @@ #ifndef KEXISHAREDACTIONCLIENT_H #define KEXISHAREDACTIONCLIENT_H -#include <qasciidict.h> +#include <tqasciidict.h> class KAction; #include <kexi_export.h> @@ -43,7 +43,7 @@ class KEXIGUIUTILS_EXPORT KexiSharedActionClient protected: //! Actions pluged for this widget using plugSharedAction(), available by name. - QAsciiDict<KAction> m_sharedActions; + TQAsciiDict<KAction> m_sharedActions; }; #endif diff --git a/kexi/widget/utils/kexitooltip.cpp b/kexi/widget/utils/kexitooltip.cpp index 69a8b583..d5df13aa 100644 --- a/kexi/widget/utils/kexitooltip.cpp +++ b/kexi/widget/utils/kexitooltip.cpp @@ -19,58 +19,58 @@ #include "kexitooltip.h" -#include <qpixmap.h> -#include <qbitmap.h> -#include <qpainter.h> -#include <qimage.h> -#include <qtooltip.h> -#include <qfont.h> -#include <qfontmetrics.h> -#include <qtimer.h> +#include <tqpixmap.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqtooltip.h> +#include <tqfont.h> +#include <tqfontmetrics.h> +#include <tqtimer.h> -KexiToolTip::KexiToolTip(const QVariant& value, QWidget* parent) - : QWidget(parent, "KexiToolTip", Qt::WStyle_Customize | Qt::WType_Popup | Qt::WStyle_NoBorder - | Qt::WX11BypassWM | Qt::WDestructiveClose) +KexiToolTip::KexiToolTip(const TQVariant& value, TQWidget* tqparent) + : TQWidget(tqparent, "KexiToolTip", TQt::WStyle_Customize | TQt::WType_Popup | TQt::WStyle_NoBorder + | TQt::WX11BypassWM | TQt::WDestructiveClose) , m_value(value) { - setPalette( QToolTip::palette() ); - setFocusPolicy(QWidget::NoFocus); + setPalette( TQToolTip::palette() ); + setFocusPolicy(TQ_NoFocus); } KexiToolTip::~KexiToolTip() { } -QSize KexiToolTip::sizeHint() const +TQSize KexiToolTip::tqsizeHint() const { - QSize sz(fontMetrics().boundingRect(m_value.toString()).size()); + TQSize sz(fontMetrics().boundingRect(m_value.toString()).size()); return sz; } void KexiToolTip::show() { updateGeometry(); - QWidget::show(); + TQWidget::show(); } -void KexiToolTip::paintEvent( QPaintEvent *pev ) +void KexiToolTip::paintEvent( TQPaintEvent *pev ) { - QWidget::paintEvent(pev); - QPainter p(this); + TQWidget::paintEvent(pev); + TQPainter p(this); drawFrame(p); drawContents(p); } -void KexiToolTip::drawFrame(QPainter& p) +void KexiToolTip::drawFrame(TQPainter& p) { - p.setPen( QPen(palette().active().foreground(), 1) ); + p.setPen( TQPen(tqpalette().active().foreground(), 1) ); p.drawRect(rect()); } -void KexiToolTip::drawContents(QPainter& p) +void KexiToolTip::drawContents(TQPainter& p) { - p.drawText(rect(), Qt::AlignCenter, m_value.toString()); + p.drawText(rect(), TQt::AlignCenter, m_value.toString()); } #include "kexitooltip.moc" diff --git a/kexi/widget/utils/kexitooltip.h b/kexi/widget/utils/kexitooltip.h index cbb0931f..3ff93120 100644 --- a/kexi/widget/utils/kexitooltip.h +++ b/kexi/widget/utils/kexitooltip.h @@ -20,28 +20,29 @@ #ifndef KEXITOOLTIP_H #define KEXITOOLTIP_H -#include <qwidget.h> -#include <qvariant.h> +#include <tqwidget.h> +#include <tqvariant.h> //! \brief A tooltip that can display rich content -class KEXIGUIUTILS_EXPORT KexiToolTip : public QWidget +class KEXIGUIUTILS_EXPORT KexiToolTip : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KexiToolTip(const QVariant& value, QWidget* parent); + KexiToolTip(const TQVariant& value, TQWidget* tqparent); virtual ~KexiToolTip(); - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; public slots: virtual void show(); protected: - virtual void paintEvent( QPaintEvent *pev ); - virtual void drawFrame(QPainter& p); - virtual void drawContents(QPainter& p); + virtual void paintEvent( TQPaintEvent *pev ); + virtual void drawFrame(TQPainter& p); + virtual void drawContents(TQPainter& p); - QVariant m_value; + TQVariant m_value; }; #endif diff --git a/kexi/widget/utils/klistviewitemtemplate.h b/kexi/widget/utils/klistviewitemtemplate.h index 1c89f96c..3807d43c 100644 --- a/kexi/widget/utils/klistviewitemtemplate.h +++ b/kexi/widget/utils/klistviewitemtemplate.h @@ -22,27 +22,27 @@ #include <klistview.h> -//! QListViewItem class with ability for storing additional data member +//! TQListViewItem class with ability for storing additional data member template<class type> class KListViewItemTemplate : public KListViewItem { public: - KListViewItemTemplate(type _data, QListView *parent) - : KListViewItem(parent), data(_data) {} - KListViewItemTemplate(type _data, QListViewItem *parent) - : KListViewItem(parent), data(_data) {} - KListViewItemTemplate(type _data, QListView *parent, QListViewItem *after) - : KListViewItem(parent, after), data(_data) {} - KListViewItemTemplate(type _data, QListViewItem *parent, QListViewItem *after) - : KListViewItem(parent, after), data(_data) {} - KListViewItemTemplate(type _data, QListView *parent, QString label1, QString label2=QString::null, QString label3=QString::null, QString label4=QString::null, QString label5=QString::null, QString label6=QString::null, QString label7=QString::null, QString label8=QString::null) - : KListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} - KListViewItemTemplate(type _data, QListViewItem *parent, QString label1, QString label2=QString::null, QString label3=QString::null, QString label4=QString::null, QString label5=QString::null, QString label6=QString::null, QString label7=QString::null, QString label8=QString::null) - : KListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} - KListViewItemTemplate(type _data, QListView *parent, QListViewItem *after, QString label1, QString label2=QString::null, QString label3=QString::null, QString label4=QString::null, QString label5=QString::null, QString label6=QString::null, QString label7=QString::null, QString label8=QString::null) - : KListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} - KListViewItemTemplate(type _data, QListViewItem *parent, QListViewItem *after, QString label1, QString label2=QString::null, QString label3=QString::null, QString label4=QString::null, QString label5=QString::null, QString label6=QString::null, QString label7=QString::null, QString label8=QString::null) - : KListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} + KListViewItemTemplate(type _data, TQListView *tqparent) + : KListViewItem(tqparent), data(_data) {} + KListViewItemTemplate(type _data, TQListViewItem *tqparent) + : KListViewItem(tqparent), data(_data) {} + KListViewItemTemplate(type _data, TQListView *tqparent, TQListViewItem *after) + : KListViewItem(tqparent, after), data(_data) {} + KListViewItemTemplate(type _data, TQListViewItem *tqparent, TQListViewItem *after) + : KListViewItem(tqparent, after), data(_data) {} + KListViewItemTemplate(type _data, TQListView *tqparent, TQString label1, TQString label2=TQString(), TQString label3=TQString(), TQString label4=TQString(), TQString label5=TQString(), TQString label6=TQString(), TQString label7=TQString(), TQString label8=TQString()) + : KListViewItem(tqparent, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} + KListViewItemTemplate(type _data, TQListViewItem *tqparent, TQString label1, TQString label2=TQString(), TQString label3=TQString(), TQString label4=TQString(), TQString label5=TQString(), TQString label6=TQString(), TQString label7=TQString(), TQString label8=TQString()) + : KListViewItem(tqparent, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} + KListViewItemTemplate(type _data, TQListView *tqparent, TQListViewItem *after, TQString label1, TQString label2=TQString(), TQString label3=TQString(), TQString label4=TQString(), TQString label5=TQString(), TQString label6=TQString(), TQString label7=TQString(), TQString label8=TQString()) + : KListViewItem(tqparent, after, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} + KListViewItemTemplate(type _data, TQListViewItem *tqparent, TQListViewItem *after, TQString label1, TQString label2=TQString(), TQString label3=TQString(), TQString label4=TQString(), TQString label5=TQString(), TQString label6=TQString(), TQString label7=TQString(), TQString label8=TQString()) + : KListViewItem(tqparent, after, label1, label2, label3, label4, label5, label6, label7, label8), data(_data) {} type data; }; |