LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::ColorThemeProxy Class Reference

Proxy for QML files to use colors from current color theme. More...

#include "colorthemeproxy.h"

+ Inheritance diagram for LC::Util::ColorThemeProxy:
+ Collaboration diagram for LC::Util::ColorThemeProxy:

Public Slots

QColor setAlpha (QColor color, qreal alpha)
 Returns the color with the alpha channel set to the given value. More...
 

Signals

void colorsChanged ()
 Emitted when the color theme changes. More...
 

Public Member Functions

 ColorThemeProxy (IColorThemeManager *manager, QObject *parent)
 Constructs the color theme proxy with the given color manager and parent object. More...
 
QColor GetTextViewTopColor () const
 
QColor GetTextViewBottomColor () const
 
QColor GetTextViewTitleTextColor () const
 
QColor GetTextViewTextColor () const
 
QColor GetTextViewAux1TextColor () const
 
QColor GetTextViewAux2TextColor () const
 
QColor GetTextViewAux3TextColor () const
 
QColor GetTextBoxTopColor () const
 
QColor GetTextBoxBottomColor () const
 
QColor GetTextBoxBorderColor () const
 
QColor GetTextBoxHighlightTopColor () const
 
QColor GetTextBoxHighlightBottomColor () const
 
QColor GetTextBoxHighlightBorderColor () const
 
QColor GetTextBoxTitleTextColor () const
 
QColor GetTextBoxTextColor () const
 
QColor GetTextBoxAux1TextColor () const
 
QColor GetTextBoxAux2TextColor () const
 
QColor GetTextBoxAux3TextColor () const
 
QColor GetToolButtonTopColor () const
 
QColor GetToolButtonBottomColor () const
 
QColor GetToolButtonBorderColor () const
 
QColor GetToolButtonSelectedTopColor () const
 
QColor GetToolButtonSelectedBottomColor () const
 
QColor GetToolButtonSelectedBorderColor () const
 
QColor GetToolButtonHoveredTopColor () const
 
QColor GetToolButtonHoveredBottomColor () const
 
QColor GetToolButtonHoveredBorderColor () const
 
QColor GetToolButtonPressedBorderColor () const
 
QColor GetToolButtonTextColor () const
 
QColor GetPanelTopColor () const
 
QColor GetPanelBottomColor () const
 
QColor GetPanelTextColor () const
 

Properties

QColor color_TextView_TopColor
 
QColor color_TextView_BottomColor
 
QColor color_TextView_TitleTextColor
 
QColor color_TextView_TextColor
 
QColor color_TextView_Aux1TextColor
 
QColor color_TextView_Aux2TextColor
 
QColor color_TextView_Aux3TextColor
 
QColor color_TextBox_TopColor
 
QColor color_TextBox_BottomColor
 
QColor color_TextBox_BorderColor
 
QColor color_TextBox_HighlightTopColor
 
QColor color_TextBox_HighlightBottomColor
 
QColor color_TextBox_HighlightBorderColor
 
QColor color_TextBox_TitleTextColor
 
QColor color_TextBox_TextColor
 
QColor color_TextBox_Aux1TextColor
 
QColor color_TextBox_Aux2TextColor
 
QColor color_TextBox_Aux3TextColor
 
QColor color_ToolButton_TopColor
 
QColor color_ToolButton_BottomColor
 
QColor color_ToolButton_BorderColor
 
QColor color_ToolButton_SelectedTopColor
 
QColor color_ToolButton_SelectedBottomColor
 
QColor color_ToolButton_SelectedBorderColor
 
QColor color_ToolButton_HoveredTopColor
 
QColor color_ToolButton_HoveredBottomColor
 
QColor color_ToolButton_HoveredBorderColor
 
QColor color_ToolButton_PressedBorderColor
 
QColor color_ToolButton_TextColor
 
QColor color_Panel_TopColor
 
QColor color_Panel_BottomColor
 
QColor color_Panel_TextColor
 

Detailed Description

Proxy for QML files to use colors from current color theme.

LeechCraft has a concept of color themes which allows to have a consistent look for different plugins and components, both based on good old QWidgets and for new QML ones. This class provides easy access for the current and up-to-date values of colors of the current current color theme via its properties. Property binding in QML allows one to automatically handle color theme changes and updated without recreating the components.

This class should be used as following:

  1. an object of this class is created, passed with an IColorThemeManager (which could be obtained from ICoreProxy);
  2. the object is added to the QML context of the view containing the component via QDeclarativeContext::setContextPropery();
  3. the corresponding properties of component are bound to the properties of this object.

