telutils/dialpad/src/dialpad.cpp
changeset 45 61f927bc9441
parent 39 cee7e9e0906c
child 46 2fa1fa551b0b
equal deleted inserted replaced
39:cee7e9e0906c 45:61f927bc9441
   115     popupLayout->addItem(&mKeypad->callButton());
   115     popupLayout->addItem(&mKeypad->callButton());
   116     popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin);
   116     popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin);
   117     popupLayout->setSpacing(0);
   117     popupLayout->setSpacing(0);
   118     popupLayout->setItemSpacing(0,margin);
   118     popupLayout->setItemSpacing(0,margin);
   119     setLayout(popupLayout);
   119     setLayout(popupLayout);
       
   120     setLayoutDirection(Qt::LeftToRight);
   120 
   121 
   121     // asterisk multitap handler
   122     // asterisk multitap handler
   122     mMultitap = new DialpadMultitapHandler(mInputField->editor(),this);
   123     mMultitap = new DialpadMultitapHandler(mInputField->editor(),this);
   123     mInputField->editor().installEventFilter(mMultitap);
   124     mInputField->editor().installEventFilter(mMultitap);
   124 
   125 
   198     if ( mOrientation == Qt::Vertical ) {
   199     if ( mOrientation == Qt::Vertical ) {
   199         rect.setLeft((rect.width()- mCloseHandleWidth)/2);
   200         rect.setLeft((rect.width()- mCloseHandleWidth)/2);
   200         rect.setWidth(mCloseHandleWidth);
   201         rect.setWidth(mCloseHandleWidth);
   201         rect.setHeight(mCloseHandleHeight);
   202         rect.setHeight(mCloseHandleHeight);
   202     } else {
   203     } else {
   203         if (layoutDirection()==Qt::LeftToRight) {
   204         rect.setTop((rect.height() - mCloseHandleWidth)/2);
   204             rect.setTop((rect.height() - mCloseHandleWidth)/2);
   205         rect.setWidth(mCloseHandleHeight);
   205             rect.setWidth(mCloseHandleHeight);
   206         rect.setHeight(mCloseHandleWidth);
   206             rect.setHeight(mCloseHandleWidth);
       
   207         } else {
       
   208             rect.setLeft((rect.width() - mCloseHandleHeight));
       
   209             rect.setTop((rect.height() - mCloseHandleWidth)/2);
       
   210             rect.setWidth(mCloseHandleHeight);
       
   211             rect.setHeight(mCloseHandleWidth);
       
   212         }
       
   213     }
   207     }
   214 
   208 
   215     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   209     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   216     mIconDrawer->paint(painter, rect);
   210     mIconDrawer->paint(painter, rect);
   217 }
   211 }
   257     if (mOrientation==Qt::Vertical) {
   251     if (mOrientation==Qt::Vertical) {
   258         qreal height = geometry().height();
   252         qreal height = geometry().height();
   259         setPos(mPosition.x(),mPosition.y()+height);
   253         setPos(mPosition.x(),mPosition.y()+height);
   260     } else {
   254     } else {
   261         qreal width = geometry().width();
   255         qreal width = geometry().width();
   262         if (layoutDirection()==Qt::LeftToRight) {
   256         setPos(mPosition.x()+width,mPosition.y());
   263             setPos(mPosition.x()+width,mPosition.y());
       
   264         } else {
       
   265             setPos(mPosition.x()-width,mPosition.y());
       
   266         }
       
   267     }
   257     }
   268 
   258 
   269     if (mOrientation!=previousOrientation) {
   259     if (mOrientation!=previousOrientation) {
   270         updateLayout((Qt::Orientation)mOrientation);
   260         updateLayout((Qt::Orientation)mOrientation);
   271     }
   261     }
   369         newPos.setX(currentPos.x());
   359         newPos.setX(currentPos.x());
   370         newPos.setY(mPosition.y()+(height*value));
   360         newPos.setY(mPosition.y()+(height*value));
   371     } else {
   361     } else {
   372         qreal width = geometry().width();
   362         qreal width = geometry().width();
   373 
   363 
   374         if (layoutDirection()==Qt::LeftToRight) {
   364         newPos.setY(currentPos.y());
   375             newPos.setY(currentPos.y());
   365         newPos.setX(mPosition.x()+(width*value));
   376             newPos.setX(mPosition.x()+(width*value));
       
   377         } else {
       
   378             newPos.setY(currentPos.y());
       
   379             newPos.setX(mPosition.x()-(width*value));
       
   380         }
       
   381     }
   366     }
   382 
   367 
   383     setPos(newPos);
   368     setPos(newPos);
   384 }
   369 }
   385 
   370 
   402         newPos.setX(currentPos.x());
   387         newPos.setX(currentPos.x());
   403         newPos.setY(mPosition.y()+(height*(1-value)));
   388         newPos.setY(mPosition.y()+(height*(1-value)));
   404     } else {
   389     } else {
   405         qreal width = geometry().width();
   390         qreal width = geometry().width();
   406 
   391 
   407         if (layoutDirection()==Qt::LeftToRight) {
   392         newPos.setY(currentPos.y());
   408             newPos.setY(currentPos.y());
   393         newPos.setX(mPosition.x()+(width*(1-value)));
   409             newPos.setX(mPosition.x()+(width*(1-value)));
       
   410         } else {
       
   411             newPos.setY(currentPos.y());
       
   412             newPos.setX(mPosition.x()-(width*(1-value)));
       
   413         }
       
   414     }
   394     }
   415 
   395 
   416     setPos(newPos);
   396     setPos(newPos);
   417 }
   397 }
   418 
   398 
   491            event->gesture(Qt::SwipeGesture))) {
   471            event->gesture(Qt::SwipeGesture))) {
   492         if (gesture->state() == Qt::GestureFinished) {
   472         if (gesture->state() == Qt::GestureFinished) {
   493             if ( mOrientation==Qt::Vertical &&
   473             if ( mOrientation==Qt::Vertical &&
   494                  gesture->sceneVerticalDirection() == QSwipeGesture::Down ) {
   474                  gesture->sceneVerticalDirection() == QSwipeGesture::Down ) {
   495                 closeGesture = true;
   475                 closeGesture = true;
   496             } else if (layoutDirection()==Qt::LeftToRight &&
   476             } else if (mOrientation==Qt::Horizontal &&
   497                 gesture->sceneHorizontalDirection() == QSwipeGesture::Right) {
   477                 gesture->sceneHorizontalDirection() == QSwipeGesture::Right) {
   498                 closeGesture = true;
       
   499             } else if (layoutDirection()==Qt::RightToLeft &&
       
   500                 gesture->sceneHorizontalDirection() == QSwipeGesture::Left) {
       
   501                 closeGesture = true;
   478                 closeGesture = true;
   502             }
   479             }
   503         }
   480         }
   504     }
   481     }
   505 
   482