3760 } else { |
3760 } else { |
3761 qDebug() << "HbStyle::polishItem : -- item name: " << name << "(missing item)"; |
3761 qDebug() << "HbStyle::polishItem : -- item name: " << name << "(missing item)"; |
3762 } |
3762 } |
3763 #endif |
3763 #endif |
3764 |
3764 |
3765 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
|
3766 |
|
3767 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile); |
|
3768 #ifdef HBSTYLE_DEBUG |
|
3769 qDebug() << "HbStyle::polishItem : -- Number of maching CSS declarations: " << decl.count(); |
|
3770 #endif |
|
3771 HbCss::ValueExtractor extractor(decl, layoutParameters, profile); |
|
3772 HbCss::GeometryValues geomValues; |
|
3773 HbCss::PositionValues posValues; |
|
3774 |
|
3775 bool extracted = extractor.extractGeometry(geomValues); |
|
3776 #ifndef HBSTYLE_DEBUG |
|
3777 Q_UNUSED(extracted); |
|
3778 #endif |
|
3779 #ifdef HBSTYLE_DEBUG |
|
3780 if ( !extracted ) { |
|
3781 qDebug() << "HbStyle::polishItem : -- No geometry overrides found"; |
|
3782 } |
|
3783 #endif |
|
3784 extracted = extractor.extractPosition(posValues); |
|
3785 #ifdef HBSTYLE_DEBUG |
|
3786 if ( !extracted ) { |
|
3787 qDebug() << "HbStyle::polishItem : -- No position overrides found"; |
|
3788 } |
|
3789 #endif |
|
3790 |
|
3791 if ( item ) { |
|
3792 if (posValues.mFlags & HbCss::ExtractedZValue) { |
|
3793 #ifdef HBSTYLE_DEBUG |
|
3794 qDebug() << "HbStyle::polishItem : -- Setting zvalue: " << posValues.mZ; |
|
3795 #endif |
|
3796 item->setZValue(posValues.mZ); |
|
3797 } |
|
3798 } |
|
3799 |
|
3800 QGraphicsWidget *gWidget = (item && item->isWidget()) |
|
3801 ? static_cast<QGraphicsWidget*>(item) |
|
3802 : 0; |
|
3803 if ( gWidget ) { |
|
3804 if (posValues.mFlags & HbCss::ExtractedLayoutDirection) { |
|
3805 #ifdef HBSTYLE_DEBUG |
|
3806 qDebug() << "HbStyle::polishItem : -- Setting layout direction: " << posValues.mLayoutDirection; |
|
3807 #endif |
|
3808 if (posValues.mLayoutDirection == HbCss::LayoutDirection_LeftToRight) { |
|
3809 gWidget->setLayoutDirection(Qt::LeftToRight); |
|
3810 } else if (posValues.mLayoutDirection == HbCss::LayoutDirection_RightToLeft) { |
|
3811 gWidget->setLayoutDirection(Qt::RightToLeft); |
|
3812 } else { |
|
3813 gWidget->unsetLayoutDirection(); |
|
3814 } |
|
3815 } |
|
3816 } |
|
3817 |
|
3818 HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget); |
|
3819 if ( hbWidget ) { |
|
3820 HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget); |
|
3821 QFont font; |
|
3822 HbFontSpec fontSpec; |
|
3823 int dummy; |
|
3824 if (extractor.extractFont(&font, &fontSpec, &dummy)) { |
|
3825 if ( !fontSpec.isNull() ) { |
|
3826 if ( font == QFont() ) { |
|
3827 #ifdef HBSTYLE_DEBUG |
|
3828 qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << fontSpec.role(); |
|
3829 #endif |
|
3830 hbWidget->setFontSpec(fontSpec); |
|
3831 } else { |
|
3832 #ifdef HBSTYLE_DEBUG |
|
3833 qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: " |
|
3834 << fontSpec.role() << font; |
|
3835 #endif |
|
3836 hbWidget->setFont(fontSpec.font().resolve(font)); |
|
3837 } |
|
3838 } else { |
|
3839 #ifdef HBSTYLE_DEBUG |
|
3840 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << font; |
|
3841 #endif |
|
3842 hbWidget->setFont(font); |
|
3843 } |
|
3844 } |
|
3845 |
|
3846 HbIconItem* icon = qobject_cast<HbIconItem*>(hbWidget); |
|
3847 if (icon) { |
|
3848 Qt::AspectRatioMode mode; |
|
3849 if (extractor.extractAspectRatioMode(&mode) |
|
3850 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode)) { |
|
3851 #ifdef HBSTYLE_DEBUG |
|
3852 qDebug() << "HbStyle::polishItem : -- Setting aspect ratio mode: " << mode; |
|
3853 #endif |
|
3854 icon->setAspectRatioMode(mode); |
|
3855 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode, false); |
|
3856 } |
|
3857 if(!hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_IconBrush)){ |
|
3858 QBrush brush; |
|
3859 QString uri; |
|
3860 HbCss::Repeat repeat = HbCss::Repeat_XY; |
|
3861 Qt::Alignment alignment = Qt::AlignTop | Qt::AlignLeft; |
|
3862 HbCss::Attachment attachment = HbCss::Attachment_Scroll; |
|
3863 HbCss::Origin origin = HbCss::Origin_Padding; |
|
3864 HbCss::Origin clip = HbCss::Origin_Border; |
|
3865 if (extractor.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip)) { |
|
3866 #ifdef HBSTYLE_DEBUG |
|
3867 qDebug() << "HbStyle::polishItem : -- Setting icon background: " << brush; |
|
3868 #endif |
|
3869 icon->setBrush( brush ); |
|
3870 } else { |
|
3871 #ifdef HBSTYLE_DEBUG |
|
3872 qDebug() << "HbStyle::polishItem : -- Resetting icon background"; |
|
3873 #endif |
|
3874 icon->setBrush( QBrush() ); |
|
3875 } |
|
3876 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconBrush, false); |
|
3877 } |
|
3878 } |
|
3879 |
|
3880 HbTextItem* text = qobject_cast<HbTextItem*>(hbWidget); |
|
3881 if (text) { |
|
3882 HbCss::TextValues textValues; |
|
3883 if ( extractor.extractTextValues( textValues ) ) { |
|
3884 if ( textValues.mFlags & HbCss::ExtractedLineCountMin |
|
3885 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3886 #ifdef HBSTYLE_DEBUG |
|
3887 qDebug() << "HbStyle::polishItem : -- Setting text min lines: " << textValues.mLineCountMin; |
|
3888 #endif |
|
3889 text->setMinimumLines( textValues.mLineCountMin ); |
|
3890 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3891 } |
|
3892 if ( textValues.mFlags & HbCss::ExtractedLineCountMax |
|
3893 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax)) { |
|
3894 #ifdef HBSTYLE_DEBUG |
|
3895 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << textValues.mLineCountMax; |
|
3896 #endif |
|
3897 text->setMaximumLines( textValues.mLineCountMax ); |
|
3898 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3899 } |
|
3900 } |
|
3901 if ( posValues.mFlags & HbCss::ExtractedTextAlign |
|
3902 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
|
3903 #ifdef HBSTYLE_DEBUG |
|
3904 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << posValues.mTextAlignment; |
|
3905 #endif |
|
3906 text->setAlignment( posValues.mTextAlignment ); |
|
3907 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
|
3908 } |
|
3909 if ( posValues.mFlags & HbCss::ExtractedWrapMode |
|
3910 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
|
3911 #ifdef HBSTYLE_DEBUG |
|
3912 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << posValues.mTextWrapMode; |
|
3913 #endif |
|
3914 text->setTextWrapping( posValues.mTextWrapMode ); |
|
3915 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3916 } |
|
3917 } |
|
3918 |
|
3919 HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget); |
|
3920 if (richtext) { |
|
3921 if ( posValues.mFlags & HbCss::ExtractedTextAlign |
|
3922 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
|
3923 #ifdef HBSTYLE_DEBUG |
|
3924 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << posValues.mTextAlignment; |
|
3925 #endif |
|
3926 richtext->setAlignment( posValues.mTextAlignment ); |
|
3927 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
|
3928 } |
|
3929 if ( posValues.mFlags & HbCss::ExtractedWrapMode |
|
3930 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
|
3931 #ifdef HBSTYLE_DEBUG |
|
3932 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << posValues.mTextWrapMode; |
|
3933 #endif |
|
3934 richtext->setTextWrapping( posValues.mTextWrapMode ); |
|
3935 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3936 } |
|
3937 } |
|
3938 |
|
3939 HbFrameItem *frame = qobject_cast<HbFrameItem*>(hbWidget); |
|
3940 if (frame && !frame->frameDrawer().d->testBorderApiProtectionFlag()) { |
|
3941 qreal borderWidths[HbCss::NumEdges] = { 0.0,0.0,0.0,0.0 }; |
|
3942 QBrush borderColors[HbCss::NumEdges]; |
|
3943 HbCss::BorderStyle borderStyles[HbCss::NumEdges]; |
|
3944 QSize borderRadii[4]; |
|
3945 |
|
3946 if (extractor.extractBorder(borderWidths,borderColors,borderStyles,borderRadii)) { |
|
3947 #ifdef HBSTYLE_DEBUG |
|
3948 qDebug() << "HbStyle::polishItem : -- Setting border widths (l,t,r,b):" |
|
3949 << borderWidths[HbCss::LeftEdge] |
|
3950 << borderWidths[HbCss::TopEdge] |
|
3951 << borderWidths[HbCss::RightEdge] |
|
3952 << borderWidths[HbCss::BottomEdge]; |
|
3953 #endif |
|
3954 frame->frameDrawer().setBorderWidths( |
|
3955 borderWidths[HbCss::LeftEdge], |
|
3956 borderWidths[HbCss::TopEdge], |
|
3957 borderWidths[HbCss::RightEdge], |
|
3958 borderWidths[HbCss::BottomEdge]); |
|
3959 frame->frameDrawer().d->setBorderApiProtectionFlag(false); |
|
3960 } |
|
3961 } |
|
3962 if ( hbWidget->inherits( "HbLineEdit" ) ) { |
|
3963 HbCss::TextValues textValues; |
|
3964 if ( extractor.extractTextValues( textValues ) ) { |
|
3965 if ( textValues.mFlags & HbCss::ExtractedLineCountMin |
|
3966 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3967 #ifdef HBSTYLE_DEBUG |
|
3968 qDebug() << "HbStyle::polishItem : -- Setting text min lines: " << textValues.mLineCountMin; |
|
3969 #endif |
|
3970 hbWidget->setProperty( "minRows", textValues.mLineCountMin ); |
|
3971 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3972 } |
|
3973 if ( textValues.mFlags & HbCss::ExtractedLineCountMax |
|
3974 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3975 #ifdef HBSTYLE_DEBUG |
|
3976 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << textValues.mLineCountMax; |
|
3977 #endif |
|
3978 hbWidget->setProperty( "maxRows", textValues.mLineCountMax ); |
|
3979 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3980 } |
|
3981 } |
|
3982 } |
|
3983 } |
|
3984 |
|
3985 QGraphicsLayoutItem* lItem = (item && item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
3765 QGraphicsLayoutItem* lItem = (item && item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
3986 if ( !lItem ) { |
3766 if ( !lItem ) { |
3987 lItem = widget->layoutPrimitive(name); |
3767 lItem = widget->layoutPrimitive(name); |
3988 if ( lItem && !lItem->graphicsItem() ) { |
3768 if ( lItem && !lItem->graphicsItem() ) { |
3989 // assume it is spacer |
3769 // assume it is spacer |
3990 static_cast<HbMeshLayout*>(widget->layout())->setItemId( lItem, name ); |
3770 static_cast<HbMeshLayout*>(widget->layout())->setItemId( lItem, name ); |
3991 } |
3771 } |
3992 } |
3772 } |
|
3773 |
|
3774 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
|
3775 |
|
3776 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile); |
|
3777 #ifdef HBSTYLE_DEBUG |
|
3778 qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count(); |
|
3779 #endif |
|
3780 HbCss::ValueExtractor extractor(decl, layoutParameters, profile); |
|
3781 HbCss::KnownProperties prop; |
|
3782 |
|
3783 if ( !extractor.extractKnownProperties(prop) ) { |
|
3784 #ifdef HBSTYLE_DEBUG |
|
3785 qDebug() << "HbStyle::polishItem : -- No polish overrides found"; |
|
3786 #endif |
|
3787 return; |
|
3788 } |
|
3789 |
|
3790 if ( item ) { |
|
3791 if (prop.mFlags & HbCss::ExtractedZValue) { |
|
3792 #ifdef HBSTYLE_DEBUG |
|
3793 qDebug() << "HbStyle::polishItem : -- Setting zvalue: " << prop.mZ; |
|
3794 #endif |
|
3795 item->setZValue(prop.mZ); |
|
3796 } |
|
3797 } |
|
3798 |
|
3799 QGraphicsWidget *gWidget = (item && item->isWidget()) |
|
3800 ? static_cast<QGraphicsWidget*>(item) |
|
3801 : 0; |
|
3802 if ( gWidget ) { |
|
3803 if (prop.mFlags & HbCss::ExtractedLayoutDir) { |
|
3804 #ifdef HBSTYLE_DEBUG |
|
3805 qDebug() << "HbStyle::polishItem : -- Setting layout direction: " << prop.mLayoutDir; |
|
3806 #endif |
|
3807 if (prop.mLayoutDir == HbCss::LayoutDirection_LeftToRight) { |
|
3808 gWidget->setLayoutDirection(Qt::LeftToRight); |
|
3809 } else if (prop.mLayoutDir == HbCss::LayoutDirection_RightToLeft) { |
|
3810 gWidget->setLayoutDirection(Qt::RightToLeft); |
|
3811 } else { |
|
3812 gWidget->unsetLayoutDirection(); |
|
3813 } |
|
3814 } |
|
3815 } |
|
3816 |
|
3817 HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget); |
|
3818 if ( hbWidget ) { |
|
3819 HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget); |
|
3820 if ( prop.mFlags & HbCss::ExtractedFontSpec ) { |
|
3821 if ( !(prop.mFlags & HbCss::ExtractedFont) ) { |
|
3822 #ifdef HBSTYLE_DEBUG |
|
3823 qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << prop.mFontSpec.role() << prop.mFontSpec.textHeight(); |
|
3824 #endif |
|
3825 hbWidget->setFontSpec(prop.mFontSpec); |
|
3826 } else { |
|
3827 #ifdef HBSTYLE_DEBUG |
|
3828 qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: " |
|
3829 << prop.mFontSpec.role() << prop.mFontSpec.textHeight() << prop.mFont; |
|
3830 #endif |
|
3831 hbWidget->setFont(prop.mFontSpec.font().resolve(prop.mFont)); |
|
3832 } |
|
3833 } else if ( prop.mFlags & HbCss::ExtractedFont ) { |
|
3834 #ifdef HBSTYLE_DEBUG |
|
3835 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << prop.mFont; |
|
3836 #endif |
|
3837 hbWidget->setFont(prop.mFont); |
|
3838 } |
|
3839 |
|
3840 HbIconItem* icon = qobject_cast<HbIconItem*>(hbWidget); |
|
3841 if (icon) { |
|
3842 if (prop.mFlags & HbCss::ExtractedAspectRatioMode |
|
3843 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode)) { |
|
3844 #ifdef HBSTYLE_DEBUG |
|
3845 qDebug() << "HbStyle::polishItem : -- Setting aspect ratio mode: " << prop.mAspectRatioMode; |
|
3846 #endif |
|
3847 icon->setAspectRatioMode(prop.mAspectRatioMode); |
|
3848 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode, false); |
|
3849 } |
|
3850 } |
|
3851 |
|
3852 HbTextItem* text = qobject_cast<HbTextItem*>(hbWidget); |
|
3853 if (text) { |
|
3854 if ( prop.mFlags & HbCss::ExtractedMinLines |
|
3855 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3856 #ifdef HBSTYLE_DEBUG |
|
3857 qDebug() << "HbStyle::polishItem : -- Setting text min lines: " << prop.mMinLines; |
|
3858 #endif |
|
3859 text->setMinimumLines( prop.mMinLines ); |
|
3860 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3861 } |
|
3862 if ( prop.mFlags & HbCss::ExtractedMaxLines |
|
3863 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax)) { |
|
3864 #ifdef HBSTYLE_DEBUG |
|
3865 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << prop.mMaxLines; |
|
3866 #endif |
|
3867 text->setMaximumLines( prop.mMaxLines ); |
|
3868 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3869 } |
|
3870 if ( prop.mFlags & HbCss::ExtractedTextAlign |
|
3871 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
|
3872 #ifdef HBSTYLE_DEBUG |
|
3873 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mTextAlignment; |
|
3874 #endif |
|
3875 text->setAlignment( prop.mTextAlignment ); |
|
3876 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
|
3877 } |
|
3878 if ( prop.mFlags & HbCss::ExtractedWrapMode |
|
3879 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
|
3880 #ifdef HBSTYLE_DEBUG |
|
3881 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
|
3882 #endif |
|
3883 text->setTextWrapping( prop.mTextWrapMode ); |
|
3884 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3885 } |
|
3886 } |
|
3887 |
|
3888 HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget); |
|
3889 if (richtext) { |
|
3890 if ( prop.mFlags & HbCss::ExtractedTextAlign |
|
3891 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
|
3892 #ifdef HBSTYLE_DEBUG |
|
3893 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mTextAlignment; |
|
3894 #endif |
|
3895 richtext->setAlignment( prop.mTextAlignment ); |
|
3896 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
|
3897 } |
|
3898 if ( prop.mFlags & HbCss::ExtractedWrapMode |
|
3899 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
|
3900 #ifdef HBSTYLE_DEBUG |
|
3901 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
|
3902 #endif |
|
3903 richtext->setTextWrapping( prop.mTextWrapMode ); |
|
3904 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3905 } |
|
3906 } |
|
3907 |
|
3908 HbFrameItem *frame = qobject_cast<HbFrameItem*>(hbWidget); |
|
3909 if (frame && !frame->frameDrawer().d->testBorderApiProtectionFlag()) { |
|
3910 if (prop.mFlags & HbCss::ExtractedBorderWidths) { |
|
3911 #ifdef HBSTYLE_DEBUG |
|
3912 qDebug() << "HbStyle::polishItem : -- Setting border widths (l,t,r,b):" |
|
3913 << prop.mBorderWidths[HbCss::LeftEdge] |
|
3914 << prop.mBorderWidths[HbCss::TopEdge] |
|
3915 << prop.mBorderWidths[HbCss::RightEdge] |
|
3916 << prop.mBorderWidths[HbCss::BottomEdge]; |
|
3917 #endif |
|
3918 frame->frameDrawer().setBorderWidths( |
|
3919 prop.mBorderWidths[HbCss::LeftEdge], |
|
3920 prop.mBorderWidths[HbCss::TopEdge], |
|
3921 prop.mBorderWidths[HbCss::RightEdge], |
|
3922 prop.mBorderWidths[HbCss::BottomEdge]); |
|
3923 frame->frameDrawer().d->setBorderApiProtectionFlag(false); |
|
3924 } |
|
3925 } |
|
3926 if ( hbWidget->inherits( "HbLineEdit" ) ) { |
|
3927 if ( prop.mFlags & HbCss::ExtractedMinLines |
|
3928 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3929 #ifdef HBSTYLE_DEBUG |
|
3930 qDebug() << "HbStyle::polishItem : -- Setting text min lines: " << prop.mMinLines; |
|
3931 #endif |
|
3932 hbWidget->setProperty( "minRows", prop.mMinLines ); |
|
3933 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3934 } |
|
3935 if ( prop.mFlags & HbCss::ExtractedMaxLines |
|
3936 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin)) { |
|
3937 #ifdef HBSTYLE_DEBUG |
|
3938 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << prop.mMaxLines; |
|
3939 #endif |
|
3940 hbWidget->setProperty( "maxRows", prop.mMaxLines ); |
|
3941 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3942 } |
|
3943 } |
|
3944 } |
|
3945 |
3993 if ( lItem ) { |
3946 if ( lItem ) { |
3994 if ( geomValues.mFlags & HbCss::ExtractedMinW ) { |
3947 if ( prop.mFlags & HbCss::ExtractedMinW ) { |
3995 #ifdef HBSTYLE_DEBUG |
3948 #ifdef HBSTYLE_DEBUG |
3996 qDebug() << "HbStyle::polishItem : -- Setting minimum width: " << geomValues.mMinW; |
3949 qDebug() << "HbStyle::polishItem : -- Setting minimum width: " << prop.mMinW; |
3997 #endif |
3950 #endif |
3998 lItem->setMinimumWidth( geomValues.mMinW ); |
3951 lItem->setMinimumWidth( prop.mMinW ); |
3999 } |
3952 } |
4000 if ( geomValues.mFlags & HbCss::ExtractedMinH ) { |
3953 if ( prop.mFlags & HbCss::ExtractedMinH ) { |
4001 #ifdef HBSTYLE_DEBUG |
3954 #ifdef HBSTYLE_DEBUG |
4002 qDebug() << "HbStyle::polishItem : -- Setting minimum height: " << geomValues.mMinH; |
3955 qDebug() << "HbStyle::polishItem : -- Setting minimum height: " << prop.mMinH; |
4003 #endif |
3956 #endif |
4004 lItem->setMinimumHeight( geomValues.mMinH ); |
3957 lItem->setMinimumHeight( prop.mMinH ); |
4005 } |
3958 } |
4006 if ( geomValues.mFlags & HbCss::ExtractedPrefW ) { |
3959 if ( prop.mFlags & HbCss::ExtractedPrefW ) { |
4007 #ifdef HBSTYLE_DEBUG |
3960 #ifdef HBSTYLE_DEBUG |
4008 qDebug() << "HbStyle::polishItem : -- Setting preferred width: " << geomValues.mPrefW; |
3961 qDebug() << "HbStyle::polishItem : -- Setting preferred width: " << prop.mPrefW; |
4009 #endif |
3962 #endif |
4010 lItem->setPreferredWidth( geomValues.mPrefW ); |
3963 lItem->setPreferredWidth( prop.mPrefW ); |
4011 } |
3964 } |
4012 if ( geomValues.mFlags & HbCss::ExtractedPrefH ) { |
3965 if ( prop.mFlags & HbCss::ExtractedPrefH ) { |
4013 #ifdef HBSTYLE_DEBUG |
3966 #ifdef HBSTYLE_DEBUG |
4014 qDebug() << "HbStyle::polishItem : -- Setting preferred height: " << geomValues.mPrefH; |
3967 qDebug() << "HbStyle::polishItem : -- Setting preferred height: " << prop.mPrefH; |
4015 #endif |
3968 #endif |
4016 lItem->setPreferredHeight( geomValues.mPrefH ); |
3969 lItem->setPreferredHeight( prop.mPrefH ); |
4017 } |
3970 } |
4018 if ( geomValues.mFlags & HbCss::ExtractedMaxW ) { |
3971 if ( prop.mFlags & HbCss::ExtractedMaxW ) { |
4019 #ifdef HBSTYLE_DEBUG |
3972 #ifdef HBSTYLE_DEBUG |
4020 qDebug() << "HbStyle::polishItem : -- Setting maximum width: " << geomValues.mMaxW; |
3973 qDebug() << "HbStyle::polishItem : -- Setting maximum width: " << prop.mMaxW; |
4021 #endif |
3974 #endif |
4022 lItem->setMaximumWidth( geomValues.mMaxW ); |
3975 lItem->setMaximumWidth( prop.mMaxW ); |
4023 } |
3976 } |
4024 if ( geomValues.mFlags & HbCss::ExtractedMaxH ) { |
3977 if ( prop.mFlags & HbCss::ExtractedMaxH ) { |
4025 #ifdef HBSTYLE_DEBUG |
3978 #ifdef HBSTYLE_DEBUG |
4026 qDebug() << "HbStyle::polishItem : -- Setting maximum height: " << geomValues.mMaxH; |
3979 qDebug() << "HbStyle::polishItem : -- Setting maximum height: " << prop.mMaxH; |
4027 #endif |
3980 #endif |
4028 lItem->setMaximumHeight( geomValues.mMaxH ); |
3981 lItem->setMaximumHeight( prop.mMaxH ); |
4029 } |
3982 } |
4030 QSizePolicy itemPol = lItem->sizePolicy(); |
3983 QSizePolicy itemPol = lItem->sizePolicy(); |
4031 if ( geomValues.mFlags & HbCss::ExtractedPolHor ) { |
3984 if ( prop.mFlags & HbCss::ExtractedPolHor ) { |
4032 #ifdef HBSTYLE_DEBUG |
3985 #ifdef HBSTYLE_DEBUG |
4033 qDebug() << "HbStyle::polishItem : -- Setting horizontal size policy: " << geomValues.mSizePolicy.horizontalPolicy(); |
3986 qDebug() << "HbStyle::polishItem : -- Setting horizontal size policy: " << prop.mSizePolicy.horizontalPolicy(); |
4034 #endif |
3987 #endif |
4035 itemPol.setHorizontalPolicy(geomValues.mSizePolicy.horizontalPolicy()); |
3988 itemPol.setHorizontalPolicy(prop.mSizePolicy.horizontalPolicy()); |
4036 } |
3989 } |
4037 if ( geomValues.mFlags & HbCss::ExtractedPolVer ) { |
3990 if ( prop.mFlags & HbCss::ExtractedPolVer ) { |
4038 #ifdef HBSTYLE_DEBUG |
3991 #ifdef HBSTYLE_DEBUG |
4039 qDebug() << "HbStyle::polishItem : -- Setting vertical size policy: " << geomValues.mSizePolicy.verticalPolicy(); |
3992 qDebug() << "HbStyle::polishItem : -- Setting vertical size policy: " << prop.mSizePolicy.verticalPolicy(); |
4040 #endif |
3993 #endif |
4041 itemPol.setVerticalPolicy(geomValues.mSizePolicy.verticalPolicy()); |
3994 itemPol.setVerticalPolicy(prop.mSizePolicy.verticalPolicy()); |
4042 } |
3995 } |
4043 lItem->setSizePolicy(itemPol); |
3996 lItem->setSizePolicy(itemPol); |
4044 } |
3997 } |
4045 |
3998 |
4046 if (layoutDefined) { |
3999 if (layoutDefined) { |
4047 HbMeshLayout *layout = static_cast<HbMeshLayout*>(widget->layout()); |
4000 HbMeshLayout *layout = static_cast<HbMeshLayout*>(widget->layout()); |
4048 if ( layout ) { |
4001 if ( layout ) { |
4049 if (posValues.mFlags & HbCss::ExtractedLeft) { |
4002 if (prop.mFlags & HbCss::ExtractedLeft) { |
4050 #ifdef HBSTYLE_DEBUG |
4003 #ifdef HBSTYLE_DEBUG |
4051 qDebug() << "HbStyle::polishItem : -- Setting left override: " << posValues.mLeft; |
4004 qDebug() << "HbStyle::polishItem : -- Setting left override: " << prop.mLeft; |
4052 #endif |
4005 #endif |
4053 layout->overrideSpacing(name, Hb::LeftEdge, posValues.mLeft); |
4006 layout->overrideSpacing(name, Hb::LeftEdge, prop.mLeft); |
4054 } |
4007 } |
4055 if (posValues.mFlags & HbCss::ExtractedRight) { |
4008 if (prop.mFlags & HbCss::ExtractedRight) { |
4056 #ifdef HBSTYLE_DEBUG |
4009 #ifdef HBSTYLE_DEBUG |
4057 qDebug() << "HbStyle::polishItem : -- Setting right override: " << posValues.mRight; |
4010 qDebug() << "HbStyle::polishItem : -- Setting right override: " << prop.mRight; |
4058 #endif |
4011 #endif |
4059 layout->overrideSpacing(name, Hb::RightEdge, posValues.mRight); |
4012 layout->overrideSpacing(name, Hb::RightEdge, prop.mRight); |
4060 } |
4013 } |
4061 if (posValues.mFlags & HbCss::ExtractedTop) { |
4014 if (prop.mFlags & HbCss::ExtractedTop) { |
4062 #ifdef HBSTYLE_DEBUG |
4015 #ifdef HBSTYLE_DEBUG |
4063 qDebug() << "HbStyle::polishItem : -- Setting top override: " << posValues.mTop; |
4016 qDebug() << "HbStyle::polishItem : -- Setting top override: " << prop.mTop; |
4064 #endif |
4017 #endif |
4065 layout->overrideSpacing(name, Hb::TopEdge, posValues.mTop); |
4018 layout->overrideSpacing(name, Hb::TopEdge, prop.mTop); |
4066 } |
4019 } |
4067 if (posValues.mFlags & HbCss::ExtractedBottom) { |
4020 if (prop.mFlags & HbCss::ExtractedBottom) { |
4068 #ifdef HBSTYLE_DEBUG |
4021 #ifdef HBSTYLE_DEBUG |
4069 qDebug() << "HbStyle::polishItem : -- Setting bottom override: " << posValues.mBottom; |
4022 qDebug() << "HbStyle::polishItem : -- Setting bottom override: " << prop.mBottom; |
4070 #endif |
4023 #endif |
4071 layout->overrideSpacing(name, Hb::BottomEdge, posValues.mBottom); |
4024 layout->overrideSpacing(name, Hb::BottomEdge, prop.mBottom); |
4072 } |
4025 } |
4073 if (posValues.mFlags & HbCss::ExtractedCenterH) { |
4026 if (prop.mFlags & HbCss::ExtractedCenterH) { |
4074 #ifdef HBSTYLE_DEBUG |
4027 #ifdef HBSTYLE_DEBUG |
4075 qDebug() << "HbStyle::polishItem : -- Setting centerh override: " << posValues.mCenterH; |
4028 qDebug() << "HbStyle::polishItem : -- Setting centerh override: " << prop.mCenterH; |
4076 #endif |
4029 #endif |
4077 layout->overrideSpacing(name, Hb::CenterHEdge, posValues.mCenterH); |
4030 layout->overrideSpacing(name, Hb::CenterHEdge, prop.mCenterH); |
4078 } |
4031 } |
4079 if (posValues.mFlags & HbCss::ExtractedCenterV) { |
4032 if (prop.mFlags & HbCss::ExtractedCenterV) { |
4080 #ifdef HBSTYLE_DEBUG |
4033 #ifdef HBSTYLE_DEBUG |
4081 qDebug() << "HbStyle::polishItem : -- Setting centerv override: " << posValues.mCenterV; |
4034 qDebug() << "HbStyle::polishItem : -- Setting centerv override: " << prop.mCenterV; |
4082 #endif |
4035 #endif |
4083 layout->overrideSpacing(name, Hb::CenterVEdge, posValues.mCenterV); |
4036 layout->overrideSpacing(name, Hb::CenterVEdge, prop.mCenterV); |
4084 } |
4037 } |
4085 } |
4038 } |
4086 } |
4039 } |
4087 } |
4040 } |
4088 |
4041 |