equal
deleted
inserted
replaced
92 |
92 |
93 void HbPopupLayoutProxy::setGeometry(const QRectF &rect) |
93 void HbPopupLayoutProxy::setGeometry(const QRectF &rect) |
94 { |
94 { |
95 if (!mPopup.isNull()) { |
95 if (!mPopup.isNull()) { |
96 const QSizeF popupPreferredSize = |
96 const QSizeF popupPreferredSize = |
97 mPopup->effectiveSizeHint(Qt::PreferredSize); |
97 mPopup->effectiveSizeHint(Qt::PreferredSize); |
98 const QSizeF usedSize( qMin(rect.width(), popupPreferredSize.width() ), |
98 const QSizeF usedSize( qMin(rect.width(), popupPreferredSize.width() ), |
99 qMin( rect.height(), popupPreferredSize.height() ) ); |
99 qMin( rect.height(), popupPreferredSize.height() ) ); |
100 QPointF usedPos(rect.left(), rect.top()); |
100 QPointF usedPos(rect.left(), rect.top()); |
101 mPreferredPos = ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->preferredPos; |
101 mPreferredPos = ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->preferredPos; |
102 mPlacement = ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->placement; |
102 mPlacement = ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->placement; |
155 if ( usedx < screenMargin ) usedx = screenMargin; |
155 if ( usedx < screenMargin ) usedx = screenMargin; |
156 if ( usedy < screenMargin ) usedy = screenMargin; |
156 if ( usedy < screenMargin ) usedy = screenMargin; |
157 |
157 |
158 usedPos = QPointF(usedx, usedy); |
158 usedPos = QPointF(usedx, usedy); |
159 } |
159 } |
160 mPopup->setGeometry(QRectF(usedPos, usedSize)); |
160 if (((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->mAutoLayouting) { |
|
161 mPopup->setGeometry(QRectF(usedPos, usedSize)); |
|
162 ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->mAutoLayouting = true; |
|
163 } else { |
|
164 mPopup->resize(usedSize); |
|
165 } |
161 } |
166 } |
162 } |
167 } |
163 |
168 |
164 bool HbPopupLayoutProxy::event( QEvent *e ) |
169 bool HbPopupLayoutProxy::event( QEvent *e ) |
165 { |
170 { |
175 |
180 |
176 bool HbPopupLayoutProxy::eventFilter(QObject *obj, QEvent *event) |
181 bool HbPopupLayoutProxy::eventFilter(QObject *obj, QEvent *event) |
177 { |
182 { |
178 Q_UNUSED( obj ); |
183 Q_UNUSED( obj ); |
179 switch( event->type() ) { |
184 switch( event->type() ) { |
180 case QEvent::LayoutRequest: { |
185 case QEvent::LayoutRequest: |
|
186 case QEvent::ContextMenu: |
|
187 case QEvent::Close: |
|
188 { |
181 updateGeometry(); |
189 updateGeometry(); |
182 break; |
190 break; |
183 } |
191 } |
184 case QEvent::ContextMenu: { |
|
185 updateGeometry(); |
|
186 break; |
|
187 } |
|
188 default: |
192 default: |
189 break; |
193 break; |
190 } |
194 } |
191 return false; |
195 return false; |
192 } |
196 } |
414 popup->metaObject()->className() != QLatin1String("HbCharPreviewPane") && |
418 popup->metaObject()->className() != QLatin1String("HbCharPreviewPane") && |
415 popup->metaObject()->className() != QLatin1String("HbCandidateList") && |
419 popup->metaObject()->className() != QLatin1String("HbCandidateList") && |
416 popup->metaObject()->className() != QLatin1String("HbExactWordPopup") && |
420 popup->metaObject()->className() != QLatin1String("HbExactWordPopup") && |
417 popup->metaObject()->className() != QLatin1String("HbInputSmileyPicker") && |
421 popup->metaObject()->className() != QLatin1String("HbInputSmileyPicker") && |
418 popup->metaObject()->className() != QLatin1String("Hb12KeyCustomKeypad") && |
422 popup->metaObject()->className() != QLatin1String("Hb12KeyCustomKeypad") && |
419 popup->metaObject()->className() != QLatin1String("HbInputThaiSpecialPopup") && |
423 !popup->inherits("HbInputVkbWidget")) { |
420 !popup->inherits("HbInputVkbWidget")) { |
|
421 setGeometryForPopup( popup ); |
424 setGeometryForPopup( popup ); |
422 } |
425 } |
423 } |
426 } |
424 |
427 |
425 // Check if popup is top level popup |
428 // Check if popup is top level popup |
430 |
433 |
431 // If this is the first popup in the stack being launched |
434 // If this is the first popup in the stack being launched |
432 if(!initialFocusedItem && scene) { |
435 if(!initialFocusedItem && scene) { |
433 initialFocusedItem = scene->focusItem(); |
436 initialFocusedItem = scene->focusItem(); |
434 } |
437 } |
435 |
438 |
436 topLevelFocusablePopup->setFocus(); |
439 // an embedded graphics item is already having a |
|
440 // focus so do not set focus as graphicsscene will automatically |
|
441 // set the focus to the embedded item. |
|
442 if (!topLevelFocusablePopup->focusItem()) |
|
443 topLevelFocusablePopup->setFocus(); |
437 } |
444 } |
438 |
445 |
439 updateFading(); |
446 updateFading(); |
440 } |
447 } |
441 } |
448 } |
483 else if (initialFocusedItem && scene && |
490 else if (initialFocusedItem && scene && |
484 scene->items().contains(initialFocusedItem)) { |
491 scene->items().contains(initialFocusedItem)) { |
485 |
492 |
486 // Move the focus to the initial focus item if there is no current focus item or |
493 // Move the focus to the initial focus item if there is no current focus item or |
487 // the ancestor of the current fucus item is popup |
494 // the ancestor of the current fucus item is popup |
488 if( !scene->focusItem() || popup->hasFocus() || popup->isAncestorOf(scene->focusItem())) { |
495 if( !scene->focusItem() || scene->focusItem() == popup || |
|
496 popup->isAncestorOf(scene->focusItem())) { |
489 initialFocusedItem->setFocus(); |
497 initialFocusedItem->setFocus(); |
490 initialFocusedItem = 0; |
498 initialFocusedItem = 0; |
491 } |
499 } |
492 } |
500 } |
493 } |
501 } |