/usr/include/klftools/klfdisplaylabel.h is in libklatexformula3-dev 3.3.0~beta-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /***************************************************************************
* file klfdisplaylabel.h
* This file is part of the KLatexFormula Project.
* Copyright (C) 2011 by Philippe Faist
* philippe.faist at bluewin.ch
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/* $Id: klfdisplaylabel.h 683 2011-07-31 13:47:08Z phfaist $ */
#ifndef KLFDISPLAYLABEL_H
#define KLFDISPLAYLABEL_H
#include <QLabel>
#include <QPixmap>
#include <QTemporaryFile>
#include <klfdefs.h>
/** \brief A label to display a LaTeX-formula-output-like image
*
* This widget displays an image, and sets another image as tooltip. It can also set itself
* in "display error" mode, changing its look and displaying the error message as tooltip.
*
* It emits \ref labelDrag() whenever the user drags the display's contents, but only if
* the display's property \c labelEnabled is TRUE (see setLabelEnabled()).
*
* As a gadget, it can add an alien glow to the images it displays.
*
* \note As of version 3.3.0, the \c labelFixedSize property dissapeared, it is no longer
* used. Use QWidget::setFixedSize() directly instead.
*/
class KLF_EXPORT KLFDisplayLabel : public QLabel
{
Q_OBJECT
Q_PROPERTY(bool enableToolTipPreview READ enableToolTipPreview WRITE setEnableToolTipPreview) ;
Q_PROPERTY(QString bigPreviewText READ bigPreviewText) ;
Q_PROPERTY(bool glowEffect READ glowEffect WRITE setGlowEffect) ;
Q_PROPERTY(QColor glowEffectColor READ glowEffectColor WRITE setGlowEffectColor) ;
Q_PROPERTY(int glowEffectRadius READ glowEffectRadius WRITE setGlowEffectRadius) ;
Q_PROPERTY(bool labelEnabled READ labelEnabled WRITE setLabelEnabled) ;
public:
KLFDisplayLabel(QWidget *parent);
virtual ~KLFDisplayLabel();
enum DisplayState { Clear = 0, Ok, Error };
virtual DisplayState currentDisplayState() const { return pDisplayState; }
/** \brief maximum pixmap size we can display
*
* For now, it just returns size().
*
* \todo subtract margins/frame border width/etc.
* */
virtual QSize labelSize() const { return size(); }
virtual bool enableToolTipPreview() const { return pEnableToolTipPreview; }
virtual QString bigPreviewText() const { return _bigPreviewText; }
inline bool glowEffect() const { return pGE; }
inline QColor glowEffectColor() const { return pGEcolor; }
inline int glowEffectRadius() const { return pGEradius; }
inline bool labelEnabled() const { return pLabelEnabled; }
signals:
void labelDrag();
public slots:
virtual void setEnableToolTipPreview(bool enable) { pEnableToolTipPreview = enable; display_state(pDisplayState); }
virtual void displayClear();
virtual void display(QImage displayimg, QImage tooltipimage, bool labelenabled = true);
virtual void displayError(bool labelenabled = false)
{ displayError(QString(), labelenabled); }
virtual void displayError(const QString& errorMessage, bool labelenabled = false);
void setGlowEffect(bool on) { pGE = on; display_state(pDisplayState); }
void setGlowEffectColor(const QColor& color) { pGEcolor = color; display_state(pDisplayState); }
void setGlowEffectRadius(int r) { pGEradius = r; display_state(pDisplayState); }
void setLabelEnabled(bool enabled) { pLabelEnabled = enabled; display_state(pDisplayState); }
protected:
virtual void mouseMoveEvent(QMouseEvent *e);
private:
QPixmap calc_display_pixmap();
void display_state(DisplayState state);
DisplayState pDisplayState;
QString pDisplayError;
QImage pDisplayImage;
QImage pDisplayTooltip;
QSize pLabelFixedSize;
bool pEnableToolTipPreview;
QTemporaryFile *mToolTipFile;
QPalette pDefaultPalette;
QPalette pErrorPalette;
QString _bigPreviewText;
bool pGE;
QColor pGEcolor;
int pGEradius;
void set_error(bool error_on);
bool pLabelEnabled;
};
#endif
|