270 QAbstractItemModel *model = mDropDown->mList->model( ); |
270 QAbstractItemModel *model = mDropDown->mList->model( ); |
271 calculateListItemHeight( ); |
271 calculateListItemHeight( ); |
272 qreal totalHeightRequd = model->rowCount( ) * mListItemHeight; |
272 qreal totalHeightRequd = model->rowCount( ) * mListItemHeight; |
273 qreal maxPopupHeight = 0.0; |
273 qreal maxPopupHeight = 0.0; |
274 |
274 |
275 //read the maximum rows in drop down for different orientation from css |
275 //calculate the maximum popup height for different orientation |
276 if( q->mainWindow( )->orientation( ) == Qt::Horizontal ) { |
276 if( q->mainWindow( )->orientation( ) == Qt::Horizontal ) { |
277 if( mDropDownRowsInLandscape == -1 ) { |
|
278 HbStyleParameters params; |
|
279 q->style()->parameters( params ); |
|
280 params.addParameter( "max-rows-in-dropdown" ); |
|
281 q->polish( params ); |
|
282 mDropDownRowsInLandscape = params.value( "max-rows-in-dropdown" ).toInt( ); |
|
283 } |
|
284 maxPopupHeight = mDropDownRowsInLandscape * mListItemHeight; |
277 maxPopupHeight = mDropDownRowsInLandscape * mListItemHeight; |
285 } else if( q->mainWindow( )->orientation( ) == Qt::Vertical ) { |
278 } else if( q->mainWindow( )->orientation( ) == Qt::Vertical ) { |
286 if( mDropDownRowsInPortrait == -1 ) { |
|
287 HbStyleParameters params; |
|
288 q->style()->parameters( params ); |
|
289 params.addParameter( "max-rows-in-dropdown" ); |
|
290 q->polish( params ); |
|
291 mDropDownRowsInPortrait = params.value( "max-rows-in-dropdown" ).toInt( ); |
|
292 } |
|
293 maxPopupHeight = mDropDownRowsInPortrait * mListItemHeight; |
279 maxPopupHeight = mDropDownRowsInPortrait * mListItemHeight; |
294 } |
280 } |
295 |
281 |
296 if ( totalHeightRequd < maxPopupHeight ) { |
282 if ( totalHeightRequd < maxPopupHeight ) { |
297 maxPopupHeight = totalHeightRequd; |
283 maxPopupHeight = totalHeightRequd; |
552 mLineEdit->backgroundItem( )->setVisible( false ); |
538 mLineEdit->backgroundItem( )->setVisible( false ); |
553 } |
539 } |
554 q->setHandlesChildEvents( false ); |
540 q->setHandlesChildEvents( false ); |
555 mLineEdit->setReadOnly( false ); |
541 mLineEdit->setReadOnly( false ); |
556 mLineEdit->setCursorVisibility( Hb::TextCursorVisible ); |
542 mLineEdit->setCursorVisibility( Hb::TextCursorVisible ); |
557 mLineEdit->setLongPressEnabled( ); |
|
558 q->repolish( ); |
543 q->repolish( ); |
559 q->connect( mLineEdit, SIGNAL( textChanged ( QString ) ), |
544 q->connect( mLineEdit, SIGNAL( textChanged ( QString ) ), |
560 q, SLOT( _q_textChanged( QString ) ) ); |
545 q, SLOT( _q_textChanged( QString ) ) ); |
561 setCompletion( true ); |
546 setCompletion( true ); |
562 } else { |
547 } else { |
563 q->disconnect( mLineEdit, SIGNAL( textChanged ( QString ) ), |
548 q->disconnect( mLineEdit, SIGNAL( textChanged ( QString ) ), |
564 q, SLOT( _q_textChanged( QString ) ) ); |
549 q, SLOT( _q_textChanged( QString ) ) ); |
565 q->setHandlesChildEvents( true ); |
550 q->setHandlesChildEvents( true ); |
566 mLineEdit->setReadOnly( true ); |
551 mLineEdit->setReadOnly( true ); |
567 mLineEdit->setLongPressEnabled( false ); |
|
568 setCompletion( false ); |
552 setCompletion( false ); |
569 mLineEdit->setCursorVisibility( Hb::TextCursorHidden ); |
553 mLineEdit->setCursorVisibility( Hb::TextCursorHidden ); |
570 if( mModel && mModel->rowCount( ) ) { |
554 if( mModel && mModel->rowCount( ) ) { |
571 QModelIndex mi = mModel->index( 0, 0 ); |
555 QModelIndex mi = mModel->index( 0, 0 ); |
572 if( mi.isValid( ) ) { |
556 if( mi.isValid( ) ) { |