void LegendItem::restore(const QJsonObject& plotSettings) { setVisible(plotSettings.value("legendVisibility").toBool()); setAlignment( Qt::AlignmentFlag(plotSettings.value("legendHorPos").toVariant().toInt()) | Qt::AlignmentFlag(plotSettings.value("legendVerPos").toVariant().toInt()) ); setBackgroundOpacity(plotSettings.value("legendBackgroundOpacity").toVariant().toInt()); setFont(plotSettings.value("legendFont").toVariant().value<QFont>()); setMaxColumns(plotSettings.value("legendColumns").toVariant().value<uint>()); }
//__________________________________________________ void Configuration::readBackgroundOpacity( KConfigGroup group ) { // do nothing if separate opacity is used between style and deco if( !opacityFromStyle() ) return; // background opacity Configuration defaultConfiguration; setBackgroundOpacity( group.readEntry( OxygenConfig::BACKGROUND_OPACITY, defaultConfiguration.backgroundOpacity() ) ); }
LegendItem::LegendItem(QwtPlot* owner) { setRenderHint(QwtPlotItem::RenderAntialiased); setTextPen(QPen(Qt::black)); setBackgroundOpacity(200); setBackgroundMode(ItemBackground); setBorderRadius(4); setAlignment(Qt::AlignTop | Qt::AlignHCenter); setMargin(0); setSpacing(4); setItemMargin(2); attach(owner); }
//__________________________________________________ Configuration::Configuration( KConfigGroup group ) { // used to set default values when entries are not found in kconfig Configuration defaultConfiguration; // title alignment setTitleAlignment( titleAlignment( group.readEntry( OxygenConfig::TITLE_ALIGNMENT, defaultConfiguration.titleAlignmentName( false ) ), false ) ); // center title on full width setCenterTitleOnFullWidth( group.readEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH, defaultConfiguration.centerTitleOnFullWidth() ) ); // button size setButtonSize( buttonSize( group.readEntry( OxygenConfig::BUTTON_SIZE, defaultConfiguration.buttonSizeName( false ) ), false ) ); // frame border setFrameBorder( frameBorder( group.readEntry( OxygenConfig::FRAME_BORDER, defaultConfiguration.frameBorderName( false ) ), false ) ); // blend color setBlendColor( blendColor( group.readEntry( OxygenConfig::BLEND_COLOR, defaultConfiguration.blendColorName( false ) ), false ) ); // size grip setSizeGripMode( sizeGripMode( group.readEntry( OxygenConfig::SIZE_GRIP_MODE, defaultConfiguration.sizeGripModeName( false ) ), false ) ); // separator mode if( !group.readEntry( OxygenConfig::DRAW_SEPARATOR, defaultConfiguration.separatorMode() != SeparatorNever ) ) { setSeparatorMode( SeparatorNever ); } else if( group.readEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, defaultConfiguration.separatorMode() == SeparatorActive ) ) { setSeparatorMode( SeparatorActive ); } else setSeparatorMode( SeparatorAlways ); // title outline setDrawTitleOutline( group.readEntry( OxygenConfig::DRAW_TITLE_OUTLINE, defaultConfiguration.drawTitleOutline() ) ); // hide title bar setHideTitleBar( group.readEntry( OxygenConfig::HIDE_TITLEBAR, defaultConfiguration.hideTitleBar() ) ); // drop shadows setUseDropShadows( group.readEntry( OxygenConfig::USE_DROP_SHADOWS, defaultConfiguration.useDropShadows() ) ); // oxygen shadows setUseOxygenShadows( group.readEntry( OxygenConfig::USE_OXYGEN_SHADOWS, defaultConfiguration.useOxygenShadows() ) ); // transparency setTransparencyEnabled( group.readEntry( OxygenConfig::TRANSPARENCY_ENABLED, defaultConfiguration.transparencyEnabled() ) ); // close from menu button setCloseFromMenuButton( group.readEntry( OxygenConfig::CLOSE_FROM_MENU_BUTTON, defaultConfiguration.closeFromMenuButton() ) ); // buttonSpacing setUseNarrowButtonSpacing( group.readEntry( OxygenConfig::NARROW_BUTTON_SPACING, defaultConfiguration.useNarrowButtonSpacing() ) ); // background opacity /* this is the decoration specific value it is overwritten by the style ("common") opacity, if opacityFromStyle is set to true */ setBackgroundOpacity( group.readEntry( OxygenConfig::BACKGROUND_OPACITY, defaultConfiguration.backgroundOpacity() ) ); setOpacityFromStyle( group.readEntry( OxygenConfig::OPACITY_FROM_STYLE, defaultConfiguration.opacityFromStyle() ) ); // extended window border setUseExtendedWindowBorder( group.readEntry( OxygenConfig::EXTENDED_WINDOW_BORDERS, defaultConfiguration.useExtendedWindowBorder() ) ); // animations setAnimationsEnabled( group.readEntry( OxygenConfig::ANIMATIONS_ENABLED, defaultConfiguration.animationsEnabled() ) ); setButtonAnimationsEnabled( group.readEntry( OxygenConfig::BUTTON_ANIMATIONS_ENABLED, defaultConfiguration.buttonAnimationsEnabled() ) ); setTitleAnimationsEnabled( group.readEntry( OxygenConfig::TITLE_ANIMATIONS_ENABLED, defaultConfiguration.titleAnimationsEnabled() ) ); setShadowAnimationsEnabled( group.readEntry( OxygenConfig::SHADOW_ANIMATIONS_ENABLED, defaultConfiguration.shadowAnimationsEnabled() ) ); setTabAnimationsEnabled( group.readEntry( OxygenConfig::TAB_ANIMATIONS_ENABLED, defaultConfiguration.tabAnimationsEnabled() ) ); // animations duration setButtonAnimationsDuration( group.readEntry( OxygenConfig::BUTTON_ANIMATIONS_DURATION, defaultConfiguration.buttonAnimationsDuration() ) ); setTitleAnimationsDuration( group.readEntry( OxygenConfig::TITLE_ANIMATIONS_DURATION, defaultConfiguration.titleAnimationsDuration() ) ); setShadowAnimationsDuration( group.readEntry( OxygenConfig::SHADOW_ANIMATIONS_DURATION, defaultConfiguration.shadowAnimationsDuration() ) ); setTabAnimationsDuration( group.readEntry( OxygenConfig::TAB_ANIMATIONS_DURATION, defaultConfiguration.tabAnimationsDuration() ) ); }