summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/widgetfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/widgetfactory.cpp')
-rw-r--r--kdevdesigner/designer/widgetfactory.cpp170
1 files changed, 85 insertions, 85 deletions
diff --git a/kdevdesigner/designer/widgetfactory.cpp b/kdevdesigner/designer/widgetfactory.cpp
index 1cf435e5..e31f5d82 100644
--- a/kdevdesigner/designer/widgetfactory.cpp
+++ b/kdevdesigner/designer/widgetfactory.cpp
@@ -31,7 +31,7 @@
#include "mainwindow.h"
#include "formwindow.h"
#include "propertyeditor.h"
-#include "layout.h"
+#include "tqlayout.h"
#include "listboxeditorimpl.h"
#include "listvieweditorimpl.h"
#include "iconvieweditorimpl.h"
@@ -64,9 +64,9 @@
#include <tqlineedit.h>
#include <tqspinbox.h>
#include <tqmultilineedit.h>
-#include <textedit.h>
+#include <tqtextedit.h>
#include <tqlabel.h>
-#include <layout.h>
+#include <tqlayout.h>
#include <tqwidgetstack.h>
#include <tqcombobox.h>
#include <tqtabbar.h>
@@ -77,8 +77,8 @@
#include <tqslider.h>
#include <tqdial.h>
#include <tqprogressbar.h>
-#include <textview.h>
-#include <textbrowser.h>
+#include <tqtextview.h>
+#include <tqtextbrowser.h>
#include <tqframe.h>
#include <tqmetaobject.h>
#include <tqwidgetstack.h>
@@ -296,11 +296,11 @@ QDesignerWidgetStack::QDesignerWidgetStack( TQWidget *parent, const char *name )
prev = new TQToolButton( TQt::LeftArrow, this, "designer_wizardstack_button" );
prev->setAutoRaise( TRUE );
prev->setAutoRepeat( TRUE );
- prev->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) );
+ prev->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) );
next = new TQToolButton( TQt::RightArrow, this, "designer_wizardstack_button" );
next->setAutoRaise( TRUE );
next->setAutoRepeat( TRUE );
- next->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) );
+ next->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) );
connect( prev, TQT_SIGNAL( clicked() ), this, TQT_SLOT( prevPage() ) );
connect( next, TQT_SIGNAL( clicked() ), this, TQT_SLOT( nextPage() ) );
updateButtons();
@@ -498,7 +498,7 @@ TQMap< int, TQStringList > *changedProperties = 0;
void WidgetFactory::saveDefaultProperties( TQObject *w, int id )
{
TQMap< TQString, TQVariant> propMap;
- TQStrList lst = w->metaObject()->propertyNames( TRUE );
+ TQStrList lst = w->tqmetaObject()->propertyNames( TRUE );
for ( uint i = 0; i < lst.count(); ++i ) {
TQVariant var = w->property( lst.at( i ) );
if ( !var.isValid() && qstrcmp( "pixmap", lst.at( i ) ) == 0 )
@@ -553,11 +553,11 @@ TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, boo
return w;
}
-/*! Creates a layout on the widget \a widget of the type \a type
+/*! Creates a tqlayout on the widget \a widget of the type \a type
which can be \c HBox, \c VBox or \c Grid.
*/
-TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, LayoutType type )
+TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, LayoutType type )
{
int spacing = MainWindow::self->currentLayoutDefaultSpacing();
int margin = 0;
@@ -570,40 +570,40 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou
widget && ::tqqt_cast<FormWindow*>(widget->parentWidget()) ) )
margin = MainWindow::self->currentLayoutDefaultMargin();
- if ( !layout && ::tqqt_cast<TQTabWidget*>(widget) )
+ if ( !tqlayout && ::tqqt_cast<TQTabWidget*>(widget) )
widget = ((TQTabWidget*)widget)->currentPage();
- if ( !layout && ::tqqt_cast<TQWizard*>(widget) )
+ if ( !tqlayout && ::tqqt_cast<TQWizard*>(widget) )
widget = ((TQWizard*)widget)->currentPage();
- if ( !layout && ::tqqt_cast<TQMainWindow*>(widget) )
+ if ( !tqlayout && ::tqqt_cast<TQMainWindow*>(widget) )
widget = ((TQMainWindow*)widget)->centralWidget();
- if ( !layout && ::tqqt_cast<TQWidgetStack*>(widget) )
+ if ( !tqlayout && ::tqqt_cast<TQWidgetStack*>(widget) )
widget = ((TQWidgetStack*)widget)->visibleWidget();
- if ( !layout && ::tqqt_cast<TQToolBox*>(widget) )
+ if ( !tqlayout && ::tqqt_cast<TQToolBox*>(widget) )
widget = ((TQToolBox*)widget)->currentItem();
MetaDataBase::addEntry( TQT_TQOBJECT(widget) );
TQLayout *l = 0;
int align = 0;
- if ( !layout && ::tqqt_cast<TQGroupBox*>(widget) ) {
+ if ( !tqlayout && ::tqqt_cast<TQGroupBox*>(widget) ) {
TQGroupBox *gb = (TQGroupBox*)widget;
gb->setColumnLayout( 0, Qt::Vertical );
- layout = gb->layout();
- layout->setMargin( 0 );
- layout->setSpacing( 0 );
+ tqlayout = gb->tqlayout();
+ tqlayout->setMargin( 0 );
+ tqlayout->setSpacing( 0 );
switch ( type ) {
case HBox:
- l = new TQHBoxLayout( layout );
+ l = new TQHBoxLayout( tqlayout );
break;
case VBox:
- l = new TQVBoxLayout( layout );
+ l = new TQVBoxLayout( tqlayout );
break;
case Grid:
- l = new QDesignerGridLayout( layout );
+ l = new QDesignerGridLayout( tqlayout );
break;
default:
return 0;
@@ -612,16 +612,16 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou
MetaDataBase::setMargin( TQT_TQOBJECT(gb), metamargin );
MetaDataBase::setSpacing( TQT_TQOBJECT(gb), metaspacing );
} else {
- if ( layout ) {
+ if ( tqlayout ) {
switch ( type ) {
case HBox:
- l = new TQHBoxLayout( layout );
+ l = new TQHBoxLayout( tqlayout );
break;
case VBox:
- l = new TQVBoxLayout( layout );
+ l = new TQVBoxLayout( tqlayout );
break;
case Grid:
- l = new QDesignerGridLayout( layout );
+ l = new QDesignerGridLayout( tqlayout );
break;
default:
return 0;
@@ -653,7 +653,7 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou
}
}
}
- l->setAlignment( align );
+ l->tqsetAlignment( align );
MetaDataBase::addEntry( TQT_TQOBJECT(l) );
return l;
}
@@ -673,7 +673,7 @@ void WidgetFactory::deleteLayout( TQWidget *widget )
widget = ((TQWidgetStack*)widget)->visibleWidget();
if ( ::tqqt_cast<TQToolBox*>(widget) )
widget = ((TQToolBox*)widget)->currentItem();
- delete widget->layout();
+ delete widget->tqlayout();
}
/*! Factory functions for creating a widget of the type \a className
@@ -690,7 +690,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare
TQPushButton *b = 0;
if ( init ) {
b = new QDesignerPushButton( parent, name );
- b->setText( TQString::fromLatin1( name ) );
+ b->setText( TQString::tqfromLatin1( name ) );
} else {
b = new QDesignerPushButton( parent, name );
}
@@ -714,24 +714,24 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare
} else if ( className == TQCHECKBOX_OBJECT_NAME_STRING ) {
if ( init ) {
QDesignerCheckBox *cb = new QDesignerCheckBox( parent, name );
- cb->setText( TQString::fromLatin1( name ) );
+ cb->setText( TQString::tqfromLatin1( name ) );
return cb;
}
return new QDesignerCheckBox( parent, name );
} else if ( className == TQRADIOBUTTON_OBJECT_NAME_STRING ) {
if ( init ) {
QDesignerRadioButton *rb = new QDesignerRadioButton( parent, name );
- rb->setText( TQString::fromLatin1( name ) );
+ rb->setText( TQString::tqfromLatin1( name ) );
return rb;
}
return new QDesignerRadioButton( parent, name );
} else if ( className == TQGROUPBOX_OBJECT_NAME_STRING ) {
if ( init )
- return new TQGroupBox( TQString::fromLatin1( name ), parent, name );
+ return new TQGroupBox( TQString::tqfromLatin1( name ), parent, name );
return new TQGroupBox( parent, name );
} else if ( className == TQBUTTONGROUP_OBJECT_NAME_STRING ) {
if ( init )
- return new TQButtonGroup( TQString::fromLatin1( name ), parent, name );
+ return new TQButtonGroup( TQString::tqfromLatin1( name ), parent, name );
return new TQButtonGroup( parent, name );
} else if ( className == TQICONVIEW_OBJECT_NAME_STRING ) {
#if !defined(TQT_NO_ICONVIEW)
@@ -789,7 +789,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare
else if ( className == TQLABEL_OBJECT_NAME_STRING || className == "TextLabel" ) {
QDesignerLabel *l = new QDesignerLabel( parent, name );
if ( init ) {
- l->setText( TQString::fromLatin1( name ) );
+ l->setText( TQString::tqfromLatin1( name ) );
MetaDataBase::addEntry( TQT_TQOBJECT(l) );
MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "text", TRUE );
}
@@ -1001,14 +1001,14 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare
-/*! Find out which type the layout of the widget is. Returns \c HBox,
- \c VBox, \c Grid or \c NoLayout. \a layout points to this
- TQWidget::layout() of \a w or to 0 after the function call.
+/*! Find out which type the tqlayout of the widget is. Returns \c HBox,
+ \c VBox, \c Grid or \c NoLayout. \a tqlayout points to this
+ TQWidget::tqlayout() of \a w or to 0 after the function call.
*/
-WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&layout )
+WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&tqlayout )
{
- layout = 0;
+ tqlayout = 0;
if ( ::tqqt_cast<TQTabWidget*>(w) )
w = ((TQTabWidget*)w)->currentPage();
@@ -1024,9 +1024,9 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay
if ( ::tqqt_cast<TQSplitter*>(w) )
return ( (TQSplitter*)w )->orientation() ==Qt::Horizontal ? HBox : VBox;
- if ( !w || !w->layout() )
+ if ( !w || !w->tqlayout() )
return NoLayout;
- TQLayout *lay = w->layout();
+ TQLayout *lay = w->tqlayout();
if ( ::tqqt_cast<TQGroupBox*>(w) ) {
TQObjectList *l = TQT_TQOBJECT(lay)->queryList( TQLAYOUT_OBJECT_NAME_STRING );
@@ -1034,7 +1034,7 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay
lay = (TQLayout*)l->first();
delete l;
}
- layout = lay;
+ tqlayout = lay;
if ( ::tqqt_cast<TQHBoxLayout*>(lay) )
return HBox;
@@ -1048,13 +1048,13 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay
/*!
\overload
*/
-WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *layout )
+WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *tqlayout )
{
- if ( ::tqqt_cast<TQHBoxLayout*>(layout) )
+ if ( ::tqqt_cast<TQHBoxLayout*>(tqlayout) )
return HBox;
- else if ( ::tqqt_cast<TQVBoxLayout*>(layout) )
+ else if ( ::tqqt_cast<TQVBoxLayout*>(tqlayout) )
return VBox;
- else if ( ::tqqt_cast<TQGridLayout*>(layout) )
+ else if ( ::tqqt_cast<TQGridLayout*>(tqlayout) )
return Grid;
return NoLayout;
}
@@ -1069,9 +1069,9 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w )
}
-TQWidget *WidgetFactory::layoutParent( TQLayout *layout )
+TQWidget *WidgetFactory::layoutParent( TQLayout *tqlayout )
{
- TQObject *o = TQT_TQOBJECT(layout);
+ TQObject *o = TQT_TQOBJECT(tqlayout);
while ( o ) {
if ( o->isWidgetType() )
return (TQWidget*)o;
@@ -1080,7 +1080,7 @@ TQWidget *WidgetFactory::layoutParent( TQLayout *layout )
return 0;
}
-/*! Returns the widget into which children should be inserted when \a
+/*! Returns the widget into which tqchildren should be inserted when \a
w is a container known to the designer.
Usually that is \a w itself, sometimes it is different (e.g. a
@@ -1469,7 +1469,7 @@ bool WidgetFactory::canResetProperty( TQObject *w, const TQString &propName )
bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName )
{
- const TQMetaProperty *p = w->metaObject()->property( w->metaObject()->
+ const TQMetaProperty *p = w->tqmetaObject()->property( w->tqmetaObject()->
findProperty( propName, TRUE ), TRUE );
if (!p )
return FALSE;
@@ -1479,10 +1479,10 @@ bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName )
TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName )
{
if ( propName == "wordwrap" ) {
- int v = defaultValue( w, "alignment" ).toInt();
+ int v = defaultValue( w, "tqalignment" ).toInt();
return TQVariant( ( v & WordBreak ) == WordBreak, 0 );
} else if ( propName == "toolTip" || propName == "whatsThis" ) {
- return TQVariant( TQString::fromLatin1( "" ) );
+ return TQVariant( TQString::tqfromLatin1( "" ) );
} else if ( w->inherits( "CustomWidget" ) ) {
return TQVariant();
} else if ( propName == "frameworkCode" ) {
@@ -1496,10 +1496,10 @@ TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName )
TQString WidgetFactory::defaultCurrentItem( TQObject *w, const TQString &propName )
{
- const TQMetaProperty *p = w->metaObject()->
- property( w->metaObject()->findProperty( propName, TRUE ), TRUE );
+ const TQMetaProperty *p = w->tqmetaObject()->
+ property( w->tqmetaObject()->findProperty( propName, TRUE ), TRUE );
if ( !p ) {
- int v = defaultValue( w, "alignment" ).toInt();
+ int v = defaultValue( w, "tqalignment" ).toInt();
if ( propName == "hAlign" ) {
if ( ( v & AlignAuto ) == AlignAuto )
return "AlignAuto";
@@ -1536,8 +1536,8 @@ TQWidget *WidgetFactory::createCustomWidget( TQWidget *parent, const char *name,
TQVariant WidgetFactory::property( TQObject *w, const char *name )
{
- int id = w->metaObject()->findProperty( name, TRUE );
- const TQMetaProperty* p = w->metaObject()->property( id, TRUE );
+ int id = w->tqmetaObject()->findProperty( name, TRUE );
+ const TQMetaProperty* p = w->tqmetaObject()->property( id, TRUE );
if ( !p || !p->isValid() )
return MetaDataBase::fakeProperty( w, name );
return w->property( name );
@@ -1549,7 +1549,7 @@ void QDesignerLabel::updateBuddy()
if ( myBuddy.isEmpty() )
return;
- TQObjectList *l = topLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, FALSE, TRUE );
+ TQObjectList *l = tqtopLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, FALSE, TRUE );
if ( !l || !l->first() ) {
delete l;
return;
@@ -1601,13 +1601,13 @@ bool TQLayoutWidget::event( TQEvent *e )
/*
This function must be called on TQLayoutWidget creation and whenever
- the TQLayoutWidget's parent layout changes (e.g., from a TQHBoxLayout
+ the TQLayoutWidget's parent tqlayout changes (e.g., from a TQHBoxLayout
to a TQVBoxLayout), because of the (illogical) way layouting works.
*/
void TQLayoutWidget::updateSizePolicy()
{
if ( childrenListObject().isEmpty() || childrenListObject().count() == 0 ) {
- sp = TQWidget::sizePolicy();
+ sp = TQWidget::tqsizePolicy();
return;
}
@@ -1624,14 +1624,14 @@ void TQLayoutWidget::updateSizePolicy()
int ht = (int) TQSizePolicy::Preferred;
int vt = (int) TQSizePolicy::Preferred;
- if ( layout() ) {
+ if ( tqlayout() ) {
/*
- parentLayout is set to the parent layout if there is one and if it is
+ parentLayout is set to the parent tqlayout if there is one and if it is
top level, in which case layouting is illogical.
*/
TQLayout *parentLayout = 0;
if ( parent() && parent()->isWidgetType() ) {
- parentLayout = ((TQWidget *)parent())->layout();
+ parentLayout = ((TQWidget *)parent())->tqlayout();
if ( parentLayout &&
::tqqt_cast<TQLayoutWidget*>(parentLayout->mainWidget()) )
parentLayout = 0;
@@ -1640,7 +1640,7 @@ void TQLayoutWidget::updateSizePolicy()
TQObjectListIt it( childrenListObject() );
TQObject *o;
- if ( ::tqqt_cast<TQVBoxLayout*>(layout()) ) {
+ if ( ::tqqt_cast<TQVBoxLayout*>(tqlayout()) ) {
if ( ::tqqt_cast<TQHBoxLayout*>(parentLayout) )
vt = TQSizePolicy::Minimum;
else
@@ -1652,16 +1652,16 @@ void TQLayoutWidget::updateSizePolicy()
continue;
TQWidget *w = (TQWidget*)o;
- if ( !w->sizePolicy().mayGrowHorizontally() )
+ if ( !w->tqsizePolicy().mayGrowHorizontally() )
ht &= ~TQSizePolicy::Minimum;
- if ( !w->sizePolicy().mayShrinkHorizontally() )
+ if ( !w->tqsizePolicy().mayShrinkHorizontally() )
ht &= ~TQSizePolicy::Maximum;
- if ( w->sizePolicy().mayGrowVertically() )
+ if ( w->tqsizePolicy().mayGrowVertically() )
vt |= TQSizePolicy::Minimum;
- if ( w->sizePolicy().mayShrinkVertically() )
+ if ( w->tqsizePolicy().mayShrinkVertically() )
vt |= TQSizePolicy::Maximum;
}
- } else if ( ::tqqt_cast<TQHBoxLayout*>(layout()) ) {
+ } else if ( ::tqqt_cast<TQHBoxLayout*>(tqlayout()) ) {
if ( ::tqqt_cast<TQVBoxLayout*>(parentLayout) )
ht = TQSizePolicy::Minimum;
else
@@ -1673,16 +1673,16 @@ void TQLayoutWidget::updateSizePolicy()
continue;
TQWidget *w = (TQWidget*)o;
- if ( w->sizePolicy().mayGrowHorizontally() )
+ if ( w->tqsizePolicy().mayGrowHorizontally() )
ht |= TQSizePolicy::Minimum;
- if ( w->sizePolicy().mayShrinkHorizontally() )
+ if ( w->tqsizePolicy().mayShrinkHorizontally() )
ht |= TQSizePolicy::Maximum;
- if ( !w->sizePolicy().mayGrowVertically() )
+ if ( !w->tqsizePolicy().mayGrowVertically() )
vt &= ~TQSizePolicy::Minimum;
- if ( !w->sizePolicy().mayShrinkVertically() )
+ if ( !w->tqsizePolicy().mayShrinkVertically() )
vt &= ~TQSizePolicy::Maximum;
}
- } else if ( ::tqqt_cast<TQGridLayout*>(layout()) ) {
+ } else if ( ::tqqt_cast<TQGridLayout*>(tqlayout()) ) {
ht = TQSizePolicy::Fixed;
vt = TQSizePolicy::Fixed;
if ( parentLayout ) {
@@ -1698,30 +1698,30 @@ void TQLayoutWidget::updateSizePolicy()
continue;
TQWidget *w = (TQWidget*)o;
- if ( w->sizePolicy().mayGrowHorizontally() )
+ if ( w->tqsizePolicy().mayGrowHorizontally() )
ht |= TQSizePolicy::Minimum;
- if ( w->sizePolicy().mayShrinkHorizontally() )
+ if ( w->tqsizePolicy().mayShrinkHorizontally() )
ht |= TQSizePolicy::Maximum;
- if ( w->sizePolicy().mayGrowVertically() )
+ if ( w->tqsizePolicy().mayGrowVertically() )
vt |= TQSizePolicy::Minimum;
- if ( w->sizePolicy().mayShrinkVertically() )
+ if ( w->tqsizePolicy().mayShrinkVertically() )
vt |= TQSizePolicy::Maximum;
}
}
#ifdef USE_QT4
- if ( layout()->expanding() & TQSizePolicy::Horizontally )
+ if ( tqlayout()->expandingDirections() & TQSizePolicy::Horizontally )
#else // USE_QT4
- if ( layout()->expanding() & TQSizePolicy::Horizontally )
+ if ( tqlayout()->expanding() & TQSizePolicy::Horizontally )
#endif // USE_QT4
ht = TQSizePolicy::Expanding;
#ifdef USE_QT4
- if ( layout()->expanding() & TQSizePolicy::Vertically )
+ if ( tqlayout()->expandingDirections() & TQSizePolicy::Vertically )
#else // USE_QT4
- if ( layout()->expanding() & TQSizePolicy::Vertically )
+ if ( tqlayout()->expanding() & TQSizePolicy::Vertically )
#endif // USE_QT4
vt = TQSizePolicy::Expanding;
- layout()->invalidate();
+ tqlayout()->tqinvalidate();
}
sp = TQSizePolicy( (TQSizePolicy::SizeType) ht, (TQSizePolicy::SizeType) vt );
@@ -1734,8 +1734,8 @@ void CustomWidget::paintEvent( TQPaintEvent *e )
( (FormWindow*)parentWidget() )->paintGrid( this, e );
} else {
TQPainter p( this );
- p.fillRect( rect(), colorGroup().dark() );
- p.setPen( colorGroup().light() );
+ p.fillRect( rect(), tqcolorGroup().dark() );
+ p.setPen( tqcolorGroup().light() );
p.drawText( 2, 2, width() - 4, height() - 4, TQt::AlignAuto | TQt::AlignTop, cusw->className );
p.drawPixmap( ( width() - cusw->pixmap->width() ) / 2,
( height() - cusw->pixmap->height() ) / 2,