GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtHandlesUtils.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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)
s
Definition: file-io.cc:2682
Matrix figureCurrentPoint(const graphics_object &fig, QMouseEvent *event)
QColor fromRgb(const Matrix &rgb)
double h
Definition: graphics.cc:11205
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.h:3288
QImage makeImageFromCData(const octave_value &v, int width, int height)
Definition: dMatrix.h:37
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
std::string figureSelectionType(QMouseEvent *event, bool isDoubleClick)
Cell toCellString(const QStringList &l)
static graphics_object get_object(double val)
Definition: graphics.h:13794
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:854
string_vector toStringVector(const QStringList &l)
T::properties & properties(graphics_object obj)