src/hbinput/inputwidgets/hbinputcandidatelist.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    80       mFrameBackground(0),
    80       mFrameBackground(0),
    81       mSpellQueryItem(0),
    81       mSpellQueryItem(0),
    82       mCandidateCommitted(false),
    82       mCandidateCommitted(false),
    83       mSpellQueryOpenIsPending(false)
    83       mSpellQueryOpenIsPending(false)
    84 {
    84 {
       
    85     mList = new HbListWidget();
       
    86     mList->setEnabledAnimations(HbAbstractItemView::None);
       
    87 }
       
    88 
       
    89 HbCandidateListPrivate::~HbCandidateListPrivate()
       
    90 {
       
    91 }
       
    92 
       
    93 void HbCandidateListPrivate::initFrameIcon()
       
    94 {
    85     Q_Q(HbCandidateList);
    95     Q_Q(HbCandidateList);
    86 
    96 
    87     mList = new HbListWidget(q);
    97     mFrameBackground = static_cast<HbFrameItem *>(q->primitive((HbStyle::Primitive)HbStylePrivate::P_Popup_background));
    88     mList->setEnabledAnimations(HbAbstractItemView::None);
       
    89 }
       
    90 
       
    91 HbCandidateListPrivate::~HbCandidateListPrivate()
       
    92 {
       
    93 }
       
    94 
       
    95 void HbCandidateListPrivate::initFrameIcon()
       
    96 {
       
    97     Q_Q(HbCandidateList);
       
    98 
       
    99     mFrameBackground = static_cast<HbFrameItem *>(q->primitive(HbStyle::P_Popup_background));
       
   100 
    98 
   101     if (mFrameBackground == 0) {
    99     if (mFrameBackground == 0) {
   102         mFrameBackground = static_cast<HbFrameItem *>(q->style()->createPrimitive((HbStyle::Primitive)(HbStyle::P_Popup_background), q));
   100         mFrameBackground = static_cast<HbFrameItem *>(HbStylePrivate::createPrimitive(HbStylePrivate::P_Popup_background, q));
   103     }
   101     }
   104 }
   102 }
   105 
   103 
   106 
   104 
   107 void HbCandidateListPrivate::calculateAndSetSize(qreal maxWidth)
   105 void HbCandidateListPrivate::calculateAndSetSize(qreal maxWidth)
   169     HbInputRegionCollector::instance()->attach(this);
   167     HbInputRegionCollector::instance()->attach(this);
   170 
   168 
   171     d->setPriority(HbPopupPrivate::VirtualKeyboard + 1);  // Should be shown on top of virtual keyboard.
   169     d->setPriority(HbPopupPrivate::VirtualKeyboard + 1);  // Should be shown on top of virtual keyboard.
   172     d->initFrameIcon();
   170     d->initFrameIcon();
   173 
   171 
       
   172     d->mList->setParent(this);
       
   173 
   174     // Make sure the preview pane never steals focus.
   174     // Make sure the preview pane never steals focus.
   175     setFlag(QGraphicsItem::ItemIsPanel, true);
   175     setFlag(QGraphicsItem::ItemIsPanel, true);
       
   176     d->mActivePopup = false;
   176     setActive(false);
   177     setActive(false);
   177 
   178 
   178     setTimeout(NoTimeout);
   179     setTimeout(NoTimeout);
   179     setAttribute(Qt::WA_InputMethodEnabled, false);
   180     setAttribute(Qt::WA_InputMethodEnabled, false);
   180     connect(d->mList, SIGNAL(activated(HbListWidgetItem *)), this, SLOT(itemActivated(HbListWidgetItem *)));
   181     connect(d->mList, SIGNAL(activated(HbListWidgetItem *)), this, SLOT(itemActivated(HbListWidgetItem *)));
   198     Q_D(HbCandidateList);
   199     Q_D(HbCandidateList);
   199 	// Only for the first time when we launch candidate list its not setting a layout, 
   200 	// Only for the first time when we launch candidate list its not setting a layout, 
   200 	// Mostly the problem is form Qt side, for the time being to resolve issue related to candidate list
   201 	// Mostly the problem is form Qt side, for the time being to resolve issue related to candidate list
   201 	// making visible property true.  
   202 	// making visible property true.  
   202     setVisible(true);
   203     setVisible(true);
       
   204 	QEvent event(QEvent::Polish);
       
   205 	QApplication::sendEvent(this, &event);
   203     setContentWidget(d->mList);
   206     setContentWidget(d->mList);
   204 
   207 
   205     d->setPriority(HbPopupPrivate::VirtualKeyboard + 1);  // Should be shown on top of virtual keyboard.
   208     d->setPriority(HbPopupPrivate::VirtualKeyboard + 1);  // Should be shown on top of virtual keyboard.
   206     d->mList->clear();
   209     d->mList->clear();
   207 
   210 
   356         if (freeViewRect.isValid() &&
   359         if (freeViewRect.isValid() &&
   357             microFocus.isValid() &&
   360             microFocus.isValid() &&
   358             freeViewRect.contains(microFocus)) {
   361             freeViewRect.contains(microFocus)) {
   359             QRectF topRect = freeViewRect;
   362             QRectF topRect = freeViewRect;
   360             topRect.setBottom(microFocus.top());
   363             topRect.setBottom(microFocus.top());
   361             topRect.adjust(HbAutoComplPopupSideMargin, HbAutoComplPopupVerticalMargin, -HbAutoComplPopupSideMargin, -HbAutoComplPopupVerticalMargin);
   364             topRect.adjust(HbAutoComplPopupSideMargin, 0, -HbAutoComplPopupSideMargin, 0);
   362 
   365 
   363             QRectF bottomRect = freeViewRect;
   366             QRectF bottomRect = freeViewRect;
   364             bottomRect.setTop(microFocus.bottom());
   367             bottomRect.setTop(microFocus.bottom());
   365             bottomRect.adjust(HbAutoComplPopupSideMargin, HbAutoComplPopupVerticalMargin, -HbAutoComplPopupSideMargin, -HbAutoComplPopupVerticalMargin);
   368             bottomRect.adjust(HbAutoComplPopupSideMargin, 0, -HbAutoComplPopupSideMargin, 0);
   366 
   369 
   367             if (topRect.height() > bottomRect.height()) {
   370             if (topRect.height() > bottomRect.height()) {
   368                 if (topRect.height() > HbAutoComplPopupMinAllowedHeight) {
   371                 if (topRect.height() > HbAutoComplPopupMinAllowedHeight) {
   369                     qreal finalHeight = (size().height() < topRect.height() ? size().height() : topRect.height());
   372                     qreal finalHeight = (size().height() < topRect.height() ? size().height() : topRect.height());
   370                     topRect.setTop(topRect.bottom() - finalHeight);
   373                     topRect.setTop(topRect.bottom() - finalHeight);