diff --git a/data/themes/BlackOnLightYellow b/data/themes/BlackOnLightYellow index 2bb1b332e..4f5727360 100644 --- a/data/themes/BlackOnLightYellow +++ b/data/themes/BlackOnLightYellow @@ -1,69 +1,69 @@ [Theme] ThemeName=BlackOnLightYellow ThemePaletteColor1=0,0,0 ThemePaletteColor2=85,93,80 ThemePaletteColor3=72,60,50 ThemePaletteColor4=59,60,54 ThemePaletteColor5=85,85,85 [Axis] LabelsFontColor=104,104,104 LabelsOpacity=1 LineColor=104,104,104 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=104,104,104 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=104,104,104 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=104,104,104 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=248,255,170 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=104,104,104 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=104,104,104 BackgroundColor=248,255,170 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=248,255,170 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=104,104,104 ValuesOpacity=1 diff --git a/data/themes/BlackOnWhite b/data/themes/BlackOnWhite index 9779a7b7b..583337333 100644 --- a/data/themes/BlackOnWhite +++ b/data/themes/BlackOnWhite @@ -1,69 +1,69 @@ [Theme] ThemeName=BlackOnWhite ThemePaletteColor1=0,0,0 ThemePaletteColor2=85,93,80 ThemePaletteColor3=72,60,50 ThemePaletteColor4=59,60,54 ThemePaletteColor5=85,85,85 [Axis] LabelsFontColor=104,104,104 LabelsOpacity=1 LineColor=104,104,104 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=104,104,104 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=104,104,104 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=104,104,104 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=255,255,255 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=104,104,104 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=104,104,104 BackgroundColor=255,255,255 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=255,255,255 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=104,104,104 ValuesOpacity=1 diff --git a/data/themes/BlueOnBlack b/data/themes/BlueOnBlack index 1947cfd70..a5723e786 100644 --- a/data/themes/BlueOnBlack +++ b/data/themes/BlueOnBlack @@ -1,69 +1,69 @@ [Theme] ThemeName=BlueOnBlack ThemePaletteColor1=159,230,238 ThemePaletteColor2=78,164,245 ThemePaletteColor3=90,125,234 ThemePaletteColor4=28,75,219 ThemePaletteColor5=34,34,148 [Axis] LabelsFontColor=128,128,128 LabelsOpacity=1 LineColor=128,128,128 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=128,128,128 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=128,128,128 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=128,128,128 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,0,0 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=128,128,128 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=128,128,128 BackgroundColor=0,0,0 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=0,0,0 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=128,128,128 ValuesOpacity=1 diff --git a/data/themes/Bright b/data/themes/Bright index 704f3e19c..820f1c56f 100644 --- a/data/themes/Bright +++ b/data/themes/Bright @@ -1,69 +1,69 @@ [Theme] ThemeName=Bright ThemePaletteColor1=0,219,241 ThemePaletteColor2=48,151,197 ThemePaletteColor3=255,125,102 ThemePaletteColor4=0,183,150 ThemePaletteColor5=254,150,1 [Axis] LabelsFontColor=128,128,128 LabelsOpacity=1 LineColor=128,128,128 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=128,128,128 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=128,128,128 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=128,128,128 MinorGridOpacity=0.5 MinorGridStyle=2 MinorGridWidth=1.76389 MinorTicksColor=0,0,0 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=255,255,255 BackgroundImageStyle=1 BackgroundOpacity=0.5 BackgroundSecondColor=160,160,160 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=128,128,128 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=128,128,128 BackgroundColor=255,255,255 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=2 FillingOpacity=0.4 FillingPosition=2 FillingSecondColor=255,255,255 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=128,128,128 ValuesOpacity=1 diff --git a/data/themes/Creme b/data/themes/Creme index 5b037960a..997d1ceaf 100644 --- a/data/themes/Creme +++ b/data/themes/Creme @@ -1,69 +1,69 @@ [Theme] ThemeName=Creme ThemePaletteColor1=62,72,190 ThemePaletteColor2=253,155,1 ThemePaletteColor3=213,32,104 ThemePaletteColor4=32,210,213 ThemePaletteColor5=131,85,147 [Axis] LabelsFontColor=142,65,0 LabelsOpacity=1 LineColor=142,65,0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=142,65,0 MajorGridOpacity=0.3 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=142,65,0 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=142,65,0 MinorGridOpacity=0.3 MinorGridStyle=2 MinorGridWidth=1.76389 MinorTicksColor=0,0,0 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=208,190,170 BackgroundImageStyle=1 BackgroundOpacity=0.5 BackgroundSecondColor=160,160,160 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=142,65,0 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=142,65,0 BackgroundColor=208,190,170 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=2 FillingOpacity=0.4 FillingPosition=2 FillingSecondColor=208,190,170 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=142,65,0 ValuesOpacity=1 diff --git a/data/themes/Dark b/data/themes/Dark index 9cc429152..38cf87f50 100644 --- a/data/themes/Dark +++ b/data/themes/Dark @@ -1,69 +1,69 @@ [Theme] ThemeName=Dark ThemePaletteColor1=43,144,143 ThemePaletteColor2=144,238,126 ThemePaletteColor3=244,91,91 ThemePaletteColor4=199,152,191 ThemePaletteColor5=133,214,91 [Axis] LabelsFontColor=128,128,128 LabelsOpacity=1 LineColor=128,128,128 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=128,128,128 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=128,128,128 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=128,128,128 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,0,0 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=128,128,128 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=128,128,128 BackgroundColor=0,0,0 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=2 FillingOpacity=0.4 FillingPosition=2 FillingSecondColor=0,0,0 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=128,128,128 ValuesOpacity=1 diff --git a/data/themes/DarkPastels b/data/themes/DarkPastels index f2df2a5cd..4f2366a1e 100644 --- a/data/themes/DarkPastels +++ b/data/themes/DarkPastels @@ -1,69 +1,69 @@ [Theme] ThemeName=DarkPastels ThemePaletteColor1=140,208,211 ThemePaletteColor2=96,180,138 ThemePaletteColor3=223,175,143 ThemePaletteColor4=154,184,215 ThemePaletteColor5=220,140,195 [Axis] LabelsFontColor=220,220,204 LabelsOpacity=1 LineColor=220,220,204 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=220,220,204 MajorGridOpacity=0.3 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=220,220,204 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=220,220,204 MinorGridOpacity=0.3 MinorGridStyle=2 MinorGridWidth=1.76389 MinorTicksColor=0,0,0 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=44,44,44 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=220,220,204 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=220,220,204 BackgroundColor=44,44,44 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=44,44,44 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=220,220,204 ValuesOpacity=1 diff --git a/data/themes/GreenOnBlack b/data/themes/GreenOnBlack index 4a04b611a..a3c815012 100644 --- a/data/themes/GreenOnBlack +++ b/data/themes/GreenOnBlack @@ -1,69 +1,69 @@ [Theme] ThemeName=GreenOnBlack ThemePaletteColor1=152,242,96 ThemePaletteColor2=109,237,30 ThemePaletteColor3=76,176,14 ThemePaletteColor4=58,133,11 ThemePaletteColor5=19,97,8 [Axis] LabelsFontColor=128,128,128 LabelsOpacity=1 LineColor=128,128,128 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=128,128,128 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=128,128,128 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=128,128,128 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,0,0 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=128,128,128 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=128,128,128 BackgroundColor=0,0,0 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=0,0,0 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=128,128,128 ValuesOpacity=1 diff --git a/data/themes/GreyOnBlack b/data/themes/GreyOnBlack index 14665ab8c..42137aeef 100644 --- a/data/themes/GreyOnBlack +++ b/data/themes/GreyOnBlack @@ -1,69 +1,69 @@ [Theme] ThemeName=GreyOnBlack ThemePaletteColor1=220,220,220 ThemePaletteColor2=192,192,192 ThemePaletteColor3=169,169,169 ThemePaletteColor4=128,128,128 ThemePaletteColor5=85,85,85 [Axis] LabelsFontColor=255,253,208 LabelsOpacity=1 LineColor=255,253,208 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=255,253,208 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=255,253,208 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=255,253,208 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,0,0 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=255,253,208 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=255,253,208 BackgroundColor=0,0,0 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=0,0,0 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=255,253,208 ValuesOpacity=1 diff --git a/data/themes/GreySlate b/data/themes/GreySlate index 8b975aae4..a3837d465 100644 --- a/data/themes/GreySlate +++ b/data/themes/GreySlate @@ -1,69 +1,69 @@ [Theme] ThemeName=GreySlate ThemePaletteColor1=246,252,156 ThemePaletteColor2=36,182,94 ThemePaletteColor3=36,165,182 ThemePaletteColor4=236,150,143 ThemePaletteColor5=204,160,8 [Axis] LabelsFontColor=211,211,211 LabelsOpacity=1 LineColor=211,211,211 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=160,160,160 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=211,211,211 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=211,211,211 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=103,103,103 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=211,211,211 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=211,211,211 BackgroundColor=103,103,103 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=2 FillingOpacity=0.4 FillingPosition=2 FillingSecondColor=80,82,110 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=211,211,211 ValuesOpacity=1 diff --git a/data/themes/RedOnBlack b/data/themes/RedOnBlack index 77908f4d8..e2624a98c 100644 --- a/data/themes/RedOnBlack +++ b/data/themes/RedOnBlack @@ -1,70 +1,70 @@ [Theme] ThemeName=RedOnBlack ThemePaletteColor1=255,115,92 ThemePaletteColor2=255,80,51 ThemePaletteColor3=255,40,5 ThemePaletteColor4=209,29,0 ThemePaletteColor5=173,24,0 [Axis] LabelsFontColor=128,128,128 LabelsOpacity=1 LineColor=128,128,128 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=128,128,128 MajorGridOpacity=0.5 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=128,128,128 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=160,160,160 MinorGridOpacity=0.5 MinorGridStyle=3 MinorGridWidth=1.76389 MinorTicksColor=128,128,128 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,0,0 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=160,160,160 BackgroundType=0 BorderColor=128,128,128 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=128,128,128 BackgroundColor=0,0,0 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingImageStyle=1 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=0,0,0 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=128,128,128 ValuesOpacity=1 diff --git a/data/themes/Solarized b/data/themes/Solarized index ad9dc0a36..cf494bb82 100644 --- a/data/themes/Solarized +++ b/data/themes/Solarized @@ -1,69 +1,69 @@ [Theme] ThemeName=Solarized ThemePaletteColor1=220,50,47 ThemePaletteColor2=133,153,0 ThemePaletteColor3=181,137,0 ThemePaletteColor4=38,139,210 ThemePaletteColor5=211,54,130 [Axis] LabelsFontColor=131,148,150 LabelsOpacity=1 LineColor=131,148,150 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=131,148,150 MajorGridOpacity=0.3 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=131,148,150 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=131,148,150 MinorGridOpacity=0.3 MinorGridStyle=2 MinorGridWidth=1.76389 MinorTicksColor=0,0,0 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=0,43,54 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=7,54,66 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=131,148,150 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=131,148,150 BackgroundColor=0,43,54 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=0,43,54 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=131,148,150 ValuesOpacity=1 diff --git a/data/themes/SolarizedLight b/data/themes/SolarizedLight index 14dd7f844..7f214f5ea 100644 --- a/data/themes/SolarizedLight +++ b/data/themes/SolarizedLight @@ -1,69 +1,69 @@ [Theme] ThemeName=SolarizedLight ThemePaletteColor1=220,50,47 ThemePaletteColor2=133,153,0 ThemePaletteColor3=181,137,0 ThemePaletteColor4=38,139,210 ThemePaletteColor5=211,54,130 [Axis] LabelsFontColor=101,123,131 LabelsOpacity=1 LineColor=101,123,131 LineOpacity=1 LineStyle=1 LineWidth=3.52778 MajorGridColor=101,123,131 MajorGridOpacity=0.3 MajorGridStyle=1 MajorGridWidth=1.76389 MajorTicksColor=101,123,131 MajorTicksLineStyle=1 MajorTicksOpacity=1 MajorTicksWidth=3.52778 MinorGridColor=101,123,131 MinorGridOpacity=0.3 MinorGridStyle=2 MinorGridWidth=1.76389 MinorTicksColor=0,0,0 MinorTicksLineStyle=0 MinorTicksOpacity=1 MinorTicksWidth=0.283465 [CartesianPlot] BackgroundBrushStyle=1 BackgroundColorStyle=0 BackgroundFirstColor=253,246,227 BackgroundImageStyle=1 BackgroundOpacity=1 BackgroundSecondColor=7,54,66 BackgroundType=0 -BorderColor=0,0,0 +BorderColor=101,123,131 BorderCornerRadius=0 BorderOpacity=1 -BorderStyle=0 +BorderStyle=1 BorderWidth=3.52778 [Label] FontColor=101,123,131 BackgroundColor=253,246,227 [XYCurve] DropLineOpacity=1 DropLineStyle=1 DropLineWidth=3.52778 ErrorBarsOpacity=1 ErrorBarsStyle=1 ErrorBarsWidth=3.52778 FillingBrushStyle=1 FillingColorStyle=0 FillingOpacity=0.4 FillingPosition=0 FillingSecondColor=253,246,227 FillingType=0 LineOpacity=1 LineStyle=1 LineWidth=3.52778 SymbolOpacity=1 ValuesColor=101,123,131 ValuesOpacity=1 diff --git a/src/backend/worksheet/plots/PlotArea.cpp b/src/backend/worksheet/plots/PlotArea.cpp index 386944a8c..ed2c199b5 100644 --- a/src/backend/worksheet/plots/PlotArea.cpp +++ b/src/backend/worksheet/plots/PlotArea.cpp @@ -1,581 +1,583 @@ /*************************************************************************** File : PlotArea.cpp Project : LabPlot Description : Plot area (for background filling and clipping). -------------------------------------------------------------------- Copyright : (C) 2011-2015 by Alexander Semke (alexander.semke@web.de) ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * ***************************************************************************/ #include "backend/worksheet/Worksheet.h" #include "backend/worksheet/plots/PlotArea.h" #include "backend/worksheet/plots/PlotAreaPrivate.h" #include "backend/lib/commandtemplates.h" #include "backend/lib/XmlStreamReader.h" #include "backend/lib/macros.h" #include #include #include #include /** * \class PlotArea * \brief Plot area (for background filling and clipping). * * \ingroup worksheet */ PlotArea::PlotArea(const QString &name):WorksheetElement(name), d_ptr(new PlotAreaPrivate(this)) { init(); } PlotArea::PlotArea(const QString &name, PlotAreaPrivate *dd) : WorksheetElement(name), d_ptr(dd) { init(); } //no need to delete the d-pointer here - it inherits from QGraphicsItem //and is deleted during the cleanup in QGraphicsScene PlotArea::~PlotArea() = default; void PlotArea::init() { Q_D(PlotArea); setHidden(true);//we don't show PlotArea aspect in the model view. d->rect = QRectF(0, 0, 1, 1); d->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); KConfig config; KConfigGroup group = config.group("PlotArea"); //Background d->backgroundType = (PlotArea::BackgroundType) group.readEntry("BackgroundType", (int)PlotArea::Color); d->backgroundColorStyle = (PlotArea::BackgroundColorStyle) group.readEntry("BackgroundColorStyle", (int) PlotArea::SingleColor); d->backgroundImageStyle = (PlotArea::BackgroundImageStyle) group.readEntry("BackgroundImageStyle", (int) PlotArea::Scaled); d->backgroundBrushStyle = (Qt::BrushStyle) group.readEntry("BackgroundBrushStyle", (int) Qt::SolidPattern); d->backgroundFileName = group.readEntry("BackgroundFileName", QString()); d->backgroundFirstColor = group.readEntry("BackgroundFirstColor", QColor(Qt::white)); d->backgroundSecondColor = group.readEntry("BackgroundSecondColor", QColor(Qt::black)); d->backgroundOpacity = group.readEntry("BackgroundOpacity", 1.0); //Border d->borderPen = QPen(group.readEntry("BorderColor", QColor(Qt::black)), group.readEntry("BorderWidth", Worksheet::convertToSceneUnits(1.0, Worksheet::Point)), (Qt::PenStyle) group.readEntry("BorderStyle", (int)Qt::SolidLine)); d->borderCornerRadius = group.readEntry("BorderCornerRadius", 0.0); d->borderOpacity = group.readEntry("BorderOpacity", 1.0); } QGraphicsItem *PlotArea::graphicsItem() const { return d_ptr; } STD_SWAP_METHOD_SETTER_CMD_IMPL(PlotArea, SetVisible, bool, swapVisible) void PlotArea::setVisible(bool on) { Q_D(PlotArea); exec(new PlotAreaSetVisibleCmd(d, on, on ? ki18n("%1: set visible") : ki18n("%1: set invisible"))); } bool PlotArea::isVisible() const { Q_D(const PlotArea); return d->isVisible(); } void PlotArea::handleResize(double horizontalRatio, double verticalRatio, bool pageResize) { DEBUG("PlotArea::handleResize()"); Q_D(PlotArea); Q_UNUSED(pageResize); d->rect.setWidth(d->rect.width()*horizontalRatio); d->rect.setHeight(d->rect.height()*verticalRatio); // TODO: scale line width } void PlotArea::retransform() { } /* ============================ getter methods ================= */ BASIC_SHARED_D_READER_IMPL(PlotArea, bool, clippingEnabled, clippingEnabled()) CLASS_SHARED_D_READER_IMPL(PlotArea, QRectF, rect, rect) BASIC_SHARED_D_READER_IMPL(PlotArea, PlotArea::BackgroundType, backgroundType, backgroundType) BASIC_SHARED_D_READER_IMPL(PlotArea, PlotArea::BackgroundColorStyle, backgroundColorStyle, backgroundColorStyle) BASIC_SHARED_D_READER_IMPL(PlotArea, PlotArea::BackgroundImageStyle, backgroundImageStyle, backgroundImageStyle) CLASS_SHARED_D_READER_IMPL(PlotArea, Qt::BrushStyle, backgroundBrushStyle, backgroundBrushStyle) CLASS_SHARED_D_READER_IMPL(PlotArea, QColor, backgroundFirstColor, backgroundFirstColor) CLASS_SHARED_D_READER_IMPL(PlotArea, QColor, backgroundSecondColor, backgroundSecondColor) CLASS_SHARED_D_READER_IMPL(PlotArea, QString, backgroundFileName, backgroundFileName) BASIC_SHARED_D_READER_IMPL(PlotArea, qreal, backgroundOpacity, backgroundOpacity) CLASS_SHARED_D_READER_IMPL(PlotArea, QPen, borderPen, borderPen) BASIC_SHARED_D_READER_IMPL(PlotArea, qreal, borderCornerRadius, borderCornerRadius) BASIC_SHARED_D_READER_IMPL(PlotArea, qreal, borderOpacity, borderOpacity) /* ============================ setter methods and undo commands ================= */ STD_SWAP_METHOD_SETTER_CMD_IMPL(PlotArea, SetClippingEnabled, bool, toggleClipping); void PlotArea::setClippingEnabled(bool on) { Q_D(PlotArea); if (d->clippingEnabled() != on) exec(new PlotAreaSetClippingEnabledCmd(d, on, ki18n("%1: toggle clipping"))); } /*! * sets plot area rect in scene coordinates. */ void PlotArea::setRect(const QRectF &newRect) { Q_D(PlotArea); d->setRect(newRect); } //Background STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundType, PlotArea::BackgroundType, backgroundType, update) void PlotArea::setBackgroundType(BackgroundType type) { Q_D(PlotArea); if (type != d->backgroundType) exec(new PlotAreaSetBackgroundTypeCmd(d, type, ki18n("%1: background type changed"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundColorStyle, PlotArea::BackgroundColorStyle, backgroundColorStyle, update) void PlotArea::setBackgroundColorStyle(BackgroundColorStyle style) { Q_D(PlotArea); if (style != d->backgroundColorStyle) exec(new PlotAreaSetBackgroundColorStyleCmd(d, style, ki18n("%1: background color style changed"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundImageStyle, PlotArea::BackgroundImageStyle, backgroundImageStyle, update) void PlotArea::setBackgroundImageStyle(PlotArea::BackgroundImageStyle style) { Q_D(PlotArea); if (style != d->backgroundImageStyle) exec(new PlotAreaSetBackgroundImageStyleCmd(d, style, ki18n("%1: background image style changed"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundBrushStyle, Qt::BrushStyle, backgroundBrushStyle, update) void PlotArea::setBackgroundBrushStyle(Qt::BrushStyle style) { Q_D(PlotArea); if (style != d->backgroundBrushStyle) exec(new PlotAreaSetBackgroundBrushStyleCmd(d, style, ki18n("%1: background brush style changed"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundFirstColor, QColor, backgroundFirstColor, update) void PlotArea::setBackgroundFirstColor(const QColor &color) { Q_D(PlotArea); if (color != d->backgroundFirstColor) exec(new PlotAreaSetBackgroundFirstColorCmd(d, color, ki18n("%1: set background first color"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundSecondColor, QColor, backgroundSecondColor, update) void PlotArea::setBackgroundSecondColor(const QColor &color) { Q_D(PlotArea); if (color != d->backgroundSecondColor) exec(new PlotAreaSetBackgroundSecondColorCmd(d, color, ki18n("%1: set background second color"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundFileName, QString, backgroundFileName, update) void PlotArea::setBackgroundFileName(const QString& fileName) { Q_D(PlotArea); if (fileName != d->backgroundFileName) exec(new PlotAreaSetBackgroundFileNameCmd(d, fileName, ki18n("%1: set background image"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBackgroundOpacity, qreal, backgroundOpacity, update) void PlotArea::setBackgroundOpacity(qreal opacity) { Q_D(PlotArea); if (opacity != d->backgroundOpacity) exec(new PlotAreaSetBackgroundOpacityCmd(d, opacity, ki18n("%1: set plot area opacity"))); } //Border STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBorderPen, QPen, borderPen, update) void PlotArea::setBorderPen(const QPen &pen) { Q_D(PlotArea); if (pen != d->borderPen) exec(new PlotAreaSetBorderPenCmd(d, pen, ki18n("%1: set plot area border"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBorderCornerRadius, qreal, borderCornerRadius, update) void PlotArea::setBorderCornerRadius(qreal radius) { Q_D(PlotArea); if (radius != d->borderCornerRadius) exec(new PlotAreaSetBorderCornerRadiusCmd(d, radius, ki18n("%1: set plot area corner radius"))); } STD_SETTER_CMD_IMPL_F_S(PlotArea, SetBorderOpacity, qreal, borderOpacity, update) void PlotArea::setBorderOpacity(qreal opacity) { Q_D(PlotArea); if (opacity != d->borderOpacity) exec(new PlotAreaSetBorderOpacityCmd(d, opacity, ki18n("%1: set plot area border opacity"))); } //##################################################################### //################### Private implementation ########################## //##################################################################### PlotAreaPrivate::PlotAreaPrivate(PlotArea *owner):q(owner) { } QString PlotAreaPrivate::name() const { return q->name(); } bool PlotAreaPrivate::clippingEnabled() const { return (flags() & QGraphicsItem::ItemClipsChildrenToShape); } bool PlotAreaPrivate::toggleClipping(bool on) { bool oldValue = clippingEnabled(); setFlag(QGraphicsItem::ItemClipsChildrenToShape, on); return oldValue; } bool PlotAreaPrivate::swapVisible(bool on) { bool oldValue = isVisible(); setVisible(on); return oldValue; } void PlotAreaPrivate::setRect(const QRectF& r) { prepareGeometryChange(); rect = mapRectFromScene(r); } QRectF PlotAreaPrivate::boundingRect () const { float width = rect.width(); float height = rect.height(); float penWidth = borderPen.width(); return QRectF{-width/2 - penWidth/2, -height/2 - penWidth/2, width + penWidth, height + penWidth}; } QPainterPath PlotAreaPrivate::shape() const { QPainterPath path; if (qFuzzyIsNull(borderCornerRadius)) path.addRect(rect); else path.addRoundedRect(rect, borderCornerRadius, borderCornerRadius); return path; } void PlotAreaPrivate::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { // DEBUG("PlotAreaPrivate::paint()"); Q_UNUSED(option) Q_UNUSED(widget) if (!isVisible()) return; //draw the area painter->setOpacity(backgroundOpacity); painter->setPen(Qt::NoPen); if (backgroundType == PlotArea::Color) { switch (backgroundColorStyle) { case PlotArea::SingleColor: { painter->setBrush(QBrush(backgroundFirstColor)); break; } case PlotArea::HorizontalLinearGradient: { QLinearGradient linearGrad(rect.topLeft(), rect.topRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::VerticalLinearGradient: { QLinearGradient linearGrad(rect.topLeft(), rect.bottomLeft()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::TopLeftDiagonalLinearGradient: { QLinearGradient linearGrad(rect.topLeft(), rect.bottomRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::BottomLeftDiagonalLinearGradient: { QLinearGradient linearGrad(rect.bottomLeft(), rect.topRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::RadialGradient: { QRadialGradient radialGrad(rect.center(), rect.width()/2); radialGrad.setColorAt(0, backgroundFirstColor); radialGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(radialGrad)); break; } } } else if (backgroundType == PlotArea::Image) { if ( !backgroundFileName.trimmed().isEmpty() ) { QPixmap pix(backgroundFileName); switch (backgroundImageStyle) { case PlotArea::ScaledCropped: pix = pix.scaled(rect.size().toSize(),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation); painter->setBrush(QBrush(pix)); painter->setBrushOrigin(pix.size().width()/2,pix.size().height()/2); painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); break; case PlotArea::Scaled: pix = pix.scaled(rect.size().toSize(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation); painter->setBrush(QBrush(pix)); painter->setBrushOrigin(pix.size().width()/2,pix.size().height()/2); painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); break; case PlotArea::ScaledAspectRatio: pix = pix.scaled(rect.size().toSize(),Qt::KeepAspectRatio,Qt::SmoothTransformation); painter->setBrush(QBrush(pix)); painter->setBrushOrigin(pix.size().width()/2,pix.size().height()/2); painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); break; case PlotArea::Centered: painter->drawPixmap(QPointF(rect.center().x()-pix.size().width()/2,rect.center().y()-pix.size().height()/2),pix); break; case PlotArea::Tiled: painter->setBrush(QBrush(pix)); painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); break; case PlotArea::CenterTiled: painter->setBrush(QBrush(pix)); painter->setBrushOrigin(pix.size().width()/2,pix.size().height()/2); painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); } } } else if (backgroundType == PlotArea::Pattern) { painter->setBrush(QBrush(backgroundFirstColor,backgroundBrushStyle)); } if ( qFuzzyIsNull(borderCornerRadius) ) painter->drawRect(rect); else painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); //draw the border if (borderPen.style() != Qt::NoPen) { painter->setPen(borderPen); painter->setBrush(Qt::NoBrush); painter->setOpacity(borderOpacity); if ( qFuzzyIsNull(borderCornerRadius) ) painter->drawRect(rect); else painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); } // DEBUG("PlotAreaPrivate::paint() DONE"); } //############################################################################## //################## Serialization/Deserialization ########################### //############################################################################## //! Save as XML void PlotArea::save(QXmlStreamWriter* writer) const { Q_D(const PlotArea); writer->writeStartElement( "plotArea" ); writeBasicAttributes(writer); writeCommentElement(writer); writer->writeStartElement( "background" ); writer->writeAttribute( "type", QString::number(d->backgroundType) ); writer->writeAttribute( "colorStyle", QString::number(d->backgroundColorStyle) ); writer->writeAttribute( "imageStyle", QString::number(d->backgroundImageStyle) ); writer->writeAttribute( "brushStyle", QString::number(d->backgroundBrushStyle) ); writer->writeAttribute( "firstColor_r", QString::number(d->backgroundFirstColor.red()) ); writer->writeAttribute( "firstColor_g", QString::number(d->backgroundFirstColor.green()) ); writer->writeAttribute( "firstColor_b", QString::number(d->backgroundFirstColor.blue()) ); writer->writeAttribute( "secondColor_r", QString::number(d->backgroundSecondColor.red()) ); writer->writeAttribute( "secondColor_g", QString::number(d->backgroundSecondColor.green()) ); writer->writeAttribute( "secondColor_b", QString::number(d->backgroundSecondColor.blue()) ); writer->writeAttribute( "fileName", d->backgroundFileName ); writer->writeAttribute( "opacity", QString::number(d->backgroundOpacity) ); writer->writeEndElement(); //border writer->writeStartElement( "border" ); WRITE_QPEN(d->borderPen); writer->writeAttribute( "borderOpacity", QString::number(d->borderOpacity) ); writer->writeAttribute( "borderCornerRadius", QString::number(d->borderCornerRadius) ); writer->writeEndElement(); writer->writeEndElement(); } //! Load from XML bool PlotArea::load(XmlStreamReader* reader, bool preview) { Q_D(PlotArea); if ( !readBasicAttributes(reader) ) return false; KLocalizedString attributeWarning = ki18n("Attribute '%1' missing or empty, default value is used"); QXmlStreamAttributes attribs; QString str; while ( !reader->atEnd() ) { reader->readNext(); if (reader->isEndElement() && reader->name() == "plotArea") break; if ( !reader->isStartElement() ) continue; if (!preview && reader->name() == "comment") { if (!readCommentElement(reader)) return false; } else if (!preview && reader->name() == "background") { attribs = reader->attributes(); str = attribs.value("type").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("type").toString()); else d->backgroundType = PlotArea::BackgroundType(str.toInt()); str = attribs.value("colorStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("colorStyle").toString()); else d->backgroundColorStyle = PlotArea::BackgroundColorStyle(str.toInt()); str = attribs.value("imageStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("imageStyle").toString()); else d->backgroundImageStyle = PlotArea::BackgroundImageStyle(str.toInt()); str = attribs.value("brushStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("brushStyle").toString()); else d->backgroundBrushStyle = Qt::BrushStyle(str.toInt()); str = attribs.value("firstColor_r").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_r").toString()); else d->backgroundFirstColor.setRed(str.toInt()); str = attribs.value("firstColor_g").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_g").toString()); else d->backgroundFirstColor.setGreen(str.toInt()); str = attribs.value("firstColor_b").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_b").toString()); else d->backgroundFirstColor.setBlue(str.toInt()); str = attribs.value("secondColor_r").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_r").toString()); else d->backgroundSecondColor.setRed(str.toInt()); str = attribs.value("secondColor_g").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_g").toString()); else d->backgroundSecondColor.setGreen(str.toInt()); str = attribs.value("secondColor_b").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_b").toString()); else d->backgroundSecondColor.setBlue(str.toInt()); str = attribs.value("fileName").toString(); d->backgroundFileName = str; str = attribs.value("opacity").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("opacity").toString()); else d->backgroundOpacity = str.toDouble(); } else if (!preview && reader->name() == "border") { attribs = reader->attributes(); READ_QPEN(d->borderPen); str = attribs.value("borderOpacity").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("borderOpacity").toString()); else d->borderOpacity = str.toDouble(); str = attribs.value("borderCornerRadius").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("borderCornerRadius").toString()); else d->borderCornerRadius = str.toDouble(); } else { // unknown element reader->raiseWarning(i18n("unknown element '%1'", reader->name().toString())); if (!reader->skipToEndElement()) return false; } } return true; } void PlotArea::loadThemeConfig(const KConfig& config) { const KConfigGroup group = config.group("CartesianPlot"); this->setBackgroundBrushStyle((Qt::BrushStyle)group.readEntry("BackgroundBrushStyle",(int) this->backgroundBrushStyle())); this->setBackgroundColorStyle((PlotArea::BackgroundColorStyle)(group.readEntry("BackgroundColorStyle",(int) this->backgroundColorStyle()))); this->setBackgroundFirstColor(group.readEntry("BackgroundFirstColor",(QColor) this->backgroundFirstColor())); this->setBackgroundImageStyle((PlotArea::BackgroundImageStyle)group.readEntry("BackgroundImageStyle",(int) this->backgroundImageStyle())); this->setBackgroundOpacity(group.readEntry("BackgroundOpacity", this->backgroundOpacity())); this->setBackgroundSecondColor(group.readEntry("BackgroundSecondColor",(QColor) this->backgroundSecondColor())); this->setBackgroundType((PlotArea::BackgroundType)(group.readEntry("BackgroundType",(int) this->backgroundType()))); - this->borderPen().setColor(group.readEntry("BorderColor",(QColor) this->borderPen().color())); + QPen pen = this->borderPen(); + pen.setColor(group.readEntry("BorderColor", pen.color())); + pen.setStyle((Qt::PenStyle)(group.readEntry("BorderStyle", (int) pen.style()))); + pen.setWidthF(group.readEntry("BorderWidth", pen.widthF())); + this->setBorderPen(pen); this->setBorderCornerRadius(group.readEntry("BorderCornerRadius", this->borderCornerRadius())); this->setBorderOpacity(group.readEntry("BorderOpacity", this->borderOpacity())); - this->borderPen().setStyle((Qt::PenStyle)(group.readEntry("BorderStyle", (int) this->borderPen().style()))); - this->borderPen().setWidthF(group.readEntry("BorderWidth", this->borderPen().widthF())); } void PlotArea::saveThemeConfig(const KConfig& config) { KConfigGroup group = config.group("CartesianPlot"); group.writeEntry("BackgroundBrushStyle",(int) this->backgroundBrushStyle()); group.writeEntry("BackgroundColorStyle",(int) this->backgroundColorStyle()); group.writeEntry("BackgroundFirstColor",(QColor) this->backgroundFirstColor()); group.writeEntry("BackgroundImageStyle",(int) this->backgroundImageStyle()); group.writeEntry("BackgroundOpacity", this->backgroundOpacity()); group.writeEntry("BackgroundSecondColor",(QColor) this->backgroundSecondColor()); group.writeEntry("BackgroundType",(int) this->backgroundType()); group.writeEntry("BorderColor",(QColor) this->borderPen().color()); group.writeEntry("BorderCornerRadius", this->borderCornerRadius()); group.writeEntry("BorderOpacity", this->borderOpacity()); group.writeEntry("BorderStyle", (int) this->borderPen().style()); group.writeEntry("BorderWidth", this->borderPen().widthF()); } diff --git a/src/backend/worksheet/plots/cartesian/CartesianPlotLegend.cpp b/src/backend/worksheet/plots/cartesian/CartesianPlotLegend.cpp index 6b158f73d..7543d7d5e 100644 --- a/src/backend/worksheet/plots/cartesian/CartesianPlotLegend.cpp +++ b/src/backend/worksheet/plots/cartesian/CartesianPlotLegend.cpp @@ -1,1231 +1,1232 @@ /*************************************************************************** File : CartesianPlotLegend.cpp Project : LabPlot Description : Legend for the cartesian plot -------------------------------------------------------------------- Copyright : (C) 2013-2018 Alexander Semke (alexander.semke@web.de) ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * ***************************************************************************/ /*! \class CartesianPlotLegend \brief Legend for the cartesian plot. \ingroup kdefrontend */ #include "CartesianPlotLegend.h" #include "backend/worksheet/plots/cartesian/CartesianPlotLegendPrivate.h" #include "backend/worksheet/plots/cartesian/CartesianPlot.h" #include "backend/worksheet/plots/cartesian/XYCurve.h" #include "backend/worksheet/Worksheet.h" #include "backend/lib/XmlStreamReader.h" #include "backend/worksheet/TextLabel.h" #include "backend/lib/commandtemplates.h" #include #include #include #include #include #include #include CartesianPlotLegend::CartesianPlotLegend(CartesianPlot* plot, const QString &name) : WorksheetElement(name), d_ptr(new CartesianPlotLegendPrivate(this)), m_plot(plot) { init(); } CartesianPlotLegend::CartesianPlotLegend(CartesianPlot* plot, const QString &name, CartesianPlotLegendPrivate *dd) : WorksheetElement(name), d_ptr(dd), m_plot(plot) { init(); } //no need to delete the d-pointer here - it inherits from QGraphicsItem //and is deleted during the cleanup in QGraphicsScene CartesianPlotLegend::~CartesianPlotLegend() = default; void CartesianPlotLegend::init() { Q_D(CartesianPlotLegend); KConfig config; KConfigGroup group = config.group( "CartesianPlotLegend" ); d->labelFont = group.readEntry("LabelsFont", QFont()); d->labelFont.setPixelSize( Worksheet::convertToSceneUnits( 10, Worksheet::Point ) ); d->labelColor = Qt::black; d->labelColumnMajor = true; d->lineSymbolWidth = group.readEntry("LineSymbolWidth", Worksheet::convertToSceneUnits(1, Worksheet::Centimeter)); d->rowCount = 0; d->columnCount = 0; d->position.horizontalPosition = CartesianPlotLegend::hPositionRight; d->position.verticalPosition = CartesianPlotLegend::vPositionBottom; d->rotationAngle = group.readEntry("Rotation", 0.0); //Title d->title = new TextLabel(this->name(), TextLabel::PlotLegendTitle); addChild(d->title); d->title->setHidden(true); d->title->setParentGraphicsItem(graphicsItem()); d->title->graphicsItem()->setFlag(QGraphicsItem::ItemIsMovable, false); connect(d->title, &TextLabel::changed, this, &CartesianPlotLegend::retransform); //Background d->backgroundType = (PlotArea::BackgroundType) group.readEntry("BackgroundType", (int) PlotArea::Color); d->backgroundColorStyle = (PlotArea::BackgroundColorStyle) group.readEntry("BackgroundColorStyle", (int) PlotArea::SingleColor); d->backgroundImageStyle = (PlotArea::BackgroundImageStyle) group.readEntry("BackgroundImageStyle", (int) PlotArea::Scaled); d->backgroundBrushStyle = (Qt::BrushStyle) group.readEntry("BackgroundBrushStyle", (int) Qt::SolidPattern); d->backgroundFileName = group.readEntry("BackgroundFileName", QString()); d->backgroundFirstColor = group.readEntry("BackgroundFirstColor", QColor(Qt::white)); d->backgroundSecondColor = group.readEntry("BackgroundSecondColor", QColor(Qt::black)); d->backgroundOpacity = group.readEntry("BackgroundOpacity", 1.0); //Border d->borderPen = QPen(group.readEntry("BorderColor", QColor(Qt::black)), group.readEntry("BorderWidth", Worksheet::convertToSceneUnits(1.0, Worksheet::Point)), (Qt::PenStyle) group.readEntry("BorderStyle", (int)Qt::SolidLine)); d->borderCornerRadius = group.readEntry("BorderCornerRadius", 0.0); d->borderOpacity = group.readEntry("BorderOpacity", 1.0); //Layout d->layoutTopMargin = group.readEntry("LayoutTopMargin", Worksheet::convertToSceneUnits(0.2f, Worksheet::Centimeter)); d->layoutBottomMargin = group.readEntry("LayoutBottomMargin", Worksheet::convertToSceneUnits(0.2f, Worksheet::Centimeter)); d->layoutLeftMargin = group.readEntry("LayoutLeftMargin", Worksheet::convertToSceneUnits(0.2f, Worksheet::Centimeter)); d->layoutRightMargin = group.readEntry("LayoutRightMargin", Worksheet::convertToSceneUnits(0.2f, Worksheet::Centimeter)); d->layoutVerticalSpacing = group.readEntry("LayoutVerticalSpacing", Worksheet::convertToSceneUnits(0.1f, Worksheet::Centimeter)); d->layoutHorizontalSpacing = group.readEntry("LayoutHorizontalSpacing", Worksheet::convertToSceneUnits(0.1f, Worksheet::Centimeter)); d->layoutColumnCount = group.readEntry("LayoutColumnCount", 1); graphicsItem()->setFlag(QGraphicsItem::ItemIsSelectable, true); graphicsItem()->setFlag(QGraphicsItem::ItemIsMovable); graphicsItem()->setFlag(QGraphicsItem::ItemSendsGeometryChanges); this->initActions(); } void CartesianPlotLegend::initActions() { visibilityAction = new QAction(i18n("Visible"), this); visibilityAction->setCheckable(true); connect(visibilityAction, &QAction::triggered, this, &CartesianPlotLegend::visibilityChanged); } QMenu* CartesianPlotLegend::createContextMenu() { QMenu *menu = WorksheetElement::createContextMenu(); QAction* firstAction = menu->actions().at(1); //skip the first action because of the "title-action" visibilityAction->setChecked(isVisible()); menu->insertAction(firstAction, visibilityAction); return menu; } /*! Returns an icon to be used in the project explorer. */ QIcon CartesianPlotLegend::icon() const{ return QIcon::fromTheme("text-field"); } STD_SWAP_METHOD_SETTER_CMD_IMPL(CartesianPlotLegend, SetVisible, bool, swapVisible) void CartesianPlotLegend::setVisible(bool on) { Q_D(CartesianPlotLegend); exec(new CartesianPlotLegendSetVisibleCmd(d, on, on ? ki18n("%1: set visible") : ki18n("%1: set invisible"))); } bool CartesianPlotLegend::isVisible() const{ Q_D(const CartesianPlotLegend); return d->isVisible(); } void CartesianPlotLegend::setPrinting(bool on) { Q_D(CartesianPlotLegend); d->m_printing = on; } QGraphicsItem *CartesianPlotLegend::graphicsItem() const{ return d_ptr; } void CartesianPlotLegend::retransform() { d_ptr->retransform(); } void CartesianPlotLegend::handleResize(double horizontalRatio, double verticalRatio, bool pageResize) { Q_UNUSED(horizontalRatio); Q_UNUSED(verticalRatio); Q_UNUSED(pageResize); //TODO // Q_D(const CartesianPlotLegend); } //############################################################################## //################################ getter methods ############################ //############################################################################## CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QFont, labelFont, labelFont) CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QColor, labelColor, labelColor) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, bool, labelColumnMajor, labelColumnMajor) CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, CartesianPlotLegend::PositionWrapper, position, position) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, qreal, rotationAngle, rotationAngle) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, lineSymbolWidth, lineSymbolWidth) //Title TextLabel* CartesianPlotLegend::title() { return d_ptr->title; } //Background BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, PlotArea::BackgroundType, backgroundType, backgroundType) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, PlotArea::BackgroundColorStyle, backgroundColorStyle, backgroundColorStyle) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, PlotArea::BackgroundImageStyle, backgroundImageStyle, backgroundImageStyle) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, Qt::BrushStyle, backgroundBrushStyle, backgroundBrushStyle) CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QColor, backgroundFirstColor, backgroundFirstColor) CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QColor, backgroundSecondColor, backgroundSecondColor) CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QString, backgroundFileName, backgroundFileName) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, backgroundOpacity, backgroundOpacity) //Border CLASS_SHARED_D_READER_IMPL(CartesianPlotLegend, QPen, borderPen, borderPen) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, borderCornerRadius, borderCornerRadius) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, borderOpacity, borderOpacity) //Layout BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutTopMargin, layoutTopMargin) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutBottomMargin, layoutBottomMargin) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutLeftMargin, layoutLeftMargin) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutRightMargin, layoutRightMargin) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutHorizontalSpacing, layoutHorizontalSpacing) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, float, layoutVerticalSpacing, layoutVerticalSpacing) BASIC_SHARED_D_READER_IMPL(CartesianPlotLegend, int, layoutColumnCount, layoutColumnCount) //############################################################################## //###################### setter methods and undo commands #################### //############################################################################## STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLabelFont, QFont, labelFont, retransform) void CartesianPlotLegend::setLabelFont(const QFont& font) { Q_D(CartesianPlotLegend); if (font!= d->labelFont) exec(new CartesianPlotLegendSetLabelFontCmd(d, font, ki18n("%1: set font"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLabelColor, QColor, labelColor, update) void CartesianPlotLegend::setLabelColor(const QColor& color) { Q_D(CartesianPlotLegend); if (color!= d->labelColor) exec(new CartesianPlotLegendSetLabelColorCmd(d, color, ki18n("%1: set font color"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLabelColumnMajor, bool, labelColumnMajor, retransform) void CartesianPlotLegend::setLabelColumnMajor(bool columnMajor) { Q_D(CartesianPlotLegend); if (columnMajor != d->labelColumnMajor) exec(new CartesianPlotLegendSetLabelColumnMajorCmd(d, columnMajor, ki18n("%1: change column order"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLineSymbolWidth, float, lineSymbolWidth, retransform) void CartesianPlotLegend::setLineSymbolWidth(float width) { Q_D(CartesianPlotLegend); if (width != d->lineSymbolWidth) exec(new CartesianPlotLegendSetLineSymbolWidthCmd(d, width, ki18n("%1: change line+symbol width"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetPosition, CartesianPlotLegend::PositionWrapper, position, updatePosition); void CartesianPlotLegend::setPosition(const PositionWrapper& pos) { Q_D(CartesianPlotLegend); if (pos.point!=d->position.point || pos.horizontalPosition!=d->position.horizontalPosition || pos.verticalPosition!=d->position.verticalPosition) exec(new CartesianPlotLegendSetPositionCmd(d, pos, ki18n("%1: set position"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetRotationAngle, qreal, rotationAngle, retransform) void CartesianPlotLegend::setRotationAngle(qreal angle) { Q_D(CartesianPlotLegend); if (angle != d->rotationAngle) { exec(new CartesianPlotLegendSetRotationAngleCmd(d, angle, ki18n("%1: set rotation angle"))); d->title->setRotationAngle(angle); } } //Background STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundType, PlotArea::BackgroundType, backgroundType, update) void CartesianPlotLegend::setBackgroundType(PlotArea::BackgroundType type) { Q_D(CartesianPlotLegend); if (type != d->backgroundType) exec(new CartesianPlotLegendSetBackgroundTypeCmd(d, type, ki18n("%1: background type changed"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundColorStyle, PlotArea::BackgroundColorStyle, backgroundColorStyle, update) void CartesianPlotLegend::setBackgroundColorStyle(PlotArea::BackgroundColorStyle style) { Q_D(CartesianPlotLegend); if (style != d->backgroundColorStyle) exec(new CartesianPlotLegendSetBackgroundColorStyleCmd(d, style, ki18n("%1: background color style changed"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundImageStyle, PlotArea::BackgroundImageStyle, backgroundImageStyle, update) void CartesianPlotLegend::setBackgroundImageStyle(PlotArea::BackgroundImageStyle style) { Q_D(CartesianPlotLegend); if (style != d->backgroundImageStyle) exec(new CartesianPlotLegendSetBackgroundImageStyleCmd(d, style, ki18n("%1: background image style changed"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundBrushStyle, Qt::BrushStyle, backgroundBrushStyle, update) void CartesianPlotLegend::setBackgroundBrushStyle(Qt::BrushStyle style) { Q_D(CartesianPlotLegend); if (style != d->backgroundBrushStyle) exec(new CartesianPlotLegendSetBackgroundBrushStyleCmd(d, style, ki18n("%1: background brush style changed"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundFirstColor, QColor, backgroundFirstColor, update) void CartesianPlotLegend::setBackgroundFirstColor(const QColor &color) { Q_D(CartesianPlotLegend); if (color!= d->backgroundFirstColor) exec(new CartesianPlotLegendSetBackgroundFirstColorCmd(d, color, ki18n("%1: set background first color"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundSecondColor, QColor, backgroundSecondColor, update) void CartesianPlotLegend::setBackgroundSecondColor(const QColor &color) { Q_D(CartesianPlotLegend); if (color!= d->backgroundSecondColor) exec(new CartesianPlotLegendSetBackgroundSecondColorCmd(d, color, ki18n("%1: set background second color"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundFileName, QString, backgroundFileName, update) void CartesianPlotLegend::setBackgroundFileName(const QString& fileName) { Q_D(CartesianPlotLegend); if (fileName!= d->backgroundFileName) exec(new CartesianPlotLegendSetBackgroundFileNameCmd(d, fileName, ki18n("%1: set background image"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBackgroundOpacity, float, backgroundOpacity, update) void CartesianPlotLegend::setBackgroundOpacity(float opacity) { Q_D(CartesianPlotLegend); if (opacity != d->backgroundOpacity) exec(new CartesianPlotLegendSetBackgroundOpacityCmd(d, opacity, ki18n("%1: set opacity"))); } //Border STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBorderPen, QPen, borderPen, update) void CartesianPlotLegend::setBorderPen(const QPen &pen) { Q_D(CartesianPlotLegend); if (pen != d->borderPen) exec(new CartesianPlotLegendSetBorderPenCmd(d, pen, ki18n("%1: set border style"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBorderCornerRadius, qreal, borderCornerRadius, update) void CartesianPlotLegend::setBorderCornerRadius(float radius) { Q_D(CartesianPlotLegend); if (radius != d->borderCornerRadius) exec(new CartesianPlotLegendSetBorderCornerRadiusCmd(d, radius, ki18n("%1: set border corner radius"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetBorderOpacity, qreal, borderOpacity, update) void CartesianPlotLegend::setBorderOpacity(float opacity) { Q_D(CartesianPlotLegend); if (opacity != d->borderOpacity) exec(new CartesianPlotLegendSetBorderOpacityCmd(d, opacity, ki18n("%1: set border opacity"))); } //Layout STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutTopMargin, float, layoutTopMargin, retransform) void CartesianPlotLegend::setLayoutTopMargin(float margin) { Q_D(CartesianPlotLegend); if (margin != d->layoutTopMargin) exec(new CartesianPlotLegendSetLayoutTopMarginCmd(d, margin, ki18n("%1: set layout top margin"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutBottomMargin, float, layoutBottomMargin, retransform) void CartesianPlotLegend::setLayoutBottomMargin(float margin) { Q_D(CartesianPlotLegend); if (margin != d->layoutBottomMargin) exec(new CartesianPlotLegendSetLayoutBottomMarginCmd(d, margin, ki18n("%1: set layout bottom margin"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutLeftMargin, float, layoutLeftMargin, retransform) void CartesianPlotLegend::setLayoutLeftMargin(float margin) { Q_D(CartesianPlotLegend); if (margin != d->layoutLeftMargin) exec(new CartesianPlotLegendSetLayoutLeftMarginCmd(d, margin, ki18n("%1: set layout left margin"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutRightMargin, float, layoutRightMargin, retransform) void CartesianPlotLegend::setLayoutRightMargin(float margin) { Q_D(CartesianPlotLegend); if (margin != d->layoutRightMargin) exec(new CartesianPlotLegendSetLayoutRightMarginCmd(d, margin, ki18n("%1: set layout right margin"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutVerticalSpacing, float, layoutVerticalSpacing, retransform) void CartesianPlotLegend::setLayoutVerticalSpacing(float spacing) { Q_D(CartesianPlotLegend); if (spacing != d->layoutVerticalSpacing) exec(new CartesianPlotLegendSetLayoutVerticalSpacingCmd(d, spacing, ki18n("%1: set layout vertical spacing"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutHorizontalSpacing, float, layoutHorizontalSpacing, retransform) void CartesianPlotLegend::setLayoutHorizontalSpacing(float spacing) { Q_D(CartesianPlotLegend); if (spacing != d->layoutHorizontalSpacing) exec(new CartesianPlotLegendSetLayoutHorizontalSpacingCmd(d, spacing, ki18n("%1: set layout horizontal spacing"))); } STD_SETTER_CMD_IMPL_F_S(CartesianPlotLegend, SetLayoutColumnCount, int, layoutColumnCount, retransform) void CartesianPlotLegend::setLayoutColumnCount(int count) { Q_D(CartesianPlotLegend); if (count != d->layoutColumnCount) exec(new CartesianPlotLegendSetLayoutColumnCountCmd(d, count, ki18n("%1: set layout column count"))); } //############################################################################## //################################# SLOTS #################################### //############################################################################## //############################################################################## //###### SLOTs for changes triggered via QActions in the context menu ######## //############################################################################## void CartesianPlotLegend::visibilityChangedSlot() { Q_D(const CartesianPlotLegend); this->setVisible(!d->isVisible()); } //############################################################################## //######################### Private implementation ############################# //############################################################################## CartesianPlotLegendPrivate::CartesianPlotLegendPrivate(CartesianPlotLegend *owner):q(owner), suppressItemChangeEvent(false), suppressRetransform(false), m_printing(false), m_hovered(false) { setAcceptHoverEvents(true); } QString CartesianPlotLegendPrivate::name() const { return q->name(); } QRectF CartesianPlotLegendPrivate::boundingRect() const { if (rotationAngle != 0) { QMatrix matrix; matrix.rotate(-rotationAngle); return matrix.mapRect(rect); } else return rect; } void CartesianPlotLegendPrivate::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) { q->createContextMenu()->exec(event->screenPos()); } /*! Returns the shape of the CartesianPlotLegend as a QPainterPath in local coordinates */ QPainterPath CartesianPlotLegendPrivate::shape() const { QPainterPath path; if ( qFuzzyIsNull(borderCornerRadius) ) path.addRect(rect); else path.addRoundedRect(rect, borderCornerRadius, borderCornerRadius); if (rotationAngle != 0) { QTransform trafo; trafo.rotate(-rotationAngle); path = trafo.map(path); } return path; } bool CartesianPlotLegendPrivate::swapVisible(bool on) { bool oldValue = isVisible(); setVisible(on); emit q->visibilityChanged(on); return oldValue; } /*! recalculates the rectangular of the legend. */ void CartesianPlotLegendPrivate::retransform() { if (suppressRetransform) return; prepareGeometryChange(); curvesList.clear(); //add xy-curves for (auto* curve : q->m_plot->children()) { if (curve && curve->isVisible()) curvesList.push_back(curve); } //add histograms for (auto* hist : q->m_plot->children()) { if (hist && hist->isVisible()) curvesList.push_back(hist); } int curveCount = curvesList.size(); columnCount = (curveCount= curveCount ) break; const WorksheetElement* curve = dynamic_cast(curvesList.at(index)); if (curve) { if (!curve->isVisible()) continue; w = fm.width(curve->name()); if (w>maxTextWidth) maxTextWidth = w; } } maxColumnTextWidths.append(maxTextWidth); legendWidth += maxTextWidth; } legendWidth += layoutLeftMargin + layoutRightMargin; //margins legendWidth += columnCount*lineSymbolWidth + layoutHorizontalSpacing; //width of the columns without the text legendWidth += (columnCount-1)*2*layoutHorizontalSpacing; //spacings between the columns if (title->isVisible() && !title->text().text.isEmpty()) { float titleWidth; if (rotationAngle == 0.0) titleWidth = title->graphicsItem()->boundingRect().width(); else { QRectF rect = title->graphicsItem()->boundingRect(); QMatrix matrix; matrix.rotate(-rotationAngle); rect = matrix.mapRect(rect); titleWidth = rect.width(); } if (titleWidth > legendWidth) legendWidth = titleWidth; } //determine the height of the legend float legendHeight = layoutTopMargin + layoutBottomMargin; //margins legendHeight += rowCount*h; //height of the rows legendHeight += (rowCount-1)*layoutVerticalSpacing; //spacing between the rows if (title->isVisible() && !title->text().text.isEmpty()) { if (rotationAngle == 0.0) legendHeight += title->graphicsItem()->boundingRect().height(); //legend title else { QRectF rect = title->graphicsItem()->boundingRect(); QMatrix matrix; matrix.rotate(-rotationAngle); rect = matrix.mapRect(rect); legendHeight += rect.height(); //legend title } } rect.setX(-legendWidth/2); rect.setY(-legendHeight/2); rect.setWidth(legendWidth); rect.setHeight(legendHeight); updatePosition(); } /*! calculates the position of the legend, when the position relative to the parent was specified (left, right, etc.) */ void CartesianPlotLegendPrivate::updatePosition() { //position the legend relative to the actual plot size minus small offset //TODO: make the offset dependent on the size of axis ticks. const QRectF parentRect = q->m_plot->dataRect(); float hOffset = Worksheet::convertToSceneUnits(10, Worksheet::Point); float vOffset = Worksheet::convertToSceneUnits(10, Worksheet::Point); if (position.horizontalPosition != CartesianPlotLegend::hPositionCustom) { if (position.horizontalPosition == CartesianPlotLegend::hPositionLeft) position.point.setX(parentRect.x() + rect.width()/2 + hOffset); else if (position.horizontalPosition == CartesianPlotLegend::hPositionCenter) position.point.setX(parentRect.x() + parentRect.width()/2); else if (position.horizontalPosition == CartesianPlotLegend::hPositionRight) position.point.setX(parentRect.x() + parentRect.width() - rect.width()/2 - hOffset); } if (position.verticalPosition != CartesianPlotLegend::vPositionCustom) { if (position.verticalPosition == CartesianPlotLegend::vPositionTop) position.point.setY(parentRect.y() + rect.height()/2 + vOffset); else if (position.verticalPosition == CartesianPlotLegend::vPositionCenter) position.point.setY(parentRect.y() + parentRect.height()/2); else if (position.verticalPosition == CartesianPlotLegend::vPositionBottom) position.point.setY(parentRect.y() + parentRect.height() - rect.height()/2 -vOffset); } suppressItemChangeEvent=true; setPos(position.point); suppressItemChangeEvent=false; emit q->positionChanged(position); suppressRetransform = true; title->retransform(); suppressRetransform = false; } /*! Reimplementation of QGraphicsItem::paint(). This function does the actual painting of the legend. \sa QGraphicsItem::paint(). */ void CartesianPlotLegendPrivate::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { Q_UNUSED(option); Q_UNUSED(widget); if (!isVisible()) return; painter->save(); painter->rotate(-rotationAngle); //draw the area painter->setOpacity(backgroundOpacity); painter->setPen(Qt::NoPen); if (backgroundType == PlotArea::Color) { switch (backgroundColorStyle) { case PlotArea::SingleColor:{ painter->setBrush(QBrush(backgroundFirstColor)); break; } case PlotArea::HorizontalLinearGradient:{ QLinearGradient linearGrad(rect.topLeft(), rect.topRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::VerticalLinearGradient:{ QLinearGradient linearGrad(rect.topLeft(), rect.bottomLeft()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::TopLeftDiagonalLinearGradient:{ QLinearGradient linearGrad(rect.topLeft(), rect.bottomRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::BottomLeftDiagonalLinearGradient:{ QLinearGradient linearGrad(rect.bottomLeft(), rect.topRight()); linearGrad.setColorAt(0, backgroundFirstColor); linearGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(linearGrad)); break; } case PlotArea::RadialGradient:{ QRadialGradient radialGrad(rect.center(), rect.width()/2); radialGrad.setColorAt(0, backgroundFirstColor); radialGrad.setColorAt(1, backgroundSecondColor); painter->setBrush(QBrush(radialGrad)); break; } } } else if (backgroundType == PlotArea::Image) { if ( !backgroundFileName.trimmed().isEmpty() ) { QPixmap pix(backgroundFileName); switch (backgroundImageStyle) { case PlotArea::ScaledCropped: pix = pix.scaled(rect.size().toSize(),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation); painter->drawPixmap(rect.topLeft(),pix); break; case PlotArea::Scaled: pix = pix.scaled(rect.size().toSize(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation); painter->drawPixmap(rect.topLeft(),pix); break; case PlotArea::ScaledAspectRatio: pix = pix.scaled(rect.size().toSize(),Qt::KeepAspectRatio,Qt::SmoothTransformation); painter->drawPixmap(rect.topLeft(),pix); break; case PlotArea::Centered: painter->drawPixmap(QPointF(rect.center().x()-pix.size().width()/2,rect.center().y()-pix.size().height()/2),pix); break; case PlotArea::Tiled: painter->drawTiledPixmap(rect,pix); break; case PlotArea::CenterTiled: painter->drawTiledPixmap(rect,pix,QPoint(rect.size().width()/2,rect.size().height()/2)); } } } else if (backgroundType == PlotArea::Pattern) { painter->setBrush(QBrush(backgroundFirstColor,backgroundBrushStyle)); } if ( qFuzzyIsNull(borderCornerRadius) ) painter->drawRect(rect); else painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); //draw the border if (borderPen.style() != Qt::NoPen) { painter->setPen(borderPen); painter->setBrush(Qt::NoBrush); painter->setOpacity(borderOpacity); if ( qFuzzyIsNull(borderCornerRadius) ) painter->drawRect(rect); else painter->drawRoundedRect(rect, borderCornerRadius, borderCornerRadius); } //draw curve's line+symbol and the names int curveCount = curvesList.size(); QFontMetrics fm(labelFont); float h=fm.ascent(); painter->setFont(labelFont); //translate to left upper conner of the bounding rect plus the layout offset and the height of the title painter->translate(-rect.width()/2+layoutLeftMargin, -rect.height()/2+layoutTopMargin); if (title->isVisible() && !title->text().text.isEmpty()) painter->translate(0, title->graphicsItem()->boundingRect().height()); painter->save(); int index; for (int c=0; c= curveCount ) break; //draw the legend item for histogram (simple rectangular with the sizes of the ascent) const Histogram* hist = dynamic_cast(curvesList.at(index)); if (hist) { //use line's pen (histogram bars, envelope or drop lines) if available, if (hist->lineType() != Histogram::NoLine && hist->linePen() != Qt::NoPen) { painter->setOpacity(hist->lineOpacity()); painter->setPen(hist->linePen()); } //for the brush, use the histogram filling or symbols filling or no brush if (hist->fillingEnabled()) painter->setBrush(QBrush(hist->fillingFirstColor(), hist->fillingBrushStyle())); else if (hist->symbolsStyle() != Symbol::NoSymbols) painter->setBrush(hist->symbolsBrush()); else painter->setBrush(Qt::NoBrush); painter->translate(QPointF(lineSymbolWidth/2, h/2)); painter->drawRect(QRectF(-h/2, -h/2, h, h)); painter->translate(-QPointF(lineSymbolWidth/2, h/2)); //curve's name painter->setPen(QPen(labelColor)); painter->setOpacity(1.0); //TODO: support HTML text? painter->drawText(QPoint(lineSymbolWidth + layoutHorizontalSpacing, h), hist->name()); painter->translate(0, layoutVerticalSpacing + h); continue; } //draw the legend item for histogram const XYCurve* curve = dynamic_cast(curvesList.at(index)); //curve's line (painted at the half of the ascent size) if (curve->lineType() != XYCurve::NoLine) { painter->setPen(curve->linePen()); painter->setOpacity(curve->lineOpacity()); painter->drawLine(0, h/2, lineSymbolWidth, h/2); } //error bars if ( (curve->xErrorType() != XYCurve::NoError && curve->xErrorPlusColumn()) || (curve->yErrorType() != XYCurve::NoError && curve->yErrorPlusColumn()) ) { painter->setOpacity(curve->errorBarsOpacity()); painter->setPen(curve->errorBarsPen()); //curve's error bars for x float errorBarsSize = Worksheet::convertToSceneUnits(10, Worksheet::Point); if (curve->symbolsStyle()!=Symbol::NoSymbols && errorBarsSizesymbolsSize()*1.4) errorBarsSize = curve->symbolsSize()*1.4; switch (curve->errorBarsType()) { case XYCurve::ErrorBarsSimple: //horiz. line if (curve->xErrorType() != XYCurve::NoError) painter->drawLine(lineSymbolWidth/2-errorBarsSize/2, h/2, lineSymbolWidth/2+errorBarsSize/2, h/2); //vert. line if (curve->yErrorType() != XYCurve::NoError) painter->drawLine(lineSymbolWidth/2, h/2-errorBarsSize/2, lineSymbolWidth/2, h/2+errorBarsSize/2); break; case XYCurve::ErrorBarsWithEnds: //horiz. line if (curve->xErrorType() != XYCurve::NoError) { painter->drawLine(lineSymbolWidth/2-errorBarsSize/2, h/2, lineSymbolWidth/2+errorBarsSize/2, h/2); //caps for the horiz. line painter->drawLine(lineSymbolWidth/2-errorBarsSize/2, h/2-errorBarsSize/4, lineSymbolWidth/2-errorBarsSize/2, h/2+errorBarsSize/4); painter->drawLine(lineSymbolWidth/2+errorBarsSize/2, h/2-errorBarsSize/4, lineSymbolWidth/2+errorBarsSize/2, h/2+errorBarsSize/4); } //vert. line if (curve->yErrorType() != XYCurve::NoError) { painter->drawLine(lineSymbolWidth/2, h/2-errorBarsSize/2, lineSymbolWidth/2, h/2+errorBarsSize/2); //caps for the vert. line painter->drawLine(lineSymbolWidth/2-errorBarsSize/4, h/2-errorBarsSize/2, lineSymbolWidth/2+errorBarsSize/4, h/2-errorBarsSize/2); painter->drawLine(lineSymbolWidth/2-errorBarsSize/4, h/2+errorBarsSize/2, lineSymbolWidth/2+errorBarsSize/4, h/2+errorBarsSize/2); } break; } } //curve's symbol if (curve->symbolsStyle()!=Symbol::NoSymbols) { painter->setOpacity(curve->symbolsOpacity()); painter->setBrush(curve->symbolsBrush()); painter->setPen(curve->symbolsPen()); QPainterPath path = Symbol::pathFromStyle(curve->symbolsStyle()); QTransform trafo; trafo.scale(curve->symbolsSize(), curve->symbolsSize()); path = trafo.map(path); if (curve->symbolsRotationAngle() != 0) { trafo.reset(); trafo.rotate(curve->symbolsRotationAngle()); path = trafo.map(path); } painter->translate(QPointF(lineSymbolWidth/2, h/2)); painter->drawPath(path); painter->translate(-QPointF(lineSymbolWidth/2, h/2)); } //curve's name painter->setPen(QPen(labelColor)); painter->setOpacity(1.0); //TODO: support HTML text? painter->drawText(QPoint(lineSymbolWidth+layoutHorizontalSpacing, h), curve->name()); painter->translate(0,layoutVerticalSpacing+h); } //translate to the beginning of the next column painter->restore(); int deltaX = lineSymbolWidth+layoutHorizontalSpacing+maxColumnTextWidths.at(c); //the width of the current columns deltaX += 2*layoutHorizontalSpacing; //spacing between two columns painter->translate(deltaX,0); painter->save(); } painter->restore(); painter->restore(); if (m_hovered && !isSelected() && !m_printing){ painter->setPen(QPen(QApplication::palette().color(QPalette::Shadow), 2, Qt::SolidLine)); painter->drawPath(shape()); } if (isSelected() && !m_printing){ painter->setPen(QPen(QApplication::palette().color(QPalette::Highlight), 2, Qt::SolidLine)); painter->drawPath(shape()); } } QVariant CartesianPlotLegendPrivate::itemChange(GraphicsItemChange change, const QVariant &value) { if (suppressItemChangeEvent) return value; if (change == QGraphicsItem::ItemPositionChange) { //convert item's center point in parent's coordinates CartesianPlotLegend::PositionWrapper tempPosition; tempPosition.point = value.toPointF(); tempPosition.horizontalPosition = CartesianPlotLegend::hPositionCustom; tempPosition.verticalPosition = CartesianPlotLegend::vPositionCustom; //emit the signals in order to notify the UI. //we don't set the position related member variables during the mouse movements. //this is done on mouse release events only. emit q->positionChanged(tempPosition); } return QGraphicsItem::itemChange(change, value); } void CartesianPlotLegendPrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { //convert position of the item in parent coordinates to label's position QPointF point = pos(); if (point!=position.point) { //position was changed -> set the position related member variables suppressRetransform = true; CartesianPlotLegend::PositionWrapper tempPosition; tempPosition.point = point; tempPosition.horizontalPosition = CartesianPlotLegend::hPositionCustom; tempPosition.verticalPosition = CartesianPlotLegend::vPositionCustom; q->setPosition(tempPosition); suppressRetransform = false; } QGraphicsItem::mouseReleaseEvent(event); } void CartesianPlotLegendPrivate::hoverEnterEvent(QGraphicsSceneHoverEvent*) { if (!isSelected()) { m_hovered = true; emit q->hovered(); update(); } } void CartesianPlotLegendPrivate::hoverLeaveEvent(QGraphicsSceneHoverEvent*) { if (m_hovered) { m_hovered = false; emit q->unhovered(); update(); } } //############################################################################## //################## Serialization/Deserialization ########################### //############################################################################## //! Save as XML void CartesianPlotLegend::save(QXmlStreamWriter* writer) const { Q_D(const CartesianPlotLegend); writer->writeStartElement( "cartesianPlotLegend" ); writeBasicAttributes( writer ); writeCommentElement( writer ); //general writer->writeStartElement( "general" ); WRITE_QCOLOR(d->labelColor); WRITE_QFONT(d->labelFont); writer->writeAttribute( "columnMajor", QString::number(d->labelColumnMajor) ); writer->writeAttribute( "lineSymbolWidth", QString::number(d->lineSymbolWidth) ); writer->writeAttribute( "visible", QString::number(d->isVisible()) ); writer->writeEndElement(); //geometry writer->writeStartElement( "geometry" ); writer->writeAttribute( "x", QString::number(d->position.point.x()) ); writer->writeAttribute( "y", QString::number(d->position.point.y()) ); writer->writeAttribute( "horizontalPosition", QString::number(d->position.horizontalPosition) ); writer->writeAttribute( "verticalPosition", QString::number(d->position.verticalPosition) ); writer->writeAttribute( "rotation", QString::number(d->rotationAngle) ); writer->writeEndElement(); //title d->title->save(writer); //background writer->writeStartElement( "background" ); writer->writeAttribute( "type", QString::number(d->backgroundType) ); writer->writeAttribute( "colorStyle", QString::number(d->backgroundColorStyle) ); writer->writeAttribute( "imageStyle", QString::number(d->backgroundImageStyle) ); writer->writeAttribute( "brushStyle", QString::number(d->backgroundBrushStyle) ); writer->writeAttribute( "firstColor_r", QString::number(d->backgroundFirstColor.red()) ); writer->writeAttribute( "firstColor_g", QString::number(d->backgroundFirstColor.green()) ); writer->writeAttribute( "firstColor_b", QString::number(d->backgroundFirstColor.blue()) ); writer->writeAttribute( "secondColor_r", QString::number(d->backgroundSecondColor.red()) ); writer->writeAttribute( "secondColor_g", QString::number(d->backgroundSecondColor.green()) ); writer->writeAttribute( "secondColor_b", QString::number(d->backgroundSecondColor.blue()) ); writer->writeAttribute( "fileName", d->backgroundFileName ); writer->writeAttribute( "opacity", QString::number(d->backgroundOpacity) ); writer->writeEndElement(); //border writer->writeStartElement( "border" ); WRITE_QPEN(d->borderPen); writer->writeAttribute( "borderOpacity", QString::number(d->borderOpacity) ); writer->writeEndElement(); //layout writer->writeStartElement( "layout" ); writer->writeAttribute( "topMargin", QString::number(d->layoutTopMargin) ); writer->writeAttribute( "bottomMargin", QString::number(d->layoutBottomMargin) ); writer->writeAttribute( "leftMargin", QString::number(d->layoutLeftMargin) ); writer->writeAttribute( "rightMargin", QString::number(d->layoutRightMargin) ); writer->writeAttribute( "verticalSpacing", QString::number(d->layoutVerticalSpacing) ); writer->writeAttribute( "horizontalSpacing", QString::number(d->layoutHorizontalSpacing) ); writer->writeAttribute( "columnCount", QString::number(d->layoutColumnCount) ); writer->writeEndElement(); writer->writeEndElement(); // close "cartesianPlotLegend" section } //! Load from XML bool CartesianPlotLegend::load(XmlStreamReader* reader, bool preview) { Q_D(CartesianPlotLegend); if (!readBasicAttributes(reader)) return false; KLocalizedString attributeWarning = ki18n("Attribute '%1' missing or empty, default value is used"); QXmlStreamAttributes attribs; QString str; while (!reader->atEnd()) { reader->readNext(); if (reader->isEndElement() && reader->name() == "cartesianPlotLegend") break; if (!reader->isStartElement()) continue; if (!preview && reader->name() == "comment") { if (!readCommentElement(reader)) return false; } else if (!preview && reader->name() == "general") { attribs = reader->attributes(); READ_QCOLOR(d->labelColor); READ_QFONT(d->labelFont); str = attribs.value("columnMajor").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("columnMajor").toString()); else d->labelColumnMajor = str.toInt(); str = attribs.value("lineSymbolWidth").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("lineSymbolWidth").toString()); else d->lineSymbolWidth = str.toDouble(); str = attribs.value("visible").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("visible").toString()); else d->setVisible(str.toInt()); } else if (!preview && reader->name() == "geometry") { attribs = reader->attributes(); str = attribs.value("x").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("x").toString()); else d->position.point.setX(str.toDouble()); str = attribs.value("y").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("y").toString()); else d->position.point.setY(str.toDouble()); str = attribs.value("horizontalPosition").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("horizontalPosition").toString()); else d->position.horizontalPosition = (CartesianPlotLegend::HorizontalPosition)str.toInt(); str = attribs.value("verticalPosition").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("verticalPosition").toString()); else d->position.verticalPosition = (CartesianPlotLegend::VerticalPosition)str.toInt(); READ_DOUBLE_VALUE("rotation", rotationAngle); } else if (reader->name() == "textLabel") { if (!d->title->load(reader, preview)) { delete d->title; d->title=nullptr; return false; } } else if (!preview && reader->name() == "background") { attribs = reader->attributes(); str = attribs.value("type").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("type").toString()); else d->backgroundType = PlotArea::BackgroundType(str.toInt()); str = attribs.value("colorStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("colorStyle").toString()); else d->backgroundColorStyle = PlotArea::BackgroundColorStyle(str.toInt()); str = attribs.value("imageStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("imageStyle").toString()); else d->backgroundImageStyle = PlotArea::BackgroundImageStyle(str.toInt()); str = attribs.value("brushStyle").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("brushStyle").toString()); else d->backgroundBrushStyle = Qt::BrushStyle(str.toInt()); str = attribs.value("firstColor_r").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_r").toString()); else d->backgroundFirstColor.setRed(str.toInt()); str = attribs.value("firstColor_g").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_g").toString()); else d->backgroundFirstColor.setGreen(str.toInt()); str = attribs.value("firstColor_b").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("firstColor_b").toString()); else d->backgroundFirstColor.setBlue(str.toInt()); str = attribs.value("secondColor_r").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_r").toString()); else d->backgroundSecondColor.setRed(str.toInt()); str = attribs.value("secondColor_g").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_g").toString()); else d->backgroundSecondColor.setGreen(str.toInt()); str = attribs.value("secondColor_b").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("secondColor_b").toString()); else d->backgroundSecondColor.setBlue(str.toInt()); str = attribs.value("fileName").toString(); d->backgroundFileName = str; str = attribs.value("opacity").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("opacity").toString()); else d->backgroundOpacity = str.toDouble(); } else if (!preview && reader->name() == "border") { attribs = reader->attributes(); READ_QPEN(d->borderPen); str = attribs.value("borderOpacity").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("borderOpacity").toString()); else d->borderOpacity = str.toDouble(); } else if (!preview && reader->name() == "layout") { attribs = reader->attributes(); str = attribs.value("topMargin").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("topMargin").toString()); else d->layoutTopMargin = str.toDouble(); str = attribs.value("bottomMargin").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("bottomMargin").toString()); else d->layoutBottomMargin = str.toDouble(); str = attribs.value("leftMargin").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("leftMargin").toString()); else d->layoutLeftMargin = str.toDouble(); str = attribs.value("rightMargin").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("rightMargin").toString()); else d->layoutRightMargin = str.toDouble(); str = attribs.value("verticalSpacing").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("verticalSpacing").toString()); else d->layoutVerticalSpacing = str.toDouble(); str = attribs.value("horizontalSpacing").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("horizontalSpacing").toString()); else d->layoutHorizontalSpacing = str.toDouble(); str = attribs.value("columnCount").toString(); if (str.isEmpty()) reader->raiseWarning(attributeWarning.subs("columnCount").toString()); else d->layoutColumnCount = str.toInt(); } } return true; } void CartesianPlotLegend::loadThemeConfig(const KConfig& config) { - KConfigGroup groupLabel = config.group("Label"); this->setLabelColor(groupLabel.readEntry("FontColor", QColor(Qt::white))); const KConfigGroup group = config.group("CartesianPlot"); this->setBackgroundBrushStyle((Qt::BrushStyle)group.readEntry("BackgroundBrushStyle",(int) this->backgroundBrushStyle())); this->setBackgroundColorStyle((PlotArea::BackgroundColorStyle)(group.readEntry("BackgroundColorStyle",(int) this->backgroundColorStyle()))); this->setBackgroundFirstColor(group.readEntry("BackgroundFirstColor",(QColor) this->backgroundFirstColor())); this->setBackgroundImageStyle((PlotArea::BackgroundImageStyle)group.readEntry("BackgroundImageStyle",(int) this->backgroundImageStyle())); this->setBackgroundOpacity(group.readEntry("BackgroundOpacity", this->backgroundOpacity())); this->setBackgroundSecondColor(group.readEntry("BackgroundSecondColor",(QColor) this->backgroundSecondColor())); this->setBackgroundType((PlotArea::BackgroundType)(group.readEntry("BackgroundType",(int) this->backgroundType()))); - this->borderPen().setColor(group.readEntry("BorderColor",(QColor) this->borderPen().color())); + QPen pen = this->borderPen(); + pen.setColor(group.readEntry("BorderColor", pen.color())); + pen.setStyle((Qt::PenStyle)(group.readEntry("BorderStyle", (int) pen.style()))); + pen.setWidthF(group.readEntry("BorderWidth", pen.widthF())); + this->setBorderPen(pen); this->setBorderCornerRadius(group.readEntry("BorderCornerRadius", this->borderCornerRadius())); this->setBorderOpacity(group.readEntry("BorderOpacity", this->borderOpacity())); - this->borderPen().setStyle((Qt::PenStyle)(group.readEntry("BorderStyle", (int) this->borderPen().style()))); - this->borderPen().setWidthF(group.readEntry("BorderWidth", this->borderPen().widthF())); title()->loadThemeConfig(config); }