~showard314/ubuntu/natty/qtiplot/Python2.7_fix

« back to all changes in this revision

Viewing changes to qtiplot/src/TableStatistics.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-04-04 15:11:55 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080404151155-rjp12ziov4tryj0o
Tags: 0.9.4-1
* New upstream release.
* Refresh patches.
* Remove 04_homepage_url patch. Merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <gsl/gsl_vector.h>
34
34
#include <gsl/gsl_statistics.h>
35
35
 
36
 
TableStatistics::TableStatistics(ScriptingEnv *env, QWidget *parent, Table *base, Type t, QList<int> targets)
 
36
TableStatistics::TableStatistics(ScriptingEnv *env, ApplicationWindow *parent, Table *base, Type t, QList<int> targets)
37
37
        : Table(env, 1, 1, "", parent, ""),
38
38
        d_base(base), d_type(t), d_targets(targets)
39
39
{
40
40
        // FIXME: Haven't found a set read-only method in Qt4 yet
41
41
        // d_table->setReadOnly(true);
42
 
        setCaptionPolicy(MyWidget::Both);
 
42
        setCaptionPolicy(MdiSubWindow::Both);
43
43
        if (d_type == row)
44
44
        {
45
45
                setName(QString(d_base->objectName())+"-"+tr("RowStats"));
100
100
 
101
101
        setColPlotDesignation(0, Table::X);
102
102
        setHeaderColType();
 
103
        
 
104
        connect(d_base, SIGNAL(modifiedData(Table*,const QString&)), this, SLOT(update(Table*,const QString&)));
 
105
        connect(d_base, SIGNAL(changedColHeader(const QString&, const QString&)), this, SLOT(renameCol(const QString&, const QString&)));
 
106
        connect(d_base, SIGNAL(removedCol(const QString&)), this, SLOT(removeCol(const QString&)));
 
107
        connect (d_base, SIGNAL(destroyed()), this, SLOT(closedBase()));
 
108
}
 
109
 
 
110
void TableStatistics::closedBase()
 
111
{
 
112
        d_base = NULL;
103
113
}
104
114
 
105
115
void TableStatistics::update(Table *t, const QString& colName)
106
116
{
 
117
        if (!d_base)
 
118
                return;
 
119
        
107
120
        if (t != d_base) return;
108
121
 
109
122
        int j;
232
245
 
233
246
void TableStatistics::renameCol(const QString &from, const QString &to)
234
247
{
 
248
        if (!d_base)
 
249
                return;
 
250
        
235
251
        if (d_type == row) return;
236
252
        for (int c=0; c < d_targets.size(); c++)
237
253
                if (from == QString(d_base->objectName())+"_"+text(c, 0))
243
259
 
244
260
void TableStatistics::removeCol(const QString &col)
245
261
{
 
262
        if (!d_base)
 
263
                return;
 
264
        
246
265
        if (d_type == row)
247
266
        {
248
267
                update(d_base, col);
259
278
 
260
279
QString TableStatistics::saveToString(const QString &geometry, bool)
261
280
{
 
281
        if (!d_base)
 
282
                return Table::saveToString(geometry, false);
 
283
                
262
284
        QString s = "<TableStatistics>\n";
263
285
        s += QString(objectName())+"\t";
264
 
        s += QString(d_base->objectName())+"\t";
 
286
        s += QString(d_base->objectName()) + "\t";
265
287
        s += QString(d_type == row ? "row" : "col") + "\t";
266
288
        s += birthDate()+"\n";
267
289
        s += "Targets";
273
295
        s += saveColumnWidths();
274
296
        s += saveCommands();
275
297
        s += saveColumnTypes();
 
298
        s += saveReadOnlyInfo();
 
299
        s += saveHiddenColumnsInfo();
276
300
        s += saveComments();
277
301
        s += "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
278
302
        return s + "</TableStatistics>\n";