LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
The GUI utilities

General GUI widgets and classes. More...

Classes

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

Enumerations

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

Functions

QPoint LC::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 LC::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 * LC::Util::ShowPixmapLabel (const QPixmap &pixmap, const QPoint &pos=QPoint())
 Shows a pixmap at the given pos. More...
 
QColor LC::Util::TintColors (const QColor &c1, const QColor &c2, double alpha=0.5)
 Mixes two colors with the given weights. More...
 
void LC::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 24 of file geometry.h.

Function Documentation

◆ FitRect()

UTIL_GUI_API QPoint LC::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 29 of file geometry.cpp.

◆ FitRectScreen()

UTIL_GUI_API QPoint LC::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 24 of file geometry.cpp.

References LC::Util::oral::sph::max, and LC::Util::oral::sph::min.

◆ ShowPixmapLabel()

UTIL_GUI_API QLabel * LC::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 67 of file util.cpp.

◆ TintColors()

UTIL_GUI_API QColor LC::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 89 of file util.cpp.

Referenced by LC::Util::ElideProgressBarText().

+ Here is the caller graph for this function:

◆ TintPalette()

UTIL_GUI_API void LC::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 103 of file util.cpp.