camerauis/cameraxui/cxui/src/cxuizoomslider.cpp
branchRCL_3
changeset 53 61bc0f252b2b
equal deleted inserted replaced
50:f54ad444594d 53:61bc0f252b2b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QGraphicsSceneMouseEvent>
       
    19 #include "cxuizoomslider.h"
       
    20 
       
    21 /*!
       
    22     \class CxuiZoomSlider
       
    23     \brief CxuiZoomSlider is a camera specific slider that is derived from HbSlider
       
    24 
       
    25     CxuiZoomslider has been created so that we are able to control and filter user
       
    26     mouse press events. All mouse press events that happen in slider rect are
       
    27     accepted in this class so that they won't be given any other components.
       
    28     This has to be done to prevent the slider to dismiss when accidentally 
       
    29     missing e.g.slider thumb touch area (camera view underneath will get the 
       
    30     event and hide the slider). 
       
    31     
       
    32 */
       
    33 
       
    34 CxuiZoomSlider::CxuiZoomSlider(QGraphicsItem *parentItem)
       
    35 : HbSlider(parentItem)
       
    36 {
       
    37 
       
    38 }
       
    39 
       
    40 
       
    41 CxuiZoomSlider::~CxuiZoomSlider()
       
    42 {
       
    43 
       
    44 }
       
    45 
       
    46 
       
    47 /*
       
    48 * CxuiZoomSlider::mousePressEvent()
       
    49 */
       
    50 void CxuiZoomSlider::mousePressEvent(QGraphicsSceneMouseEvent *event)
       
    51 {
       
    52     HbSlider::mousePressEvent(event);
       
    53     
       
    54     // accept event so that it will not be given to the components
       
    55     // underneath this slider
       
    56     event->accept();
       
    57 }
       
    58 
       
    59 /*!
       
    60 * Adding zoom buttons to the slider
       
    61 */
       
    62 void CxuiZoomSlider::addZoomButtons()
       
    63 {
       
    64     // get current slider elements
       
    65     QList<QVariant> elements = sliderElements();
       
    66 
       
    67     // add increase and decrease elements to the slider
       
    68     elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement;
       
    69     setSliderElements(elements);
       
    70 
       
    71     // set icons for the increase and decrease element
       
    72     setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus"));
       
    73     setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus"));
       
    74 }
       
    75 
       
    76 //End of file