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/formeditor/factories | |
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/formeditor/factories')
-rw-r--r-- | kexi/formeditor/factories/containerfactory.cpp | 418 | ||||
-rw-r--r-- | kexi/formeditor/factories/containerfactory.h | 132 | ||||
-rw-r--r-- | kexi/formeditor/factories/stdwidgetfactory.cpp | 340 | ||||
-rw-r--r-- | kexi/formeditor/factories/stdwidgetfactory.h | 61 |
4 files changed, 482 insertions, 469 deletions
diff --git a/kexi/formeditor/factories/containerfactory.cpp b/kexi/formeditor/factories/containerfactory.cpp index d098c290..ada3f994 100644 --- a/kexi/formeditor/factories/containerfactory.cpp +++ b/kexi/formeditor/factories/containerfactory.cpp @@ -19,24 +19,24 @@ * Boston, MA 02110-1301, USA. */ -#include <qwidgetstack.h> -#include <qframe.h> -#include <qbuttongroup.h> -#include <qwidget.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qstring.h> -#include <qpopupmenu.h> -#include <qdom.h> -#include <qevent.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qvaluevector.h> -#include <qfileinfo.h> -#include <qscrollview.h> -#include <qtabbar.h> -#include <qsplitter.h> -#include <qlayout.h> +#include <tqwidgetstack.h> +#include <tqframe.h> +#include <tqbuttongroup.h> +#include <tqwidget.h> +#include <tqhbox.h> +#include <tqvbox.h> +#include <tqstring.h> +#include <tqpopupmenu.h> +#include <tqdom.h> +#include <tqevent.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqvaluevector.h> +#include <tqfileinfo.h> +#include <tqscrollview.h> +#include <tqtabbar.h> +#include <tqsplitter.h> +#include <tqlayout.h> #include <kiconloader.h> #include <kgenericfactory.h> @@ -57,15 +57,15 @@ #include <formeditor/utils.h> #if KDE_VERSION < KDE_MAKE_VERSION(3,1,9) -# define KInputDialog QInputDialog -# include <qinputdialog.h> -# include <qlineedit.h> +# define KInputDialog TQInputDialog +# include <tqinputdialog.h> +# include <tqlineedit.h> #else # include <kinputdialog.h> #endif -ContainerWidget::ContainerWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +ContainerWidget::ContainerWidget(TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name) { } @@ -73,27 +73,27 @@ ContainerWidget::~ContainerWidget() { } -QSize ContainerWidget::sizeHint() const +TQSize ContainerWidget::tqsizeHint() const { - return QSize(30,30); //default + return TQSize(30,30); //default } -void ContainerWidget::dragMoveEvent( QDragMoveEvent *e ) +void ContainerWidget::dragMoveEvent( TQDragMoveEvent *e ) { - QWidget::dragMoveEvent(e); + TQWidget::dragMoveEvent(e); emit handleDragMoveEvent(e); } -void ContainerWidget::dropEvent( QDropEvent *e ) +void ContainerWidget::dropEvent( TQDropEvent *e ) { - QWidget::dropEvent(e); + TQWidget::dropEvent(e); emit handleDropEvent(e); } //////////////////////// -GroupBox::GroupBox(const QString & title, QWidget *parent, const char *name) - : QGroupBox(title, parent, name) +GroupBox::GroupBox(const TQString & title, TQWidget *tqparent, const char *name) + : TQGroupBox(title, tqparent, name) { } @@ -101,22 +101,22 @@ GroupBox::~GroupBox() { } -void GroupBox::dragMoveEvent( QDragMoveEvent *e ) +void GroupBox::dragMoveEvent( TQDragMoveEvent *e ) { - QGroupBox::dragMoveEvent(e); + TQGroupBox::dragMoveEvent(e); emit handleDragMoveEvent(e); } -void GroupBox::dropEvent( QDropEvent *e ) +void GroupBox::dropEvent( TQDropEvent *e ) { - QGroupBox::dropEvent(e); + TQGroupBox::dropEvent(e); emit handleDropEvent(e); } //////////////////////// -KFDTabWidget::KFDTabWidget(QWidget *parent, const char *name) - : KFormDesigner::TabWidget(parent, name) +KFDTabWidget::KFDTabWidget(TQWidget *tqparent, const char *name) + : KFormDesigner::TabWidget(tqparent, name) { } @@ -124,17 +124,17 @@ KFDTabWidget::~KFDTabWidget() { } -QSize -KFDTabWidget::sizeHint() const +TQSize +KFDTabWidget::tqsizeHint() const { - QSize s(30,30); // default min size + TQSize s(30,30); // default min size for(int i=0; i < count(); i++) s = s.expandedTo( KFormDesigner::getSizeFromChildren(page(i)) ); - return s + QSize(10/*margin*/, tabBar()->height() + 20/*margin*/); + return s + TQSize(10/*margin*/, tabBar()->height() + 20/*margin*/); } -void KFDTabWidget::dragMoveEvent( QDragMoveEvent *e ) +void KFDTabWidget::dragMoveEvent( TQDragMoveEvent *e ) { TabWidgetBase::dragMoveEvent( e ); if (dynamic_cast<ContainerWidget*>(currentPage())) @@ -142,7 +142,7 @@ void KFDTabWidget::dragMoveEvent( QDragMoveEvent *e ) emit handleDragMoveEvent(e); } -void KFDTabWidget::dropEvent( QDropEvent *e ) +void KFDTabWidget::dropEvent( TQDropEvent *e ) { TabWidgetBase::dropEvent( e ); if (dynamic_cast<ContainerWidget*>(currentPage())) @@ -150,90 +150,90 @@ void KFDTabWidget::dropEvent( QDropEvent *e ) emit handleDropEvent(e); } -/// Various layout widgets /////////////////: +/// Various tqlayout widgets /////////////////: -HBox::HBox(QWidget *parent, const char *name) - : QFrame(parent, name), m_preview(false) +HBox::HBox(TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), m_preview(false) {} void -HBox::paintEvent(QPaintEvent *) +HBox::paintEvent(TQPaintEvent *) { if(m_preview) return; - QPainter p(this); - p.setPen(QPen(red, 2, Qt::DashLine)); + TQPainter p(this); + p.setPen(TQPen(red, 2, TQt::DashLine)); p.drawRect(1, 1, width()-1, height() - 1); } -VBox::VBox(QWidget *parent, const char *name) - : QFrame(parent, name), m_preview(false) +VBox::VBox(TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), m_preview(false) {} void -VBox::paintEvent(QPaintEvent *) +VBox::paintEvent(TQPaintEvent *) { if(m_preview) return; - QPainter p(this); - p.setPen(QPen(blue, 2, Qt::DashLine)); + TQPainter p(this); + p.setPen(TQPen(blue, 2, TQt::DashLine)); p.drawRect(1, 1, width()-1, height() - 1); } -Grid::Grid(QWidget *parent, const char *name) - : QFrame(parent, name), m_preview(false) +Grid::Grid(TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), m_preview(false) {} void -Grid::paintEvent(QPaintEvent *) +Grid::paintEvent(TQPaintEvent *) { if(m_preview) return; - QPainter p(this); - p.setPen(QPen(darkGreen, 2, Qt::DashLine)); + TQPainter p(this); + p.setPen(TQPen(darkGreen, 2, TQt::DashLine)); p.drawRect(1, 1, width()-1, height() - 1); } -HFlow::HFlow(QWidget *parent, const char *name) - : QFrame(parent, name), m_preview(false) +HFlow::HFlow(TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), m_preview(false) {} void -HFlow::paintEvent(QPaintEvent *) +HFlow::paintEvent(TQPaintEvent *) { if(m_preview) return; - QPainter p(this); - p.setPen(QPen(magenta, 2, Qt::DashLine)); + TQPainter p(this); + p.setPen(TQPen(magenta, 2, TQt::DashLine)); p.drawRect(1, 1, width()-1, height() - 1); } -VFlow::VFlow(QWidget *parent, const char *name) - : QFrame(parent, name), m_preview(false) +VFlow::VFlow(TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), m_preview(false) {} void -VFlow::paintEvent(QPaintEvent *) +VFlow::paintEvent(TQPaintEvent *) { if(m_preview) return; - QPainter p(this); - p.setPen(QPen(cyan, 2, Qt::DashLine)); + TQPainter p(this); + p.setPen(TQPen(cyan, 2, TQt::DashLine)); p.drawRect(1, 1, width()-1, height() - 1); } -QSize -VFlow::sizeHint() const +TQSize +VFlow::tqsizeHint() const { - if(layout()) - return layout()->sizeHint(); + if(tqlayout()) + return tqlayout()->tqsizeHint(); else - return QSize(700, 50); // default + return TQSize(700, 50); // default } /////// Tab related KCommand (to allow tab creation/deletion undoing) -InsertPageCommand::InsertPageCommand(KFormDesigner::Container *container, QWidget *parent) +InsertPageCommand::InsertPageCommand(KFormDesigner::Container *container, TQWidget *tqparent) : KCommand() { m_containername = container->widget()->name(); m_form = container->form(); - m_parentname = parent->name(); + m_parentname = tqparent->name(); m_pageid = -1; } @@ -241,31 +241,31 @@ void InsertPageCommand::execute() { KFormDesigner::Container *container = m_form->objectTree()->lookup(m_containername)->container(); - QWidget *parent = m_form->objectTree()->lookup(m_parentname)->widget(); + TQWidget *tqparent = m_form->objectTree()->lookup(m_parentname)->widget(); if(m_name.isEmpty()) { m_name = container->form()->objectTree()->generateUniqueName( - container->form()->library()->displayName("QWidget").latin1(), + container->form()->library()->displayName(TQWIDGET_OBJECT_NAME_STRING).latin1(), /*!numberSuffixRequired*/false); } - QWidget *page = container->form()->library()->createWidget("QWidget", parent, m_name.latin1(), container); -// QWidget *page = new ContainerWidget(parent, m_name.latin1()); -// new KFormDesigner::Container(container, page, parent); + TQWidget *page = container->form()->library()->createWidget(TQWIDGET_OBJECT_NAME_STRING, tqparent, m_name.latin1(), container); +// TQWidget *page = new ContainerWidget(tqparent, m_name.latin1()); +// new KFormDesigner::Container(container, page, tqparent); - QCString classname = parent->className(); + TQCString classname = tqparent->className(); if(classname == "KFDTabWidget") { - TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(parent); - QString n = i18n("Page %1").arg(tab->count() + 1); + TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(tqparent); + TQString n = i18n("Page %1").tqarg(tab->count() + 1); tab->addTab(page, n); tab->showPage(page); KFormDesigner::ObjectTreeItem *item = container->form()->objectTree()->lookup(m_name); item->addModifiedProperty("title", n); } - else if(classname == "QWidgetStack") + else if(classname == TQWIDGETSTACK_OBJECT_NAME_STRING) { - QWidgetStack *stack = (QWidgetStack*)parent; + TQWidgetStack *stack = (TQWidgetStack*)tqparent; stack->addWidget(page, m_pageid); stack->raiseWidget(page); m_pageid = stack->id(page); @@ -278,22 +278,22 @@ InsertPageCommand::execute() void InsertPageCommand::unexecute() { - QWidget *page = m_form->objectTree()->lookup(m_name)->widget(); - QWidget *parent = m_form->objectTree()->lookup(m_parentname)->widget(); + TQWidget *page = m_form->objectTree()->lookup(m_name)->widget(); + TQWidget *tqparent = m_form->objectTree()->lookup(m_parentname)->widget(); KFormDesigner::WidgetList list; list.append(page); KCommand *com = new KFormDesigner::DeleteWidgetCommand(list, m_form); - QCString classname = parent->className(); + TQCString classname = tqparent->className(); if(classname == "KFDTabWidget") { - TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(parent); + TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(tqparent); tab->removePage(page); } - else if(classname == "QWidgetStack") + else if(classname == TQWIDGETSTACK_OBJECT_NAME_STRING) { - QWidgetStack *stack = (QWidgetStack*)parent; + TQWidgetStack *stack = (TQWidgetStack*)tqparent; int id = stack->id(page) - 1; while(!stack->widget(id)) id--; @@ -306,7 +306,7 @@ InsertPageCommand::unexecute() delete com; } -QString +TQString InsertPageCommand::name() const { return i18n("Add Page"); @@ -314,20 +314,20 @@ InsertPageCommand::name() const /////// Sub forms ////////////////////////: -SubForm::SubForm(QWidget *parent, const char *name) -: QScrollView(parent, name), m_form(0), m_widget(0) +SubForm::SubForm(TQWidget *tqparent, const char *name) +: TQScrollView(tqparent, name), m_form(0), m_widget(0) { - setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - viewport()->setPaletteBackgroundColor(colorGroup().mid()); + setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken); + viewport()->setPaletteBackgroundColor(tqcolorGroup().mid()); } void -SubForm::setFormName(const QString &name) +SubForm::setFormName(const TQString &name) { if(name.isEmpty()) return; - QFileInfo info(name); + TQFileInfo info(name); if(!info.exists() || (KFormDesigner::FormManager::self()->activeForm() && (info.fileName() == KFormDesigner::FormManager::self()->activeForm()->filename()) ) ) @@ -335,7 +335,7 @@ SubForm::setFormName(const QString &name) // we create the container widget delete m_widget; - m_widget = new QWidget(viewport(), "subform_widget"); + m_widget = new TQWidget(viewport(), "subform_widget"); // m_widget->show(); addChild(m_widget); m_form = new KFormDesigner::Form( @@ -352,12 +352,12 @@ SubForm::setFormName(const QString &name) ///// The factory ///////////////////////// -ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringList &) - : KFormDesigner::WidgetFactory(parent, "containers") +ContainerFactory::ContainerFactory(TQObject *tqparent, const char *, const TQStringList &) + : KFormDesigner::WidgetFactory(tqparent, "containers") { KFormDesigner::WidgetInfo *wBtnGroup = new KFormDesigner::WidgetInfo(this); wBtnGroup->setPixmap("frame"); - wBtnGroup->setClassName("QButtonGroup"); + wBtnGroup->setClassName(TQBUTTONGROUP_OBJECT_NAME_STRING); wBtnGroup->setName(i18n("Button Group")); wBtnGroup->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "buttonGroup")); @@ -369,11 +369,11 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL wTabWidget->setClassName("KFDTabWidget"); #if KDE_VERSION >= KDE_MAKE_VERSION(3,1,9) wTabWidget->addAlternateClassName("KTabWidget"); - wTabWidget->addAlternateClassName("QTabWidget"); -//tmp: wTabWidget->setSavingName("QTabWidget"); + wTabWidget->addAlternateClassName(TQTABWIDGET_OBJECT_NAME_STRING); +//tmp: wTabWidget->setSavingName(TQTABWIDGET_OBJECT_NAME_STRING); wTabWidget->setSavingName("KTabWidget"); #else - wTabWidget->setSavingName("QTabWidget"); + wTabWidget->setSavingName(TQTABWIDGET_OBJECT_NAME_STRING); #endif wTabWidget->setIncludeFileName("ktabwidget.h"); wTabWidget->setName(i18n("Tab Widget")); @@ -384,7 +384,7 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wWidget = new KFormDesigner::WidgetInfo(this); wWidget->setPixmap("frame"); - wWidget->setClassName("QWidget"); + wWidget->setClassName(TQWIDGET_OBJECT_NAME_STRING); wWidget->addAlternateClassName("ContainerWidget"); wWidget->setName(i18n("Basic container")); wWidget->setNamePrefix( @@ -394,7 +394,7 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wGroupBox = new KFormDesigner::WidgetInfo(this); wGroupBox->setPixmap("groupbox"); - wGroupBox->setClassName("QGroupBox"); + wGroupBox->setClassName(TQGROUPBOX_OBJECT_NAME_STRING); wGroupBox->addAlternateClassName("GroupBox"); wGroupBox->setName(i18n("Group Box")); wGroupBox->setNamePrefix( @@ -404,7 +404,7 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wFrame = new KFormDesigner::WidgetInfo(this); wFrame->setPixmap("frame"); - wFrame->setClassName("QFrame"); + wFrame->setClassName(TQFRAME_OBJECT_NAME_STRING); wFrame->setName(i18n("Frame")); wFrame->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "frame")); @@ -413,7 +413,7 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wWidgetStack = new KFormDesigner::WidgetInfo(this); wWidgetStack->setPixmap("widgetstack"); - wWidgetStack->setClassName("QWidgetStack"); + wWidgetStack->setClassName(TQWIDGETSTACK_OBJECT_NAME_STRING); wWidgetStack->setName(i18n("Widget Stack")); wWidgetStack->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "widgetStack")); @@ -451,11 +451,11 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL //! @todo horizontal/vertical splitter icons wSplitter->setPixmap("frame"); wSplitter->setClassName("Splitter"); - wSplitter->addAlternateClassName("QSplitter"); + wSplitter->addAlternateClassName(TQSPLITTER_OBJECT_NAME_STRING); wSplitter->setName(i18n("Splitter")); wSplitter->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "splitter")); - wSplitter->setDescription(i18n("A container that enables user to resize its children")); + wSplitter->setDescription(i18n("A container that enables user to resize its tqchildren")); addClass(wSplitter); KFormDesigner::WidgetInfo *wHFlow = new KFormDesigner::WidgetInfo(this); @@ -504,14 +504,14 @@ ContainerFactory::ContainerFactory(QObject *parent, const char *, const QStringL m_propValDesc["Triangular"] = i18n("for Tab Shape", "Triangular"); } -QWidget* -ContainerFactory::createWidget(const QCString &c, QWidget *p, const char *n, +TQWidget* +ContainerFactory::createWidget(const TQCString &c, TQWidget *p, const char *n, KFormDesigner::Container *container, int options) { - if(c == "QButtonGroup") + if(c == TQBUTTONGROUP_OBJECT_NAME_STRING) { - QString text = container->form()->library()->textForWidgetName(n, c); - QButtonGroup *w = new QButtonGroup(/*i18n("Button Group")*/text, p, n); + TQString text = container->form()->library()->textForWidgetName(n, c); + TQButtonGroup *w = new TQButtonGroup(/*i18n("Button Group")*/text, p, n); new KFormDesigner::Container(container, w, container); return w; } @@ -520,7 +520,7 @@ ContainerFactory::createWidget(const QCString &c, QWidget *p, const char *n, KFDTabWidget *tab = new KFDTabWidget(p, n); #if defined(USE_KTabWidget) && KDE_VERSION >= KDE_MAKE_VERSION(3,1,9) tab->setTabReorderingEnabled(true); - connect(tab, SIGNAL(movedTab(int,int)), this, SLOT(reorderTabs(int,int))); + connect(tab, TQT_SIGNAL(movedTab(int,int)), this, TQT_SLOT(reorderTabs(int,int))); #endif container->form()->objectTree()->addItem(container->objectTree(), new KFormDesigner::ObjectTreeItem( @@ -538,32 +538,32 @@ ContainerFactory::createWidget(const QCString &c, QWidget *p, const char *n, return tab; } - else if(c == "QWidget" || c=="ContainerWidget") + else if(c == TQWIDGET_OBJECT_NAME_STRING || c=="ContainerWidget") { - QWidget *w = new ContainerWidget(p, n); - new KFormDesigner::Container(container, w, p); + TQWidget *w = new ContainerWidget(p, n); + new KFormDesigner::Container(container, w, TQT_TQOBJECT(p)); return w; } - else if(c == "QGroupBox" || c == "GroupBox") + else if(c == TQGROUPBOX_OBJECT_NAME_STRING || c == "GroupBox") { - QString text = container->form()->library()->textForWidgetName(n, c); - QGroupBox *w = new GroupBox(text, p, n); + TQString text = container->form()->library()->textForWidgetName(n, c); + TQGroupBox *w = new GroupBox(text, p, n); new KFormDesigner::Container(container, w, container); return w; } - else if(c == "QFrame") + else if(c == TQFRAME_OBJECT_NAME_STRING) { - QFrame *w = new QFrame(p, n); + TQFrame *w = new TQFrame(p, n); w->setLineWidth(2); - w->setFrameStyle(QFrame::StyledPanel|QFrame::Raised); + w->setFrameStyle(TQFrame::StyledPanel|TQFrame::Raised); new KFormDesigner::Container(container, w, container); return w; } - else if(c == "QWidgetStack") + else if(c == TQWIDGETSTACK_OBJECT_NAME_STRING) { - QWidgetStack *stack = new QWidgetStack(p, n); + TQWidgetStack *stack = new TQWidgetStack(p, n); stack->setLineWidth(2); - stack->setFrameStyle(QFrame::StyledPanel|QFrame::Raised); + stack->setFrameStyle(TQFrame::StyledPanel|TQFrame::Raised); container->form()->objectTree()->addItem( container->objectTree(), new KFormDesigner::ObjectTreeItem( container->form()->library()->displayName(c), n, stack, container)); @@ -606,8 +606,8 @@ ContainerFactory::createWidget(const QCString &c, QWidget *p, const char *n, SubForm *subform = new SubForm(p, n); return subform; } - else if(c == "QSplitter") { - QSplitter *split = new QSplitter(p, n); + else if(c == TQSPLITTER_OBJECT_NAME_STRING) { + TQSplitter *split = new TQSplitter(p, n); if (0 == (options & WidgetFactory::AnyOrientation)) split->setOrientation( (options & WidgetFactory::VerticalOrientation) ? Qt::Vertical : Qt::Horizontal); @@ -619,14 +619,14 @@ ContainerFactory::createWidget(const QCString &c, QWidget *p, const char *n, } bool -ContainerFactory::previewWidget(const QCString &classname, QWidget *widget, KFormDesigner::Container *container) +ContainerFactory::previewWidget(const TQCString &classname, TQWidget *widget, KFormDesigner::Container *container) { if(classname == "WidgetStack") { - QWidgetStack *stack = ((QWidgetStack*)widget); + TQWidgetStack *stack = ((TQWidgetStack*)widget); KFormDesigner::ObjectTreeItem *tree = container->form()->objectTree()->lookup(widget->name()); - if(!tree->modifiedProperties()->contains("frameShape")) - stack->setFrameStyle(QFrame::NoFrame); + if(!tree->modifiedProperties()->tqcontains("frameShape")) + stack->setFrameStyle(TQFrame::NoFrame); } else if(classname == "HBox") ((HBox*)widget)->setPreviewMode(); @@ -644,53 +644,53 @@ ContainerFactory::previewWidget(const QCString &classname, QWidget *widget, KFor } bool -ContainerFactory::createMenuActions(const QCString &classname, QWidget *w, QPopupMenu *menu, +ContainerFactory::createMenuActions(const TQCString &classname, TQWidget *w, TQPopupMenu *menu, KFormDesigner::Container *container) { setWidget(w, container); //m_widget = w; // m_container = container; - if((classname == "KFDTabWidget") || (w->parentWidget()->parentWidget()->inherits("QTabWidget"))) + if((classname == "KFDTabWidget") || (w->tqparentWidget()->tqparentWidget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING))) { - if(w->parentWidget()->parentWidget()->inherits("QTabWidget")) + if(w->tqparentWidget()->tqparentWidget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) { - //m_widget = w->parentWidget()->parentWidget(); - setWidget(w->parentWidget()->parentWidget(), m_container->toplevel()); + //m_widget = w->tqparentWidget()->tqparentWidget(); + setWidget(w->tqparentWidget()->tqparentWidget(), m_container->toplevel()); // m_container = m_container->toplevel(); } - int id = menu->insertItem(SmallIconSet("tab_new"), i18n("Add Page"), this, SLOT(addTabPage()) ); - id = menu->insertItem(SmallIconSet("edit"), i18n("Rename Page..."), this, SLOT(renameTabPage())); - id = menu->insertItem(SmallIconSet("tab_remove"), i18n("Remove Page"), this, SLOT(removeTabPage())); + int id = menu->insertItem(SmallIconSet("tab_new"), i18n("Add Page"), this, TQT_SLOT(addTabPage()) ); + id = menu->insertItem(SmallIconSet("edit"), i18n("Rename Page..."), this, TQT_SLOT(renameTabPage())); + id = menu->insertItem(SmallIconSet("tab_remove"), i18n("Remove Page"), this, TQT_SLOT(removeTabPage())); // if( dynamic_cast<TabWidgetBase*>(m_widget)->count() == 1) if( dynamic_cast<TabWidgetBase*>(widget())->count() == 1) menu->setItemEnabled(id, false); return true; } - else if(w->parentWidget()->isA("QWidgetStack") && !w->parentWidget()->parentWidget()->inherits("QTabWidget")) + else if(w->tqparentWidget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING) && !w->tqparentWidget()->tqparentWidget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) { - //m_widget = w->parentWidget(); - QWidgetStack *stack = (QWidgetStack*)w->parentWidget(); //m_widget; + //m_widget = w->tqparentWidget(); + TQWidgetStack *stack = (TQWidgetStack*)w->tqparentWidget(); //m_widget; setWidget( - w->parentWidget(), - container->form()->objectTree()->lookup(stack->name())->parent()->container() + w->tqparentWidget(), + container->form()->objectTree()->lookup(stack->name())->tqparent()->container() ); -// m_container = container->form()->objectTree()->lookup(m_widget->name())->parent()->container(); -// m_container = container->form()->objectTree()->lookup(stack->name())->parent()->container(); +// m_container = container->form()->objectTree()->lookup(m_widget->name())->tqparent()->container(); +// m_container = container->form()->objectTree()->lookup(stack->name())->tqparent()->container(); - int id = menu->insertItem(SmallIconSet("tab_new"), i18n("Add Page"), this, SLOT(addStackPage()) ); + int id = menu->insertItem(SmallIconSet("tab_new"), i18n("Add Page"), this, TQT_SLOT(addStackPage()) ); - id = menu->insertItem(SmallIconSet("tab_remove"), i18n("Remove Page"), this, SLOT(removeStackPage()) ); -// if( ((QWidgetStack*)m_widget)->children()->count() == 4) // == the stack has only one page - if(stack->children()->count() == 4) // == the stack has only one page + id = menu->insertItem(SmallIconSet("tab_remove"), i18n("Remove Page"), this, TQT_SLOT(removeStackPage()) ); +// if( ((TQWidgetStack*)m_widget)->tqchildren()->count() == 4) // == the stack has only one page + if(stack->childrenListObject().count() == 4) // == the stack has only one page menu->setItemEnabled(id, false); - id = menu->insertItem(SmallIconSet("next"), i18n("Jump to Next Page"), this, SLOT(nextStackPage())); + id = menu->insertItem(SmallIconSet("next"), i18n("Jump to Next Page"), this, TQT_SLOT(nextStackPage())); if(!stack->widget(stack->id(stack->visibleWidget())+1)) menu->setItemEnabled(id, false); - id = menu->insertItem(SmallIconSet("previous"), i18n("Jump to Previous Page"), this, SLOT(prevStackPage())); + id = menu->insertItem(SmallIconSet("previous"), i18n("Jump to Previous Page"), this, TQT_SLOT(prevStackPage())); if(!stack->widget(stack->id(stack->visibleWidget()) -1) ) menu->setItemEnabled(id, false); return true; @@ -699,38 +699,38 @@ ContainerFactory::createMenuActions(const QCString &classname, QWidget *w, QPopu } bool -ContainerFactory::startEditing(const QCString &classname, QWidget *w, KFormDesigner::Container *container) +ContainerFactory::startEditing(const TQCString &classname, TQWidget *w, KFormDesigner::Container *container) { m_container = container; - if(classname == "QButtonGroup") + if(classname == TQBUTTONGROUP_OBJECT_NAME_STRING) { - QButtonGroup *group = static_cast<QButtonGroup*>(w); - QRect r = QRect(group->x()+2, group->y()-5, group->width()-10, w->fontMetrics().height() + 10); - createEditor(classname, group->title(), group, container, r, Qt::AlignAuto); + TQButtonGroup *group = static_cast<TQButtonGroup*>(w); + TQRect r = TQRect(group->x()+2, group->y()-5, group->width()-10, w->fontMetrics().height() + 10); + createEditor(classname, group->title(), group, container, r, TQt::AlignAuto); return true; } - if(classname == "QGroupBox" || classname == "GroupBox") + if(classname == TQGROUPBOX_OBJECT_NAME_STRING || classname == "GroupBox") { - QGroupBox *group = static_cast<QGroupBox*>(w); - QRect r = QRect(group->x()+2, group->y()-5, group->width()-10, w->fontMetrics().height() + 10); - createEditor(classname, group->title(), group, container, r, Qt::AlignAuto); + TQGroupBox *group = static_cast<TQGroupBox*>(w); + TQRect r = TQRect(group->x()+2, group->y()-5, group->width()-10, w->fontMetrics().height() + 10); + createEditor(classname, group->title(), group, container, r, TQt::AlignAuto); return true; } return false; } bool -ContainerFactory::saveSpecialProperty(const QCString &, const QString &name, const QVariant &, QWidget *w, QDomElement &parentNode, QDomDocument &parent) +ContainerFactory::saveSpecialProperty(const TQCString &, const TQString &name, const TQVariant &, TQWidget *w, TQDomElement &tqparentNode, TQDomDocument &tqparent) { - if((name == "title") && (w->parentWidget()->parentWidget()->inherits("QTabWidget"))) + if((name == "title") && (w->tqparentWidget()->tqparentWidget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING))) { - TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(w->parentWidget()->parentWidget()); - KFormDesigner::FormIO::savePropertyElement(parentNode, parent, "attribute", "title", tab->tabLabel(w)); + TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(w->tqparentWidget()->tqparentWidget()); + KFormDesigner::FormIO::savePropertyElement(tqparentNode, tqparent, "attribute", "title", tab->tabLabel(w)); } - else if((name == "id") && (w->parentWidget()->isA("QWidgetStack"))) + else if((name == "id") && (w->tqparentWidget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING))) { - QWidgetStack *stack = (QWidgetStack*)w->parentWidget(); - KFormDesigner::FormIO::savePropertyElement(parentNode, parent, "attribute", "id", stack->id(w)); + TQWidgetStack *stack = (TQWidgetStack*)w->tqparentWidget(); + KFormDesigner::FormIO::savePropertyElement(tqparentNode, tqparent, "attribute", "id", stack->id(w)); } else return false; @@ -738,21 +738,21 @@ ContainerFactory::saveSpecialProperty(const QCString &, const QString &name, con } bool -ContainerFactory::readSpecialProperty(const QCString &, QDomElement &node, QWidget *w, KFormDesigner::ObjectTreeItem *item) +ContainerFactory::readSpecialProperty(const TQCString &, TQDomElement &node, TQWidget *w, KFormDesigner::ObjectTreeItem *item) { - QString name = node.attribute("name"); - if((name == "title") && (item->parent()->widget()->inherits("QTabWidget"))) + TQString name = node.attribute("name"); + if((name == "title") && (item->tqparent()->widget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING))) { - TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(w->parentWidget()); + TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(w->tqparentWidget()); tab->addTab(w, node.firstChild().toElement().text()); item->addModifiedProperty("title", node.firstChild().toElement().text()); return true; } - if((name == "id") && (w->parentWidget()->isA("QWidgetStack"))) + if((name == "id") && (w->tqparentWidget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING))) { - QWidgetStack *stack = (QWidgetStack*)w->parentWidget(); - int id = KFormDesigner::FormIO::readPropertyValue(node.firstChild(), w, name).toInt(); + TQWidgetStack *stack = (TQWidgetStack*)w->tqparentWidget(); + int id = KFormDesigner::FormIO::readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toInt(); stack->addWidget(w, id); stack->raiseWidget(w); item->addModifiedProperty("id", id); @@ -762,20 +762,20 @@ ContainerFactory::readSpecialProperty(const QCString &, QDomElement &node, QWidg return false; } -QValueList<QCString> -ContainerFactory::autoSaveProperties(const QCString &c) +TQValueList<TQCString> +ContainerFactory::autoSaveProperties(const TQCString &c) { - QValueList<QCString> lst; + TQValueList<TQCString> lst; // if(c == "SubForm") // lst << "formName"; - if(c == "QSplitter") + if(c == TQSPLITTER_OBJECT_NAME_STRING) lst << "orientation"; return lst; } bool -ContainerFactory::isPropertyVisibleInternal(const QCString &classname, - QWidget *w, const QCString &property, bool isTopLevel) +ContainerFactory::isPropertyVisibleInternal(const TQCString &classname, + TQWidget *w, const TQCString &property, bool isTopLevel) { bool ok = true; @@ -784,7 +784,7 @@ ContainerFactory::isPropertyVisibleInternal(const QCString &classname, { return property == "name" || property == "geometry"; } - else if (classname == "QGroupBox" || classname=="GroupBox") { + else if (classname == TQGROUPBOX_OBJECT_NAME_STRING || classname=="GroupBox") { ok = #ifdef KEXI_NO_UNFINISHED /*! @todo Hidden for now in Kexi. "checkable" and "checked" props need adding @@ -803,16 +803,16 @@ child widgets become frozen when checked==true */ } bool -ContainerFactory::changeText(const QString &text) +ContainerFactory::changeText(const TQString &text) { changeProperty("title", text, m_container->form()); return true; } void -ContainerFactory::resizeEditor(QWidget *editor, QWidget *widget, const QCString &) +ContainerFactory::resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &) { - QSize s = widget->size(); + TQSize s = widget->size(); editor->move(widget->x() + 2, widget->y() - 5); editor->resize(s.width() - 20, widget->fontMetrics().height() +10); } @@ -821,8 +821,8 @@ ContainerFactory::resizeEditor(QWidget *editor, QWidget *widget, const QCString void ContainerFactory::addTabPage() { -// if (!m_widget->inherits("QTabWidget")) - if (!widget()->inherits("QTabWidget")) +// if (!m_widget->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) + if (!widget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) return; KCommand *com = new InsertPageCommand(m_container, widget()); if(dynamic_cast<TabWidgetBase*>(widget())->count() == 0) @@ -836,10 +836,10 @@ void ContainerFactory::addTabPage() void ContainerFactory::removeTabPage() { - if (!widget()->inherits("QTabWidget")) + if (!widget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) return; TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(widget()); - QWidget *w = tab->currentPage(); + TQWidget *w = tab->currentPage(); KFormDesigner::WidgetList list; list.append(w); @@ -850,17 +850,17 @@ void ContainerFactory::removeTabPage() void ContainerFactory::renameTabPage() { - if (!widget()->inherits("QTabWidget")) + if (!widget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING)) return; TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(widget()); - QWidget *w = tab->currentPage(); + TQWidget *w = tab->currentPage(); bool ok; - QString name = KInputDialog::getText(i18n("New Page Title"), i18n("Enter a new title for the current page:"), + TQString name = KInputDialog::getText(i18n("New Page Title"), i18n("Enter a new title for the current page:"), #if KDE_VERSION < KDE_MAKE_VERSION(3,1,9) - QLineEdit::Normal, + TQLineEdit::Normal, #endif - tab->tabLabel(w), &ok, w->topLevelWidget()); + tab->tabLabel(w), &ok, w->tqtopLevelWidget()); if(ok) tab->changeTab(w, name); } @@ -868,20 +868,20 @@ void ContainerFactory::renameTabPage() void ContainerFactory::reorderTabs(int oldpos, int newpos) { KFormDesigner::ObjectTreeItem *tab - = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(sender()->name()); + = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name()); if(!tab) return; - KFormDesigner::ObjectTreeItem *item = tab->children()->take(oldpos); - tab->children()->insert(newpos, item); + KFormDesigner::ObjectTreeItem *item = tab->tqchildren()->take(oldpos); + tab->tqchildren()->insert(newpos, item); } void ContainerFactory::addStackPage() { - if (!widget()->isA("QWidgetStack")) + if (!widget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING)) return; KCommand *com = new InsertPageCommand(m_container, widget()); - if(!((QWidgetStack*)widget())->visibleWidget()) + if(!((TQWidgetStack*)widget())->visibleWidget()) { com->execute(); delete com; @@ -892,10 +892,10 @@ void ContainerFactory::addStackPage() void ContainerFactory::removeStackPage() { - if (!widget()->isA("QWidgetStack")) + if (!widget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING)) return; - QWidgetStack *stack = (QWidgetStack*)widget(); - QWidget *page = stack->visibleWidget(); + TQWidgetStack *stack = (TQWidgetStack*)widget(); + TQWidget *page = stack->visibleWidget(); KFormDesigner::WidgetList list; list.append(page); @@ -913,7 +913,7 @@ void ContainerFactory::removeStackPage() void ContainerFactory::prevStackPage() { - QWidgetStack *stack = (QWidgetStack*)widget(); + TQWidgetStack *stack = (TQWidgetStack*)widget(); int id = stack->id(stack->visibleWidget()) - 1; if(stack->widget(id)) stack->raiseWidget(id); @@ -921,7 +921,7 @@ void ContainerFactory::prevStackPage() void ContainerFactory::nextStackPage() { - QWidgetStack *stack = (QWidgetStack*)widget(); + TQWidgetStack *stack = (TQWidgetStack*)widget(); int id = stack->id(stack->visibleWidget()) + 1; if(stack->widget(id)) stack->raiseWidget(id); diff --git a/kexi/formeditor/factories/containerfactory.h b/kexi/formeditor/factories/containerfactory.h index 1092d852..b8623fad 100644 --- a/kexi/formeditor/factories/containerfactory.h +++ b/kexi/formeditor/factories/containerfactory.h @@ -37,220 +37,230 @@ namespace KFormDesigner class InsertPageCommand : public KCommand { public: - InsertPageCommand(KFormDesigner::Container *container, QWidget *widget); + InsertPageCommand(KFormDesigner::Container *container, TQWidget *widget); virtual void execute(); virtual void unexecute(); - virtual QString name() const; + virtual TQString name() const; protected: KFormDesigner::Form *m_form; - QString m_containername; - QString m_name; - QString m_parentname; + TQString m_containername; + TQString m_name; + TQString m_parentname; int m_pageid; }; //! Helper widget (used when using 'Lay out horizontally') -class KFORMEDITOR_EXPORT HBox : public QFrame +class KFORMEDITOR_EXPORT HBox : public TQFrame { Q_OBJECT + TQ_OBJECT public: - HBox(QWidget *parent, const char *name); + HBox(TQWidget *tqparent, const char *name); virtual ~HBox(){;} void setPreviewMode() {m_preview = true;} - virtual void paintEvent(QPaintEvent *ev); + virtual void paintEvent(TQPaintEvent *ev); protected: bool m_preview; }; //! Helper widget (used when using 'Lay out vertically') -class KFORMEDITOR_EXPORT VBox : public QFrame +class KFORMEDITOR_EXPORT VBox : public TQFrame { Q_OBJECT + TQ_OBJECT public: - VBox(QWidget *parent, const char *name); + VBox(TQWidget *tqparent, const char *name); virtual ~VBox(){;} void setPreviewMode() {m_preview = true;} - virtual void paintEvent(QPaintEvent *ev); + virtual void paintEvent(TQPaintEvent *ev); protected: bool m_preview; }; //! Helper widget (used when using 'Lay out in a grid') -class KFORMEDITOR_EXPORT Grid : public QFrame +class KFORMEDITOR_EXPORT Grid : public TQFrame { Q_OBJECT + TQ_OBJECT public: - Grid(QWidget *parent, const char *name); + Grid(TQWidget *tqparent, const char *name); virtual ~Grid(){;} void setPreviewMode() {m_preview = true;} - virtual void paintEvent(QPaintEvent *ev); + virtual void paintEvent(TQPaintEvent *ev); protected: bool m_preview; }; //! Helper widget (used when using 'Lay out with horizontal flow') -class KFORMEDITOR_EXPORT HFlow : public QFrame +class KFORMEDITOR_EXPORT HFlow : public TQFrame { Q_OBJECT + TQ_OBJECT public: - HFlow(QWidget *parent, const char *name); + HFlow(TQWidget *tqparent, const char *name); virtual ~HFlow(){;} void setPreviewMode() {m_preview = true;} - virtual void paintEvent(QPaintEvent *ev); + virtual void paintEvent(TQPaintEvent *ev); protected: bool m_preview; }; //! Helper widget (used when using 'Lay out with horizontal flow') -class KFORMEDITOR_EXPORT VFlow : public QFrame +class KFORMEDITOR_EXPORT VFlow : public TQFrame { Q_OBJECT + TQ_OBJECT public: - VFlow(QWidget *parent, const char *name); + VFlow(TQWidget *tqparent, const char *name); virtual ~VFlow(){;} void setPreviewMode() {m_preview = true;} - virtual void paintEvent(QPaintEvent *ev); - virtual QSize sizeHint() const; + virtual void paintEvent(TQPaintEvent *ev); + virtual TQSize tqsizeHint() const; protected: bool m_preview; }; //! A simple container widget -class KFORMEDITOR_EXPORT ContainerWidget : public QWidget +class KFORMEDITOR_EXPORT ContainerWidget : public TQWidget { Q_OBJECT + TQ_OBJECT friend class KFDTabWidget; public: - ContainerWidget(QWidget *parent, const char *name); + ContainerWidget(TQWidget *tqparent, const char *name); virtual ~ContainerWidget(); - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface - virtual void dragMoveEvent( QDragMoveEvent *e ); + virtual void dragMoveEvent( TQDragMoveEvent *e ); //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface - virtual void dropEvent( QDropEvent *e ); + virtual void dropEvent( TQDropEvent *e ); signals: //! Needed to control dragging over the container's surface - void handleDragMoveEvent(QDragMoveEvent *e); + void handleDragMoveEvent(TQDragMoveEvent *e); //! Needed to control dropping on the container's surface - void handleDropEvent(QDropEvent *e); + void handleDropEvent(TQDropEvent *e); }; //! A tab widget class KFORMEDITOR_EXPORT KFDTabWidget : public KFormDesigner::TabWidget { Q_OBJECT + TQ_OBJECT public: - KFDTabWidget(QWidget *parent, const char *name); + KFDTabWidget(TQWidget *tqparent, const char *name); virtual ~KFDTabWidget(); - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface - virtual void dragMoveEvent( QDragMoveEvent *e ); + virtual void dragMoveEvent( TQDragMoveEvent *e ); //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface - virtual void dropEvent( QDropEvent *e ); + virtual void dropEvent( TQDropEvent *e ); signals: //! Needed to control dragging over the container's surface - void handleDragMoveEvent(QDragMoveEvent *e); + void handleDragMoveEvent(TQDragMoveEvent *e); //! Needed to control dropping on the container's surface - void handleDropEvent(QDropEvent *e); + void handleDropEvent(TQDropEvent *e); }; //! A group box widget -class KFORMEDITOR_EXPORT GroupBox : public QGroupBox +class KFORMEDITOR_EXPORT GroupBox : public TQGroupBox { Q_OBJECT + TQ_OBJECT public: - GroupBox(const QString & title, QWidget *parent, const char *name); + GroupBox(const TQString & title, TQWidget *tqparent, const char *name); virtual ~GroupBox(); //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface - virtual void dragMoveEvent( QDragMoveEvent *e ); + virtual void dragMoveEvent( TQDragMoveEvent *e ); //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface - virtual void dropEvent( QDropEvent *e ); + virtual void dropEvent( TQDropEvent *e ); signals: //! Needed to control dragging over the container's surface - void handleDragMoveEvent(QDragMoveEvent *e); + void handleDragMoveEvent(TQDragMoveEvent *e); //! Needed to control dropping on the container's surface - void handleDropEvent(QDropEvent *e); + void handleDropEvent(TQDropEvent *e); }; //! A form embedded as a widget inside other form -class KFORMEDITOR_EXPORT SubForm : public QScrollView +class KFORMEDITOR_EXPORT SubForm : public TQScrollView { Q_OBJECT - Q_PROPERTY(QString formName READ formName WRITE setFormName DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString formName READ formName WRITE setFormName DESIGNABLE true) public: - SubForm(QWidget *parent, const char *name); + SubForm(TQWidget *tqparent, const char *name); ~SubForm() {} //! \return the name of the subform inside the db - QString formName() const { return m_formName; } - void setFormName(const QString &name); + TQString formName() const { return m_formName; } + void setFormName(const TQString &name); private: // KFormDesigner::FormManager *m_manager; KFormDesigner::Form *m_form; - QWidget *m_widget; - QString m_formName; + TQWidget *m_widget; + TQString m_formName; }; //! Standard Factory for all container widgets class ContainerFactory : public KFormDesigner::WidgetFactory { Q_OBJECT + TQ_OBJECT public: - ContainerFactory(QObject *parent, const char *name, const QStringList &args); + ContainerFactory(TQObject *tqparent, const char *name, const TQStringList &args); virtual ~ContainerFactory(); - virtual QWidget *createWidget(const QCString & classname, QWidget *parent, const char *name, KFormDesigner::Container *container, + virtual TQWidget *createWidget(const TQCString & classname, TQWidget *tqparent, const char *name, KFormDesigner::Container *container, int options = DefaultOptions); - virtual bool createMenuActions(const QCString& classname, QWidget *w, QPopupMenu *menu, + virtual bool createMenuActions(const TQCString& classname, TQWidget *w, TQPopupMenu *menu, KFormDesigner::Container *container); - virtual bool startEditing(const QCString &classname, QWidget *w, + virtual bool startEditing(const TQCString &classname, TQWidget *w, KFormDesigner::Container *container); - virtual bool previewWidget(const QCString &classname, QWidget *widget, + virtual bool previewWidget(const TQCString &classname, TQWidget *widget, KFormDesigner::Container *container); - virtual bool saveSpecialProperty(const QCString &classname, const QString &name, - const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent); - virtual bool readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w, + virtual bool saveSpecialProperty(const TQCString &classname, const TQString &name, + const TQVariant &value, TQWidget *w, TQDomElement &tqparentNode, TQDomDocument &tqparent); + virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w, KFormDesigner::ObjectTreeItem *item); - virtual QValueList<QCString> autoSaveProperties(const QCString &classname); + virtual TQValueList<TQCString> autoSaveProperties(const TQCString &classname); protected: - virtual bool isPropertyVisibleInternal(const QCString &classname, QWidget *w, - const QCString &property, bool isTopLevel); - virtual bool changeText(const QString &newText); - virtual void resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname); + virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w, + const TQCString &property, bool isTopLevel); + virtual bool changeText(const TQString &newText); + virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname); public slots: void addTabPage(); @@ -263,7 +273,7 @@ class ContainerFactory : public KFormDesigner::WidgetFactory void reorderTabs(int oldpos, int newpos); private: -// QWidget *m_widget; +// TQWidget *m_widget; // KFormDesigner::Container *m_container; // KFormDesigner::FormManager *m_manager; }; diff --git a/kexi/formeditor/factories/stdwidgetfactory.cpp b/kexi/formeditor/factories/stdwidgetfactory.cpp index fade100a..b625c712 100644 --- a/kexi/formeditor/factories/stdwidgetfactory.cpp +++ b/kexi/formeditor/factories/stdwidgetfactory.cpp @@ -7,19 +7,19 @@ * License, or (at your option) any later version. * ***************************************************************************/ -#include <qlabel.h> -#include <qpopupmenu.h> -#include <qcursor.h> -#include <qradiobutton.h> -#include <qcheckbox.h> -#include <qslider.h> -#include <qobjectlist.h> -#include <qstring.h> -#include <qvariant.h> -#include <qheader.h> -#include <qdom.h> -#include <qstyle.h> -#include <qvaluevector.h> +#include <tqlabel.h> +#include <tqpopupmenu.h> +#include <tqcursor.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqslider.h> +#include <tqobjectlist.h> +#include <tqstring.h> +#include <tqvariant.h> +#include <tqheader.h> +#include <tqdom.h> +#include <tqstyle.h> +#include <tqvaluevector.h> #include <klineedit.h> #include <kpushbutton.h> @@ -36,10 +36,10 @@ #include <kdeversion.h> #if KDE_VERSION < KDE_MAKE_VERSION(3,1,9) -# include <qdatetimeedit.h> -# define KTimeWidget QTimeEdit -# define KDateWidget QDateEdit -# define KDateTimeWidget QDateTimeEdit +# include <tqdatetimeedit.h> +# define KTimeWidget TQTimeEdit +# define KDateWidget TQDateEdit +# define KDateTimeWidget TQDateTimeEdit #else # include <ktimewidget.h> # include <kdatewidget.h> @@ -57,26 +57,26 @@ #include "stdwidgetfactory.h" // Some widgets subclass to allow event filtering and some other things -KexiPictureLabel::KexiPictureLabel(const QPixmap &pix, QWidget *parent, const char *name) - : QLabel(parent, name) +KexiPictureLabel::KexiPictureLabel(const TQPixmap &pix, TQWidget *tqparent, const char *name) + : TQLabel(tqparent, name) { setPixmap(pix); setScaledContents(false); } bool -KexiPictureLabel::setProperty(const char *name, const QVariant &value) +KexiPictureLabel::setProperty(const char *name, const TQVariant &value) { - if(QString(name) == "pixmap") + if(TQString(name) == "pixmap") resize(value.toPixmap().height(), value.toPixmap().width()); - return QLabel::setProperty(name, value); + return TQLabel::setProperty(name, value); } -Line::Line(Qt::Orientation orient, QWidget *parent, const char *name) - : QFrame(parent, name) +Line::Line(Qt::Orientation orient, TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name) { setFrameShadow(Sunken); - if(orient == Horizontal) + if(orient ==Qt::Horizontal) setFrameShape(HLine); else setFrameShape(VLine); @@ -85,7 +85,7 @@ Line::Line(Qt::Orientation orient, QWidget *parent, const char *name) void Line::setOrientation(Qt::Orientation orient) { - if(orient == Horizontal) + if(orient ==Qt::Horizontal) setFrameShape(HLine); else setFrameShape(VLine); @@ -95,15 +95,15 @@ Qt::Orientation Line::orientation() const { if(frameShape() == HLine) - return Horizontal; + return Qt::Horizontal; else - return Vertical; + return Qt::Vertical; } // The factory itself -StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringList &) - : KFormDesigner::WidgetFactory(parent, "stdwidgets") +StdWidgetFactory::StdWidgetFactory(TQObject *tqparent, const char *, const TQStringList &) + : KFormDesigner::WidgetFactory(tqparent, "stdwidgets") { KFormDesigner::WidgetInfo *wFormWidget = new KFormDesigner::WidgetInfo(this); wFormWidget->setPixmap("form"); @@ -125,7 +125,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wLabel = new KFormDesigner::WidgetInfo(this); wLabel->setPixmap("label"); - wLabel->setClassName("QLabel"); + wLabel->setClassName(TQLABEL_OBJECT_NAME_STRING); wLabel->setName(i18n("Text Label")); wLabel->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "label")); @@ -136,8 +136,8 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL wPixLabel->setPixmap("pixmaplabel"); wPixLabel->setClassName("KexiPictureLabel"); wPixLabel->setName(i18n("Picture Label")); -//! @todo Qt designer compatibility: maybe use this class when QLabel has a pixmap set...? - //wPixLabel->addAlternateClassName("QLabel"); +//! @todo TQt designer compatibility: maybe use this class when TQLabel has a pixmap set...? + //wPixLabel->addAlternateClassName(TQLABEL_OBJECT_NAME_STRING); wPixLabel->setSavingName("KexiPictureLabel"); wPixLabel->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "picture")); @@ -147,7 +147,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wLineEdit = new KFormDesigner::WidgetInfo(this); wLineEdit->setPixmap("lineedit"); wLineEdit->setClassName("KLineEdit"); - wLineEdit->addAlternateClassName("QLineEdit"); + wLineEdit->addAlternateClassName(TQLINEEDIT_OBJECT_NAME_STRING); wLineEdit->setIncludeFileName("klineedit.h"); wLineEdit->setName(i18n("Line Edit")); wLineEdit->setNamePrefix( @@ -167,7 +167,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wPushButton = new KFormDesigner::WidgetInfo(this); wPushButton->setPixmap("button"); wPushButton->setClassName("KPushButton"); - wPushButton->addAlternateClassName("QPushButton"); + wPushButton->addAlternateClassName(TQPUSHBUTTON_OBJECT_NAME_STRING); wPushButton->setIncludeFileName("kpushbutton.h"); wPushButton->setName(i18n("Push Button")); wPushButton->setNamePrefix( @@ -177,7 +177,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wRadioButton = new KFormDesigner::WidgetInfo(this); wRadioButton->setPixmap("radio"); - wRadioButton->setClassName("QRadioButton"); + wRadioButton->setClassName(TQRADIOBUTTON_OBJECT_NAME_STRING); wRadioButton->setName(i18n("Option Button")); wRadioButton->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "optionButton")); @@ -186,7 +186,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wCheckBox = new KFormDesigner::WidgetInfo(this); wCheckBox->setPixmap("check"); - wCheckBox->setClassName("QCheckBox"); + wCheckBox->setClassName(TQCHECKBOX_OBJECT_NAME_STRING); wCheckBox->setName(i18n("Check Box")); wCheckBox->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "checkBox")); @@ -196,7 +196,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wSpinBox = new KFormDesigner::WidgetInfo(this); wSpinBox->setPixmap("spin"); wSpinBox->setClassName("KIntSpinBox"); - wSpinBox->addAlternateClassName("QSpinBox"); + wSpinBox->addAlternateClassName(TQSPINBOX_OBJECT_NAME_STRING); wSpinBox->setIncludeFileName("knuminput.h"); wSpinBox->setName(i18n("Spin Box")); wSpinBox->setNamePrefix( @@ -207,7 +207,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wComboBox = new KFormDesigner::WidgetInfo(this); wComboBox->setPixmap("combo"); wComboBox->setClassName("KComboBox"); - wComboBox->addAlternateClassName("QComboBox"); + wComboBox->addAlternateClassName(TQCOMBOBOX_OBJECT_NAME_STRING); wComboBox->setIncludeFileName("kcombobox.h"); wComboBox->setName(i18n("Combo Box")); wComboBox->setNamePrefix( @@ -218,7 +218,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wListBox = new KFormDesigner::WidgetInfo(this); wListBox->setPixmap("listbox"); wListBox->setClassName("KListBox"); - wListBox->addAlternateClassName("QListBox"); + wListBox->addAlternateClassName(TQLISTBOX_OBJECT_NAME_STRING); wListBox->setIncludeFileName("klistbox.h"); wListBox->setName(i18n("List Box")); wListBox->setNamePrefix( @@ -229,7 +229,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wTextEdit = new KFormDesigner::WidgetInfo(this); wTextEdit->setPixmap("textedit"); wTextEdit->setClassName("KTextEdit"); - wTextEdit->addAlternateClassName("QTextEdit"); + wTextEdit->addAlternateClassName(TQTEXTEDIT_OBJECT_NAME_STRING); wTextEdit->setIncludeFileName("ktextedit.h"); wTextEdit->setName(i18n("Text Editor")); wTextEdit->setNamePrefix( @@ -240,7 +240,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wListView = new KFormDesigner::WidgetInfo(this); wListView->setPixmap("listview"); wListView->setClassName("KListView"); - wListView->addAlternateClassName("QListView"); + wListView->addAlternateClassName(TQLISTVIEW_OBJECT_NAME_STRING); wListView->setIncludeFileName("klistview.h"); wListView->setName(i18n("List View")); wListView->setNamePrefix( @@ -250,7 +250,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wSlider = new KFormDesigner::WidgetInfo(this); wSlider->setPixmap("slider"); - wSlider->setClassName("QSlider"); + wSlider->setClassName(TQSLIDER_OBJECT_NAME_STRING); wSlider->setName(i18n("Slider")); wSlider->setNamePrefix( i18n("Widget name. This string will be used to name widgets of this class. It must _not_ contain white spaces and non latin1 characters.", "slider")); @@ -260,7 +260,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL KFormDesigner::WidgetInfo *wProgressBar = new KFormDesigner::WidgetInfo(this); wProgressBar->setPixmap("progress"); wProgressBar->setClassName("KProgress"); - wProgressBar->addAlternateClassName("QProgressBar"); + wProgressBar->addAlternateClassName(TQPROGRESSBAR_OBJECT_NAME_STRING); wProgressBar->setIncludeFileName("kprogress.h"); wProgressBar->setName(i18n("Progress Bar")); wProgressBar->setNamePrefix( @@ -281,7 +281,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL wDate->setPixmap("dateedit"); wDate->setClassName("KDateWidget"); #if KDE_VERSION >= KDE_MAKE_VERSION(3,1,9) - wDate->addAlternateClassName("QDateEdit"); + wDate->addAlternateClassName(TQDATEEDIT_OBJECT_NAME_STRING); wDate->setIncludeFileName("kdatewidget.h"); #endif wDate->setName(i18n("Date Widget")); @@ -294,7 +294,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL wTime->setPixmap("timeedit"); wTime->setClassName("KTimeWidget"); #if KDE_VERSION >= KDE_MAKE_VERSION(3,1,9) - wTime->addAlternateClassName("QTimeEdit"); + wTime->addAlternateClassName(TQTIMEEDIT_OBJECT_NAME_STRING); wTime->setIncludeFileName("ktimewidget.h"); #endif wTime->setName(i18n("Time Widget")); @@ -307,7 +307,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL wDateTime->setPixmap("datetimeedit"); wDateTime->setClassName("KDateTimeWidget"); #if KDE_VERSION >= KDE_MAKE_VERSION(3,1,9) - wDateTime->addAlternateClassName("QDateTimeEdit"); + wDateTime->addAlternateClassName(TQDATETIMEEDIT_OBJECT_NAME_STRING); wDateTime->setIncludeFileName("kdatetimewidget.h"); #endif wDateTime->setName(i18n("Date/Time Widget")); @@ -325,7 +325,7 @@ StdWidgetFactory::StdWidgetFactory(QObject *parent, const char *, const QStringL i18n("Echo mode for Line Edit widget eg. Normal, NoEcho, Password","Echo Mode"); m_propDesc["indent"] = i18n("Indent"); //line - m_propDesc["orientation"] = i18n("Orientation"); + m_propDesc["orientation"] = i18n("Qt::Orientation"); //checkbox m_propDesc["checked"] = i18n("Checked checkbox", "Checked"); m_propDesc["tristate"] = i18n("Tristate checkbox", "Tristate"); @@ -377,16 +377,16 @@ StdWidgetFactory::~StdWidgetFactory() { } -QWidget* -StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, +TQWidget* +StdWidgetFactory::createWidget(const TQCString &c, TQWidget *p, const char *n, KFormDesigner::Container *container, int options) { - QWidget *w=0; - QString text( container->form()->library()->textForWidgetName(n, c) ); + TQWidget *w=0; + TQString text( container->form()->library()->textForWidgetName(n, c) ); const bool designMode = options & KFormDesigner::WidgetFactory::DesignViewMode; - if(c == "QLabel") - w = new QLabel(text, p, n); + if(c == TQLABEL_OBJECT_NAME_STRING) + w = new TQLabel(text, p, n); else if(c == "KexiPictureLabel") w = new KexiPictureLabel(DesktopIcon("image"), p, n); @@ -394,16 +394,16 @@ StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, { w = new KLineEdit(p, n); if (designMode) - w->setCursor(QCursor(Qt::ArrowCursor)); + w->setCursor(TQCursor(TQt::ArrowCursor)); } else if(c == "KPushButton") w = new KPushButton(/*i18n("Button")*/text, p, n); - else if(c == "QRadioButton") - w = new QRadioButton(/*i18n("Radio Button")*/text, p, n); + else if(c == TQRADIOBUTTON_OBJECT_NAME_STRING) + w = new TQRadioButton(/*i18n("Radio Button")*/text, p, n); - else if(c == "QCheckBox") - w = new QCheckBox(/*i18n("Check Box")*/text, p, n); + else if(c == TQCHECKBOX_OBJECT_NAME_STRING) + w = new TQCheckBox(/*i18n("Check Box")*/text, p, n); else if(c == "KIntSpinBox") w = new KIntSpinBox(p, n); @@ -415,7 +415,7 @@ StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, w = new KListBox(p, n); else if(c == "KTextEdit") - w = new KTextEdit(/*i18n("Enter your text here")*/text, QString::null, p, n); + w = new KTextEdit(/*i18n("Enter your text here")*/text, TQString(), p, n); else if(c == "KListView") { @@ -424,23 +424,23 @@ StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, ((KListView*)w)->addColumn(i18n("Column 1")); ((KListView*)w)->setRootIsDecorated(true); } - else if(c == "QSlider") - w = new QSlider(Qt::Horizontal, p, n); + else if(c == TQSLIDER_OBJECT_NAME_STRING) + w = new TQSlider(Qt::Horizontal, p, n); else if(c == "KProgress") w = new KProgress(p, n); else if(c == "KDateWidget") - w = new KDateWidget(QDate::currentDate(), p, n); + w = new KDateWidget(TQDate::tqcurrentDate(), p, n); else if(c == "KTimeWidget") - w = new KTimeWidget(QTime::currentTime(), p, n); + w = new KTimeWidget(TQTime::currentTime(), p, n); else if(c == "KDateTimeWidget") - w = new KDateTimeWidget(QDateTime::currentDateTime(), p, n); + w = new KDateTimeWidget(TQDateTime::tqcurrentDateTime(), p, n); else if(c == "Line") - w = new Line(options & WidgetFactory::VerticalOrientation ? Line::Vertical : Line::Horizontal, p, n); + w = new Line(options & WidgetFactory::VerticalOrientation ? Qt::Vertical : Qt::Horizontal, p, n); else if(c == "Spring") { w = new Spring(p, n); @@ -457,7 +457,7 @@ StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, } bool -StdWidgetFactory::previewWidget(const QCString &classname, QWidget *widget, KFormDesigner::Container *) +StdWidgetFactory::previewWidget(const TQCString &classname, TQWidget *widget, KFormDesigner::Container *) { if(classname == "Spring") { ((Spring*)widget)->setPreviewMode(); @@ -467,17 +467,17 @@ StdWidgetFactory::previewWidget(const QCString &classname, QWidget *widget, KFor } bool -StdWidgetFactory::createMenuActions(const QCString &classname, QWidget *, QPopupMenu *menu, +StdWidgetFactory::createMenuActions(const TQCString &classname, TQWidget *, TQPopupMenu *menu, KFormDesigner::Container *) { - if((classname == "QLabel") || (classname == "KTextEdit")) + if((classname == TQLABEL_OBJECT_NAME_STRING) || (classname == "KTextEdit")) { - menu->insertItem(SmallIconSet("edit"), i18n("Edit Rich Text"), this, SLOT(editText())); + menu->insertItem(SmallIconSet("edit"), i18n("Edit Rich Text"), this, TQT_SLOT(editText())); return true; } else if(classname == "KListView") { - menu->insertItem(SmallIconSet("edit"), i18n("Edit Listview Contents"), this, SLOT(editListContents())); + menu->insertItem(SmallIconSet("edit"), i18n("Edit Listview Contents"), this, TQT_SLOT(editListContents())); return true; } @@ -485,19 +485,19 @@ StdWidgetFactory::createMenuActions(const QCString &classname, QWidget *, QPopup } bool -StdWidgetFactory::startEditing(const QCString &classname, QWidget *w, KFormDesigner::Container *container) +StdWidgetFactory::startEditing(const TQCString &classname, TQWidget *w, KFormDesigner::Container *container) { setWidget(w, container); // m_container = container; if(classname == "KLineEdit") { KLineEdit *lineedit = static_cast<KLineEdit*>(w); - createEditor(classname, lineedit->text(), lineedit, container, lineedit->geometry(), lineedit->alignment(), true); + createEditor(classname, lineedit->text(), lineedit, container, lineedit->tqgeometry(), lineedit->tqalignment(), true); return true; } - else if(classname == "QLabel") + else if(classname == TQLABEL_OBJECT_NAME_STRING) { - QLabel *label = static_cast<QLabel*>(w); + TQLabel *label = static_cast<TQLabel*>(w); if(label->textFormat() == RichText) { //m_widget = w; @@ -505,42 +505,42 @@ StdWidgetFactory::startEditing(const QCString &classname, QWidget *w, KFormDesig editText(); } else - createEditor(classname, label->text(), label, container, label->geometry(), label->alignment()); + createEditor(classname, label->text(), label, container, label->tqgeometry(), label->tqalignment()); return true; } else if(classname == "KPushButton") { KPushButton *push = static_cast<KPushButton*>(w); - QRect r = w->style().subRect(QStyle::SR_PushButtonContents, w); - QRect editorRect = QRect(push->x() + r.x(), push->y() + r.y(), r.width(), r.height()); + TQRect r = w->tqstyle().subRect(TQStyle::SR_PushButtonContents, w); + TQRect editorRect = TQRect(push->x() + r.x(), push->y() + r.y(), r.width(), r.height()); //r.setX(r.x() + 5); //r.setY(r.y() + 5); //r.setWidth(r.width()-10); //r.setHeight(r.height() - 10); - createEditor(classname, push->text(), push, container, editorRect, Qt::AlignCenter, false, false, Qt::PaletteButton); + createEditor(classname, push->text(), push, container, editorRect, TQt::AlignCenter, false, false, TQt::PaletteButton); return true; } - else if(classname == "QRadioButton") + else if(classname == TQRADIOBUTTON_OBJECT_NAME_STRING) { - QRadioButton *radio = static_cast<QRadioButton*>(w); - QRect r = w->style().subRect(QStyle::SR_RadioButtonContents, w); - QRect editorRect = QRect(radio->x() + r.x(), radio->y() + r.y(), r.width(), r.height()); - createEditor(classname, radio->text(), radio, container, editorRect, Qt::AlignAuto); + TQRadioButton *radio = static_cast<TQRadioButton*>(w); + TQRect r = w->tqstyle().subRect(TQStyle::SR_RadioButtonContents, w); + TQRect editorRect = TQRect(radio->x() + r.x(), radio->y() + r.y(), r.width(), r.height()); + createEditor(classname, radio->text(), radio, container, editorRect, TQt::AlignAuto); return true; } - else if(classname == "QCheckBox") + else if(classname == TQCHECKBOX_OBJECT_NAME_STRING) { - QCheckBox *check = static_cast<QCheckBox*>(w); - //QRect r(check->geometry()); + TQCheckBox *check = static_cast<TQCheckBox*>(w); + //TQRect r(check->tqgeometry()); //r.setX(r.x() + 20); - QRect r = w->style().subRect(QStyle::SR_CheckBoxContents, w); - QRect editorRect = QRect(check->x() + r.x(), check->y() + r.y(), r.width(), r.height()); - createEditor(classname, check->text(), check, container, editorRect, Qt::AlignAuto); + TQRect r = w->tqstyle().subRect(TQStyle::SR_CheckBoxContents, w); + TQRect editorRect = TQRect(check->x() + r.x(), check->y() + r.y(), r.width(), r.height()); + createEditor(classname, check->text(), check, container, editorRect, TQt::AlignAuto); return true; } else if((classname == "KComboBox") || (classname == "KListBox")) { - QStringList list; + TQStringList list; if(classname == "KListBox") { KListBox *listbox = (KListBox*)w; @@ -578,7 +578,7 @@ StdWidgetFactory::startEditing(const QCString &classname, QWidget *w, KFormDesig } bool -StdWidgetFactory::clearWidgetContent(const QCString &classname, QWidget *w) +StdWidgetFactory::clearWidgetContent(const TQCString &classname, TQWidget *w) { if(classname == "KLineEdit") ((KLineEdit*)w)->clear(); @@ -596,35 +596,35 @@ StdWidgetFactory::clearWidgetContent(const QCString &classname, QWidget *w) } bool -StdWidgetFactory::changeText(const QString &text) +StdWidgetFactory::changeText(const TQString &text) { - QCString n = WidgetFactory::widget()->className(); - QWidget *w = WidgetFactory::widget(); + TQCString n = WidgetFactory::widget()->className(); + TQWidget *w = WidgetFactory::widget(); if(n == "KIntSpinBox") ((KIntSpinBox*)w)->setValue(text.toInt()); else changeProperty("text", text, m_container->form()); - /* By-hand method not needed as sizeHint() can do that for us - QFontMetrics fm = w->fontMetrics(); - QSize s(fm.width( text ), fm.height()); + /* By-hand method not needed as tqsizeHint() can do that for us + TQFontMetrics fm = w->fontMetrics(); + TQSize s(fm.width( text ), fm.height()); int width; - if(n == "QLabel") // labels are resized to fit the text + if(n == TQLABEL_OBJECT_NAME_STRING) // labels are resized to fit the text { - w->resize(w->sizeHint()); + w->resize(w->tqsizeHint()); WidgetFactory::m_editor->resize(w->size()); return; } // and other widgets are just enlarged if needed else if(n == "KPushButton") - width = w->style().sizeFromContents( QStyle::CT_PushButton, w, s).width(); - else if(n == "QCheckBox") - width = w->style().sizeFromContents( QStyle::CT_CheckBox, w, s).width(); - else if(n == "QRadioButton") - width = w->style().sizeFromContents( QStyle::CT_RadioButton, w, s).width(); + width = w->style().sizeFromContents( TQStyle::CT_PushButton, w, s).width(); + else if(n == TQCHECKBOX_OBJECT_NAME_STRING) + width = w->style().sizeFromContents( TQStyle::CT_CheckBox, w, s).width(); + else if(n == TQRADIOBUTTON_OBJECT_NAME_STRING) + width = w->style().sizeFromContents( TQStyle::CT_RadioButton, w, s).width(); else return; - int width = w->sizeHint().width();*/ + int width = w->tqsizeHint().width();*/ #if 0 //not needed here, size hint is used on creation in InsertWidgetCommand::execute() if(w->width() < width) @@ -637,27 +637,27 @@ StdWidgetFactory::changeText(const QString &text) } void -StdWidgetFactory::resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname) +StdWidgetFactory::resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname) { - QSize s = widget->size(); - QPoint p = widget->pos(); - QRect r; + TQSize s = widget->size(); + TQPoint p = widget->pos(); + TQRect r; - if(classname == "QRadioButton") + if(classname == TQRADIOBUTTON_OBJECT_NAME_STRING) { - r = widget->style().subRect(QStyle::SR_RadioButtonContents, widget); + r = widget->tqstyle().subRect(TQStyle::SR_RadioButtonContents, widget); p += r.topLeft(); s.setWidth(r.width()); } - else if(classname == "QCheckBox") + else if(classname == TQCHECKBOX_OBJECT_NAME_STRING) { - r = widget->style().subRect(QStyle::SR_CheckBoxContents, widget); + r = widget->tqstyle().subRect(TQStyle::SR_CheckBoxContents, widget); p += r.topLeft(); s.setWidth(r.width()); } else if(classname == "KPushButton") { - r = widget->style().subRect(QStyle::SR_PushButtonContents, widget); + r = widget->tqstyle().subRect(TQStyle::SR_PushButtonContents, widget); p += r.topLeft(); s = r.size(); } @@ -667,16 +667,16 @@ StdWidgetFactory::resizeEditor(QWidget *editor, QWidget *widget, const QCString } bool -StdWidgetFactory::saveSpecialProperty(const QCString &classname, const QString &name, const QVariant &, QWidget *w, QDomElement &parentNode, QDomDocument &domDoc) +StdWidgetFactory::saveSpecialProperty(const TQCString &classname, const TQString &name, const TQVariant &, TQWidget *w, TQDomElement &tqparentNode, TQDomDocument &domDoc) { if(name == "list_items" && classname == "KComboBox") { KComboBox *combo = (KComboBox*)w; for(int i=0; i < combo->count(); i++) { - QDomElement item = domDoc.createElement("item"); + TQDomElement item = domDoc.createElement("item"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", combo->text(i)); - parentNode.appendChild(item); + tqparentNode.appendChild(item); } return true; } @@ -685,9 +685,9 @@ StdWidgetFactory::saveSpecialProperty(const QCString &classname, const QString & KListBox *listbox = (KListBox*)w; for(uint i=0; i < listbox->count(); i++) { - QDomElement item = domDoc.createElement("item"); + TQDomElement item = domDoc.createElement("item"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", listbox->text(i)); - parentNode.appendChild(item); + tqparentNode.appendChild(item); } return true; } @@ -697,20 +697,20 @@ StdWidgetFactory::saveSpecialProperty(const QCString &classname, const QString & // First we save the columns for(int i = 0; i < listview->columns(); i++) { - QDomElement item = domDoc.createElement("column"); + TQDomElement item = domDoc.createElement("column"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", listview->columnText(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "width", listview->columnWidth(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "resizable", listview->header()->isResizeEnabled(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "clickable", listview->header()->isClickEnabled(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "fullwidth", listview->header()->isStretchEnabled(i)); - parentNode.appendChild(item); + tqparentNode.appendChild(item); } // Then we save the list view items - QListViewItem *item = listview->firstChild(); + TQListViewItem *item = listview->firstChild(); while(item) { - saveListItem(item, parentNode, domDoc); + saveListItem(item, tqparentNode, domDoc); item = item->nextSibling(); } return true; @@ -720,17 +720,17 @@ StdWidgetFactory::saveSpecialProperty(const QCString &classname, const QString & } void -StdWidgetFactory::saveListItem(QListViewItem *item, QDomNode &parentNode, QDomDocument &domDoc) +StdWidgetFactory::saveListItem(TQListViewItem *item, TQDomNode &tqparentNode, TQDomDocument &domDoc) { - QDomElement element = domDoc.createElement("item"); - parentNode.appendChild(element); + TQDomElement element = domDoc.createElement("item"); + tqparentNode.appendChild(element); // We save the text of each column for(int i = 0; i < item->listView()->columns(); i++) KFormDesigner::FormIO::savePropertyElement(element, domDoc, "property", "text", item->text(i)); // Then we save every sub items - QListViewItem *child = item->firstChild(); + TQListViewItem *child = item->firstChild(); while(child) { saveListItem(child, element, domDoc); @@ -739,16 +739,16 @@ StdWidgetFactory::saveListItem(QListViewItem *item, QDomNode &parentNode, QDomDo } bool -StdWidgetFactory::readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w, KFormDesigner::ObjectTreeItem *) +StdWidgetFactory::readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w, KFormDesigner::ObjectTreeItem *) { - QString tag = node.tagName(); - QString name = node.attribute("name"); + TQString tag = node.tagName(); + TQString name = node.attribute("name"); if((tag == "item") && (classname == "KComboBox")) { KComboBox *combo = (KComboBox*)w; - QVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), w, name); - if(val.canCast(QVariant::Pixmap)) + TQVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), TQT_TQOBJECT(w), name); + if(val.canCast(TQVariant::Pixmap)) combo->insertItem(val.toPixmap()); else combo->insertItem(val.toString()); @@ -758,8 +758,8 @@ StdWidgetFactory::readSpecialProperty(const QCString &classname, QDomElement &no if((tag == "item") && (classname == "KListBox")) { KListBox *listbox = (KListBox*)w; - QVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), w, name); - if(val.canCast(QVariant::Pixmap)) + TQVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), TQT_TQOBJECT(w), name); + if(val.canCast(TQVariant::Pixmap)) listbox->insertItem(val.toPixmap()); else listbox->insertItem(val.toString()); @@ -770,10 +770,10 @@ StdWidgetFactory::readSpecialProperty(const QCString &classname, QDomElement &no { KListView *listview = (KListView*)w; int id=0; - for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) + for(TQDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - QString prop = n.toElement().attribute("name"); - QVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), w, name); + TQString prop = n.toElement().attribute("name"); + TQVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), TQT_TQOBJECT(w), name); if(prop == "text") id = listview->addColumn(val.toString()); else if(prop == "width") @@ -798,18 +798,18 @@ StdWidgetFactory::readSpecialProperty(const QCString &classname, QDomElement &no } void -StdWidgetFactory::readListItem(QDomElement &node, QListViewItem *parent, KListView *listview) +StdWidgetFactory::readListItem(TQDomElement &node, TQListViewItem *tqparent, KListView *listview) { - QListViewItem *item; - if(parent) - item = new KListViewItem(parent); + TQListViewItem *item; + if(tqparent) + item = new KListViewItem(tqparent); else item = new KListViewItem(listview); // We need to move the item at the end of the list - QListViewItem *last; - if(parent) - last = parent->firstChild(); + TQListViewItem *last; + if(tqparent) + last = tqparent->firstChild(); else last = listview->firstChild(); @@ -818,11 +818,11 @@ StdWidgetFactory::readListItem(QDomElement &node, QListViewItem *parent, KListVi item->moveItem(last); int i = 0; - for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) + for(TQDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement childEl = n.toElement(); - QString prop = childEl.attribute("name"); - QString tag = childEl.tagName(); + TQDomElement childEl = n.toElement(); + TQString prop = childEl.attribute("name"); + TQString tag = childEl.tagName(); // We read sub items if(tag == "item") @@ -833,7 +833,7 @@ StdWidgetFactory::readListItem(QDomElement &node, QListViewItem *parent, KListVi // and column texts else if((tag == "property") && (prop == "text")) { - QVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), listview, "item"); + TQVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), TQT_TQOBJECT(listview), "item"); item->setText(i, val.toString()); i++; } @@ -841,8 +841,8 @@ StdWidgetFactory::readListItem(QDomElement &node, QListViewItem *parent, KListVi } bool -StdWidgetFactory::isPropertyVisibleInternal(const QCString &classname, - QWidget *w, const QCString &property, bool isTopLevel) +StdWidgetFactory::isPropertyVisibleInternal(const TQCString &classname, + TQWidget *w, const TQCString &property, bool isTopLevel) { bool ok = true; if(classname == "FormWidgetBase") @@ -860,10 +860,10 @@ StdWidgetFactory::isPropertyVisibleInternal(const QCString &classname, } else if(classname == "KexiPictureLabel") { - if((property == "text") || (property == "indent") || (property == "textFormat") || (property == "font") || (property == "alignment")) + if((property == "text") || (property == "indent") || (property == "textFormat") || (property == "font") || (property == "tqalignment")) return false; } - else if(classname == "QLabel") + else if(classname == TQLABEL_OBJECT_NAME_STRING) { if(property == "pixmap") return false; @@ -890,11 +890,11 @@ StdWidgetFactory::isPropertyVisibleInternal(const QCString &classname, if((property == "frameShape") || (property == "font") || (property == "margin")) return false; } - else if(classname=="QCheckBox") + else if(classname==TQCHECKBOX_OBJECT_NAME_STRING) { ok = m_showAdvancedProperties || (property != "autoRepeat"); } - else if(classname=="QRadioButton") + else if(classname==TQRADIOBUTTON_OBJECT_NAME_STRING) { ok = m_showAdvancedProperties || (property != "autoRepeat"); } @@ -906,12 +906,12 @@ StdWidgetFactory::isPropertyVisibleInternal(const QCString &classname, return ok && WidgetFactory::isPropertyVisibleInternal(classname, w, property, isTopLevel); } -QValueList<QCString> -StdWidgetFactory::autoSaveProperties(const QCString &classname) +TQValueList<TQCString> +StdWidgetFactory::autoSaveProperties(const TQCString &classname) { - QValueList<QCString> l; + TQValueList<TQCString> l; - if(classname == "QLabel") + if(classname == TQLABEL_OBJECT_NAME_STRING) l << "text"; if(classname == "KPushButton") l << "text"; @@ -942,12 +942,12 @@ StdWidgetFactory::autoSaveProperties(const QCString &classname) void StdWidgetFactory::editText() { - QCString classname = widget()->className(); - QString text; + TQCString classname = widget()->className(); + TQString text; if(classname == "KTextEdit") text = ((KTextEdit*)widget())->text(); - else if(classname == "QLabel") - text = ((QLabel*)widget())->text(); + else if(classname == TQLABEL_OBJECT_NAME_STRING) + text = ((TQLabel*)widget())->text(); if(editRichText(widget(), text)) { @@ -955,24 +955,24 @@ StdWidgetFactory::editText() changeProperty("text", text, m_container->form()); } - if(classname == "QLabel") - widget()->resize(widget()->sizeHint()); + if(classname == TQLABEL_OBJECT_NAME_STRING) + widget()->resize(widget()->tqsizeHint()); } void StdWidgetFactory::editListContents() { - if(widget()->inherits("QListView")) - editListView((QListView*)widget()); + if(widget()->inherits(TQLISTVIEW_OBJECT_NAME_STRING)) + editListView((TQListView*)widget()); } void -StdWidgetFactory::setPropertyOptions( KFormDesigner::WidgetPropertySet& buf, const KFormDesigner::WidgetInfo& info, QWidget *w ) +StdWidgetFactory::setPropertyOptions( KFormDesigner::WidgetPropertySet& buf, const KFormDesigner::WidgetInfo& info, TQWidget *w ) { Q_UNUSED( info ); Q_UNUSED( w ); - if (buf.contains("indent")) { + if (buf.tqcontains("indent")) { buf["indent"].setOption("min", -1); buf["indent"].setOption("minValueText", i18n("default indent value", "default")); } diff --git a/kexi/formeditor/factories/stdwidgetfactory.h b/kexi/formeditor/factories/stdwidgetfactory.h index c0e56c5b..f5bd5528 100644 --- a/kexi/formeditor/factories/stdwidgetfactory.h +++ b/kexi/formeditor/factories/stdwidgetfactory.h @@ -20,80 +20,83 @@ #ifndef STDWIDGETFACTORY_H #define STDWIDGETFACTORY_H -#include <qframe.h> +#include <tqframe.h> #include "widgetfactory.h" #include "container.h" -class KFORMEDITOR_EXPORT KexiPictureLabel : public QLabel +class KFORMEDITOR_EXPORT KexiPictureLabel : public TQLabel { Q_OBJECT + TQ_OBJECT public: - KexiPictureLabel(const QPixmap &pix, QWidget *parent, const char *name); + KexiPictureLabel(const TQPixmap &pix, TQWidget *tqparent, const char *name); ~KexiPictureLabel(){;} - virtual bool setProperty(const char *name, const QVariant &value); + virtual bool setProperty(const char *name, const TQVariant &value); }; -class KFORMEDITOR_EXPORT Line : public QFrame +class KFORMEDITOR_EXPORT Line : public TQFrame { Q_OBJECT - Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation) + TQ_OBJECT + TQ_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) public: - Line(Orientation orient, QWidget *parent, const char *name); + Line(Qt::Orientation orient, TQWidget *tqparent, const char *name); ~Line(){;} - void setOrientation(Orientation orient); - Orientation orientation() const; + void setOrientation(Qt::Orientation orient); + Qt::Orientation orientation() const; }; //! Factory for all basic widgets, including Spring (not containers) class StdWidgetFactory : public KFormDesigner::WidgetFactory { Q_OBJECT + TQ_OBJECT public: - StdWidgetFactory(QObject *parent, const char *name, const QStringList &args); + StdWidgetFactory(TQObject *tqparent, const char *name, const TQStringList &args); ~StdWidgetFactory(); - virtual QWidget *createWidget(const QCString &c, QWidget *p, const char *n, + virtual TQWidget *createWidget(const TQCString &c, TQWidget *p, const char *n, KFormDesigner::Container *container, int options = DefaultOptions); - virtual bool createMenuActions(const QCString &classname, QWidget *w, QPopupMenu *menu, + virtual bool createMenuActions(const TQCString &classname, TQWidget *w, TQPopupMenu *menu, KFormDesigner::Container *container); - virtual bool startEditing(const QCString &classname, QWidget *w, + virtual bool startEditing(const TQCString &classname, TQWidget *w, KFormDesigner::Container *container); - virtual bool previewWidget(const QCString &classname, QWidget *widget, + virtual bool previewWidget(const TQCString &classname, TQWidget *widget, KFormDesigner::Container *container); - virtual bool clearWidgetContent(const QCString &classname, QWidget *w); + virtual bool clearWidgetContent(const TQCString &classname, TQWidget *w); - virtual bool saveSpecialProperty(const QCString &classname, - const QString &name, const QVariant &value, QWidget *w, - QDomElement &parentNode, QDomDocument &parent); - virtual bool readSpecialProperty(const QCString &classname, QDomElement &node, - QWidget *w, KFormDesigner::ObjectTreeItem *item); - virtual QValueList<QCString> autoSaveProperties(const QCString &classname); + virtual bool saveSpecialProperty(const TQCString &classname, + const TQString &name, const TQVariant &value, TQWidget *w, + TQDomElement &tqparentNode, TQDomDocument &tqparent); + virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node, + TQWidget *w, KFormDesigner::ObjectTreeItem *item); + virtual TQValueList<TQCString> autoSaveProperties(const TQCString &classname); virtual void setPropertyOptions( KFormDesigner::WidgetPropertySet& buf, - const KFormDesigner::WidgetInfo& info, QWidget *w ); + const KFormDesigner::WidgetInfo& info, TQWidget *w ); public slots: void editText(); void editListContents(); protected: - virtual bool isPropertyVisibleInternal(const QCString &classname, QWidget *w, - const QCString &property, bool isTopLevel); - virtual bool changeText(const QString &newText); - virtual void resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname); - void saveListItem(QListViewItem *item, QDomNode &parentNode, QDomDocument &domDoc); - void readListItem(QDomElement &node, QListViewItem *parent, KListView *listview); + virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w, + const TQCString &property, bool isTopLevel); + virtual bool changeText(const TQString &newText); + virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname); + void saveListItem(TQListViewItem *item, TQDomNode &tqparentNode, TQDomDocument &domDoc); + void readListItem(TQDomElement &node, TQListViewItem *tqparent, KListView *listview); private: // KFormDesigner::Container *m_container; -// QWidget *m_widget; +// TQWidget *m_widget; }; #endif |