File indexing completed on 2024-05-05 05:46:09

0001 /***************************************************************************
0002  *   Copyright (C) 2006 by William Hillerby                                *
0003  *   william.hillerby@ntlworld.com                                         *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef VARIABLECAPACITOR_H
0012 #define VARIABLECAPACITOR_H
0013 
0014 #include "component.h"
0015 
0016 class Capacitance;
0017 class QSlider;
0018 
0019 /**
0020 @short Variable Capacitor
0021 @author William Hillerby
0022 */
0023 
0024 class VariableCapacitor : public Component
0025 {
0026 public:
0027     VariableCapacitor(ICNDocument *icnDocument, bool newItem, const QString &id = nullptr);
0028     ~VariableCapacitor() override;
0029 
0030     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0031     static LibraryItem *libraryItem();
0032 
0033     void sliderValueChanged(const QString &id, int newValue) override;
0034 
0035 private:
0036     void dataChanged() override;
0037     void drawShape(QPainter &p) override;
0038 
0039     Capacitance *m_pCapacitance;
0040     QSlider *m_pSlider;
0041 
0042     double m_minCapacitance;
0043     double m_maxCapacitance;
0044     double m_currCapacitance, m_tickValue;
0045 };
0046 
0047 #endif