[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Feb 18 22:19:38 CET 2004


CVS commit by staikos: 

add tooltips with values of scalars


  M +21 -1     kstplugindialog_i.cpp   1.51
  M +1 -0      kstplugindialog_i.h   1.13


--- kdeextragear-2/kst/kst/kstplugindialog_i.cpp  #1.50:1.51
@@ -30,4 +30,5 @@
 #include <qstringlist.h>
 #include <qtimer.h>
+#include <qtooltip.h>
 #include <qwhatsthis.h>
 #include <qwidget.h>
@@ -482,6 +483,12 @@ QString scalarLabelTemplate, vectorLabel
     if (input) {
       if (scalar) {
-        widget = new ScalarSelector(parent, (*it)._name.latin1());
+        ScalarSelector *w = new ScalarSelector(parent, (*it)._name.latin1());
+        widget = w;
+        connect(w->_scalar, SIGNAL(activated(const QString&)), this, SLOT(updateScalarTooltip(const QString&)));
         connect(widget, SIGNAL(newScalarCreated()), this, SIGNAL(modified()));
+        KstScalarPtr p = *KST::scalarList.findTag(w->_scalar->currentText());
+        if (p) {
+          QToolTip::add(w->_scalar, QString::number(p->value()));
+        }
       } else {
         widget = new VectorSelector(parent, (*it)._name.latin1());
@@ -577,4 +584,17 @@ void KstPluginDialogI::showPluginManager
 }
 
+
+void KstPluginDialogI::updateScalarTooltip(const QString& n) {
+  KstScalarPtr s = *KST::scalarList.findTag(n);
+  QWidget *w = const_cast<QWidget*>(static_cast<const QWidget*>(sender()));
+  if (s) {
+    QToolTip::remove(w);
+    QToolTip::add(w, QString::number(s->value()));
+  } else {
+    QToolTip::remove(w);
+  }
+}
+
+
 #include "kstplugindialog_i.moc"
 

--- kdeextragear-2/kst/kst/kstplugindialog_i.h  #1.12:1.13
@@ -52,4 +52,5 @@ private slots:
   void showPluginManager();
   void fixupLayout();
+  void updateScalarTooltip(const QString& n);
 
 private:





More information about the Kst mailing list