The first two steps are as easy as following:

ICoreProxy_ptr proxy; // core proxy object passed to IInfo::Init()
View_->rootContext ()->setContextProperty ("colorProxy",
new Util::ColorThemeProxy (proxy->GetColorThemeManager (), parent));

Here the color theme proxy object is added by the "colorProxy" name.

Using the added object is pretty easy too:

Rectangle {
anchors.fill: parent
radius: 5
smooth: true
border.color: colorProxy.color_TextBox_BorderColor
border.width: 1
gradient: Gradient {
GradientStop {
position: 0
id: upperStop
color: colorProxy.color_TextBox_TopColor
}
GradientStop {
position: 1
id: lowerStop
color: colorProxy.color_TextBox_BottomColor
}
}
}

The colors can also be used in the states and dynamic elements, for example:

states: [
State {
name: "hovered"
PropertyChanges { target: tabRect; border.color: colorProxy.color_TextBox_HighlightBorderColor }
PropertyChanges { target: upperStop; color: colorProxy.color_TextBox_HighlightTopColor }
PropertyChanges { target: lowerStop; color: colorProxy.color_TextBox_HighlightBottomColor }
}
]
transitions: [
Transition {
from: ""
to: "hovered"
reversible: true
PropertyAnimation { properties: "border.color"; duration: 200 }
PropertyAnimation { properties: "color"; duration: 200 }
}
]

Good examples of color proxy usage are in LMP and SB2 plugins, for example.

This class uses IColorThemeManager internally. The section and key of IColorThemeManager::GetQMLColor() form the name of the properties in this class in the form of color_section_key.

See also
ICoreProxy
IInfo
IColorThemeManager

Definition at line 105 of file colorthemeproxy.h.

Constructor & Destructor Documentation

◆ ColorThemeProxy()

LC::Util::ColorThemeProxy::ColorThemeProxy ( IColorThemeManager manager,
QObject *  parent 
)

Constructs the color theme proxy with the given color manager and parent object.

Parameters
[in]managerThe color manager to use.
[in]parentThe parent object of the proxy.

Definition at line 21 of file colorthemeproxy.cpp.

Member Function Documentation

◆ colorsChanged

void LC::Util::ColorThemeProxy::colorsChanged ( )
signal

Emitted when the color theme changes.

This signal can be used to be notified of the properties changes.

◆ GetPanelBottomColor()

QColor LC::Util::ColorThemeProxy::GetPanelBottomColor ( ) const
inline

Definition at line 193 of file colorthemeproxy.h.

◆ GetPanelTextColor()

QColor LC::Util::ColorThemeProxy::GetPanelTextColor ( ) const
inline

Definition at line 194 of file colorthemeproxy.h.

◆ GetPanelTopColor()

QColor LC::Util::ColorThemeProxy::GetPanelTopColor ( ) const
inline

Definition at line 192 of file colorthemeproxy.h.

◆ GetTextBoxAux1TextColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxAux1TextColor ( ) const
inline

Definition at line 176 of file colorthemeproxy.h.

◆ GetTextBoxAux2TextColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxAux2TextColor ( ) const
inline

Definition at line 177 of file colorthemeproxy.h.

◆ GetTextBoxAux3TextColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxAux3TextColor ( ) const
inline

Definition at line 178 of file colorthemeproxy.h.

◆ GetTextBoxBorderColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxBorderColor ( ) const
inline

Definition at line 170 of file colorthemeproxy.h.

◆ GetTextBoxBottomColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxBottomColor ( ) const
inline

Definition at line 169 of file colorthemeproxy.h.

◆ GetTextBoxHighlightBorderColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxHighlightBorderColor ( ) const
inline

Definition at line 173 of file colorthemeproxy.h.

◆ GetTextBoxHighlightBottomColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxHighlightBottomColor ( ) const
inline

Definition at line 172 of file colorthemeproxy.h.

◆ GetTextBoxHighlightTopColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxHighlightTopColor ( ) const
inline

Definition at line 171 of file colorthemeproxy.h.

◆ GetTextBoxTextColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxTextColor ( ) const
inline

Definition at line 175 of file colorthemeproxy.h.

◆ GetTextBoxTitleTextColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxTitleTextColor ( ) const
inline

Definition at line 174 of file colorthemeproxy.h.

◆ GetTextBoxTopColor()

QColor LC::Util::ColorThemeProxy::GetTextBoxTopColor ( ) const
inline

