[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
src/klftools/klfpixmapbutton.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfpixmapbutton.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2011 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id$ */
00023 
00024 #ifndef KLFPIXMAPBUTTON_H
00025 #define KLFPIXMAPBUTTON_H
00026 
00027 #include <QPushButton>
00028 #include <QPixmap>
00029 
00030 #include <klfdefs.h>
00031 
00033 class KLF_EXPORT KLFPixmapButton : public QPushButton
00034 {
00035   Q_OBJECT
00036 public:
00037   Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap USER true)
00038   Q_PROPERTY(int pixmapMargin READ pixmapMargin WRITE setPixmapMargin)
00039   Q_PROPERTY(float pixXAlignFactor READ pixXAlignFactor WRITE setPixXAlignFactor)
00040   Q_PROPERTY(float pixYAlignFactor READ pixYAlignFactor WRITE setPixYAlignFactor)
00041   Q_PROPERTY(float pixmapScale READ pixmapScale WRITE setPixmapScale)
00042 
00043   KLFPixmapButton(const QPixmap& pix, QWidget *parent = 0);
00044   virtual ~KLFPixmapButton() { }
00045 
00046   virtual QSize minimumSizeHint() const;
00047   virtual QSize sizeHint() const;
00048 
00049   virtual QPixmap pixmap() const { return _pix; }
00050   virtual int pixmapMargin() const { return _pixmargin; }
00051   virtual float pixXAlignFactor() const { return _xalignfactor; }
00052   virtual float pixYAlignFactor() const { return _yalignfactor; }
00053   virtual float pixmapScale() const { return _pixscale; }
00054 
00055 public slots:
00056   virtual void setPixmap(const QPixmap& pix) { _pix = pix; }
00057   virtual void setPixmapMargin(int pixels) { _pixmargin = pixels; }
00058   virtual void setPixXAlignFactor(float xalignfactor) { _xalignfactor = xalignfactor; }
00059   virtual void setPixYAlignFactor(float yalignfactor) { _yalignfactor = yalignfactor; }
00060   virtual void setPixmapScale(float x) { _pixscale = x; }
00061 
00062 protected:
00063   virtual void paintEvent(QPaintEvent *event);
00064 
00065 private:
00066   QPixmap _pix;
00067   int _pixmargin;
00068   float _xalignfactor, _yalignfactor;
00069   float _pixscale;
00070 };
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 #endif

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