diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-13 08:32:36 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-01-13 08:32:36 +0000 |
commit | f7e71d47719ab6094cf4a9fafffa5ea351973522 (patch) | |
tree | 30834aa632d442019e14f88685001d94657d060b /kdeui/ktoolbar.cpp | |
parent | b31cfd9a1ee986fe2ae9a693f3afd7f171dd897c (diff) | |
download | tdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.tar.gz tdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.zip |
Initial conversion for TQt for Qt4 3.4.0 TP2
This will also compile with TQt for Qt3, and should not cause any problems
with dependent modules such as kdebase. If it does then it needs to be fixed!
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1214149 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/ktoolbar.cpp')
-rw-r--r-- | kdeui/ktoolbar.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/kdeui/ktoolbar.cpp b/kdeui/ktoolbar.cpp index 79607099a..fc61ee2ff 100644 --- a/kdeui/ktoolbar.cpp +++ b/kdeui/ktoolbar.cpp @@ -90,7 +90,7 @@ public: m_xmlguiClient = 0; - oldPos = Qt::DockUnmanaged; + oldPos = TQt::DockUnmanaged; modified = m_isHorizontal = positioned = false; @@ -122,16 +122,16 @@ public: struct ToolBarInfo { - ToolBarInfo() : index( -1 ), offset( -1 ), newline( false ), dock( Qt::DockTop ) {} - ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} + ToolBarInfo() : index( -1 ), offset( -1 ), newline( false ), dock( TQt::DockTop ) {} + ToolBarInfo( TQt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} int index, offset; bool newline; - Qt::Dock dock; + TQt::Dock dock; }; ToolBarInfo toolBarInfo; TQValueList<int> iconSizes; - TQTimer repaintTimer; + TQTimer tqrepaintTimer; // Default Values. bool HiddenDefault; @@ -166,11 +166,11 @@ void KToolBarSeparator::drawContents( TQPainter* p ) if ( line ) { TQStyle::SFlags flags = TQStyle::Style_Default; - if ( orientation() == Horizontal ) + if ( orientation() == Qt::Horizontal ) flags = flags | TQStyle::Style_Horizontal; - style().drawPrimitive(TQStyle::PE_DockWindowSeparator, p, - contentsRect(), colorGroup(), flags); + tqstyle().tqdrawPrimitive(TQStyle::PE_DockWindowSeparator, p, + contentsRect(), tqcolorGroup(), flags); } else { TQFrame::drawContents(p); } @@ -181,10 +181,10 @@ void KToolBarSeparator::styleChange( TQStyle& ) setOrientation( orient ); } -TQSize KToolBarSeparator::sizeHint() const +TQSize KToolBarSeparator::tqsizeHint() const { - int dim = style().pixelMetric( TQStyle::PM_DockWindowSeparatorExtent, this ); - return orientation() == Vertical ? TQSize( 0, dim ) : TQSize( dim, 0 ); + int dim = tqstyle().tqpixelMetric( TQStyle::PM_DockWindowSeparatorExtent, this ); + return orientation() == Qt::Vertical ? TQSize( 0, dim ) : TQSize( dim, 0 ); } TQSizePolicy KToolBarSeparator::sizePolicy() const @@ -193,7 +193,7 @@ TQSizePolicy KToolBarSeparator::sizePolicy() const } KToolBar::KToolBar( TQWidget *parent, const char *name, bool honorStyle, bool readConfig ) - : TQToolBar( TQString::fromLatin1( name ), + : TQToolBar( TQString::tqfromLatin1( name ), dynamic_cast<TQMainWindow*>(parent), parent, false, name ? name : "mainToolBar") @@ -202,7 +202,7 @@ KToolBar::KToolBar( TQWidget *parent, const char *name, bool honorStyle, bool re } KToolBar::KToolBar( TQMainWindow *parentWindow, TQMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) - : TQToolBar( TQString::fromLatin1( name ), + : TQToolBar( TQString::tqfromLatin1( name ), parentWindow, dock, newLine, name ? name : "mainToolBar") { @@ -210,7 +210,7 @@ KToolBar::KToolBar( TQMainWindow *parentWindow, TQMainWindow::ToolBarDock dock, } KToolBar::KToolBar( TQMainWindow *parentWindow, TQWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) - : TQToolBar( TQString::fromLatin1( name ), + : TQToolBar( TQString::tqfromLatin1( name ), parentWindow, dock, newLine, name ? name : "mainToolBar") { @@ -232,7 +232,7 @@ void KToolBar::init( bool readConfig, bool honorStyle ) layoutTimer = new TQTimer( this ); connect( layoutTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( rebuildLayout() ) ); - connect( &(d->repaintTimer), TQT_SIGNAL( timeout() ), + connect( &(d->tqrepaintTimer), TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotRepaint() ) ); if ( kapp ) { // may be null when started inside designer @@ -427,7 +427,7 @@ int KToolBar::insertAnimatedWidget(int id, TQObject *receiver, const char *slot, KAnimWidget *KToolBar::animatedWidget( int id ) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; KAnimWidget *aw = dynamic_cast<KAnimWidget *>(*it); @@ -610,7 +610,7 @@ TQString KToolBar::getComboItem (int id, int index) const KComboBox * KToolBar::getCombo(int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; return dynamic_cast<KComboBox *>( *it ); @@ -619,7 +619,7 @@ KComboBox * KToolBar::getCombo(int id) KLineEdit * KToolBar::getLined (int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; return dynamic_cast<KLineEdit *>( *it ); @@ -628,7 +628,7 @@ KLineEdit * KToolBar::getLined (int id) KToolBarButton * KToolBar::getButton (int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; return dynamic_cast<KToolBarButton *>( *it ); @@ -637,7 +637,7 @@ KToolBarButton * KToolBar::getButton (int id) void KToolBar::alignItemRight (int id, bool right ) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return; if ( rightAligned && !right && (*it) == rightAligned ) @@ -649,7 +649,7 @@ void KToolBar::alignItemRight (int id, bool right ) TQWidget *KToolBar::getWidget (int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); return ( it == id2widget.end() ) ? 0 : (*it); } @@ -677,7 +677,7 @@ void KToolBar::clear () void KToolBar::removeItem(int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) { kdDebug(220) << name() << " KToolBar::removeItem item " << id << " not found" << endl; @@ -693,7 +693,7 @@ void KToolBar::removeItem(int id) void KToolBar::removeItemDelayed(int id) { - Id2WidgetMap::Iterator it = id2widget.find( id ); + Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) { kdDebug(220) << name() << " KToolBar::removeItem item " << id << " not found" << endl; @@ -729,7 +729,7 @@ void KToolBar::showItem (int id) int KToolBar::itemIndex (int id) { TQWidget *w = getWidget(id); - return w ? widgets.findRef(w) : -1; + return w ? widgets.tqfindRef(w) : -1; } int KToolBar::idAt (int index) @@ -911,7 +911,7 @@ int KToolBar::iconSize() const int KToolBar::iconSizeDefault() const { - if (!::qstrcmp(TQObject::name(), "mainToolBar")) + if (!::qstrcmp(name(), "mainToolBar")) return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); return KGlobal::iconLoader()->currentSize(KIcon::Toolbar); @@ -1005,7 +1005,7 @@ void KToolBar::saveState() if ( curname == barname ) { just_append = false; - local.documentElement().replaceChild( current, elem ); + local.documentElement().tqreplaceChild( current, elem ); break; } } @@ -1158,7 +1158,7 @@ void KToolBar::mousePressEvent ( TQMouseEvent *m ) return; TQMainWindow *mw = mainWindow(); if ( mw->toolBarsMovable() && d->m_enableContext ) { - if ( m->button() == RightButton ) { + if ( m->button() == Qt::RightButton ) { TQGuardedPtr<KToolBar> guard( this ); int i = contextMenu()->exec( m->globalPos(), 0 ); // "Configure Toolbars" recreates toolbars, so we might not exist anymore. @@ -1239,7 +1239,7 @@ void KToolBar::rebuildLayout() continue; KToolBarSeparator *ktbs = dynamic_cast<KToolBarSeparator *>(w); if ( ktbs && !ktbs->showLine() ) { - l->addSpacing( orientation() == Vertical ? w->sizeHint().height() : w->sizeHint().width() ); + l->addSpacing( orientation() == Qt::Vertical ? w->tqsizeHint().height() : w->tqsizeHint().width() ); w->hide(); continue; } @@ -1247,7 +1247,7 @@ void KToolBar::rebuildLayout() continue; l->addWidget( w ); w->show(); - if ((orientation() == Horizontal) && dynamic_cast<TQLineEdit *>(w)) // w is TQLineEdit ? + if ((orientation() == Qt::Horizontal) && dynamic_cast<TQLineEdit *>(w)) // w is TQLineEdit ? l->addSpacing(2); // A little bit extra spacing behind it. } if ( rightAligned ) { @@ -1262,7 +1262,7 @@ void KToolBar::rebuildLayout() if ( stretchableWidget ) l->setStretchFactor( stretchableWidget, 10 ); } - l->invalidate(); + l->tqinvalidate(); TQApplication::postEvent( this, new TQEvent( TQEvent::LayoutHint ) ); } @@ -1279,7 +1279,7 @@ void KToolBar::childEvent( TQChildEvent *e ) if ( !dynamic_cast<TQPopupMenu *>(w)) { // e->child() is not a QPopupMenu // prevent items that have been explicitly inserted by insert*() from // being inserted again - if ( !widget2id.contains( w ) ) + if ( !widget2id.tqcontains( w ) ) { int dummy = -1; insertWidgetInternal( w, dummy, -1 ); @@ -1336,13 +1336,13 @@ void KToolBar::setStretchableWidget( TQWidget *w ) TQSizePolicy KToolBar::sizePolicy() const { - if ( orientation() == Horizontal ) + if ( orientation() == Qt::Horizontal ) return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ); else return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ); } -TQSize KToolBar::sizeHint() const +TQSize KToolBar::tqsizeHint() const { TQSize minSize(0,0); KToolBar *ncThis = const_cast<KToolBar *>(this); @@ -1356,13 +1356,13 @@ TQSize KToolBar::sizeHint() const case KToolBar::Bottom: for ( TQWidget *w = ncThis->widgets.first(); w; w = ncThis->widgets.next() ) { - TQSize sh = w->sizeHint(); - if ( w->sizePolicy().horData() == TQSizePolicy::Ignored ) + TQSize sh = w->tqsizeHint(); + if ( w->tqsizePolicy().horData() == TQSizePolicy::Ignored ) sh.setWidth( 1 ); - if ( w->sizePolicy().verData() == TQSizePolicy::Ignored ) + if ( w->tqsizePolicy().verData() == TQSizePolicy::Ignored ) sh.setHeight( 1 ); - sh = sh.boundedTo( w->maximumSize() ) - .expandedTo( w->minimumSize() ).expandedTo( TQSize(1, 1) ); + sh = sh.boundedTo( w->tqmaximumSize() ) + .expandedTo( w->tqminimumSize() ).expandedTo( TQSize(1, 1) ); minSize = minSize.expandedTo(TQSize(0, sh.height())); minSize += TQSize(sh.width()+1, 0); @@ -1370,7 +1370,7 @@ TQSize KToolBar::sizeHint() const minSize += TQSize(2, 0); // A little bit extra spacing behind it. } - minSize += TQSize(TQApplication::style().pixelMetric( TQStyle::PM_DockWindowHandleExtent ), 0); + minSize += TQSize(TQApplication::tqstyle().tqpixelMetric( TQStyle::PM_DockWindowHandleExtent ), 0); minSize += TQSize(margin*2, margin*2); break; @@ -1378,36 +1378,36 @@ TQSize KToolBar::sizeHint() const case KToolBar::Right: for ( TQWidget *w = ncThis->widgets.first(); w; w = ncThis->widgets.next() ) { - TQSize sh = w->sizeHint(); - if ( w->sizePolicy().horData() == TQSizePolicy::Ignored ) + TQSize sh = w->tqsizeHint(); + if ( w->tqsizePolicy().horData() == TQSizePolicy::Ignored ) sh.setWidth( 1 ); - if ( w->sizePolicy().verData() == TQSizePolicy::Ignored ) + if ( w->tqsizePolicy().verData() == TQSizePolicy::Ignored ) sh.setHeight( 1 ); - sh = sh.boundedTo( w->maximumSize() ) - .expandedTo( w->minimumSize() ).expandedTo( TQSize(1, 1) ); + sh = sh.boundedTo( w->tqmaximumSize() ) + .expandedTo( w->tqminimumSize() ).expandedTo( TQSize(1, 1) ); minSize = minSize.expandedTo(TQSize(sh.width(), 0)); minSize += TQSize(0, sh.height()+1); } - minSize += TQSize(0, TQApplication::style().pixelMetric( TQStyle::PM_DockWindowHandleExtent )); + minSize += TQSize(0, TQApplication::tqstyle().tqpixelMetric( TQStyle::PM_DockWindowHandleExtent )); minSize += TQSize(margin*2, margin*2); break; default: - minSize = TQToolBar::sizeHint(); + minSize = TQToolBar::tqsizeHint(); break; } return minSize; } -TQSize KToolBar::minimumSize() const +TQSize KToolBar::tqminimumSize() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } -TQSize KToolBar::minimumSizeHint() const +TQSize KToolBar::tqminimumSizeHint() const { - return sizeHint(); + return tqsizeHint(); } bool KToolBar::highlight() const @@ -1434,8 +1434,8 @@ void KToolBar::resizeEvent( TQResizeEvent *e ) { if (layoutTimer->isActive()) { - // Wait with repainting till layout is complete. - d->repaintTimer.start( 100, true ); + // Wait with tqrepainting till layout is complete. + d->tqrepaintTimer.start( 100, true ); } else { @@ -1481,25 +1481,25 @@ void KToolBar::slotAppearanceChanged() //static bool KToolBar::highlightSetting() { - TQString grpToolbar(TQString::fromLatin1("Toolbar style")); + TQString grpToolbar(TQString::tqfromLatin1("Toolbar style")); KConfigGroupSaver saver(KGlobal::config(), grpToolbar); - return KGlobal::config()->readBoolEntry(TQString::fromLatin1("Highlighting"),true); + return KGlobal::config()->readBoolEntry(TQString::tqfromLatin1("Highlighting"),true); } //static bool KToolBar::transparentSetting() { - TQString grpToolbar(TQString::fromLatin1("Toolbar style")); + TQString grpToolbar(TQString::tqfromLatin1("Toolbar style")); KConfigGroupSaver saver(KGlobal::config(), grpToolbar); - return KGlobal::config()->readBoolEntry(TQString::fromLatin1("TransparentMoving"),true); + return KGlobal::config()->readBoolEntry(TQString::tqfromLatin1("TransparentMoving"),true); } //static KToolBar::IconText KToolBar::iconTextSetting() { - TQString grpToolbar(TQString::fromLatin1("Toolbar style")); + TQString grpToolbar(TQString::tqfromLatin1("Toolbar style")); KConfigGroupSaver saver(KGlobal::config(), grpToolbar); - TQString icontext = KGlobal::config()->readEntry(TQString::fromLatin1("IconText"),TQString::fromLatin1("IconOnly")); + TQString icontext = KGlobal::config()->readEntry(TQString::tqfromLatin1("IconText"),TQString::tqfromLatin1("IconOnly")); if ( icontext == "IconTextRight" ) return IconTextRight; else if ( icontext == "IconTextBottom" ) @@ -1541,7 +1541,7 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const TQString &_configG TQString iconText = d->IconTextDefault; // this is the first iteration - TQString grpToolbar(TQString::fromLatin1("Toolbar style")); + TQString grpToolbar(TQString::tqfromLatin1("Toolbar style")); { // start block for KConfigGroupSaver KConfigGroupSaver saver(gconfig, grpToolbar); @@ -1711,7 +1711,7 @@ void KToolBar::applySettings(KConfig *config, const TQString &_configGroup, bool bool KToolBar::event( TQEvent *e ) { if ( (e->type() == TQEvent::LayoutHint) && isUpdatesEnabled() ) - d->repaintTimer.start( 100, true ); + d->tqrepaintTimer.start( 100, true ); if (e->type() == TQEvent::ChildInserted ) { @@ -1735,7 +1735,7 @@ void KToolBar::slotRepaint() resizeEvent(&ev); TQApplication::sendPostedEvents( this, TQEvent::LayoutHint ); setUpdatesEnabled( true ); - repaint( true ); + tqrepaint( true ); } void KToolBar::toolBarPosChanged( TQToolBar *tb ) @@ -2061,7 +2061,7 @@ KPopupMenu *KToolBar::contextMenu() TQValueList<int> avSizes; if (theme) { - if (!::qstrcmp(TQObject::name(), "mainToolBar")) + if (!::qstrcmp(name(), "mainToolBar")) avSizes = theme->querySizes( KIcon::MainToolbar); else avSizes = theme->querySizes( KIcon::Toolbar); @@ -2151,7 +2151,7 @@ void KToolBar::slotContextAboutToShow() configureAction = kmw->actionCollection()->action(actionName); if ( configureAction ) configureAction->plug(context); - KEditToolbar::setDefaultToolbar(TQObject::name()); + KEditToolbar::setDefaultToolbar(name()); for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i) context->setItemChecked(i, false); @@ -2245,7 +2245,7 @@ void KToolBar::widgetDestroyed() void KToolBar::removeWidgetInternal( TQWidget * w ) { widgets.removeRef( w ); - TQMap< TQWidget*, int >::Iterator it = widget2id.find( w ); + TQMap< TQWidget*, int >::Iterator it = widget2id.tqfind( w ); if ( it == widget2id.end() ) return; id2widget.remove( *it ); |