[Kst] branches/work/kst/portto4/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Jun 16 00:19:13 CEST 2011
SVN commit 1236936 by netterfield:
CCBUG: 274322
Add saving defaults to the label dialog.
M +11 -0 devel-docs/Kst2Specs/Bugs
M +13 -6 src/libkstapp/labelcreator.cpp
M +1 -0 src/libkstapp/labelcreator.h
M +12 -5 src/libkstapp/labelcreator.ui
M +19 -4 src/libkstapp/labelitem.cpp
M +3 -0 src/libkstapp/labelitem.h
M +5 -0 src/libkstapp/labelitemdialog.cpp
M +0 -1 src/libkstapp/plotitem.cpp
M +2 -2 src/plugins/dataobject/linefit/linefit.cpp
M +1 -1 src/plugins/dataobject/syncbin/syncbin.cpp
M +1 -1 src/plugins/filters/despike/filterdespike.cpp
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1236935:1236936
@@ -1,4 +1,15 @@
+More than one shared axis group. Tied zoom doesn't work right.
+-----------------
+
+Draw a box and an arrow. Drage the box. Then the arrow. Arrow starting location is way off from the mouse.
+
+-----------------
+
+Draw a box and an arrow. Box can never be put over the arrow (it alway ends up behind.)
+
+---------------------
+
Draw an ellipse that spans many plots. It ends up in the back, and can't be brought to the front.
--------------------
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.cpp #1236935:1236936
@@ -18,7 +18,9 @@
#include "document.h"
#include "applicationsettings.h"
+#include "dialogdefaults.h"
+
namespace Kst {
LabelCreator::LabelCreator(QWidget *parent)
@@ -37,12 +39,17 @@
_labelText->setObjectStore(kstApp->mainWindow()->document()->objectStore());
- QFont defaultFont(ApplicationSettings::self()->defaultFont());
- _family->setCurrentFont(defaultFont);
- _bold->setChecked(defaultFont.bold());
- _italic->setChecked(defaultFont.italic());
- _labelColor->setColor(ApplicationSettings::self()->defaultFontColor());
- _labelFontScale->setValue(ApplicationSettings::self()->defaultFontScale());
+ QFont font;
+ font.fromString(_dialogDefaults->value("label/font",font.toString()).toString());
+ _family->setCurrentFont(font);
+ _bold->setChecked(font.bold());
+ _italic->setChecked(font.italic());
+
+ _labelColor->setColor(_dialogDefaults->value("label/color",QColor(Qt::black)).value<QColor>());
+ _labelFontScale->setValue(_dialogDefaults->value("label/fontScale",12).toDouble());
+
+ _saveAsDefault->show();
+
}
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.h #1236935:1236936
@@ -35,6 +35,7 @@
qreal labelScale() const;
QColor labelColor() const;
QFont labelFont() const;
+ bool saveAsDefaults() const {return _saveAsDefault->isChecked();}
};
}
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.ui #1236935:1236936
@@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
- <width>562</width>
+ <width>358</width>
<height>162</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0" colspan="2">
<widget class="Kst::LabelBuilder" name="_labelText" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -24,7 +24,7 @@
</property>
</widget>
</item>
- <item>
+ <item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="_Label_11">
@@ -128,7 +128,14 @@
</item>
</layout>
</item>
- <item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="_saveAsDefault">
+ <property name="text">
+ <string>Save as default</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.cpp #1236935:1236936
@@ -20,6 +20,7 @@
#include "applicationsettings.h"
#include "debug.h"
+#include "dialogdefaults.h"
#include <QDebug>
#include <QInputDialog>
@@ -33,17 +34,28 @@
setTypeName("Label");
setFixedSize(true);
setAllowedGripModes(Move /*| Resize*/ | Rotate /*| Scale*/);
- _scale = ApplicationSettings::self()->defaultFontScale();
- _color = ApplicationSettings::self()->defaultFontColor();
- _font = view()->defaultFont(_scale);
+
+ applyDefaults();
}
+void LabelItem::applyDefaults() {
+ QFont font;
+ font.fromString(_dialogDefaults->value("label/font",font.toString()).toString());
+ _font = font;
+ _color = _dialogDefaults->value("label/color",QColor(Qt::black)).value<QColor>();
+ _scale = _dialogDefaults->value("label/fontScale",12).toDouble();
+}
+void LabelItem::saveAsDialogDefaults() const {
+ _dialogDefaults->setValue("label/font", QVariant(_font).toString());
+ _dialogDefaults->setValue("label/color", _color.name());
+ _dialogDefaults->setValue("label/fontScale", _scale);
+}
+
LabelItem::~LabelItem() {
delete _labelRc;
}
-
void LabelItem::generateLabel() {
if (_labelRc) {
delete _labelRc;
@@ -216,7 +228,10 @@
label->setLabelScale(dialog.labelScale());
label->setLabelColor(dialog.labelColor());
label->setLabelFont(dialog.labelFont());
+ if (dialog.saveAsDefaults()) {
+ label->saveAsDialogDefaults();
}
+ }
_item->view()->scene()->addItem(_item);
_view->setCursor(Qt::IBeamCursor);
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.h #1236935:1236936
@@ -44,6 +44,9 @@
QFont labelFont() const;
void setLabelFont(const QFont &font);
+ void applyDefaults();
+ void saveAsDialogDefaults() const;
+
public Q_SLOTS:
virtual void edit();
void setDirty() { _dirty = true; };
--- branches/work/kst/portto4/kst/src/libkstapp/labelitemdialog.cpp #1236935:1236936
@@ -34,6 +34,8 @@
connect(_propertiesTab, SIGNAL(apply()), this, SLOT(propertiesChanged()));
setupProperties();
+ _saveAsDefault->show();
+
}
@@ -55,7 +57,10 @@
_labelItem->setLabelColor(_propertiesTab->labelColor());
_labelItem->setLabelFont(_propertiesTab->labelFont());
saveDimensions(_labelItem);
+ if (_saveAsDefault->isChecked()) {
+ _labelItem->saveAsDialogDefaults();
}
+}
}
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1236935:1236936
@@ -2966,7 +2966,6 @@
if (projection.isValid()) {
if (isInSharedAxisBox()) {
if (!force) {
- qDebug() << "zoom X range: telling shared axis box";
sharedAxisBox()->zoomXRange(projection, this);
} else {
xAxis()->setAxisZoomMode(PlotAxis::FixedExpression);
--- branches/work/kst/portto4/kst/src/plugins/dataobject/linefit/linefit.cpp #1236935:1236936
@@ -24,8 +24,8 @@
static const QString& VECTOR_OUT_X = "X Interpolated";
static const QString& VECTOR_OUT_Y = "Y Interpolated";
-static const QString SCALAR_OUT_A('a');
-static const QString SCALAR_OUT_B('b');
+static const QString& SCALAR_OUT_A = "a";
+static const QString& SCALAR_OUT_B = "b";
static const QString& SCALAR_OUT_CHI2 = "chi^2";
--- branches/work/kst/portto4/kst/src/plugins/dataobject/syncbin/syncbin.cpp #1236935:1236936
@@ -33,7 +33,7 @@
static const QString& VECTOR_OUT_X_OUT = "X out";
static const QString& VECTOR_OUT_Y_OUT = "Y out";
static const QString& VECTOR_OUT_Y_ERROR = "Y error";
-static const QString VECTOR_OUT_N('N');
+static const QString& VECTOR_OUT_N = "N";
class ConfigSyncBinPlugin : public Kst::DataObjectConfigWidget, public Ui_SyncBinConfig {
public:
--- branches/work/kst/portto4/kst/src/plugins/filters/despike/filterdespike.cpp #1236935:1236936
@@ -20,7 +20,7 @@
static const QString& VECTOR_IN = "Y Vector";
static const QString& SCALAR_NSIGMA_IN = "NSigma Scalar";
static const QString& SCALAR_SPACING_IN = "Spacing Scalar";
-static const QString VECTOR_OUT('Y');
+static const QString& VECTOR_OUT = "Y";
class ConfigWidgetFilterDespikePlugin : public Kst::DataObjectConfigWidget, public Ui_FilterDespikeConfig {
public:
More information about the Kst
mailing list