From 374d939d8af431477ce2601815f0ba121b66871c Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 15 Feb 2011 19:11:41 +0000 Subject: Allow kdelibs to function correctly with TQt for Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1220926 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeui/ktoolbar.cpp | 73 +++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'kdeui/ktoolbar.cpp') diff --git a/kdeui/ktoolbar.cpp b/kdeui/ktoolbar.cpp index d6ae372d6..456acc438 100644 --- a/kdeui/ktoolbar.cpp +++ b/kdeui/ktoolbar.cpp @@ -194,7 +194,7 @@ TQSizePolicy KToolBarSeparator::sizePolicy() const KToolBar::KToolBar( TQWidget *parent, const char *name, bool honorStyle, bool readConfig ) : TQToolBar( TQString::tqfromLatin1( name ), - dynamic_cast(parent), + tqt_dynamic_cast(parent), parent, false, name ? name : "mainToolBar") { @@ -430,7 +430,7 @@ KAnimWidget *KToolBar::animatedWidget( int id ) Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; - KAnimWidget *aw = dynamic_cast(*it); + KAnimWidget *aw = tqt_dynamic_cast(*it); if ( aw ) return aw; TQObjectList *l = queryList( "KAnimWidget" ); @@ -440,7 +440,7 @@ KAnimWidget *KToolBar::animatedWidget( int id ) } for ( TQObject *o = l->first(); o; o = l->next() ) { - KAnimWidget *aw = dynamic_cast(o); + KAnimWidget *aw = tqt_dynamic_cast(o); if ( aw ) { delete l; @@ -613,7 +613,7 @@ KComboBox * KToolBar::getCombo(int id) Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; - return dynamic_cast( *it ); + return tqt_dynamic_cast( *it ); } @@ -622,7 +622,7 @@ KLineEdit * KToolBar::getLined (int id) Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; - return dynamic_cast( *it ); + return tqt_dynamic_cast( *it ); } @@ -631,7 +631,7 @@ KToolBarButton * KToolBar::getButton (int id) Id2WidgetMap::Iterator it = id2widget.tqfind( id ); if ( it == id2widget.end() ) return 0; - return dynamic_cast( *it ); + return tqt_dynamic_cast( *it ); } @@ -734,7 +734,7 @@ int KToolBar::itemIndex (int id) int KToolBar::idAt (int index) { - TQWidget *w = widgets.at(index); + TQWidget *w = widgets.tqat(index); return widget2id[w]; } @@ -856,10 +856,11 @@ void KToolBar::setIconText(IconText icontext, bool update) // ugly hack to force a TQMainWindow::triggerLayout( true ) TQMainWindow *mw = mainWindow(); if ( mw ) { - mw->setUpdatesEnabled( false ); - mw->setToolBarsMovable( !mw->toolBarsMovable() ); - mw->setToolBarsMovable( !mw->toolBarsMovable() ); - mw->setUpdatesEnabled( true ); + mw->tqsetUpdatesEnabled( false ); +// mw->setToolBarsMovable( !mw->toolBarsMovable() ); // Old way +// mw->setToolBarsMovable( !mw->toolBarsMovable() ); + mw->setCentralWidget(mw->centralWidget()); // This is a faster hack + mw->tqsetUpdatesEnabled( true ); } } @@ -893,14 +894,14 @@ void KToolBar::setIconSize(int size, bool update) // ugly hack to force a TQMainWindow::triggerLayout( true ) if ( mainWindow() ) { TQMainWindow *mw = mainWindow(); - mw->setUpdatesEnabled( false ); - mw->setToolBarsMovable( !mw->toolBarsMovable() ); - mw->setToolBarsMovable( !mw->toolBarsMovable() ); - mw->setUpdatesEnabled( true ); + mw->tqsetUpdatesEnabled( false ); +// mw->setToolBarsMovable( !mw->toolBarsMovable() ); // Old way +// mw->setToolBarsMovable( !mw->toolBarsMovable() ); + mw->setCentralWidget(mw->centralWidget()); // This is a faster hack + mw->tqsetUpdatesEnabled( true ); } } - int KToolBar::iconSize() const { if ( !d->m_iconSize ) // default value? @@ -946,7 +947,7 @@ void KToolBar::setFlat (bool flag) else mainWindow()->moveDockWindow( this, DockTop ); // And remember to save the new look later - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); if ( kmw ) kmw->setSettingsDirty(); } @@ -1092,7 +1093,7 @@ void KToolBar::saveSettings(KConfig *config, const TQString &_configGroup) // reappear at the same position the next time. // The whole set of indexes has to be saved. //kdDebug(220) << name() << " writing index " << index << endl; - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); // don't save if there's only one toolbar // Don't use kmw->toolBarIterator() because you might @@ -1203,7 +1204,7 @@ void KToolBar::mousePressEvent ( TQMouseEvent *m ) else return; // assume this was an action handled elsewhere, no need for setSettingsDirty() } - KMainWindow *kmw = dynamic_cast(mw); + KMainWindow *kmw = tqt_dynamic_cast(mw); if ( kmw ) kmw->setSettingsDirty(); } @@ -1237,17 +1238,17 @@ void KToolBar::rebuildLayout() for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) { if ( w == rightAligned ) continue; - KToolBarSeparator *ktbs = dynamic_cast(w); + KToolBarSeparator *ktbs = tqt_dynamic_cast(w); if ( ktbs && !ktbs->showLine() ) { l->addSpacing( orientation() == Qt::Vertical ? w->tqsizeHint().height() : w->tqsizeHint().width() ); w->hide(); continue; } - if ( dynamic_cast(w) ) // w is a QPopupMenu? + if ( tqt_dynamic_cast(w) ) // w is a QPopupMenu? continue; l->addWidget( w ); w->show(); - if ((orientation() == Qt::Horizontal) && dynamic_cast(w)) // w is TQLineEdit ? + if ((orientation() == Qt::Horizontal) && tqt_dynamic_cast(w)) // w is TQLineEdit ? l->addSpacing(2); // A little bit extra spacing behind it. } if ( rightAligned ) { @@ -1269,14 +1270,14 @@ void KToolBar::rebuildLayout() void KToolBar::childEvent( TQChildEvent *e ) { if ( e->child()->isWidgetType() ) { - TQWidget * w = dynamic_cast(e->child()); + TQWidget * w = tqt_dynamic_cast(e->child()); if (!w || !(::qstrcmp( "qt_dockwidget_internal", w->name()))) { TQToolBar::childEvent( e ); return; } if ( e->type() == TQEvent::ChildInserted ) { - if ( !dynamic_cast(w)) { // e->child() is not a QPopupMenu + if ( !tqt_dynamic_cast(w)) { // e->child() is not a QPopupMenu // prevent items that have been explicitly inserted by insert*() from // being inserted again if ( !widget2id.tqcontains( w ) ) @@ -1293,8 +1294,8 @@ void KToolBar::childEvent( TQChildEvent *e ) layoutTimer->start( 50, true ); TQBoxLayout *l = boxLayout(); - // clear the old layout so that we don't get unnecassery layout - // changes till we have rebuild the thing + // clear the old layout so that we don't get unnecessary layout + // changes until we have rebuilt the thing TQLayoutIterator it = l->iterator(); while ( it.current() ) it.deleteCurrent(); @@ -1366,7 +1367,7 @@ TQSize KToolBar::tqsizeHint() const minSize = minSize.expandedTo(TQSize(0, sh.height())); minSize += TQSize(sh.width()+1, 0); - if (dynamic_cast(w)) // w is a TQLineEdit ? + if (tqt_dynamic_cast(w)) // w is a TQLineEdit ? minSize += TQSize(2, 0); // A little bit extra spacing behind it. } @@ -1428,7 +1429,7 @@ void KToolBar::show() void KToolBar::resizeEvent( TQResizeEvent *e ) { bool b = isUpdatesEnabled(); - setUpdatesEnabled( false ); + tqsetUpdatesEnabled( false ); TQToolBar::resizeEvent( e ); if (b) { @@ -1443,6 +1444,10 @@ void KToolBar::resizeEvent( TQResizeEvent *e ) slotRepaint(); } } +// else { +// printf("[WARNING] In KToolBar::resizeEvent, but this code block should not be executing. Preventing toolbar lockup. [Code 0045]\n\r"); +// tqsetUpdatesEnabled( true ); +// } } void KToolBar::slotIconChanged(int group) @@ -1473,7 +1478,7 @@ void KToolBar::slotAppearanceChanged() applyAppearanceSettings(KGlobal::config(), TQString::null, true /* lose local settings */ ); // And remember to save the new look later - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); if ( kmw ) kmw->setSettingsDirty(); } @@ -1727,14 +1732,14 @@ bool KToolBar::event( TQEvent *e ) void KToolBar::slotRepaint() { - setUpdatesEnabled( false ); + tqsetUpdatesEnabled( false ); // Send a resizeEvent to update the "toolbar extension arrow" // (The button you get when your toolbar-items don't fit in // the available space) TQResizeEvent ev(size(), size()); resizeEvent(&ev); TQApplication::sendPostedEvents( this, TQEvent::LayoutHint ); - setUpdatesEnabled( true ); + tqsetUpdatesEnabled( true ); tqrepaint( true ); } @@ -1745,7 +1750,7 @@ void KToolBar::toolBarPosChanged( TQToolBar *tb ) if ( d->oldPos == DockMinimized ) rebuildLayout(); d->oldPos = (TQMainWindow::ToolBarDock)barPos(); - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); if ( kmw ) kmw->setSettingsDirty(); } @@ -2133,7 +2138,7 @@ void KToolBar::slotContextAboutToShow() // and ToolBarHandler::setupActions() deletes it, so better not keep it around. // So we currently plug/unplug the last two actions of the menu. // Another way would be to keep around the actions and plug them all into a (new each time) popupmenu. - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); if ( kmw ) { kmw->setupToolbarMenuActions(); // Only allow hiding a toolbar if the action is also plugged somewhere else (e.g. menubar) @@ -2213,7 +2218,7 @@ void KToolBar::slotContextAboutToHide() { // We have to unplug whatever slotContextAboutToShow plugged into the menu. // Unplug the toolbar menu action - KMainWindow *kmw = dynamic_cast(mainWindow()); + KMainWindow *kmw = tqt_dynamic_cast(mainWindow()); if ( kmw && kmw->toolBarMenuAction() ) if ( kmw->toolBarMenuAction()->containerCount() > 1 ) kmw->toolBarMenuAction()->unplug(context); -- cgit v1.2.1