23 #if defined (HAVE_CONFIG_H) 27 #include <QApplication> 29 #include <QMouseEvent> 53 return QString::fromLocal8Bit (
s.c_str ());
80 foreach (
const QString&
s, l)
91 while ((
tmp.length () > 0) &&
tmp.last ().isEmpty ())
103 template <
typename T>
109 static std::map<std::string, QFont::Weight> weightMap;
110 static std::map<std::string, QFont::Style> angleMap;
111 static bool mapsInitialized =
false;
113 if (! mapsInitialized)
115 weightMap[
"normal"] = QFont::Normal;
116 weightMap[
"light"] = QFont::Light;
117 weightMap[
"demi"] = QFont::DemiBold;
118 weightMap[
"bold"] = QFont::Bold;
120 angleMap[
"normal"] = QFont::StyleNormal;
121 angleMap[
"italic"] = QFont::StyleItalic;
122 angleMap[
"oblique"] = QFont::StyleOblique;
124 mapsInitialized =
true;
127 f.setPointSizeF (props.get___fontsize_points__ (height));
128 f.setWeight (weightMap[props.get_fontweight ()]);
129 f.setStyle (angleMap[props.get_fontangle ()]);
148 if (rgb.
numel () == 3)
149 c.setRgbF (rgb(0), rgb(1), rgb(2));
164 rgbData[0] =
tmp[0]; rgbData[1] =
tmp[1]; rgbData[2] =
tmp[2];
176 Qt::MouseButtons buttons = event->buttons ();
177 Qt::KeyboardModifiers mods = event->modifiers ();
179 if (mods == Qt::NoModifier)
181 if (buttons == Qt::LeftButton)
183 else if (buttons == Qt::RightButton)
185 #if defined (Q_WS_WIN) 186 else if (buttons == (Qt::LeftButton | Qt::RightButton))
188 #elif defined (Q_WS_X11) 189 else if (buttons == Qt::MidButton)
193 else if (buttons == Qt::LeftButton)
195 if (mods == Qt::ShiftModifier)
197 else if (mods == Qt::ControlModifier)
221 QPoint
qp =
c->mapFromGlobal (event->globalPos ());
228 return Matrix (1, 2, 0.0);
244 QPoint
qp =
c->mapFromGlobal (QCursor::pos ());
251 return Matrix (1, 2, 0.0);
260 flags |= Qt::AlignLeft;
262 flags |= Qt::AlignHCenter;
264 flags |= Qt::AlignRight;
266 flags |= Qt::AlignLeft;
269 flags |= Qt::AlignVCenter;
271 flags |= Qt::AlignTop;
273 flags |= Qt::AlignBottom;
275 flags |= Qt::AlignVCenter;
287 int w = qMin (
dv(1), static_cast<octave_idx_type> (width));
288 int h = qMin (
dv(0), static_cast<octave_idx_type> (height));
290 int x_off = (
w < width ? (width -
w) / 2 : 0);
291 int y_off = (
h < height ? (height -
h) / 2 : 0);
293 QImage img (width, height, QImage::Format_ARGB32);
294 img.fill (qRgba (0, 0, 0, 0));
300 for (
int i = 0;
i <
w;
i++)
301 for (
int j = 0; j <
h; j++)
308 img.setPixel (x_off +
i, y_off + j, qRgba (r, g,
b,
a));
315 for (
int i = 0;
i <
w;
i++)
316 for (
int j = 0; j <
h; j++)
318 float r =
f(j,
i, 0);
319 float g =
f(j,
i, 1);
320 float b =
f(j,
i, 2);
324 img.setPixel (x_off +
i, y_off + j,
335 for (
int i = 0;
i <
w;
i++)
336 for (
int j = 0; j <
h; j++)
338 double r =
d(j,
i, 0);
339 double g =
d(j,
i, 1);
340 double b =
d(j,
i, 2);
344 img.setPixel (x_off +
i, y_off + j,
366 std::list<std::string> modList;
367 Qt::KeyboardModifiers mods =
event->modifiers ();
369 if (mods & Qt::ShiftModifier)
370 modList.push_back (
"shift");
371 if (mods & Qt::ControlModifier)
372 #if defined (Q_OS_MAC) 373 modList.push_back (
"command");
375 modList.push_back (
"control");
377 if (mods & Qt::AltModifier)
378 modList.push_back (
"alt");
379 #if defined (Q_OS_MAC) 380 if (mods & Qt::MetaModifier)
381 modList.push_back (
"control");
static int qp(const Matrix &H, const ColumnVector &q, const Matrix &Aeq, const ColumnVector &beq, const Matrix &Ain, const ColumnVector &bin, int maxit, ColumnVector &x, ColumnVector &lambda, int &iter)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
Qt::Alignment fromHVAlign(const std::string &halign, const std::string &valign)
const T * fortran_vec(void) const
QString fromStdString(const std::string &s)
QStringList fromStringVector(const string_vector &v)
virtual Container * innerContainer(void)=0
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
FloatNDArray float_array_value(bool frc_str_conv=false) const
Matrix figureCurrentPoint(const graphics_object &fig, QMouseEvent *event)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
template QFont computeFont< uicontrol >(const uicontrol::properties &props, int height)
QColor fromRgb(const Matrix &rgb)
std::string qKeyToKeyString(int key)
template QFont computeFont< uibuttongroup >(const uibuttongroup::properties &props, int height)
octave_scalar_map makeKeyEventStruct(QKeyEvent *event)
Matrix toRgb(const QColor &c)
std::complex< double > w(std::complex< double > z, double relerr=0)
bool is_single_type(void) const
dim_vector dims(void) const
QFont computeFont(const typename T::properties &props, int height)
template QFont computeFont< uipanel >(const uipanel::properties &props, int height)
QImage makeImageFromCData(const octave_value &v, int width, int height)
static Object * toolkitObject(const graphics_object &go)
bool strcmpi(const T &str_a, const T &str_b)
True if strings are the same, ignoring case.
std::string figureSelectionType(QMouseEvent *event, bool isDoubleClick)
Cell toCellString(const QStringList &l)
octave_idx_type ndims(void) const
Number of dimensions.
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
std::string toStdString(const QString &s)
bool is_uint8_type(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
NDArray array_value(bool frc_str_conv=false) const
base_properties & properties(void)
uint8NDArray uint8_array_value(void) const
string_vector toStringVector(const QStringList &l)
T::properties & properties(graphics_object obj)