summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2003-03-30 02:54:37 (UTC)
committer mickeyl <mickeyl>2003-03-30 02:54:37 (UTC)
commit15ee85466704072173296ff4f0f446cd8fe81d1e (patch) (unidiff)
treed497cb855ee8ee6533f2efd5b064cef4dc2bb16b /libopie2
parent1d5a00fa8db662c4a5f6490d26d4e2ef1836f118 (diff)
downloadopie-15ee85466704072173296ff4f0f446cd8fe81d1e.zip
opie-15ee85466704072173296ff4f0f446cd8fe81d1e.tar.gz
opie-15ee85466704072173296ff4f0f446cd8fe81d1e.tar.bz2
convert dynamic_cast<> to using QObject::inherits
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/qt3/opieui/ocombobox.cpp5
-rw-r--r--libopie2/qt3/opieui/oeditlistbox.cpp5
2 files changed, 7 insertions, 3 deletions
diff --git a/libopie2/qt3/opieui/ocombobox.cpp b/libopie2/qt3/opieui/ocombobox.cpp
index a1dd5f5..8dbda8f 100644
--- a/libopie2/qt3/opieui/ocombobox.cpp
+++ b/libopie2/qt3/opieui/ocombobox.cpp
@@ -299,49 +299,52 @@ void OComboBox::setCompletedItems( const QStringList& items )
299{ 299{
300 if ( d->olineEdit ) 300 if ( d->olineEdit )
301 d->olineEdit->setCompletedItems( items ); 301 d->olineEdit->setCompletedItems( items );
302} 302}
303 303
304 304
305OCompletionBox * OComboBox::completionBox( bool create ) 305OCompletionBox * OComboBox::completionBox( bool create )
306{ 306{
307 if ( d->olineEdit ) 307 if ( d->olineEdit )
308 return d->olineEdit->completionBox( create ); 308 return d->olineEdit->completionBox( create );
309 return 0; 309 return 0;
310} 310}
311 311
312// QWidget::create() turns off mouse-Tracking which would break auto-hiding 312// QWidget::create() turns off mouse-Tracking which would break auto-hiding
313void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) 313void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow )
314{ 314{
315 QComboBox::create( id, initializeWindow, destroyOldWindow ); 315 QComboBox::create( id, initializeWindow, destroyOldWindow );
316 //OCursor::setAutoHideCursor( lineEdit(), true, true ); 316 //OCursor::setAutoHideCursor( lineEdit(), true, true );
317} 317}
318 318
319void OComboBox::setLineEdit( OLineEdit *edit ) 319void OComboBox::setLineEdit( OLineEdit *edit )
320{ 320{
321 #if QT_VERSION > 290 321 #if QT_VERSION > 290
322 QComboBox::setLineEdit( edit ); 322 QComboBox::setLineEdit( edit );
323 d->olineEdit = dynamic_cast<OLineEdit*>( edit ); 323 if ( !edit->inherits( "OLineEdit" ) )
324 d->olineEdit = 0;
325 else
326 d->olineEdit = static_cast<OLineEdit*>( edit );
324 setDelegate( d->olineEdit ); 327 setDelegate( d->olineEdit );
325 328
326 // forward some signals. We only emit returnPressed() ourselves. 329 // forward some signals. We only emit returnPressed() ourselves.
327 if ( d->olineEdit ) { 330 if ( d->olineEdit ) {
328 connect( d->olineEdit, SIGNAL( completion( const QString& )), 331 connect( d->olineEdit, SIGNAL( completion( const QString& )),
329 SIGNAL( completion( const QString& )) ); 332 SIGNAL( completion( const QString& )) );
330 connect( d->olineEdit, SIGNAL( substringCompletion( const QString& )), 333 connect( d->olineEdit, SIGNAL( substringCompletion( const QString& )),
331 SIGNAL( substringCompletion( const QString& )) ); 334 SIGNAL( substringCompletion( const QString& )) );
332 connect( d->olineEdit, 335 connect( d->olineEdit,
333 SIGNAL( textRotation( OCompletionBase::KeyBindingType )), 336 SIGNAL( textRotation( OCompletionBase::KeyBindingType )),
334 SIGNAL( textRotation( OCompletionBase::KeyBindingType )) ); 337 SIGNAL( textRotation( OCompletionBase::KeyBindingType )) );
335 connect( d->olineEdit, 338 connect( d->olineEdit,
336 SIGNAL( completionModeChanged( OGlobalSettings::Completion )), 339 SIGNAL( completionModeChanged( OGlobalSettings::Completion )),
337 SIGNAL( completionModeChanged( OGlobalSettings::Completion))); 340 SIGNAL( completionModeChanged( OGlobalSettings::Completion)));
338 341
339 connect( d->olineEdit, 342 connect( d->olineEdit,
340 SIGNAL( aboutToShowContextMenu( QPopupMenu * )), 343 SIGNAL( aboutToShowContextMenu( QPopupMenu * )),
341 SIGNAL( aboutToShowContextMenu( QPopupMenu * )) ); 344 SIGNAL( aboutToShowContextMenu( QPopupMenu * )) );
342 } 345 }
343 #else 346 #else
344 #warning OComboBox is not fully functional with Qt2 347 #warning OComboBox is not fully functional with Qt2
345 #endif 348 #endif
346} 349}
347 350
diff --git a/libopie2/qt3/opieui/oeditlistbox.cpp b/libopie2/qt3/opieui/oeditlistbox.cpp
index 3c53552..0e95274 100644
--- a/libopie2/qt3/opieui/oeditlistbox.cpp
+++ b/libopie2/qt3/opieui/oeditlistbox.cpp
@@ -390,27 +390,28 @@ void OEditListBox::insertStrList(const char ** list, int numStrings, int index)
390{ 390{
391 m_listBox->insertStrList(list,numStrings,index); 391 m_listBox->insertStrList(list,numStrings,index);
392} 392}
393 393
394QStringList OEditListBox::items() const 394QStringList OEditListBox::items() const
395{ 395{
396 QStringList list; 396 QStringList list;
397 for ( uint i = 0; i < m_listBox->count(); i++ ) 397 for ( uint i = 0; i < m_listBox->count(); i++ )
398 list.append( m_listBox->text( i )); 398 list.append( m_listBox->text( i ));
399 399
400 return list; 400 return list;
401} 401}
402 402
403void OEditListBox::virtual_hook( int, void* ) 403void OEditListBox::virtual_hook( int, void* )
404{ /*BASE::virtual_hook( id, data );*/ } 404{ /*BASE::virtual_hook( id, data );*/ }
405 405
406 406
407/*====================================================================================== 407/*======================================================================================
408 * CustomEditor 408 * CustomEditor
409 *======================================================================================*/ 409 *======================================================================================*/
410 410
411OEditListBox::CustomEditor::CustomEditor( OComboBox *combo ) 411OEditListBox::CustomEditor::CustomEditor( OComboBox *combo )
412{ 412{
413 m_representationWidget = combo; 413 m_representationWidget = combo;
414 m_lineEdit = dynamic_cast<OLineEdit*>( combo->lineEdit() ); 414 assert( combo->lineEdit()->inherits( "OLineEdit" ) );
415 assert( m_lineEdit ); 415 m_lineEdit = static_cast<OLineEdit*>( combo->lineEdit() );
416
416} 417}