[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Fri Sep 28 17:44:16 CEST 2007


SVN commit 718395 by treat:

* Add new curve dialog.
* Cleanup the databutton(action) class.
* Don't show the canonical dataobjects that don't
exist yet.


 A             curvedialog.cpp   [License: GPL (v2+)]
 A             curvedialog.h   [License: GPL (v2+)]
 M  +4 -0      databutton.cpp  
 M  +49 -44    datamanager.cpp  
 M  +1 -0      datamanager.h  
 M  +3 -0      libkstapp.pro  


--- branches/work/kst/portto4/kst/src/libkstapp/databutton.cpp #718394:718395
@@ -19,6 +19,8 @@
 
 DataButton::DataButton(const QString &text, QWidget *parent)
   : QPushButton(text, parent) {
+  setBackgroundRole(QPalette::Base);
+  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
 }
 
 
@@ -31,6 +33,8 @@
   QStyleOptionButton option;
   initStyleOption(&option);
 
+  option.features = QStyleOptionButton::Flat;
+
   p.drawControl(QStyle::CE_PushButtonBevel, option);
   p.drawPrimitive(QStyle::PE_FrameFocusRect, option);
 
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #718394:718395
@@ -14,6 +14,7 @@
 #include "databutton.h"
 
 #include "vectordialog.h"
+#include "curvedialog.h"
 
 #include "document.h"
 #include "sessionmodel.h"
@@ -31,18 +32,22 @@
   _primitives = new QToolBar(_objects);
   _primitives->setOrientation(Qt::Vertical);
   _primitives->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+  _primitives->setBackgroundRole(QPalette::Base);
 
   _dataObjects = new QToolBar(_objects);
   _dataObjects->setOrientation(Qt::Vertical);
   _dataObjects->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+  _dataObjects->setBackgroundRole(QPalette::Base);
 
   _fits = new QToolBar(_objects);
   _fits->setOrientation(Qt::Vertical);
   _fits->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+  _fits->setBackgroundRole(QPalette::Base);
 
   _filters = new QToolBar(_objects);
   _filters->setOrientation(Qt::Vertical);
   _filters->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+  _filters->setBackgroundRole(QPalette::Base);
 
   _objects->addItem(_primitives, tr("Create Primitive"));
   _objects->addItem(_dataObjects, tr("Create Data Object"));
@@ -51,55 +56,49 @@
 
 //   Create canonical items...
 
-//FIXME "Scalar"
-
   QAction *action = new DataButtonAction(tr("Vector"));
+  connect(action, SIGNAL(triggered()), this, SLOT(showVectorDialog()));
   _primitives->addAction(action);
-  connect(action, SIGNAL(triggered()), this, SLOT(showVectorDialog()));
-  QWidget *widget = _primitives->widgetForAction(action);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
 
-  action = _primitives->addWidget(new DataButton(tr("Matrix")));
-  widget = _primitives->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+//   action = new DataButtonAction(tr("Matrix"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showMatrixDialog()));
+//   _primitives->addAction(action);
+// 
+//   action = new DataButtonAction(tr("Scalar"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showScalarDialog()));
+//   _primitives->addAction(action);
+// 
+//   action = new DataButtonAction(tr("String"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showStringDialog()));
+//   _primitives->addAction(action);
 
-//FIXME "String"
+  action = new DataButtonAction(tr("Curve"));
+  connect(action, SIGNAL(triggered()), this, SLOT(showCurveDialog()));
+  _dataObjects->addAction(action);
 
-  action = _dataObjects->addWidget(new DataButton(tr("Curve")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("Equation")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("Histogram")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("Power Spectrum")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("Event Monitor")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("Image")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
-  action = _dataObjects->addWidget(new DataButton(tr("CSD")));
-  widget = _dataObjects->widgetForAction(action);
-  widget->setEnabled(false);
-  widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+//   action = new DataButtonAction(tr("Equation"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showEquationDialog()));
+//   _dataObjects->addAction(action);
+// 
+//   action = new DataButtonAction(tr("Histogram"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showHistogramDialog()));
+//   _dataObjects->addAction(action);
+// 
+//   action = new DataButtonAction(tr("Power Spectrum"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showPowerSpectrumDialog()));
+//   _dataObjects->addAction(action);
+// 
+//   action = new DataButtonAction(tr("Event Monitor")));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showEventMonitorDialog()));
+//   _dataObjects->addAction(action);
+// 
+//   action = new DataButtonAction(tr("Image"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showImageDialog()));
+//   _dataObjects->addAction(action);
+// 
+//   action = new DataButtonAction(tr("CSD"));
+//   connect(action, SIGNAL(triggered()), this, SLOT(showCSDDialog()));
+//   _dataObjects->addAction(action);
 }
 
 
@@ -112,6 +111,12 @@
   dialog.exec();
 }
 
+
+void DataManager::showCurveDialog() {
+  CurveDialog dialog(this);
+  dialog.exec();
 }
 
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.h #718394:718395
@@ -33,6 +33,7 @@
 
   private Q_SLOTS:
     void showVectorDialog();
+    void showCurveDialog();
 
   private:
     Document *_doc;
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #718394:718395
@@ -25,6 +25,7 @@
     axis.cpp \
     boxitem.cpp \
     builtingraphics.cpp \
+    curvedialog.cpp \
     databutton.cpp \
     databuttonaction.cpp \
     datadialog.cpp \
@@ -80,6 +81,7 @@
     axis.h \
     boxitem.h \
     builtingraphics.h \
+    curvedialog.h \
     databutton.h \
     databuttonaction.h \
     datadialog.h \
@@ -131,6 +133,7 @@
 
 FORMS += \
     aboutdialog.ui \
+    curvetab.ui \
     datamanager.ui \
     debugdialog.ui \
     dialog.ui \


More information about the Kst mailing list