LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
The GUI utilities

General GUI widgets and classes. More...

Classes

class  LeechCraft::Util::AutoResizeMixin
 Automatically moves a widget to fit a rectangle on resize. More...
 
class  LeechCraft::Util::ClearLineEditAddon
 Provides a "clear text" action for line edits. More...
 
class  LeechCraft::Util::ColorButton
 A button for choosing a color. More...
 
class  LeechCraft::Util::FindNotification
 A horizontal bar with typical widgets for text search. More...
 
class  LeechCraft::Util::FindNotificationWk
 A helper class to aid connecting FindNotification with Qt WebKit. More...
 
class  LeechCraft::Util::FlowLayout
 A simple flow layout implementation. More...
 
class  LeechCraft::Util::LineEditButtonManager
 Manages additional overlay buttons in a QLineEdit. More...
 
class  LeechCraft::Util::PageNotification
 A horizontal widget embedding into the parent layout of the passed parent widget. More...
 
class  LeechCraft::Util::SelectableBrowser
 A "browser" that shows HTML either via QTextBrowser or a browser plugin. More...
 
class  LeechCraft::Util::UnhoverDeleteMixin
 Allows to hide a widget or popup after mouse leave. More...
 

Enumerations

enum  LeechCraft::Util::FitFlag {
  LeechCraft::Util::NoFlags,
  LeechCraft::Util::NoOverlap = 0x01
}
 

Functions

QPoint LeechCraft::Util::FitRectScreen (QPoint pos, const QSize &size, FitFlags flags=NoFlags, const QPoint &shiftAdd=QPoint(0, 0))
 Tries to fit a rectangle (like a dialog or popup) into screen. More...
 
QPoint LeechCraft::Util::FitRect (QPoint pos, const QSize &size, const QRect &geometry, FitFlags flags=NoFlags, const QPoint &shiftAdd=QPoint(0, 0))
 Tries to fit a rectangle (like a dialog or popup) into geometry. More...
 
QLabel * LeechCraft::Util::ShowPixmapLabel (const QPixmap &pixmap, const QPoint &pos=QPoint())
 Shows a pixmap at the given pos. More...
 
QColor LeechCraft::Util::TintColors (const QColor &c1, const QColor &c2, double alpha=0.5)
 Mixes two colors with the given weights. More...
 
void LeechCraft::Util::TintPalette (QWidget *widget, const QColor &color, double alpha=0.5, const QList< QPalette::ColorRole > &roles={ QPalette::ColorRole::Text, QPalette::ColorRole::WindowText })
 Mixes some of the widget's palette roles with the given color. More...
 

Detailed Description

General GUI widgets and classes.

Enumeration Type Documentation

◆ FitFlag

Additional fitting options used by FitRect() and FitRectScreen().

Enumerator
NoFlags 

Default fitting options.

NoOverlap 

The fitted rectangle should never overlap with the original top left position.

This option may be useful if a menu or tooltip is fitted, since it's generally undesirable to cover the corresponding UI element with the menu or tooltip.

Definition at line 53 of file util.h.

Function Documentation

◆ FitRect()

UTIL_GUI_API QPoint LeechCraft::Util::FitRect ( QPoint  pos,
const QSize &  size,
const QRect &  geometry,
FitFlags  flags = NoFlags,
const QPoint &  shiftAdd = QPoint(0, 0) 
)

Tries to fit a rectangle (like a dialog or popup) into geometry.

This function tries to move the rectangle with top left point at pos and with given size so that it fits completely into the rectangle given by the geometry parameter. It leaves the size intact, instead returning the new top left position.

If the rectangle is actually moved by this function, the shiftAdd parameter is used to customize how it is moved: the shiftAdd.x() component is added to the result iff pos.x() is changed, and shiftAdd.y() is added to the result iff pos.y() is changed.

Parameters
[in]posThe original top left position of the rect to fit.
[in]sizeThe size of the rectangle to fit.
[in]geometryThe rectangle into which the source rectangle should be fitted.
[in]flagsAdditional fitting parameters.
[in]shiftAddAdditional components to be added if the rectangle is actually moved in the corresponding directions.
Returns
The new top left position of the rectangle.
See also
FitRectScreen()

Definition at line 50 of file util.cpp.

References LeechCraft::Util::NoOverlap.

Referenced by LeechCraft::Util::FitRectScreen().

+ Here is the caller graph for this function:

◆ FitRectScreen()

UTIL_GUI_API QPoint LeechCraft::Util::FitRectScreen ( QPoint  pos,
const QSize &  size,
FitFlags  flags = NoFlags,
const QPoint &  shiftAdd = QPoint(0, 0) 
)

Tries to fit a rectangle (like a dialog or popup) into screen.

This function tries to move the rectangle with top left point at pos and with given size so that it fits completely into the available geometry of the screen that contains the point pos. It leaves the rectangle size intact, instead returning the new top left position.

Calling this function is equivalent to calling FitRect() with the geometry parameter set to QDesktopWidget::availableGeometry(pos). See the documentation for FitRect() for more details.

Parameters
[in]posThe original top left position of the rect to fit.
[in]sizeThe size of the rectangle to fit.
[in]flagsAdditional fitting parameters.
[in]shiftAddAdditional components to be added if the rectangle is actually moved in the corresponding directions.
Returns
The new top left position of the rectangle.
See also
FitRect()

Definition at line 45 of file util.cpp.

References LeechCraft::Util::FitRect().

+ Here is the call graph for this function:

◆ ShowPixmapLabel()

UTIL_GUI_API QLabel * LeechCraft::Util::ShowPixmapLabel ( const QPixmap &  pixmap,
const QPoint &  pos = QPoint() 
)

Shows a pixmap at the given pos.

This function shows a dialog with the given pixmap at the given position. If the pixmap is too big, it is scaled down. A QLabel created with window decorations is used as the dialog. The created label is returned from the function, so one could also set the window title and further customize the label.

This function is useful to display full version of album art in a media player or a user avatar in an IM application.

Parameters
[in]pixmapThe pixmap to show.
[in]posThe position where the dialog should be shown.
Returns
The created dialog.

Definition at line 120 of file util.cpp.

◆ TintColors()

UTIL_GUI_API QColor LeechCraft::Util::TintColors ( const QColor &  c1,
const QColor &  c2,
double  alpha = 0.5 
)

Mixes two colors with the given weights.

Mixes two colors c1 and c2 with weights alpha and (1 - alpha) respectively.

Parameters
[in]c1The first color to mix.
[in]c2The second color to mix.
[in]alphaThe weight of the first color (and 1 - weight for the second color).
Returns
The mixed color.
See also
TintPalette()

Definition at line 141 of file util.cpp.

Referenced by LeechCraft::Util::TintPalette().

+ Here is the caller graph for this function:

◆ TintPalette()

UTIL_GUI_API void LeechCraft::Util::TintPalette ( QWidget *  widget,
const QColor &  color,
double  alpha = 0.5,
const QList< QPalette::ColorRole > &  roles = { QPalette::ColorRole::Text, QPalette::ColorRole::WindowText } 
)

Mixes some of the widget's palette roles with the given color.

This function queries the palette of the widget and mixes the colors for the given roles in it with the given color and the given alpha weight. After that it sets the resulting palette back for the widget.

Parameters
[in]widgetThe widget whose palette should be changed.
[in]colorThe color to tint the palette's colors with.
[in]alphaThe weight of the palette's colors in the resulting mix.
[in]rolesThe roles of the palette that should be mixed with the given color.
See also
TintColors()

Definition at line 155 of file util.cpp.

References LeechCraft::Util::TintColors().

+ Here is the call graph for this function: