GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
QtHandlesUtils.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2018 Michael Goffioul
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_QtHandlesUtils_h)
24 #define octave_QtHandlesUtils_h 1
25 
26 #include <QColor>
27 #include <QFont>
28 #include <QImage>
29 #include <QString>
30 #include <QStringList>
31 
32 #include <string>
33 
34 #include "graphics.h"
35 
36 class QKeyEvent;
37 class QMouseEvent;
38 
39 namespace QtHandles
40 {
41 
42  namespace Utils
43  {
44  QString fromStdString (const std::string& s);
45  std::string toStdString (const QString& s);
46 
47  QStringList fromStringVector (const string_vector& v);
48  string_vector toStringVector (const QStringList& l);
49 
50  Cell toCellString (const QStringList& l);
51 
52  template <typename T>
53  QFont computeFont (const typename T::properties& props, int height = -1);
54 
55  QColor fromRgb (const Matrix& rgb);
56  Matrix toRgb (const QColor& c);
57 
58  Qt::Alignment fromHVAlign (const std::string& halign,
59  const std::string& valign);
60 
61  std::string figureSelectionType (QMouseEvent *event,
62  bool isDoubleClick = false);
63 
64  Matrix figureCurrentPoint (const graphics_object& fig, QMouseEvent *event);
66 
67  template <typename T>
68  inline typename T::properties&
70  { return dynamic_cast<typename T::properties&> (obj.get_properties ()); }
71 
72  template <typename T>
73  inline typename T::properties&
75  { return Utils::properties<T> (gh_manager::get_object (h)); }
76 
77  QImage makeImageFromCData (const octave_value& v, int width = -1,
78  int height = -1);
79 
80  octave_scalar_map makeKeyEventStruct (QKeyEvent *event);
81  }
82 
83 }
84 
85 #endif
Definition: Cell.h:37
T::properties & properties(const graphics_handle &h)
Qt::Alignment fromHVAlign(const std::string &halign, const std::string &valign)
QString fromStdString(const std::string &s)
QStringList fromStringVector(const string_vector &v)
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
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
Matrix figureCurrentPoint(const graphics_object &fig, QMouseEvent *event)
QColor fromRgb(const Matrix &rgb)
double h
Definition: graphics.cc:11808
octave_scalar_map makeKeyEventStruct(QKeyEvent *event)
Matrix toRgb(const QColor &c)
QFont computeFont(const typename T::properties &props, int height)
base_properties & get_properties(void)
Definition: graphics.in.h:2788
QImage makeImageFromCData(const octave_value &v, int width, int height)
Definition: dMatrix.h:36
std::string figureSelectionType(QMouseEvent *event, bool isDoubleClick)
Cell toCellString(const QStringList &l)
static graphics_object get_object(double val)
Definition: graphics.in.h:6098
std::string toStdString(const QString &s)
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
Definition: utils.cc:888
string_vector toStringVector(const QStringList &l)
T::properties & properties(graphics_object obj)