172 } |
172 } |
173 mDropDown->mList->scrollTo( mModel->index( 0, 0 ) ); |
173 mDropDown->mList->scrollTo( mModel->index( 0, 0 ) ); |
174 mDropDown->mList->setCurrentIndex( |
174 mDropDown->mList->setCurrentIndex( |
175 mModel->index( 0, 0 ), QItemSelectionModel::Select ); |
175 mModel->index( 0, 0 ), QItemSelectionModel::Select ); |
176 } |
176 } |
|
177 positionDropDown( ); |
177 #ifdef HB_EFFECTS |
178 #ifdef HB_EFFECTS |
178 HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "appear" ); |
179 HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "appear" ); |
179 #endif |
180 #endif |
180 positionDropDown( ); |
|
181 } |
181 } |
182 } |
182 } |
183 |
183 |
184 void HbComboBoxPrivate::vkbOpened( ) |
184 void HbComboBoxPrivate::vkbOpened( ) |
185 { |
185 { |
209 mDropDown->mList->setCurrentIndex( mCurrentIndex, QItemSelectionModel::Select ); |
209 mDropDown->mList->setCurrentIndex( mCurrentIndex, QItemSelectionModel::Select ); |
210 } else { |
210 } else { |
211 mDropDown->mList->scrollTo( aModel->index( 0, 0 ) ); |
211 mDropDown->mList->scrollTo( aModel->index( 0, 0 ) ); |
212 } |
212 } |
213 positionDropDown( ); |
213 positionDropDown( ); |
214 mDropDown->setVisible( true ); |
214 if( !mDropDown->isVisible( ) ) { |
|
215 mDropDown->setVisible( true ); |
|
216 #ifdef HB_EFFECTS |
|
217 HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "appear" ); |
|
218 #endif |
|
219 } |
215 } |
220 } |
216 } |
221 } |
217 |
222 |
218 void HbComboBoxPrivate::createDropDown( ) |
223 void HbComboBoxPrivate::createDropDown( ) |
219 { |
224 { |
257 p->setFlag( QGraphicsItem::ItemSendsGeometryChanges, false ); |
262 p->setFlag( QGraphicsItem::ItemSendsGeometryChanges, false ); |
258 } |
263 } |
259 } |
264 } |
260 widgetGeometryChange.clear(); |
265 widgetGeometryChange.clear(); |
261 } |
266 } |
|
267 } |
|
268 |
|
269 void HbComboBoxPrivate::showDismissEffect( ) |
|
270 { |
|
271 #ifdef HB_EFFECTS |
|
272 HbEffect::start( mDropDown, HB_DROPD0WN_ITEM_TYPE, "disappear", mDropDown, "dismissEffectFinished" ); |
|
273 #else |
|
274 mDropDown->setVisible( false ); |
|
275 #endif |
262 } |
276 } |
263 |
277 |
264 void HbComboBoxPrivate::positionDropDown( ) |
278 void HbComboBoxPrivate::positionDropDown( ) |
265 { |
279 { |
266 Q_Q( HbComboBox ); |
280 Q_Q( HbComboBox ); |
291 popupPos = QPointF( widgetPos.x( ), widgetPos.y( ) + q->rect( ).height( ) ); |
305 popupPos = QPointF( widgetPos.x( ), widgetPos.y( ) + q->rect( ).height( ) ); |
292 #ifdef HB_EFFECTS |
306 #ifdef HB_EFFECTS |
293 if ( !mHasDownEffect ) { |
307 if ( !mHasDownEffect ) { |
294 mHasDownEffect = true; |
308 mHasDownEffect = true; |
295 mHasUpEffect = false; |
309 mHasUpEffect = false; |
296 // this is temporary until proper effect theming comes. |
|
297 //this Effect will be shown when there is space in the view bottom. |
310 //this Effect will be shown when there is space in the view bottom. |
298 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
311 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
299 HbEffectInternal::add( mDropDown, "combo_disappear_downl", "disappear" ); |
312 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" ); |
300 } |
313 } |
301 #endif |
314 #endif |
302 } else if( widgetPos.y( ) - maxPopupHeight > 0.0 ) { |
315 } else if( widgetPos.y( ) - maxPopupHeight > 0.0 ) { |
303 popupPos = QPointF( widgetPos.x( ), widgetPos.y( ) - maxPopupHeight ); |
316 popupPos = QPointF( widgetPos.x( ), widgetPos.y( ) - maxPopupHeight ); |
304 #ifdef HB_EFFECTS |
317 #ifdef HB_EFFECTS |
305 if ( !mHasUpEffect ) { |
318 if ( !mHasUpEffect ) { |
306 // this is temporary until proper effect theming comes. |
|
307 //this Effect will be shown when there is no space in the view bottom |
319 //this Effect will be shown when there is no space in the view bottom |
308 mHasUpEffect = true; |
320 mHasUpEffect = true; |
309 mHasDownEffect = false; |
321 mHasDownEffect = false; |
310 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
322 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
311 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
323 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
317 popupPos = QPointF( widgetPos.x( ), 0.0 ); |
329 popupPos = QPointF( widgetPos.x( ), 0.0 ); |
318 #ifdef HB_EFFECTS |
330 #ifdef HB_EFFECTS |
319 if ( !mHasDownEffect ) { |
331 if ( !mHasDownEffect ) { |
320 mHasDownEffect = true; |
332 mHasDownEffect = true; |
321 mHasUpEffect = false; |
333 mHasUpEffect = false; |
322 // this is temporary until proper effect theming comes. |
|
323 //this Effect will be shown when there is more space in the view bottom. |
334 //this Effect will be shown when there is more space in the view bottom. |
324 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
335 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
325 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" ); |
336 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" ); |
326 } |
337 } |
327 #endif |
338 #endif |
329 popupPos = QPointF( widgetPos.x( ), sceneRect.height( ) - maxPopupHeight ); |
340 popupPos = QPointF( widgetPos.x( ), sceneRect.height( ) - maxPopupHeight ); |
330 #ifdef HB_EFFECTS |
341 #ifdef HB_EFFECTS |
331 if ( !mHasUpEffect ) { |
342 if ( !mHasUpEffect ) { |
332 mHasUpEffect = true; |
343 mHasUpEffect = true; |
333 mHasDownEffect = false; |
344 mHasDownEffect = false; |
334 // this is temporary until proper effect theming comes. |
|
335 //this Effect will be shown when there is more space in the view bottom. |
345 //this Effect will be shown when there is more space in the view bottom. |
336 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
346 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
337 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
347 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
338 } |
348 } |
339 #endif |
349 #endif |
363 } |
373 } |
364 #ifdef HB_EFFECTS |
374 #ifdef HB_EFFECTS |
365 if ( !mHasUpEffect ) { |
375 if ( !mHasUpEffect ) { |
366 mHasUpEffect = true; |
376 mHasUpEffect = true; |
367 mHasDownEffect = false; |
377 mHasDownEffect = false; |
368 // this is temporary until proper effect theming comes. |
|
369 //this Effect will be shown when there is more space in the view bottom. |
378 //this Effect will be shown when there is more space in the view bottom. |
370 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
379 HbEffectInternal::add( mDropDown, "combo_appear_up", "appear" ); |
371 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
380 HbEffectInternal::add( mDropDown, "combo_disappear_up", "disappear" ); |
372 } |
381 } |
373 #endif |
382 #endif |
379 } |
388 } |
380 #ifdef HB_EFFECTS |
389 #ifdef HB_EFFECTS |
381 if ( !mHasDownEffect ) { |
390 if ( !mHasDownEffect ) { |
382 mHasDownEffect = true; |
391 mHasDownEffect = true; |
383 mHasUpEffect = false; |
392 mHasUpEffect = false; |
384 // this is temporary until proper effect theming comes. |
|
385 //this Effect will be shown when there is more space in the view bottom. |
393 //this Effect will be shown when there is more space in the view bottom. |
386 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
394 HbEffectInternal::add( mDropDown, "combo_appear_down", "appear" ); |
387 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" ); |
395 HbEffectInternal::add( mDropDown, "combo_disappear_down", "disappear" ); |
388 } |
396 } |
389 #endif |
397 #endif |
431 mCurrentIndex = findData( mText ); |
439 mCurrentIndex = findData( mText ); |
432 q->connect( mLineEdit, SIGNAL( textChanged ( QString ) ), q, |
440 q->connect( mLineEdit, SIGNAL( textChanged ( QString ) ), q, |
433 SLOT( _q_textChanged( QString ) ) ); |
441 SLOT( _q_textChanged( QString ) ) ); |
434 } |
442 } |
435 if ( mDropDown->isVisible( ) ) { |
443 if ( mDropDown->isVisible( ) ) { |
436 mDropDown->setVisible( false ); |
444 showDismissEffect( ); |
437 q->setProperty( "state", "normal" ); |
445 q->setProperty( "state", "normal" ); |
438 } |
446 } |
439 currentIndexChanged( mCurrentIndex ); |
447 currentIndexChanged( mCurrentIndex ); |
440 } |
448 } |
441 |
449 |