[KLF Application][KLF Tools][KLF Backend][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 603 2011-02-26 23:14:55Z 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 
42  KLFPixmapButton(const QPixmap& pix, QWidget *parent = 0);
43  virtual ~KLFPixmapButton() { }
44 
45  virtual QSize minimumSizeHint() const;
46  virtual QSize sizeHint() const;
47 
48  virtual QPixmap pixmap() const { return _pix; }
49  virtual int pixmapMargin() const { return _pixmargin; }
50  virtual float pixXAlignFactor() const { return _xalignfactor; }
51  virtual float pixYAlignFactor() const { return _yalignfactor; }
52 
53 public slots:
54  virtual void setPixmap(const QPixmap& pix) { _pix = pix; }
55  virtual void setPixmapMargin(int pixels) { _pixmargin = pixels; }
56  virtual void setPixXAlignFactor(float xalignfactor) { _xalignfactor = xalignfactor; }
57  virtual void setPixYAlignFactor(float yalignfactor) { _yalignfactor = yalignfactor; }
58 
59 protected:
60  virtual void paintEvent(QPaintEvent *event);
61 
62 private:
63  QPixmap _pix;
64  int _pixmargin;
65  float _xalignfactor, _yalignfactor;
66 };
67 
68 
69 
70 
71 
72 
73 
74 #endif
virtual int pixmapMargin() const
virtual void setPixmap(const QPixmap &pix)
virtual void setPixmapMargin(int pixels)
virtual void setPixYAlignFactor(float yalignfactor)
virtual QPixmap pixmap() const
virtual float pixXAlignFactor() const
virtual void setPixXAlignFactor(float xalignfactor)
virtual float pixYAlignFactor() const

Generated by doxygen 1.8.6