#include <dynamicSlider.h>
Inheritance diagram for DynamicSlider:
Definition at line 21 of file dynamicSlider.h.
Signals | |
void | mouseHasMoved () |
Public Member Functions | |
DynamicSlider (Orientation orientation, QWidget *parent, const char *name=0) | |
~DynamicSlider () | |
void | setZeroString (QString val) |
when set, a zero string is shown instead of the current value/prefix/suffix when the slider value is 0 | |
void | setPrefix (QString val) |
set the prefix that is displayed before the current slider value | |
void | setPrefixes (QString prefix1, QString prefix2) |
set two prefix values, one for when the value is positive and one for when the value is negative. | |
void | setSuffix (QString val) |
set the suffix that is displayed after the current slider value | |
void | setSuffixes (QString suffix1, QString suffix2) |
set two suffix values, one for when the value is positive and one for when the value is negative. | |
QPoint | getMousePos () |
Protected Member Functions | |
void | mouseMoveEvent (QMouseEvent *e) |
virtual QString | mapValToString () |
subclass DynamicSlider and reimplement this method to change the behavior used to display slider values | |
Private Slots | |
void | updateTooltipLabel () |
Private Attributes | |
QString | zeroString |
QString | prefix1 |
QString | prefix2 |
QString | suffix1 |
QString | suffix2 |
SliderToolTip * | tooltip |
QPoint | cachedMousePos |
|
Definition at line 17 of file dynamicSlider.cpp. References tooltip, and updateTooltipLabel(). 00018 : QSlider(orientation, parent, name) 00019 { 00020 //determine the parent screen the tooltip will be displayed in and create tooltip 00021 int scr = QApplication::desktop()->screenNumber( this ); 00022 tooltip = new SliderToolTip( QApplication::desktop()->screen( scr ), this); 00023 updateTooltipLabel(); 00024 00025 //make sure tooltip label is updated when the slider value changes 00026 connect( this, SIGNAL( valueChanged(int) ), 00027 this, SLOT( updateTooltipLabel() ) ); 00028 }
|
|
Definition at line 30 of file dynamicSlider.cpp. References tooltip. 00031 { 00032 delete tooltip; 00033 tooltip = NULL; 00034 }
|
|
Definition at line 119 of file dynamicSlider.cpp. Referenced by SliderToolTip::update(). 00119 { return cachedMousePos; }
|
|
subclass DynamicSlider and reimplement this method to change the behavior used to display slider values
Reimplemented in BlurSharpenSlider. Definition at line 70 of file dynamicSlider.cpp. Referenced by updateTooltipLabel(). 00071 { 00072 //the default behavior is to simply use the slider value directly 00073 if( orientation() == Qt::Vertical ) 00074 return QString("%1").arg( -value() ); 00075 else 00076 return QString("%1").arg(value()); 00077 }
|
|
Referenced by mouseMoveEvent(). |
|
Definition at line 111 of file dynamicSlider.cpp. References cachedMousePos, and mouseHasMoved(). 00112 { 00113 //cache the mouse position since the tooltip will need this information when updating itself 00114 cachedMousePos = e->pos(); 00115 QSlider::mouseMoveEvent(e); 00116 emit mouseHasMoved(); 00117 }
|
|
set the prefix that is displayed before the current slider value
Definition at line 42 of file dynamicSlider.cpp. References prefix1, prefix2, and updateTooltipLabel(). 00043 { 00044 prefix1 = val; 00045 prefix2 = QString( NULL ); 00046 updateTooltipLabel(); 00047 }
|
|
set two prefix values, one for when the value is positive and one for when the value is negative.
Definition at line 49 of file dynamicSlider.cpp. References prefix1, prefix2, and updateTooltipLabel(). Referenced by BlurSharpenSlider::BlurSharpenSlider(), and HistogramEditor::HistogramEditor(). 00050 { 00051 prefix1 = v1; 00052 prefix2 = v2; 00053 updateTooltipLabel(); 00054 }
|
|
set the suffix that is displayed after the current slider value
Definition at line 56 of file dynamicSlider.cpp. References suffix1, suffix2, and updateTooltipLabel(). Referenced by BlurSharpenSlider::BlurSharpenSlider(). 00057 { 00058 suffix1 = val; 00059 suffix2 = QString( NULL ); 00060 updateTooltipLabel(); 00061 }
|
|
set two suffix values, one for when the value is positive and one for when the value is negative.
Definition at line 63 of file dynamicSlider.cpp. References suffix1, suffix2, and updateTooltipLabel(). 00064 { 00065 suffix1 = v1; 00066 suffix2 = v2; 00067 updateTooltipLabel(); 00068 }
|
|
when set, a zero string is shown instead of the current value/prefix/suffix when the slider value is 0
Definition at line 36 of file dynamicSlider.cpp. References updateTooltipLabel(), and zeroString. Referenced by BlurSharpenSlider::BlurSharpenSlider(), and HistogramEditor::HistogramEditor(). 00037 { 00038 zeroString = val; 00039 updateTooltipLabel(); 00040 }
|
|
Definition at line 79 of file dynamicSlider.cpp. References mapValToString(), prefix2, suffix2, tooltip, and zeroString. Referenced by DynamicSlider(), setPrefix(), setPrefixes(), setSuffix(), setSuffixes(), and setZeroString(). 00080 { 00081 //determine string that will be used for tooltip 00082 QString tipString; 00083 00084 //if the value is zero and a zero string has been provided used that 00085 if( value() == 0 && !zeroString.isNull() ) 00086 { 00087 tipString = zeroString; 00088 } 00089 //otherwise construct a tip string using provided prefixes, suffixes, and the current slider value 00090 else 00091 { 00092 //determine prefix and suffix that will be used to construct tooltip string 00093 QString p, s; 00094 if( value() > 0 || prefix2.isNull() ) p = prefix1; 00095 else p = prefix2; 00096 00097 if( value() > 0 || suffix2.isNull() ) s = suffix1; 00098 else s = suffix2; 00099 00100 //construct tipstring 00101 tipString = QString("%1%2%3").arg(p).arg(mapValToString()).arg(s); 00102 00103 } 00104 00105 //update tooltip 00106 tooltip->setText( tipString ); 00107 tooltip->adjustSize(); 00108 if( tooltip->isShown() ) qApp->processEvents(); 00109 }
|
|
Definition at line 61 of file dynamicSlider.h. Referenced by mouseMoveEvent(). |
|
Definition at line 57 of file dynamicSlider.h. Referenced by setPrefix(), and setPrefixes(). |
|
Definition at line 57 of file dynamicSlider.h. Referenced by setPrefix(), setPrefixes(), and updateTooltipLabel(). |
|
Definition at line 58 of file dynamicSlider.h. Referenced by setSuffix(), and setSuffixes(). |
|
Definition at line 58 of file dynamicSlider.h. Referenced by setSuffix(), setSuffixes(), and updateTooltipLabel(). |
|
Definition at line 60 of file dynamicSlider.h. Referenced by DynamicSlider(), updateTooltipLabel(), and ~DynamicSlider(). |
|
Definition at line 55 of file dynamicSlider.h. Referenced by setZeroString(), and updateTooltipLabel(). |