libyui-qt
Loading...
Searching...
No Matches
QY2Styler Class Reference
Inheritance diagram for QY2Styler:
Collaboration diagram for QY2Styler:

Classes

struct  BackgrInfo

Public Member Functions

bool styleSheetExists (const QString &file)
bool loadStyleSheet (const QString &file)
void setStyleSheet (const QString &text)
bool loadDefaultStyleSheet ()
bool loadAlternateStyleSheet ()
QString themeDir () const
QStringList allStyleSheets ()
void registerWidget (QWidget *widget)
void unregisterWidget (QWidget *widget)
void registerChildWidget (QWidget *parent, QWidget *widget)
QString textStyle () const
QString currentStyleSheet () const
void setDefaultStyleSheet (const QString &styleSheet)
QString defaultStyleSheet () const
void setAlternateStyleSheet (const QString &styleSheet)
QString alternateStyleSheet () const
void toggleAlternateStyleSheet ()
bool usingAlternateStyleSheet ()
bool updateRendering (QWidget *widget)

Static Public Member Functions

static QY2Stylerstyler ()

Protected Member Functions

 QY2Styler (QObject *parent, const QString &defaultStyleSheet="", const QString &alternateStyleSheet="")
void renderParent (QWidget *widget)
QImage getScaled (const QString &name, const QSize &size)
void processUrls (QString &text)
QString buildStyleSheet (const QString &content)
QString buildStyleSheet (const QString &content, QStringList &alreadyImportedFilenames_ret)
QString buildStyleSheetFromFile (const QString &filename, QStringList &alreadyImportedFilenames_ret)
void setRichTextStyleSheet (YWidget *widget)
bool eventFilter (QObject *obj, QEvent *ev)

Protected Attributes

QString _currentStyleSheet
QString _defaultStyleSheet = DEFAULT_STYLE_SHEET
QString _alternateStyleSheet = HIGH_CONTRAST_STYLE_SHEET
bool _usingAlternateStyleSheet = false
QHash< QString, BackgrInfo_backgrounds
QMap< QWidget *, QList< QWidget * > > _children
QList< QWidget * > _registered_widgets
QString _style
QString _textStyle

Constructor & Destructor Documentation

◆ QY2Styler()

QY2Styler::QY2Styler ( QObject * parent,
const QString & defaultStyleSheet = "",
const QString & alternateStyleSheet = "" )
protected

Constructor. Use the static styler() function instead to return the singleton for this class.

Member Function Documentation

◆ allStyleSheets()

QStringList QY2Styler::allStyleSheets ( )

Return a sorted list of all style sheets in the theme directory.

◆ alternateStyleSheet()

QString QY2Styler::alternateStyleSheet ( ) const
inline

Return the name of the alternate theme.

◆ buildStyleSheet() [1/2]

QString QY2Styler::buildStyleSheet ( const QString & content)
protected

Build a stylesheet from a string.

◆ buildStyleSheet() [2/2]

QString QY2Styler::buildStyleSheet ( const QString & content,
QStringList & alreadyImportedFilenames_ret )
protected

Build a stylesheet from a string.

alreadyImportedFilenames_ret is a return parameter that will contain the names of files that have already been imported.

◆ buildStyleSheetFromFile()

QString QY2Styler::buildStyleSheetFromFile ( const QString & filename,
QStringList & alreadyImportedFilenames_ret )
protected

Build a stylesheet from a file.

alreadyImportedFilenames_ret is a return parameter that will contain the names of files that have already been imported.

◆ currentStyleSheet()

QString QY2Styler::currentStyleSheet ( ) const
inline

Return the name of the last loaded style sheet.

◆ defaultStyleSheet()

QString QY2Styler::defaultStyleSheet ( ) const
inline

Return the name of the default theme.

◆ loadAlternateStyleSheet()

bool QY2Styler::loadAlternateStyleSheet ( )

Loads the alternate stylesheet

The alternate stylesheet is determined by the environment variable Y2ALTSTYLE. If this variable is not set, the HIGH_COLOR_STYLE_SHEET style sheet will be used.

Returns
true if the stylesheet was loaded; false otherwise.

◆ loadDefaultStyleSheet()

bool QY2Styler::loadDefaultStyleSheet ( )

Loads the default stylesheet.

The default stylesheet is determined by the environment variable Y2STYLE. If this variable is not set, the DEFAULT_STYLE_SHEET style sheet will be used.

Returns
true if the stylesheet was loaded; false otherwise.

◆ loadStyleSheet()

bool QY2Styler::loadStyleSheet ( const QString & file)

Loads and apply a style sheet from a file.

Parameters
fileFilename. It should live in the themeDir() directory.
Returns
true if the file was found (and applied); false otherwise.

◆ processUrls()

void QY2Styler::processUrls ( QString & text)
protected

Search and replace some self-defined macros in the style sheet. Among other things, expands the file name inside url( filename.png ) in the style sheet with the full path.

◆ registerChildWidget()

void QY2Styler::registerChildWidget ( QWidget * parent,
QWidget * widget )

Registers a child widget.

Parameters
parentParent widget.
widgetWidget to register.

◆ registerWidget()

void QY2Styler::registerWidget ( QWidget * widget)

Registers a widget and applies the style sheet

Parameters
widgetWidget to register.

◆ setAlternateStyleSheet()

void QY2Styler::setAlternateStyleSheet ( const QString & styleSheet)

Set the name of the style sheet for the alternate theme. If the style sheet does not exists, it won't be changed.

Parameters
styleSheetStyle sheet file name

◆ setDefaultStyleSheet()

void QY2Styler::setDefaultStyleSheet ( const QString & styleSheet)

Set the name of the style sheet for the default theme. If the style sheet does not exist, it won't be changed.

Parameters
styleSheetStyle sheet file name

◆ setRichTextStyleSheet()

void QY2Styler::setRichTextStyleSheet ( YWidget * widget)
protected

Apply the RichText style to all RichText widgets recursively.

"widget" argument is the starting point, usually the top most dialog

◆ setStyleSheet()

void QY2Styler::setStyleSheet ( const QString & text)

Applies a style sheet from a string.

Parameters
textStyle sheet content.

◆ styler()

QY2Styler * QY2Styler::styler ( )
static

Return the singleton for this class. The first call to this creates the singleton.

◆ styleSheetExists()

bool QY2Styler::styleSheetExists ( const QString & file)

Determines if an style sheet exists.

Parameters
fileFilename. It should live in the themeDir() directory.
Returns
true if the file was found; false otherwise.

◆ themeDir()

QString QY2Styler::themeDir ( ) const

Returns the path to the style sheets directory.

◆ toggleAlternateStyleSheet()

void QY2Styler::toggleAlternateStyleSheet ( )

Toggle between default/alternate style sheets.

◆ unregisterWidget()

void QY2Styler::unregisterWidget ( QWidget * widget)

Unregisters a widget.

Parameters
widgetWidget to unregister.

◆ usingAlternateStyleSheet()

bool QY2Styler::usingAlternateStyleSheet ( )
inline

Determines if the alternate style is being used.


The documentation for this class was generated from the following files:
  • /builddir/build/BUILD/libyui-4.6.2-build/libyui-4.6.2/libyui-qt/src/QY2Styler.h
  • /builddir/build/BUILD/libyui-4.6.2-build/libyui-4.6.2/libyui-qt/src/QY2Styler.cc