Debian Codegraph @

tests/qt6-deprecated-api-fixes/main.cpp.fixed.expected

raw
1 #include <QtCore/QTextStream>
2 #include <QtCore/QCalendar>
3 #include <QtCore/QDateTime>
4 #include <QtCore/QDir>
5 #include <QtCore/QHash>
6 #include <QtCore/QLinkedList>
7 #include <QtCore/QMap>
8 #include <QtCore/QProcess>
9 #include <QtCore/QResource>
10 #include <QtCore/QSet>
11 #include <QtCore/QSignalMapper>
12 #include <QtCore/QTimeLine>
13 #include <QtWidgets/QButtonGroup>
14 #include <QtWidgets/QComboBox>
15 #include <QtWidgets/QDirModel>
16 #include <QtWidgets/QDockWidget>
17 #include <QtWidgets/QGraphicsView>
18 #include <QtWidgets/QMacCocoaViewContainer>
19 #include <QtWidgets/QMacNativeWidget>
20 #include <QtWidgets/QSplashScreen>
21 #include <QtWidgets/QStyle>
22 #include <QtWidgets/QTextBrowser>
23 #include <QtWidgets/QWizard>
24
25 class my_Class
26 {
27 public:
28 QDir m_dir;
29 QDir *m_dir_bis;
30 QVariant m_variant;
31 };
32 #define MYSTRING "myDirPath"
33
34 void test()
35 {
36 QDir dir;
37 dir.setPath("myStuff");
38
39 QDir d;
40 QFileInfo fi;
41 d.setPath(fi.absolutePath());
42
43 my_Class test_class;
44 test_class.m_dir.setPath("name");
45
46 my_Class* test_class_bis = new my_Class;
47 test_class_bis->m_dir.setPath(("name"));
48 test_class.m_dir_bis->setPath("name");
49
50 QDir dir2;
51 dir2.setPath(MYSTRING);
52 dir2 = dir;
53
54 QDir dir3;
55 dir3.setPath("my" "Stuff");
56
57 QDir dir4;
58 char *pathName = "myStuff";
59 dir4.setPath(pathName);
60
61 QDir dir5;
62 bool cond = true;
63 dir5.setPath(cond ? "mystuff" : "yourStuff");
64
65 QDir dir6;
66 dir6.setPath(true ? (cond ? "path1" : "path2") : (cond ? "path3" : "path4"));
67
68 QDir *dir7 = new QDir("apath");
69 dir7->setPath("adir");
70 dir7->setPath("adir");
71
72 QDir::addResourceSearchPath("somePath1");
73 dir6.addResourceSearchPath("somePath2");
74
75 QMap<QString, QString> m;
76 m.insertMulti("foo", "bar");
77 QList<QString> m_keys= m.uniqueKeys();
78 QList<QString> m_list= m.values();
79 QMap<QString, QString> mm;
80 m.unite(mm);
81
82 QProcess pp;
83 pp.start("stringContainingACommandWithArguments");
84 pp.execute("stringContainingACommandWithArguments");
85 pp.startDetached("stringContainingACommandWithArguments");
86
87 QResource rr;
88 bool a_bool = rr.compressionAlgorithm();
89
90 uint matchtype = 4;
91 if (matchtype == Qt::MatchRegularExpression)
92 matchtype = 0;
93
94 QTextStream out;
95 out << "blabla" << Qt::endl;
96 out << Qt::hex << Qt::endl;
97
98 QString a_string = "eeoaaoii";
99 QString sep = "o";
100 QStringList my_list = a_string.split(sep, Qt::KeepEmptyParts);
101 QStringList my_list2 = a_string.split(sep, Qt::KeepEmptyParts);
102 Qt::SplitBehavior behavior = Qt::KeepEmptyParts;
103
104 QSet<QString> my_set;
105 QSet<QString>::iterator it_set = my_set.begin();
106 QSet<QString>::const_iterator cit_set = my_set.cbegin();
107 --it_set;
108 it_set + 1;
109 it_set - 1;
110 it_set += 1;
111 it_set -= 1;
112 ++it_set; //ok
113 cit_set -= 2;
114 cit_set += 1;
115 cit_set + 1;
116 cit_set - 1;
117
118 QSetIterator<QString> i(my_set);
119 i.hasPrevious();
120 i.previous();
121 i.peekPrevious();
122 i.findPrevious(a_string);
123
124 QSet<int> s;
125 s << 1 << 17 << 61 << 127 << 911;
126 s.rbegin();
127 s.rend();
128 s.crbegin();
129 s.crend();
130
131 int my_int = 2;
132 QWidget* my_qwidget;
133 QObject* my_qobject;
134 QSignalMapper sigMap;
135 sigMap.mappedInt(1);
136 sigMap.mappedInt(my_int);
137 sigMap.mappedString("astring");
138 sigMap.mappedString(a_string);
139 sigMap.mappedObject(my_qwidget);
140 sigMap.mappedObject(my_qobject);
141
142 QHash<QString, QString> my_hash;
143 QHash<QString, QString>::iterator it_hash = my_hash.begin();
144 QHash<QString, QString>::const_iterator cit_hash = my_hash.cbegin();
145 --it_hash;
146 it_hash + 1;
147 it_hash - 1;
148 it_hash += 1;
149 it_hash -= 1;
150 ++it_hash; //ok
151 cit_hash -= 2;
152 cit_hash += 1;
153 cit_hash + 1;
154 cit_hash - 1;
155
156 QHashIterator<QString, QString> ih(my_hash);
157 ih.hasPrevious();
158 ih.previous();
159 ih.peekPrevious();
160 ih.findPrevious(a_string);
161
162 QLinkedList<QString> linkList;
163
164 qrand();
165 qsrand(1);
166
167 QTimeLine timeline;
168 timeline.setCurveShape(QTimeLine::CurveShape::EaseInCurve);
169 timeline.curveShape();
170
171 QDate myDate;
172 QDate *myOtherDate = new QDate();
173 QCalendar myCalendar;
174 myDate.toString(Qt::DateFormat::TextDate);
175 myDate.toString("format", myCalendar);
176 QDateTime myDateTime = myDate.startOfDay();
177 myDateTime = myOtherDate->startOfDay();
178
179 QVariant var1;
180 QVariant *var3;
181 QVariant var2;
182 bool bool1 = QVariant::compare(var1, var2) > 0;
183 bool bool2 = (QVariant::compare(var1, (var2)) >= 0);
184 bool bool3 = (QVariant::compare((*var3), var2) < 0);
185 bool bool4 = (QVariant::compare(*var3, var2) <= 0);
186 bool bool5 = (QVariant::compare(*var3, test_class.m_variant) <= 0);
187 bool bool6 = (QVariant::compare(test_class_bis->m_variant, test_class.m_variant) <= 0);
188
189
190 }
191
192 void function1(QLinkedList<QString> arg) {};
193 QLinkedList<QString> function2() { return {}; };
194
195 class aclass
196 {
197 public:
198 QLinkedList<QString> m_linkList;
199 void m_function1(QLinkedList<QString> arg) {};
200 };
201
202 namespace Qt {
203 void test_1() {
204 uint matchtype = 4;
205 if (matchtype == MatchRegularExpression)
206 matchtype = 0;
207 QTextStream out;
208 out << "blabla" << endl;
209 out << hex << endl;
210
211 QString a_string = "eeoaaoii";
212 QString sep = "o";
213 QStringList my_list = a_string.split(sep, KeepEmptyParts);
214 SplitBehavior behavior = KeepEmptyParts;
215
216 }
217 }
218
219 void test_widgets()
220 {
221 QWizard wizard;
222 wizard.visitedIds();
223
224 QButtonGroup buttonGroup;
225 buttonGroup.idClicked(1);
226 buttonGroup.idPressed(1);
227 buttonGroup.idReleased(1);
228 buttonGroup.idToggled(1, true);
229
230 QComboBox combobox;
231 combobox.setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLength);
232 QString astring = "asdf";
233 combobox.currentIndexChanged(astring);
234 combobox.textActivated(astring);
235 combobox.textHighlighted(astring);
236
237 QMacCocoaViewContainer *cocoa = NULL;
238 QMacNativeWidget *native = NULL;
239
240 QWidget *a_widget = NULL;
241 QSplashScreen *splash1 = new QSplashScreen(a_widget);
242 QScreen *a_screen = NULL;
243 QSplashScreen *splash2 = new QSplashScreen(a_screen);
244
245 QTextBrowser browser;
246 QString a_string = "aaa";
247 browser.highlighted(a_string);
248 QUrl a_url;
249 browser.highlighted(a_url);
250
251 QDockWidget dock;
252 dock.setFeatures(QDockWidget::AllDockWidgetFeatures);
253
254 QDirModel dirModel;
255
256 QGraphicsView graphview;
257 QMatrix matrix = graphview.matrix();
258 graphview.setMatrix(matrix);
259 graphview.resetMatrix();
260
261 QStyle *style = NULL;
262 style->pixelMetric(QStyle::PixelMetric::PM_DefaultTopLevelMargin);
263 style->pixelMetric(QStyle::PixelMetric::PM_DefaultChildMargin);
264 style->pixelMetric(QStyle::PixelMetric::PM_DefaultLayoutSpacing);
265 style->subElementRect(QStyle::SubElement::SE_DialogButtonBoxLayoutItem, NULL);
266
267 }
268
269 void func_coco (QMacCocoaViewContainer *cocoa) {}
270 void func_native (QMacNativeWidget *native){}