itom 2.2.1
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2016, Institut fuer Technische Optik (ITO), 00005 Universitaet Stuttgart, Germany 00006 00007 This file is part of itom and its software development toolkit (SDK). 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 In addition, as a special exception, the Institut fuer Technische 00015 Optik (ITO) gives you certain additional rights. 00016 These rights are described in the ITO LGPL Exception version 1.0, 00017 which can be found in the file LGPL_EXCEPTION.txt in this package. 00018 00019 itom is distributed in the hope that it will be useful, but 00020 WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00022 General Public Licence for more details. 00023 00024 You should have received a copy of the GNU Library General Public License 00025 along with itom. If not, see <http://www.gnu.org/licenses/>. 00026 00027 *********************************************************************** */ 00028 00029 #ifndef STATUSLED_H 00030 #define STATUSLED_H 00031 00032 #include <QWidget> 00033 00034 #include "commonWidgets.h" 00035 00036 class StatusLedPrivate; // forward declare 00037 00044 class ITOMWIDGETS_EXPORT StatusLed : public QWidget 00045 { 00046 Q_OBJECT 00047 00048 Q_PROPERTY(QColor colorOnEdge READ colorOnEdge WRITE setColorOnEdge); 00049 Q_PROPERTY(QColor colorOnCenter READ colorOnCenter WRITE setColorOnCenter); 00050 Q_PROPERTY(QColor colorOffEdge READ colorOffEdge WRITE setColorOffEdge); 00051 Q_PROPERTY(QColor colorOffCenter READ colorOffCenter WRITE setColorOffCenter); 00052 Q_PROPERTY(bool checked READ checked WRITE setChecked); 00053 00054 public: 00055 00056 explicit StatusLed(QWidget *parent = 0); 00057 virtual ~StatusLed(); 00058 00059 virtual QSize sizeHint() const 00060 { 00061 return QSize(24,24); 00062 } 00063 00064 virtual QSize minimumSizeHint() const 00065 { 00066 return QSize(12,12); 00067 } 00068 00069 virtual int heightForWidth(int w) const 00070 { 00071 return w; 00072 } 00073 00074 bool checked() const; 00075 QColor colorOnEdge() const; 00076 QColor colorOnCenter() const; 00077 QColor colorOffEdge() const; 00078 QColor colorOffCenter() const; 00079 00080 public Q_SLOTS: 00081 void setColorOnEdge(const QColor &color); 00082 void setColorOnCenter(const QColor &color); 00083 void setColorOffEdge(const QColor &color); 00084 void setColorOffCenter(const QColor &color); 00085 void setChecked(bool checked); 00086 00087 protected: 00088 virtual void paintEvent(QPaintEvent *event); 00089 00090 QScopedPointer<StatusLedPrivate> d_ptr; // QScopedPointer to forward declared class 00091 00092 private: 00093 Q_DECLARE_PRIVATE(StatusLed); 00094 Q_DISABLE_COPY(StatusLed); 00095 }; 00096 00097 #endif // STATUSLED_H