1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _QT_HELPER_HXX_
21 #define _QT_HELPER_HXX_
24 // =============================================================
25 // Macro and template functions for type conversions.
26 // =============================================================
28 #include "Basics_Utils.hxx" // To get ToString macro
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))
40 // =============================================================
41 // General helper macros for manipulating widgets values
42 // =============================================================
44 #define GETTEXT(widget) ToString(QCHARSTAR(widget->text().trimmed()))
45 #define SETTEXT(widget,str) widget->setText(str.c_str())
48 // =============================================================
50 // =============================================================
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:
57 #define QDEBUG qWarning()
58 //#define QDEBUG qDebug()
59 #define QLOG(data) QDEBUG << __FILE__<<" ["<<__LINE__<<"] : " << data
65 #endif // __QT_HELPER_H_