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