]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/qt_helpers.h
we've never used Q_FOREACH
[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  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QTHELPERS_H
13 #define QTHELPERS_H
14
15 #include "lyxlength.h"
16 #include "support/docstring.h"
17 #include "support/qstring_helpers.h"
18
19 #include <QString>
20
21 #include <utility>
22
23 #include "qt_connection_check.h"
24
25 class QComboBox;
26 class QLineEdit;
27
28 class LengthCombo;
29
30 namespace lyx {
31
32 std::string makeFontName(std::string const & family, std::string const & foundry);
33
34 std::pair<std::string,std::string> parseFontName(std::string const & name);
35
36 /// method to get a LyXLength from widgets (LengthCombo)
37 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
38 /// method to get a LyXLength from widgets (QComboBox)
39 LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
40
41 /// method to set widgets from a LyXLength
42 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
43         std::string const & len, LyXLength::UNIT default_unit);
44
45 /// format a string to the given width
46 docstring const formatted(docstring const & text, int w = 80);
47
48
49 /**
50  * qt_ - i18nize string and convert to QString
51  *
52  * Use this in qt4/ instead of _()
53  */
54 QString const qt_(char const * str, const char * comment = 0);
55
56
57 /**
58  * qt_ - i18nize string and convert to QString
59  *
60  * Use this in qt4/ instead of _()
61  */
62 QString const qt_(std::string const & str);
63
64 } // namespace lyx
65
66 #endif // QTHELPERS_H