]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/qt_helpers.h
shuffle stuff around; minor coding style issues
[lyx.git] / src / frontends / qt4 / qt_helpers.h
1 // -*- C++ -*-
2 /**
3  * \file qt_helpers.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Dekel Tsur
8  * \author Richard Heck
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QTHELPERS_H
14 #define QTHELPERS_H
15
16 #include "Length.h"
17 #include "support/qstring_helpers.h"
18
19 #include <string>
20
21 class QComboBox;
22 class QLineEdit;
23 class QCheckBox;
24 class QString;
25 class QWidget;
26
27 class LengthCombo;
28
29 namespace lyx {
30
31 /// method to get a Length from widgets (LengthCombo)
32 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
33 /// method to get a Length from widgets (QComboBox)
34 Length widgetsToLength(QLineEdit const * input, QComboBox const * combo);
35
36 //FIXME It would be nice if defaultUnit were a default argument
37 /// method to set widgets from a Length
38 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
39         Length const & len, Length::UNIT default_unit);
40 /// method to set widgets from a string
41 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
42         std::string const & len, Length::UNIT default_unit);
43 /// method to set widgets from a Length with optional "auto" if zero
44 void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
45         Length const & len, Length::UNIT defaultUnit);
46
47 /// colors a widget red if invalid
48 void setValid(QWidget * widget, bool valid);
49
50
51 /**
52  * qt_ - i18nize string and convert to QString
53  *
54  * Use this in qt4/ instead of _()
55  */
56 QString const qt_(char const * str, const char * comment = 0);
57
58
59 /**
60  * qt_ - i18nize string and convert to QString
61  *
62  * Use this in qt4/ instead of _()
63  */
64 QString const qt_(std::string const & str);
65
66 } // namespace lyx
67
68 #endif // QTHELPERS_H