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 /kword/KWFrameStyleManager.cpp | |
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 'kword/KWFrameStyleManager.cpp')
-rw-r--r-- | kword/KWFrameStyleManager.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/kword/KWFrameStyleManager.cpp b/kword/KWFrameStyleManager.cpp index bf9be484..b0395d24 100644 --- a/kword/KWFrameStyleManager.cpp +++ b/kword/KWFrameStyleManager.cpp @@ -30,27 +30,27 @@ #include <klocale.h> #include <kiconloader.h> -#include <qtabwidget.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qbrush.h> -#include <qgroupbox.h> -#include <qpainter.h> -#include <qlayout.h> +#include <tqtabwidget.h> +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqbrush.h> +#include <tqgroupbox.h> +#include <tqpainter.h> +#include <tqlayout.h> /******************************************************************/ /* Class: KWTableStylePreview */ /******************************************************************/ #undef ptToPx -#define ptToPx qRound +#define ptToPx tqRound -void KWFrameStylePreview::paintEvent( QPaintEvent * ) +void KWFrameStylePreview::paintEvent( TQPaintEvent * ) { int wid = ( width() - 20 ); int hei = ( height() - 20 ); - QPainter p; + TQPainter p; p.begin( this ); // 1: create borders @@ -77,8 +77,8 @@ void KWFrameStylePreview::paintEvent( QPaintEvent * ) // 2.1: create background - p.fillRect( QRect( QPoint(10 + int(ceil(frameStyle->leftBorder().width()/2)), 10 + int(ceil(frameStyle->topBorder().width()/2))), - QPoint(10 + wid - int(floor(frameStyle->rightBorder().width()/2)+1), 10 + hei - int(floor(frameStyle->bottomBorder().width()/2)+1)) ), + p.fillRect( TQRect( TQPoint(10 + int(ceil(frameStyle->leftBorder().width()/2)), 10 + int(ceil(frameStyle->topBorder().width()/2))), + TQPoint(10 + wid - int(floor(frameStyle->rightBorder().width()/2)+1), 10 + hei - int(floor(frameStyle->bottomBorder().width()/2)+1)) ), frameStyle->backgroundColor() ); p.end(); @@ -90,7 +90,7 @@ void KWFrameStylePreview::setFrameStyle( KWFrameStyle *_frameStyle ) frameStyle = _frameStyle; - repaint( true ); + tqrepaint( true ); } /******************************************************************/ @@ -127,8 +127,8 @@ void KWFrameStyleListItem::apply() /* Class: KWFrameStyleManager */ /******************************************************************/ -KWFrameStyleManager::KWFrameStyleManager( QWidget *_parent, KWDocument *_doc, - const QString & activeStyleName ) +KWFrameStyleManager::KWFrameStyleManager( TQWidget *_parent, KWDocument *_doc, + const TQString & activeStyleName ) : KDialogBase( _parent, "", true, i18n("Frame Style Manager"), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply| KDialogBase::User1 ) @@ -151,14 +151,14 @@ KWFrameStyleManager::KWFrameStyleManager( QWidget *_parent, KWDocument *_doc, KWFrameStyleBackgroundTab *bgTab = new KWFrameStyleBackgroundTab( m_tabs ); addTab( bgTab ); - QListBoxItem * item = m_stylesList->findItem( activeStyleName ); + TQListBoxItem * item = m_stylesList->tqfindItem( activeStyleName ); m_stylesList->setCurrentItem( item ? m_stylesList->index(item) : 0 ); noSignals=false; switchStyle(); - setInitialSize( QSize( 600, 370 ) ); + setInitialSize( TQSize( 600, 370 ) ); setButtonText( KDialogBase::User1, i18n("Import From File...") ); - connect(this, SIGNAL(user1Clicked()), this, SLOT(importFromFile())); + connect(this, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(importFromFile())); } KWFrameStyleManager::~KWFrameStyleManager() @@ -175,15 +175,15 @@ void KWFrameStyleManager::addTab( KWFrameStyleManagerTab * tab ) void KWFrameStyleManager::setupWidget() { - QFrame * frame1 = makeMainWidget(); - QGridLayout *frame1Layout = new QGridLayout( frame1, 0, 0, // auto + TQFrame * frame1 = makeMainWidget(); + TQGridLayout *frame1Layout = new TQGridLayout( frame1, 0, 0, // auto 0, KDialog::spacingHint() ); KWFrameStyleCollection* collection = m_doc->frameStyleCollection(); numFrameStyles = collection->count(); - m_stylesList = new QListBox( frame1, "stylesList" ); + m_stylesList = new TQListBox( frame1, "stylesList" ); m_stylesList->insertStringList( collection->displayNameList() ); - const QValueList<KoUserStyle*> styleList = collection->styleList(); - for ( QValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); + const TQValueList<KoUserStyle*> styleList = collection->styleList(); + for ( TQValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); it != end ; ++it ) { KWFrameStyle* style = static_cast<KWFrameStyle *>( *it ); @@ -196,66 +196,66 @@ void KWFrameStyleManager::setupWidget() frame1Layout->addMultiCellWidget( m_stylesList, 0, 0, 0, 1 ); - m_moveUpButton = new QPushButton( frame1, "moveUpButton" ); + m_moveUpButton = new TQPushButton( frame1, "moveUpButton" ); m_moveUpButton->setIconSet( SmallIconSet( "up" ) ); - connect( m_moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUpStyle() ) ); + connect( m_moveUpButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveUpStyle() ) ); frame1Layout->addWidget( m_moveUpButton, 1, 1 ); - m_moveDownButton = new QPushButton( frame1, "moveDownButton" ); + m_moveDownButton = new TQPushButton( frame1, "moveDownButton" ); m_moveDownButton->setIconSet( SmallIconSet( "down" ) ); - connect( m_moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDownStyle() ) ); + connect( m_moveDownButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveDownStyle() ) ); frame1Layout->addWidget( m_moveDownButton, 1, 0 ); - m_deleteButton = new QPushButton( frame1, "deleteButton" ); + m_deleteButton = new TQPushButton( frame1, "deleteButton" ); m_deleteButton->setText( i18n( "&Delete" ) ); - connect( m_deleteButton, SIGNAL( clicked() ), this, SLOT( deleteStyle() ) ); + connect( m_deleteButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( deleteStyle() ) ); frame1Layout->addWidget( m_deleteButton, 2, 1 ); - m_newButton = new QPushButton( frame1, "newButton" ); + m_newButton = new TQPushButton( frame1, "newButton" ); m_newButton->setText( i18n( "New" ) ); - connect( m_newButton, SIGNAL( clicked() ), this, SLOT( addStyle() ) ); + connect( m_newButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( addStyle() ) ); frame1Layout->addWidget( m_newButton, 2, 0 ); - m_tabs = new QTabWidget( frame1 ); + m_tabs = new TQTabWidget( frame1 ); frame1Layout->addMultiCellWidget( m_tabs, 0, 2, 2, 2 ); - connect( m_stylesList, SIGNAL( selectionChanged() ), this, SLOT( switchStyle() ) ); - connect( m_tabs, SIGNAL( currentChanged ( QWidget * ) ), this, SLOT( switchTabs() ) ); + connect( m_stylesList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( switchStyle() ) ); + connect( m_tabs, TQT_SIGNAL( currentChanged ( TQWidget * ) ), this, TQT_SLOT( switchTabs() ) ); } void KWFrameStyleManager::addGeneralTab() { - QWidget *tab = new QWidget( m_tabs ); + TQWidget *tab = new TQWidget( m_tabs ); - QGridLayout *tabLayout = new QGridLayout( tab ); + TQGridLayout *tabLayout = new TQGridLayout( tab ); tabLayout->setSpacing( KDialog::spacingHint() ); tabLayout->setMargin( KDialog::marginHint() ); - previewBox = new QGroupBox( 0, Qt::Vertical, i18n( "Preview" ), tab ); - previewBox->layout()->setSpacing(KDialog::spacingHint()); - previewBox->layout()->setMargin(KDialog::marginHint()); - QGridLayout *previewLayout = new QGridLayout( previewBox->layout() ); + previewBox = new TQGroupBox( 0, Qt::Vertical, i18n( "Preview" ), tab ); + previewBox->tqlayout()->setSpacing(KDialog::spacingHint()); + previewBox->tqlayout()->setMargin(KDialog::marginHint()); + TQGridLayout *previewLayout = new TQGridLayout( previewBox->tqlayout() ); preview = new KWFrameStylePreview( previewBox ); - preview->resize(preview->sizeHint()); + preview->resize(preview->tqsizeHint()); previewLayout->addWidget( preview, 0, 0 ); tabLayout->addMultiCellWidget( previewBox, 1, 1, 0, 1 ); - m_nameString = new QLineEdit( tab ); - m_nameString->resize(m_nameString->sizeHint() ); - connect( m_nameString, SIGNAL( textChanged( const QString &) ), this, SLOT( renameStyle(const QString &) ) ); + m_nameString = new TQLineEdit( tab ); + m_nameString->resize(m_nameString->tqsizeHint() ); + connect( m_nameString, TQT_SIGNAL( textChanged( const TQString &) ), this, TQT_SLOT( renameStyle(const TQString &) ) ); tabLayout->addWidget( m_nameString, 0, 1 ); - QLabel *nameLabel = new QLabel( tab ); + TQLabel *nameLabel = new TQLabel( tab ); nameLabel->setText( i18n( "Name:" ) ); - nameLabel->resize(nameLabel->sizeHint()); - nameLabel->setAlignment( AlignRight | AlignVCenter ); + nameLabel->resize(nameLabel->tqsizeHint()); + nameLabel->tqsetAlignment( AlignRight | AlignVCenter ); tabLayout->addWidget( nameLabel, 0, 0 ); @@ -313,7 +313,7 @@ int KWFrameStyleManager::frameStyleIndex( int pos ) { void KWFrameStyleManager::updateGUI() { kdDebug() << "KWFrameStyleManager::updateGUI m_currentFrameStyle=" << m_currentFrameStyle << " " << m_currentFrameStyle->name() << endl; - QPtrListIterator<KWFrameStyleManagerTab> it( m_tabsList ); + TQPtrListIterator<KWFrameStyleManagerTab> it( m_tabsList ); for ( ; it.current() ; ++it ) { it.current()->setStyle( m_currentFrameStyle ); @@ -339,7 +339,7 @@ void KWFrameStyleManager::updatePreview() void KWFrameStyleManager::save() { if(m_currentFrameStyle) { // save changes from UI to object. - QPtrListIterator<KWFrameStyleManagerTab> it( m_tabsList ); + TQPtrListIterator<KWFrameStyleManagerTab> it( m_tabsList ); for ( ; it.current() ; ++it ) it.current()->save(); @@ -350,7 +350,7 @@ void KWFrameStyleManager::save() { void KWFrameStyleManager::importFromFile() { // ## why not just use collection->displayNameList()? - QStringList lst; + TQStringList lst; for ( int i = 0; i<(int)m_stylesList->count();i++) { lst << m_stylesList->text(i); @@ -362,11 +362,11 @@ void KWFrameStyleManager::importFromFile() } } -void KWFrameStyleManager::addStyles( const QPtrList<KWFrameStyle> &listStyle ) +void KWFrameStyleManager::addStyles( const TQPtrList<KWFrameStyle> &listStyle ) { save(); - QPtrListIterator<KWFrameStyle> style( listStyle ); + TQPtrListIterator<KWFrameStyle> style( listStyle ); for ( ; style.current() ; ++style ) { noSignals=true; @@ -383,7 +383,7 @@ void KWFrameStyleManager::addStyle() { save(); - QString str = i18n( "New Framestyle Template (%1)" ).arg(numFrameStyles++); + TQString str = i18n( "New Framestyle Template (%1)" ).tqarg(numFrameStyles++); if ( m_currentFrameStyle ) { m_currentFrameStyle = new KWFrameStyle( *m_currentFrameStyle ); // Create a new style, initializing from the current one @@ -425,10 +425,10 @@ void KWFrameStyleManager::moveUpStyle() if(m_currentFrameStyle !=0L) save(); unsigned int pos = 0; - QString currentStyleName = m_stylesList->currentText(); + TQString currentStyleName = m_stylesList->currentText(); if ( currentStyleName.isEmpty() ) return; - int pos2 = m_styleOrder.findIndex( currentStyleName ); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 > 0 ) // neither -1 nor 0 { m_styleOrder.remove( m_styleOrder.at(pos2)); @@ -453,11 +453,11 @@ void KWFrameStyleManager::moveDownStyle() if(m_currentFrameStyle !=0L) save(); unsigned int pos = 0; - QString currentStyleName=m_stylesList->currentText (); + TQString currentStyleName=m_stylesList->currentText (); if ( currentStyleName.isEmpty() ) return; - int pos2 = m_styleOrder.findIndex( currentStyleName ); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 != -1 ) { m_styleOrder.remove( m_styleOrder.at(pos2)); @@ -520,7 +520,7 @@ void KWFrameStyleManager::apply() noSignals=false; } -void KWFrameStyleManager::renameStyle(const QString &theText) { +void KWFrameStyleManager::renameStyle(const TQString &theText) { if(noSignals) return; noSignals=true; @@ -564,44 +564,44 @@ void KWFrameStyleManager::renameStyle(const QString &theText) { /* Class: KWFrameStyleBackgroundTab */ /******************************************************************/ -KWFrameStyleBackgroundTab::KWFrameStyleBackgroundTab( QWidget * parent ) - : KWFrameStyleManagerTab( parent ) +KWFrameStyleBackgroundTab::KWFrameStyleBackgroundTab( TQWidget * tqparent ) + : KWFrameStyleManagerTab( tqparent ) { bgwidget = this; - m_backgroundColor.setStyle( SolidPattern ); + m_backgroundColor.setStyle( Qt::SolidPattern ); - grid = new QGridLayout( bgwidget, 7, 2, KDialog::marginHint(), KDialog::spacingHint() ); + grid = new TQGridLayout( bgwidget, 7, 2, KDialog::marginHint(), KDialog::spacingHint() ); int row=0; brushPreview = new KWBrushStylePreview( bgwidget ); grid->addMultiCellWidget(brushPreview,row,5,1,1); - QLabel *l = new QLabel( i18n( "Frame background color:" ), bgwidget ); + TQLabel *l = new TQLabel( i18n( "Frame background color:" ), bgwidget ); grid->addWidget(l,row++,0); - brushColor = new KColorButton( Qt::white, bgwidget ); + brushColor = new KColorButton( TQt::white, bgwidget ); grid->addWidget(brushColor,row++,0); - connect( brushColor, SIGNAL( changed( const QColor & ) ), - this, SLOT( updateBrushConfiguration( const QColor & ) ) ); + connect( brushColor, TQT_SIGNAL( changed( const TQColor & ) ), + this, TQT_SLOT( updateBrushConfiguration( const TQColor & ) ) ); - QSpacerItem* spacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); + TQSpacerItem* spacer = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Expanding); grid->addItem( spacer,row,0 ); - updateBrushConfiguration( Qt::white ); + updateBrushConfiguration( TQt::white ); } -void KWFrameStyleBackgroundTab::updateBrushConfiguration( const QColor & _color ) +void KWFrameStyleBackgroundTab::updateBrushConfiguration( const TQColor & _color ) { m_backgroundColor.setColor( _color ); brushPreview->show(); brushPreview->setBrush( m_backgroundColor ); - brushPreview->repaint(true); + brushPreview->tqrepaint(true); } -QString KWFrameStyleBackgroundTab::tabName() +TQString KWFrameStyleBackgroundTab::tabName() { return i18n("Background"); } @@ -621,8 +621,8 @@ void KWFrameStyleBackgroundTab::save() /* Class: KWFrameStyleBordersTab */ /******************************************************************/ -KWFrameStyleBordersTab::KWFrameStyleBordersTab( QWidget * parent ) - : KWFrameStyleManagerTab( parent ) +KWFrameStyleBordersTab::KWFrameStyleBordersTab( TQWidget * tqparent ) + : KWFrameStyleManagerTab( tqparent ) { m_widget = 0L; m_borders = new KoParagLayout(); @@ -633,7 +633,7 @@ KWFrameStyleBordersTab::~KWFrameStyleBordersTab() delete m_borders; } -QString KWFrameStyleBordersTab::tabName() +TQString KWFrameStyleBordersTab::tabName() { return m_widget->tabName(); } @@ -663,9 +663,9 @@ void KWFrameStyleBordersTab::setWidget( KoParagLayoutWidget * widget ) m_widget = widget; } -void KWFrameStyleBordersTab::resizeEvent( QResizeEvent *e ) +void KWFrameStyleBordersTab::resizeEvent( TQResizeEvent *e ) { - QWidget::resizeEvent( e ); + TQWidget::resizeEvent( e ); if ( m_widget ) m_widget->resize( size() ); } |