author | mickeyl <mickeyl> | 2003-03-30 02:54:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-30 02:54:37 (UTC) |
commit | 15ee85466704072173296ff4f0f446cd8fe81d1e (patch) (unidiff) | |
tree | d497cb855ee8ee6533f2efd5b064cef4dc2bb16b | |
parent | 1d5a00fa8db662c4a5f6490d26d4e2ef1836f118 (diff) | |
download | opie-15ee85466704072173296ff4f0f446cd8fe81d1e.zip opie-15ee85466704072173296ff4f0f446cd8fe81d1e.tar.gz opie-15ee85466704072173296ff4f0f446cd8fe81d1e.tar.bz2 |
convert dynamic_cast<> to using QObject::inherits
-rw-r--r-- | libopie2/qt3/opieui/ocombobox.cpp | 5 | ||||
-rw-r--r-- | libopie2/qt3/opieui/oeditlistbox.cpp | 5 |
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 | |||
@@ -275,97 +275,100 @@ void OComboBox::setEditURL( const OURL& url ) | |||
275 | 275 | ||
276 | void OComboBox::insertURL( const OURL& url, int index ) | 276 | void OComboBox::insertURL( const OURL& url, int index ) |
277 | { | 277 | { |
278 | QComboBox::insertItem( url.prettyURL(), index ); | 278 | QComboBox::insertItem( url.prettyURL(), index ); |
279 | } | 279 | } |
280 | 280 | ||
281 | void OComboBox::insertURL( const QPixmap& pixmap, const OURL& url, int index ) | 281 | void OComboBox::insertURL( const QPixmap& pixmap, const OURL& url, int index ) |
282 | { | 282 | { |
283 | QComboBox::insertItem( pixmap, url.prettyURL(), index ); | 283 | QComboBox::insertItem( pixmap, url.prettyURL(), index ); |
284 | } | 284 | } |
285 | 285 | ||
286 | void OComboBox::changeURL( const OURL& url, int index ) | 286 | void OComboBox::changeURL( const OURL& url, int index ) |
287 | { | 287 | { |
288 | QComboBox::changeItem( url.prettyURL(), index ); | 288 | QComboBox::changeItem( url.prettyURL(), index ); |
289 | } | 289 | } |
290 | 290 | ||
291 | void OComboBox::changeURL( const QPixmap& pixmap, const OURL& url, int index ) | 291 | void OComboBox::changeURL( const QPixmap& pixmap, const OURL& url, int index ) |
292 | { | 292 | { |
293 | QComboBox::changeItem( pixmap, url.prettyURL(), index ); | 293 | QComboBox::changeItem( pixmap, url.prettyURL(), index ); |
294 | } | 294 | } |
295 | */ | 295 | */ |
296 | 296 | ||
297 | 297 | ||
298 | void OComboBox::setCompletedItems( const QStringList& items ) | 298 | 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 | ||
305 | OCompletionBox * OComboBox::completionBox( bool create ) | 305 | OCompletionBox * 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 |
313 | void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow ) | 313 | void 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 | ||
319 | void OComboBox::setLineEdit( OLineEdit *edit ) | 319 | void 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 | ||
348 | // Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001 | 351 | // Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001 |
349 | void OComboBox::deleteWordForward() | 352 | void OComboBox::deleteWordForward() |
350 | { | 353 | { |
351 | lineEdit()->cursorWordForward(TRUE); | 354 | lineEdit()->cursorWordForward(TRUE); |
352 | #if QT_VERSION > 290 | 355 | #if QT_VERSION > 290 |
353 | if ( lineEdit()->hasSelectedText() ) | 356 | if ( lineEdit()->hasSelectedText() ) |
354 | #else | 357 | #else |
355 | if ( lineEdit()->hasMarkedText() ) | 358 | if ( lineEdit()->hasMarkedText() ) |
356 | #endif | 359 | #endif |
357 | { | 360 | { |
358 | lineEdit()->del(); | 361 | lineEdit()->del(); |
359 | } | 362 | } |
360 | } | 363 | } |
361 | 364 | ||
362 | void OComboBox::deleteWordBack() | 365 | void OComboBox::deleteWordBack() |
363 | { | 366 | { |
364 | lineEdit()->cursorWordBackward(TRUE); | 367 | lineEdit()->cursorWordBackward(TRUE); |
365 | #if QT_VERSION > 290 | 368 | #if QT_VERSION > 290 |
366 | if ( lineEdit()->hasSelectedText() ) | 369 | if ( lineEdit()->hasSelectedText() ) |
367 | #else | 370 | #else |
368 | if ( lineEdit()->hasMarkedText() ) | 371 | if ( lineEdit()->hasMarkedText() ) |
369 | #endif | 372 | #endif |
370 | { | 373 | { |
371 | lineEdit()->del(); | 374 | lineEdit()->del(); |
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 | |||
@@ -366,51 +366,52 @@ void OEditListBox::enableMoveButtons(int index) | |||
366 | 366 | ||
367 | void OEditListBox::clear() | 367 | void OEditListBox::clear() |
368 | { | 368 | { |
369 | m_lineEdit->clear(); | 369 | m_lineEdit->clear(); |
370 | m_listBox->clear(); | 370 | m_listBox->clear(); |
371 | emit changed(); | 371 | emit changed(); |
372 | } | 372 | } |
373 | 373 | ||
374 | void OEditListBox::insertStringList(const QStringList& list, int index) | 374 | void OEditListBox::insertStringList(const QStringList& list, int index) |
375 | { | 375 | { |
376 | m_listBox->insertStringList(list,index); | 376 | m_listBox->insertStringList(list,index); |
377 | } | 377 | } |
378 | 378 | ||
379 | void OEditListBox::insertStrList(const QStrList* list, int index) | 379 | void OEditListBox::insertStrList(const QStrList* list, int index) |
380 | { | 380 | { |
381 | m_listBox->insertStrList(list,index); | 381 | m_listBox->insertStrList(list,index); |
382 | } | 382 | } |
383 | 383 | ||
384 | void OEditListBox::insertStrList(const QStrList& list, int index) | 384 | void OEditListBox::insertStrList(const QStrList& list, int index) |
385 | { | 385 | { |
386 | m_listBox->insertStrList(list,index); | 386 | m_listBox->insertStrList(list,index); |
387 | } | 387 | } |
388 | 388 | ||
389 | void OEditListBox::insertStrList(const char ** list, int numStrings, int index) | 389 | 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 | ||
394 | QStringList OEditListBox::items() const | 394 | QStringList 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 | ||
403 | void OEditListBox::virtual_hook( int, void* ) | 403 | void 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 | ||
411 | OEditListBox::CustomEditor::CustomEditor( OComboBox *combo ) | 411 | OEditListBox::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 | } |