Version: 9.15.0
QtHelper.hxx
Go to the documentation of this file.
1
// Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2
//
3
// This library is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU Lesser General Public
5
// License as published by the Free Software Foundation; either
6
// version 2.1 of the License, or (at your option) any later version.
7
//
8
// This library is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
// Lesser General Public License for more details.
12
//
13
// You should have received a copy of the GNU Lesser General Public
14
// License along with this library; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
//
17
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
//
19
20
#ifndef _QT_HELPER_HXX_
21
#define _QT_HELPER_HXX_
22
23
//
24
// =============================================================
25
// Macro and template functions for type conversions.
26
// =============================================================
27
//
28
#include "Basics_Utils.hxx"
// To get ToString macro
29
#include <QString>
30
31
// This can be used to convert QString into char *.
32
#define QCHARSTAR(qstring) qstring.toLatin1().data()
33
// This converts a string into a QString
34
#define S2QS(string) QString(string.c_str())
35
// This converts a QString into a string
36
#define QS2S(qstring) ToString(QCHARSTAR(qstring))
37
#define QSTRING(any) S2QS(ToString(any))
38
39
//
40
// =============================================================
41
// General helper macros for manipulating widgets values
42
// =============================================================
43
//
44
#define GETTEXT(widget) ToString(QCHARSTAR(widget->text().trimmed()))
45
#define SETTEXT(widget,str) widget->setText(str.c_str())
46
47
//
48
// =============================================================
49
// Qt Logger macros
50
// =============================================================
51
//
52
53
// We can use the macros defined by SALOMELocalTrace/utilities.h
54
// as proposed in the file KERNEL_helper.hxx. But we can use instead
55
// the Qt debug function:
56
#include <QDebug>
57
#define QDEBUG qWarning()
58
//#define QDEBUG qDebug()
59
#define QLOG(data) QDEBUG << __FILE__<<" ["
<<__LINE__<<"] : " << data
60
#ifdef LOG
61
#undef LOG
62
#endif
63
#define LOG QLOG
64
65
#endif
// __QT_HELPER_H_
src
GuiHelpers
QtHelper.hxx
Copyright © 2007-2025 CEA, EDF, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS