Mercurial > octave
annotate libgui/src/qt-utils.h @ 33661:4c378dd47cf2 default tip @
command-widget: Use new signal-slot syntax for better compiler diagnostics.
* libgui/src/command-widget.cc (console::console): Use new signal-slot syntax
for better compiler diagnostics.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Wed, 12 Jun 2024 17:24:20 +0200 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 // Copyright (C) 2020-2024 The Octave Project Developers |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 // This file is part of Octave. |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 // (at your option) any later version. |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 // GNU General Public License for more details. |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 // |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if ! defined (octave_qt_utils_h) |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #define octave_qt_utils_h 1 |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include <list> |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
31 #include <QFontMetrics> |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <QList> |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
34 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
35 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
36 template <typename T> |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
37 inline QList<T> |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
38 std_list_to_qt_list (const std::list<T>& lst) |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
39 { |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #if defined (HAVE_QLIST_ITERATOR_CONSTRUCTOR) |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
41 return QList<T> (lst.begin (), lst.end ()); |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 #else |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
43 return QList<T>::fromStdList (lst); |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 #endif |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
45 } |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
46 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
47 inline int |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
48 qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, QChar ch) |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
49 { |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
50 #if defined (HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE) |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
51 return fm.horizontalAdvance (ch); |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
52 #else |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
53 return fm.width (ch); |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
54 #endif |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
55 } |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
56 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
57 inline int |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
58 qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
59 const QString& text, int len = -1) |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
60 { |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
61 #if defined (HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE) |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
62 return fm.horizontalAdvance (text, len); |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
63 #else |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
64 return fm.width (text, len); |
28571
dea121672378
avoid deprecated Qt QFontMetrics::width function
John W. Eaton <jwe@octave.org>
parents:
28566
diff
changeset
|
65 #endif |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
66 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
67 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
68 OCTAVE_END_NAMESPACE(octave) |
28566
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 |
20ee8aa92897
avoid QList deprecated function warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 #endif |