![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
00001 /**************************************************************************** 00002 00003 Copyright (c) 2008 Deepak Chandran 00004 Contact: Deepak Chandran (dchandran1@gmail.com) 00005 See COPYRIGHT.TXT 00006 00007 A slider widget that calls a C function whenver values in the slider are changed. 00008 Uses CThread. 00009 00010 ****************************************************************************/ 00011 00012 #ifndef TINKERCELL_MULTITHREADEDSLIDER_H 00013 #define TINKERCELL_MULTITHREADEDSLIDER_H 00014 00015 #include <QWidget> 00016 #include <QLineEdit> 00017 #include <QSlider> 00018 #include <QLabel> 00019 #include <QGridLayout> 00020 #include <QHBoxLayout> 00021 #include <QVBoxLayout> 00022 #include <QScrollArea> 00023 #include <QHash> 00024 #include "CThread.h" 00025 00026 namespace Tinkercell 00027 { 00032 class TINKERCELLCOREEXPORT MultithreadedSliderWidget : public QWidget 00033 { 00034 Q_OBJECT 00035 00036 signals: 00037 00041 void valuesChanged(DataTable<qreal>); 00042 00043 public slots: 00044 00051 virtual void setSliders(const QStringList& options, const QList<double>& minValues, const QList<double>& maxValues); 00052 00057 virtual void setVisibleSliders(const QStringList& options); 00058 00063 virtual void setVisibleSliders(const QString& substring); 00064 00065 public: 00066 00073 MultithreadedSliderWidget(MainWindow * parent, CThread * thread=0, Qt::Orientation orientation = Qt::Horizontal); 00074 00082 MultithreadedSliderWidget(MainWindow * parent, const QString & lib, const QString & functionName, Qt::Orientation orientation = Qt::Horizontal); 00083 00087 virtual CThread * thread() const; 00088 00092 virtual void setThread(CThread *); 00093 00099 virtual void setDefaultDataTable(const QString&); 00100 00104 virtual DataTable<qreal> data() const; 00105 00106 protected slots: 00107 00111 virtual void valueChanged(); 00112 00116 virtual void sliderChanged(int); 00117 00121 virtual void minmaxChanged(); 00122 00126 virtual void saveValues(); 00127 00128 protected: 00129 00133 CThread * cthread; 00137 Qt::Orientation orientation; 00141 DataTable<qreal> values; 00145 QList< QLabel* > labels; 00149 QList< QSlider* > sliders; 00153 QList< QLineEdit* > minline, maxline, valueline; 00157 QList<double> min, max; 00161 QVBoxLayout * slidersLayout; 00165 QHash< QString, QWidget* > sliderWidgets; 00169 MainWindow * mainWindow; 00175 QString defaultDataTable; 00176 }; 00177 } 00178 00179 #endif