GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Table.cc File Reference
#include <QCheckBox>
#include <QComboBox>
#include <QEvent>
#include <QFrame>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QModelIndexList>
#include <QMouseEvent>
#include <QString>
#include <QStringList>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QTimer>
#include "Container.h"
#include "ContextMenu.h"
#include "Table.h"
#include "QtHandlesUtils.h"
#include "octave-qobject.h"
#include "graphics.h"
#include "interpreter.h"
#include "oct-map.h"
#include "oct-stream.h"
#include "oct-string.h"
#include "oct-strstrm.h"
Include dependency graph for Table.cc:

Go to the source code of this file.

Macros

#define AUTO_HEIGHT   (tp.get_fontsize () * 2 - 1)
 
#define FORMAT_INT_VALUE()
 
#define FORMAT_UINT_VALUE()
 
#define FORMAT_VALUE(f, l)
 
#define FORMAT_VALUE_EXCEPT_RAT(f, l)
 
#define FORMATNUMBER(type)
 
#define SCANF_AND_CONVERT(name, ctype, format)
 

Functions

static octave_value attempt_type_conversion (const octave_value &ov, const octave_value &old_value)
 
static QString formatComplex (Complex c, char format='f', int precision=4)
 
static QString formatNumber (double d, char format='f', int precision=4)
 
static QString formatNumber (float d, char format='f', int precision=4)
 
static QTableWidgetItem * itemFor (octave_value val, std::string format="", bool enabled=false)
 
static std::pair< Qt::AlignmentFlag, QString > qStringValueFor (octave_value val, std::string format="")
 
static QSize realQSizeForTable (QTableWidget *t)
 

Variables

static const int AUTO_WIDTH = 75
 

Macro Definition Documentation

◆ AUTO_HEIGHT

#define AUTO_HEIGHT   (tp.get_fontsize () * 2 - 1)

Definition at line 64 of file Table.cc.

◆ FORMAT_INT_VALUE

#define FORMAT_INT_VALUE ( )
Value:
text = QString::number (value); \
if (format == "char" || format == "popup") \
flag = Qt::AlignLeft ; \
else if (format == "+") \
{ \
if (value > 0) \
text = Utils::fromStdString ("+"); \
else if (value < 0) \
text = Utils::fromStdString ("-"); \
else \
text = Utils::fromStdString (""); \
}
QString fromStdString(const std::string &s)
std::size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1473

Definition at line 179 of file Table.cc.

◆ FORMAT_UINT_VALUE

#define FORMAT_UINT_VALUE ( )
Value:
text = QString::number (value); \
if (format == "char" || format == "popup") \
flag = Qt::AlignLeft; \
else if (format == "+") \
{ \
if (value > 0) \
text = Utils::fromStdString ("+"); \
else \
text = Utils::fromStdString (""); \
}

Definition at line 167 of file Table.cc.

◆ FORMAT_VALUE

#define FORMAT_VALUE (   f,
 
)
Value:
else if (format == "rat") \
text = Utils::fromStdString (rational_approx (double (value), 0)); \
else \
{ \
text = formatNumber (value, 'n', f); \
flag = Qt::AlignLeft ; \
}
#define FORMAT_VALUE_EXCEPT_RAT(f, l)
Definition: Table.cc:126
static QString formatNumber(double d, char format='f', int precision=4)
Definition: Table.cc:115
F77_RET_T const F77_DBLE const F77_DBLE * f
std::string rational_approx(T val, int len)
Definition: oct-string.cc:696

Definition at line 157 of file Table.cc.

◆ FORMAT_VALUE_EXCEPT_RAT

#define FORMAT_VALUE_EXCEPT_RAT (   f,
 
)
Value:
if (format == "numeric" || format == "short") \
text = formatNumber (value, 'n', f); \
else if (format == "short f" || format == "shortf") \
text = formatNumber (value, 'f', f); \
else if (format == "short e" || format == "shorte") \
text = formatNumber (value, 'e', f); \
else if (format == "short eng" || format == "shorteng") \
text = formatNumber (value, 'F', f); \
else if (format == "short g" || format == "shortg") \
text = formatNumber (value, 'g', f + 1); \
else if (format == "long") \
text = formatNumber (value, 'n', l); \
else if (format == "long f" || format == "longf") \
text = formatNumber (value, 'f', l); \
else if (format == "long e" || format == "longe") \
text = formatNumber (value, 'e', l); \
else if (format == "long eng" || format == "longeng") \
text = formatNumber (value, 'E', l); \
else if (format == "long g" || format == "longg") \
text = formatNumber (value, 'g', l + 1); \
else if (format == "bank") \
text = QString::number (value, 'f', 2); \
else if (format == "+") \
if (value > 0) \
text = Utils::fromStdString ("+"); \
else if (value < 0) \
text = Utils::fromStdString ("-"); \
else \
text = Utils::fromStdString ("");

Definition at line 126 of file Table.cc.

◆ FORMATNUMBER

#define FORMATNUMBER (   type)

Definition at line 77 of file Table.cc.

◆ SCANF_AND_CONVERT

#define SCANF_AND_CONVERT (   name,
  ctype,
  format 
)
Value:
else if (old_value.is_ ## name ## _type ()) \
{ \
ctype val; \
int n; \
const std::string cxx_str = ov.string_value (); \
const char *c_str = cxx_str.c_str (); \
int error = sscanf (c_str, format, &val, &n); \
if (error != 1 || c_str[n]) \
{ \
val = 0; \
} \
retval = octave_value ( octave_ ## name (val)); \
}
void error(const char *fmt,...)
Definition: error.cc:979
octave_idx_type n
Definition: mx-inlines.cc:753
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))

Function Documentation

◆ attempt_type_conversion()

◆ formatComplex()

static QString formatComplex ( Complex  c,
char  format = 'f',
int  precision = 4 
)
static

Definition at line 120 of file Table.cc.

References format(), and formatNumber().

Referenced by qStringValueFor().

◆ formatNumber() [1/2]

static QString formatNumber ( double  d,
char  format = 'f',
int  precision = 4 
)
static

Definition at line 115 of file Table.cc.

Referenced by formatComplex().

◆ formatNumber() [2/2]

static QString formatNumber ( float  d,
char  format = 'f',
int  precision = 4 
)
static

Definition at line 116 of file Table.cc.

◆ itemFor()

static QTableWidgetItem* itemFor ( octave_value  val,
std::string  format = "",
bool  enabled = false 
)
static

Definition at line 334 of file Table.cc.

References format(), and qStringValueFor().

Referenced by Table::updateData().

◆ qStringValueFor()

◆ realQSizeForTable()

static QSize realQSizeForTable ( QTableWidget *  t)
static

Definition at line 66 of file Table.cc.

References Faddeeva::w().

Referenced by Table::updateExtent().

Variable Documentation

◆ AUTO_WIDTH

const int AUTO_WIDTH = 75
static

Definition at line 62 of file Table.cc.

Referenced by Table::updateColumnwidth().