Definition at line 168 of file colorthemeproxy.h.

◆ GetTextViewAux1TextColor()

QColor LC::Util::ColorThemeProxy::GetTextViewAux1TextColor ( ) const
inline

Definition at line 164 of file colorthemeproxy.h.

◆ GetTextViewAux2TextColor()

QColor LC::Util::ColorThemeProxy::GetTextViewAux2TextColor ( ) const
inline

Definition at line 165 of file colorthemeproxy.h.

◆ GetTextViewAux3TextColor()

QColor LC::Util::ColorThemeProxy::GetTextViewAux3TextColor ( ) const
inline

Definition at line 166 of file colorthemeproxy.h.

◆ GetTextViewBottomColor()

QColor LC::Util::ColorThemeProxy::GetTextViewBottomColor ( ) const
inline

Definition at line 161 of file colorthemeproxy.h.

◆ GetTextViewTextColor()

QColor LC::Util::ColorThemeProxy::GetTextViewTextColor ( ) const
inline

Definition at line 163 of file colorthemeproxy.h.

◆ GetTextViewTitleTextColor()

QColor LC::Util::ColorThemeProxy::GetTextViewTitleTextColor ( ) const
inline

Definition at line 162 of file colorthemeproxy.h.

◆ GetTextViewTopColor()

QColor LC::Util::ColorThemeProxy::GetTextViewTopColor ( ) const
inline

Definition at line 160 of file colorthemeproxy.h.

◆ GetToolButtonBorderColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonBorderColor ( ) const
inline

Definition at line 182 of file colorthemeproxy.h.

◆ GetToolButtonBottomColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonBottomColor ( ) const
inline

Definition at line 181 of file colorthemeproxy.h.

◆ GetToolButtonHoveredBorderColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonHoveredBorderColor ( ) const
inline

Definition at line 188 of file colorthemeproxy.h.

◆ GetToolButtonHoveredBottomColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonHoveredBottomColor ( ) const
inline

Definition at line 187 of file colorthemeproxy.h.

◆ GetToolButtonHoveredTopColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonHoveredTopColor ( ) const
inline

Definition at line 186 of file colorthemeproxy.h.

◆ GetToolButtonPressedBorderColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonPressedBorderColor ( ) const
inline

Definition at line 189 of file colorthemeproxy.h.

◆ GetToolButtonSelectedBorderColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonSelectedBorderColor ( ) const
inline

Definition at line 185 of file colorthemeproxy.h.

◆ GetToolButtonSelectedBottomColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonSelectedBottomColor ( ) const
inline

Definition at line 184 of file colorthemeproxy.h.

◆ GetToolButtonSelectedTopColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonSelectedTopColor ( ) const
inline

Definition at line 183 of file colorthemeproxy.h.

◆ GetToolButtonTextColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonTextColor ( ) const
inline

Definition at line 190 of file colorthemeproxy.h.

◆ GetToolButtonTopColor()

QColor LC::Util::ColorThemeProxy::GetToolButtonTopColor ( ) const
inline

Definition at line 180 of file colorthemeproxy.h.

◆ setAlpha

QColor LC::Util::ColorThemeProxy::setAlpha ( QColor  color,
qreal  alpha 
)
slot

Returns the color with the alpha channel set to the given value.

Parameters
[in]colorThe color whose alpha value should be changed.
[in]alphaThe new alpha value. 0 is fully transparent, 1 is fully opaque.

Definition at line 31 of file colorthemeproxy.cpp.

Property Documentation

◆ color_Panel_BottomColor

QColor LC::Util::ColorThemeProxy::color_Panel_BottomColor
read

Definition at line 193 of file colorthemeproxy.h.

◆ color_Panel_TextColor

QColor LC::Util::ColorThemeProxy::color_Panel_TextColor
read

Definition at line 194 of file colorthemeproxy.h.

◆ color_Panel_TopColor

QColor LC::Util::ColorThemeProxy::color_Panel_TopColor
read

Definition at line 192 of file colorthemeproxy.h.

◆ color_TextBox_Aux1TextColor

QColor LC::Util::ColorThemeProxy::color_TextBox_Aux1TextColor
read

Definition at line 176 of file colorthemeproxy.h.

◆ color_TextBox_Aux2TextColor

QColor LC::Util::ColorThemeProxy::color_TextBox_Aux2TextColor
read

Definition at line 177 of file colorthemeproxy.h.

◆ color_TextBox_Aux3TextColor

