Mercurial > octave
annotate libgui/graphics/EditControl.cc @ 31649:deb553ac2c54
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2022 15:45:27 -0500 |
parents | 431f80aba37a 29d734430e5f |
children | 5f11de0e7440 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2011-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <QLineEdit> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include "Container.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include "EditControl.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include "TextEdit.h" |
18505
fb96b7f55242
rename file to avoid clash on case-insenstive filesystems (bug #41658)
John W. Eaton <jwe@octave.org>
parents:
18501
diff
changeset
|
35 #include "QtHandlesUtils.h" |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
37 OCTAVE_BEGIN_NAMESPACE(octave) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29992
diff
changeset
|
39 EditControl * |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
40 EditControl::create (octave::interpreter& interp, const graphics_object& go) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
41 { |
27647
2a506bc4a7af
eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27645
diff
changeset
|
42 Object *parent = parentObject (interp, go); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
44 if (parent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
45 { |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
46 Container *container = parent->innerContainer (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
48 if (container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
49 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
50 uicontrol::properties& up = Utils::properties<uicontrol> (go); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
52 if ((up.get_max () - up.get_min ()) > 1) |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
53 return new EditControl (interp, go, |
27647
2a506bc4a7af
eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27645
diff
changeset
|
54 new TextEdit (container)); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
55 else |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
56 return new EditControl (interp, go, |
27647
2a506bc4a7af
eliminate global access to Octave interpreter in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27645
diff
changeset
|
57 new QLineEdit (container)); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
58 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
59 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
61 return nullptr; |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
62 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
64 EditControl::EditControl (octave::interpreter& interp, |
27645
028205a91a07
eliminate global access to Octave resources in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27319
diff
changeset
|
65 const graphics_object& go, QLineEdit *edit) |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
66 : BaseControl (interp, go, edit), m_multiLine (false), |
27645
028205a91a07
eliminate global access to Octave resources in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27319
diff
changeset
|
67 m_textChanged (false) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
68 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
69 init (edit); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
70 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
72 void |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
73 EditControl::init (QLineEdit *edit, bool callBase) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
74 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
75 if (callBase) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
76 BaseControl::init (edit, callBase); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
78 m_multiLine = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
79 initCommon (edit); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
81 uicontrol::properties& up = properties<uicontrol> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 |
28244
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
83 if (up.enable_is ("inactive")) |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
84 edit->setReadOnly (true); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
85 else |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
86 edit->setEnabled (up.enable_is ("on")); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
87 edit->setText (Utils::fromStdString (up.get_string_string ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
88 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
89 up.get_verticalalignment ())); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
91 connect (edit, &QLineEdit::textEdited, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
92 this, &EditControl::textChanged); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
93 connect (edit, &QLineEdit::editingFinished, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
94 this, &EditControl::editingFinished); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
95 connect (edit, &QLineEdit::returnPressed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
96 this, &EditControl::returnPressed); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
97 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
99 EditControl::EditControl (octave::interpreter& interp, |
27645
028205a91a07
eliminate global access to Octave resources in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27319
diff
changeset
|
100 const graphics_object& go, TextEdit *edit) |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
101 : BaseControl (interp, go, edit), m_multiLine (true), |
27645
028205a91a07
eliminate global access to Octave resources in qt graphics classes
John W. Eaton <jwe@octave.org>
parents:
27319
diff
changeset
|
102 m_textChanged (false) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
103 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
104 init (edit); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
105 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
107 void |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
108 EditControl::init (TextEdit *edit, bool callBase) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
109 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
110 if (callBase) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
111 BaseControl::init (edit, callBase); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
113 m_multiLine = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
114 initCommon (edit); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
116 uicontrol::properties& up = properties<uicontrol> (); |
19595
be7ac98fab43
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18505
diff
changeset
|
117 |
28244
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
118 if (up.enable_is ("inactive")) |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
119 edit->setReadOnly (true); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
120 else |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
121 edit->setEnabled (up.enable_is ("on")); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
122 edit->setAcceptRichText (false); |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
123 edit->setPlainText (Utils::fromStringVector |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
124 (up.get_string_vector ()).join ("\n")); |
28234
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
125 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
126 up.get_verticalalignment ())); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
127 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
128 connect (edit, &TextEdit::textChanged, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
129 this, &EditControl::textChanged); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
130 connect (edit, &TextEdit::editingFinished, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
131 this, &EditControl::editingFinished); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
132 connect (edit, &TextEdit::returnPressed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
133 this, &EditControl::returnPressed); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
134 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
136 EditControl::~EditControl (void) |
22417
48c00363dc74
maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents:
22413
diff
changeset
|
137 { } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
139 void |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29992
diff
changeset
|
140 EditControl::initCommon (QWidget *) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
141 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
142 m_textChanged = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
143 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
144 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
145 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
146 EditControl::update (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
147 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
148 bool handled = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
150 if (m_multiLine) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
151 handled = updateMultiLine (pId); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
152 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
153 handled = updateSingleLine (pId); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
155 if (! handled) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
156 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
157 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
158 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
159 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
160 BaseControl::update (pId); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
161 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
162 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
163 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
164 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
166 bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
167 EditControl::updateSingleLine (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
168 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
169 uicontrol::properties& up = properties<uicontrol> (); |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
170 QLineEdit *edit = qWidget<QLineEdit> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
172 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
173 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
174 case uicontrol::properties::ID_STRING: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
175 edit->setText (Utils::fromStdString (up.get_string_string ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
176 return true; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
177 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
178 case uicontrol::properties::ID_HORIZONTALALIGNMENT: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
179 case uicontrol::properties::ID_VERTICALALIGNMENT: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
180 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
181 up.get_verticalalignment ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
182 return true; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
183 |
28244
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
184 case uicontrol::properties::ID_ENABLE: |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
185 if (up.enable_is ("inactive")) |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
186 edit->setReadOnly (true); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
187 else |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
188 { |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
189 edit->setReadOnly (false); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
190 edit->setEnabled (up.enable_is ("on")); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
191 } |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
192 return true; |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
193 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
194 case uicontrol::properties::ID_MIN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
195 case uicontrol::properties::ID_MAX: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
196 if ((up.get_max () - up.get_min ()) > 1) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
197 { |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
198 QWidget *container = edit->parentWidget (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
199 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
200 delete edit; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
201 init (new TextEdit (container), true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
202 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
203 return true; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
204 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
205 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
206 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
207 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
208 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
209 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
210 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
212 bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
213 EditControl::updateMultiLine (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
214 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
215 uicontrol::properties& up = properties<uicontrol> (); |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
216 TextEdit *edit = qWidget<TextEdit> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
218 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
219 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
220 case uicontrol::properties::ID_STRING: |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
221 edit->setPlainText (Utils::fromStringVector |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
222 (up.get_string_vector ()).join ("\n")); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
223 return true; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
224 |
28234
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
225 case uicontrol::properties::ID_HORIZONTALALIGNMENT: |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
226 case uicontrol::properties::ID_VERTICALALIGNMENT: |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
227 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
228 up.get_verticalalignment ())); |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
229 return true; |
2757f267a198
Implement "HorizontalAlignment" property for multi-line "Edit" uicontrols (bug #58224).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
230 |
28244
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
231 case uicontrol::properties::ID_ENABLE: |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
232 if (up.enable_is ("inactive")) |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
233 edit->setReadOnly (true); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
234 else |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
235 { |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
236 edit->setReadOnly (false); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
237 edit->setEnabled (up.enable_is ("on")); |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
238 } |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
239 return true; |
cba489221bab
Implement Enable property values "inactive" and "off" for uicontrol Edit (bug #57128)
Rik <rik@octave.org>
parents:
28234
diff
changeset
|
240 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
241 case uicontrol::properties::ID_MIN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
242 case uicontrol::properties::ID_MAX: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
243 if ((up.get_max () - up.get_min ()) <= 1) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
244 { |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
245 QWidget *container = edit->parentWidget (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
246 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
247 delete edit; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
248 init (new QLineEdit (container), true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
249 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
250 return true; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
251 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
252 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
253 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
254 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
255 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
256 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
257 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
258 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
259 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
260 EditControl::textChanged (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
261 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
262 m_textChanged = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
263 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
264 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
265 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
266 EditControl::returnPressed (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
267 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
268 QString txt = (m_multiLine |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
269 ? qWidget<TextEdit> ()->toPlainText () |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
270 : qWidget<QLineEdit> ()->text ()); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
271 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
272 if (m_textChanged) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
273 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
274 if (m_multiLine) |
27319
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
275 emit gh_set_event (m_handle, "string", |
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
276 Utils::toCellString (txt.split ("\n")), false); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
277 else |
27319
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
278 emit gh_set_event (m_handle, "string", |
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
279 Utils::toStdString (txt), false); |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
280 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
281 m_textChanged = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
282 } |
20011
2535b9ffa2fc
Qt EditControl: do callback always on return pressed (Bug #44690)
John Donoghue
parents:
20003
diff
changeset
|
283 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
284 if (txt.length () > 0) |
27319
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
285 emit gh_callback_event (m_handle, "callback"); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
286 } |
20011
2535b9ffa2fc
Qt EditControl: do callback always on return pressed (Bug #44690)
John Donoghue
parents:
20003
diff
changeset
|
287 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
288 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
289 EditControl::editingFinished (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
290 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
291 if (m_textChanged) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
292 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
293 QString txt = (m_multiLine |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
294 ? qWidget<TextEdit> ()->toPlainText () |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
295 : qWidget<QLineEdit> ()->text ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
296 if (m_multiLine) |
27319
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
297 emit gh_set_event (m_handle, "string", |
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
298 Utils::toCellString (txt.split ("\n")), false); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
299 else |
27319
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
300 emit gh_set_event (m_handle, "string", Utils::toStdString (txt), |
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
301 false); |
6b2d20317b26
use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
302 emit gh_callback_event (m_handle, "callback"); |
20011
2535b9ffa2fc
Qt EditControl: do callback always on return pressed (Bug #44690)
John Donoghue
parents:
20003
diff
changeset
|
303 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
304 m_textChanged = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
305 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
306 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
307 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
308 OCTAVE_END_NAMESPACE(octave) |