calendarui/views/src/calenmonthgrid.cpp
changeset 49 5de72ea7a065
parent 37 360d55486d7f
child 50 579cc610882e
equal deleted inserted replaced
37:360d55486d7f 49:5de72ea7a065
    20 #include <hbabstractviewitem.h>
    20 #include <hbabstractviewitem.h>
    21 #include <hbstyleloader.h>
    21 #include <hbstyleloader.h>
    22 #include <hbcolorscheme.h>
    22 #include <hbcolorscheme.h>
    23 #include <hbpangesture.h>
    23 #include <hbpangesture.h>
    24 #include <hbswipegesture.h>
    24 #include <hbswipegesture.h>
       
    25 #include <hbdeviceprofile.h>
    25 
    26 
    26 // User includes
    27 // User includes
    27 #include "calenmonthgrid.h"
    28 #include "calenmonthgrid.h"
    28 #include "calengriditemprototype.h"
    29 #include "calengriditemprototype.h"
    29 #include "calenmonthdata.h"
    30 #include "calenmonthdata.h"
    30 #include "calenmonthview.h"
    31 #include "calenmonthview.h"
    31 #include "calendateutils.h"
    32 #include "calendateutils.h"
    32 #include "calencommon.h"
    33 #include "calencommon.h"
       
    34 #include "calenconstants.h"
    33 
    35 
    34 // Constants
    36 // Constants
    35 #define SCROLL_SPEEED 3000 
    37 #define SCROLL_SPEEED 3000 
    36 #define GRIDLINE_WIDTH 0.075 //units
    38 #define GRIDLINE_WIDTH 0.075 //units
    37 
    39 
    65 	setUniformItemSizes(true);
    67 	setUniformItemSizes(true);
    66 	setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
    68 	setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
    67 	setClampingStyle(HbScrollArea::StrictClamping);
    69 	setClampingStyle(HbScrollArea::StrictClamping);
    68 	setEnabledAnimations(HbAbstractItemView::None);
    70 	setEnabledAnimations(HbAbstractItemView::None);
    69 	setFrictionEnabled(false);
    71 	setFrictionEnabled(false);
       
    72 	setFlag(QGraphicsItem::ItemHasNoContents, false);
    70 	resetTransform();
    73 	resetTransform();
    71 	
    74 	
    72 	// Get the content widget of the scroll area to draw the grid lines
    75 	// Get the content widget of the scroll area to draw the grid lines
    73 	mContentWidget = contentWidget();
    76 	mContentWidget = contentWidget();
    74 	
    77 	
   981 	Q_UNUSED(widget);
   984 	Q_UNUSED(widget);
   982 	painter->setRenderHint(QPainter::NonCosmeticDefaultPen);
   985 	painter->setRenderHint(QPainter::NonCosmeticDefaultPen);
   983 	
   986 	
   984 	// Set the required attributes to the pen
   987 	// Set the required attributes to the pen
   985 	QPen pen;
   988 	QPen pen;
       
   989 	HbDeviceProfile deviceProf;
       
   990 	qreal unitValue = deviceProf.unitValue();
       
   991 	qreal widthInPixels = GRIDLINE_WIDTH * unitValue;
   986 	pen.setStyle(Qt::SolidLine);
   992 	pen.setStyle(Qt::SolidLine);
   987 	pen.setWidth(GRIDLINE_WIDTH);
   993 	pen.setWidth(widthInPixels);
   988 	if (mGridLineColor.isValid()) {
   994 	if (mGridLineColor.isValid()) {
   989 		pen.setBrush(mGridLineColor);
   995 		pen.setBrush(mGridLineColor);
   990 	} else {
   996 	} else {
   991 		pen.setBrush(mGridBorderColor);
   997 		pen.setBrush(mGridBorderColor);
   992 	}
   998 	}