[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Functions
src/klftools/klfguiutil.cpp File Reference
#include <cmath>
#include <QApplication>
#include <QDesktopWidget>
#include <QIcon>
#include <QPushButton>
#include <QDebug>
#include "klfutil.h"
#include "klfrelativefont.h"
#include "klfguiutil.h"
Include dependency graph for klfguiutil.cpp:

Go to the source code of this file.

Functions

KLF_EXPORT void klfDrawGlowedImage (QPainter *p, const QImage &foreground, const QColor &glowcol, int r, bool also_draw_image)
 Draws the given image with a glow effect.
QImage klfImageScaled (const QImage &source, const QSize &newSize)
 Scale image, preserve aspect ratio and meta-information.
KLF_EXPORT QRect klf_get_window_geometry (QWidget *w)
KLF_EXPORT void klf_set_window_geometry (QWidget *w, QRect g)
KLF_EXPORT void klfHideWindows ()
KLF_EXPORT void klfRestoreWindows ()

Function Documentation

KLF_EXPORT QRect klf_get_window_geometry ( QWidget *  w)

Definition at line 527 of file klfguiutil.cpp.

Referenced by KLFWindowGeometryRestorer::eventFilter().

KLF_EXPORT void klf_set_window_geometry ( QWidget *  w,
QRect  g 
)

Definition at line 537 of file klfguiutil.cpp.

References QRect::isValid().

Referenced by KLFWindowGeometryRestorer::eventFilter().

KLF_EXPORT void klfDrawGlowedImage ( QPainter painter,
const QImage foreground,
const QColor glow_color = QColor(128, 255, 128, 8),
int  radius = 4,
bool  also_draw_image = true 
)

Draws the given image with a glow effect.

Draws a glow effect for image foreground by extracting the alpha channel, and creating fills an image of color glow_color with the same alpha channel. The image is then drawn at all points (x,y) around (0,0) such that |(x,y)-(0,0)| < r, effectively overlapping the glow image with itself creating a blur effect.

The resulting graphics are painted using the painter painter, at the reference position (0,0). If you want your image drawn at another position, use QPainter::translate().

If also_draw_image is TRUE, then the image itself is also drawn on top of the glow effect.

Definition at line 461 of file klfguiutil.cpp.

References QImage::convertToFormat(), QPainter::device(), QPaintDevice::devicePixelRatioF(), QPainter::drawImage(), QImage::format(), QImage::height(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, QImage::pixel(), QColor::rgba(), QImage::size(), and QImage::width().

KLF_EXPORT void klfHideWindows ( )
Todo:
THIS IS A WORKAROUND to avoid "hiding" the system tray icon when hiding all windows (which is of course not what we want!). This also has the undesirable effect of not hiding all windows which have the x11-bypass-window-manager flag on. TODO: write some more intelligent code.

Definition at line 597 of file klfguiutil.cpp.

References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and klfDbg.

QImage klfImageScaled ( const QImage source,
const QSize newSize 
)

Scale image, preserve aspect ratio and meta-information.

Calls QImage::scaled(), with instruction to keep aspect ratio, to scale to new size, with a smooth (not fast) transformation.

Then copies the original image's meta-information to the returned image with QImage::setText().

Definition at line 512 of file klfguiutil.cpp.

References QImage::scaled(), QImage::setText(), QList::size(), QImage::text(), and QImage::textKeys().

KLF_EXPORT void klfRestoreWindows ( )

Definition at line 636 of file klfguiutil.cpp.

References QHash::contains(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and klfDbg.


Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net