QColor LC::Util::ColorThemeProxy::color_TextBox_Aux3TextColor
read

Definition at line 178 of file colorthemeproxy.h.

◆ color_TextBox_BorderColor

QColor LC::Util::ColorThemeProxy::color_TextBox_BorderColor
read

Definition at line 170 of file colorthemeproxy.h.

◆ color_TextBox_BottomColor

QColor LC::Util::ColorThemeProxy::color_TextBox_BottomColor
read

Definition at line 169 of file colorthemeproxy.h.

◆ color_TextBox_HighlightBorderColor

QColor LC::Util::ColorThemeProxy::color_TextBox_HighlightBorderColor
read

Definition at line 173 of file colorthemeproxy.h.

◆ color_TextBox_HighlightBottomColor

QColor LC::Util::ColorThemeProxy::color_TextBox_HighlightBottomColor
read

Definition at line 172 of file colorthemeproxy.h.

◆ color_TextBox_HighlightTopColor

QColor LC::Util::ColorThemeProxy::color_TextBox_HighlightTopColor
read

Definition at line 171 of file colorthemeproxy.h.

◆ color_TextBox_TextColor

QColor LC::Util::ColorThemeProxy::color_TextBox_TextColor
read

Definition at line 175 of file colorthemeproxy.h.

◆ color_TextBox_TitleTextColor

QColor LC::Util::ColorThemeProxy::color_TextBox_TitleTextColor
read

Definition at line 174 of file colorthemeproxy.h.

◆ color_TextBox_TopColor

QColor LC::Util::ColorThemeProxy::color_TextBox_TopColor
read

Definition at line 168 of file colorthemeproxy.h.

◆ color_TextView_Aux1TextColor

QColor LC::Util::ColorThemeProxy::color_TextView_Aux1TextColor
read

Definition at line 164 of file colorthemeproxy.h.

◆ color_TextView_Aux2TextColor

QColor LC::Util::ColorThemeProxy::color_TextView_Aux2TextColor
read

Definition at line 165 of file colorthemeproxy.h.

◆ color_TextView_Aux3TextColor

QColor LC::Util::ColorThemeProxy::color_TextView_Aux3TextColor
read

Definition at line 166 of file colorthemeproxy.h.

◆ color_TextView_BottomColor

QColor LC::Util::ColorThemeProxy::color_TextView_BottomColor
read

Definition at line 161 of file colorthemeproxy.h.

◆ color_TextView_TextColor

QColor LC::Util::ColorThemeProxy::color_TextView_TextColor
read

Definition at line 163 of file colorthemeproxy.h.

◆ color_TextView_TitleTextColor

QColor LC::Util::ColorThemeProxy::color_TextView_TitleTextColor
read

Definition at line 162 of file colorthemeproxy.h.

◆ color_TextView_TopColor

QColor LC::Util::ColorThemeProxy::color_TextView_TopColor
read

Definition at line 160 of file colorthemeproxy.h.

◆ color_ToolButton_BorderColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_BorderColor
read

Definition at line 182 of file colorthemeproxy.h.

◆ color_ToolButton_BottomColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_BottomColor
read

Definition at line 181 of file colorthemeproxy.h.

◆ color_ToolButton_HoveredBorderColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_HoveredBorderColor
read

Definition at line 188 of file colorthemeproxy.h.

◆ color_ToolButton_HoveredBottomColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_HoveredBottomColor
read

Definition at line 187 of file colorthemeproxy.h.

◆ color_ToolButton_HoveredTopColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_HoveredTopColor
read

Definition at line 186 of file colorthemeproxy.h.

◆ color_ToolButton_PressedBorderColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_PressedBorderColor
read

Definition at line 189 of file colorthemeproxy.h.

◆ color_ToolButton_SelectedBorderColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_SelectedBorderColor
read

Definition at line 185 of file colorthemeproxy.h.

◆ color_ToolButton_SelectedBottomColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_SelectedBottomColor
read

Definition at line 184 of file colorthemeproxy.h.

◆ color_ToolButton_SelectedTopColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_SelectedTopColor
read

Definition at line 183 of file colorthemeproxy.h.

◆ color_ToolButton_TextColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_TextColor
read

Definition at line 190 of file colorthemeproxy.h.

◆ color_ToolButton_TopColor

QColor LC::Util::ColorThemeProxy::color_ToolButton_TopColor
read

Definition at line 180 of file colorthemeproxy.h.


The documentation for this class was generated from the following files:
ICoreProxy_ptr
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition: icoreproxy.h:181