[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfpixmapbutton.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfpixmapbutton.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klfpixmapbutton.h 996 2017-01-15 09:38:25Z phfaist $ */
23 
24 #ifndef KLFPIXMAPBUTTON_H
25 #define KLFPIXMAPBUTTON_H
26 
27 #include <QPushButton>
28 #include <QPixmap>
29 
30 #include <klfdefs.h>
31 
33 class KLF_EXPORT KLFPixmapButton : public QPushButton
34 {
35  Q_OBJECT
36 public:
37  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap USER true)
38  Q_PROPERTY(int pixmapMargin READ pixmapMargin WRITE setPixmapMargin)
39  Q_PROPERTY(float pixXAlignFactor READ pixXAlignFactor WRITE setPixXAlignFactor)
40  Q_PROPERTY(float pixYAlignFactor READ pixYAlignFactor WRITE setPixYAlignFactor)
41  Q_PROPERTY(float pixmapScale READ pixmapScale WRITE setPixmapScale)
42 
43  KLFPixmapButton(const QPixmap& pix, QWidget *parent = 0);
44  virtual ~KLFPixmapButton() { }
45 
46  virtual QSize minimumSizeHint() const;
47  virtual QSize sizeHint() const;
48 
49  virtual QPixmap pixmap() const { return _pix; }
50  virtual int pixmapMargin() const { return _pixmargin; }
51  virtual float pixXAlignFactor() const { return _xalignfactor; }
52  virtual float pixYAlignFactor() const { return _yalignfactor; }
53  virtual float pixmapScale() const { return _pixscale; }
54 
55 public slots:
56  virtual void setPixmap(const QPixmap& pix) { _pix = pix; }
57  virtual void setPixmapMargin(int pixels) { _pixmargin = pixels; }
58  virtual void setPixXAlignFactor(float xalignfactor) { _xalignfactor = xalignfactor; }
59  virtual void setPixYAlignFactor(float yalignfactor) { _yalignfactor = yalignfactor; }
60  virtual void setPixmapScale(float x) { _pixscale = x; }
61 
62 protected:
63  virtual void paintEvent(QPaintEvent *event);
64 
65 private:
66  QPixmap _pix;
67  int _pixmargin;
68  float _xalignfactor, _yalignfactor;
69  float _pixscale;
70 };
71 
72 
73 
74 
75 
76 
77 
78 #endif
virtual QPixmap pixmap() const
virtual void setPixmap(const QPixmap &pix)
virtual void setPixmapMargin(int pixels)
Base declarations for klatexformula and some utilities.
virtual int pixmapMargin() const
virtual void setPixmapScale(float x)
#define KLF_EXPORT
Definition: klfdefs.h:41
virtual void setPixXAlignFactor(float xalignfactor)
virtual float pixmapScale() const
virtual void setPixYAlignFactor(float yalignfactor)
virtual float pixYAlignFactor() const
virtual float pixXAlignFactor() const

Generated by doxygen 1.8.13