Warning, /sdk/clazy/tests/qt6-deprecated-api-fixes/main.cpp.fixed.expected is written in an unsupported language. File is not indexed.
0001 #include <QtCore/QTextStream> 0002 #include <QtCore/QCalendar> 0003 #include <QtCore/QDateTime> 0004 #include <QtCore/QDir> 0005 #include <QtCore/QHash> 0006 #include <QtCore/QLinkedList> 0007 #include <QtCore/QMap> 0008 #include <QtCore/QProcess> 0009 #include <QtCore/QResource> 0010 #include <QtCore/QSet> 0011 #include <QtCore/QSignalMapper> 0012 #include <QtCore/QTimeLine> 0013 #include <QtWidgets/QButtonGroup> 0014 #include <QtWidgets/QComboBox> 0015 #include <QtWidgets/QDirModel> 0016 #include <QtWidgets/QDockWidget> 0017 #include <QtWidgets/QGraphicsView> 0018 #include <QtWidgets/QMacCocoaViewContainer> 0019 #include <QtWidgets/QMacNativeWidget> 0020 #include <QtWidgets/QSplashScreen> 0021 #include <QtWidgets/QStyle> 0022 #include <QtWidgets/QTextBrowser> 0023 #include <QtWidgets/QWizard> 0024 0025 class my_Class 0026 { 0027 public: 0028 QDir m_dir; 0029 QDir *m_dir_bis; 0030 QVariant m_variant; 0031 }; 0032 #define MYSTRING "myDirPath" 0033 0034 void test() 0035 { 0036 QDir dir; 0037 dir.setPath("myStuff"); 0038 0039 QDir d; 0040 QFileInfo fi; 0041 d.setPath(fi.absolutePath()); 0042 0043 my_Class test_class; 0044 test_class.m_dir.setPath("name"); 0045 0046 my_Class* test_class_bis = new my_Class; 0047 test_class_bis->m_dir.setPath(("name")); 0048 0049 test_class.m_dir_bis->setPath("name"); 0050 0051 QDir dir2; 0052 dir2.setPath(MYSTRING); 0053 0054 QDir dir3; 0055 dir3.setPath("my" "Stuff"); 0056 0057 QDir dir4; 0058 char *pathName = "myStuff"; 0059 dir4.setPath(pathName); 0060 0061 QDir dir5; 0062 bool cond = true; 0063 dir5.setPath(cond ? "mystuff" : "yourStuff"); 0064 0065 QDir dir6; 0066 dir6.setPath(true ? (cond ? "path1" : "path2") : (cond ? "path3" : "path4")); 0067 0068 QDir *dir7 = new QDir("apath"); 0069 dir7->setPath("adir"); 0070 dir7->setPath("adir"); 0071 0072 QDir::addResourceSearchPath("somePath1"); 0073 dir6.addResourceSearchPath("somePath2"); 0074 0075 QMap<QString, QString> m; 0076 m.insertMulti("foo", "bar"); 0077 QList<QString> m_keys= m.uniqueKeys(); 0078 QList<QString> m_list= m.values(); 0079 QMap<QString, QString> mm; 0080 m.unite(mm); 0081 0082 QProcess pp; 0083 pp.startCommand("stringContainingACommandWithArguments"); 0084 pp.execute("stringContainingACommandWithArguments"); 0085 pp.startDetached("stringContainingACommandWithArguments"); 0086 0087 QResource rr; 0088 bool a_bool = rr.compressionAlgorithm(); 0089 0090 uint matchtype = 4; 0091 if (matchtype == Qt::MatchRegularExpression) 0092 matchtype = 0; 0093 0094 QTextStream out; 0095 out << "blabla" << Qt::endl; 0096 out << Qt::hex << Qt::endl; 0097 0098 QString a_string = "eeoaaoii"; 0099 QString sep = "o"; 0100 QStringList my_list = a_string.split(sep, Qt::KeepEmptyParts); 0101 QStringList my_list2 = a_string.split(sep, Qt::KeepEmptyParts); 0102 Qt::SplitBehavior behavior = Qt::KeepEmptyParts; 0103 0104 QSet<QString> my_set; 0105 QSet<QString>::iterator it_set = my_set.begin(); 0106 QSet<QString>::const_iterator cit_set = my_set.cbegin(); 0107 --it_set; 0108 it_set + 1; 0109 it_set - 1; 0110 it_set += 1; 0111 it_set -= 1; 0112 ++it_set; //ok 0113 cit_set -= 2; 0114 cit_set += 1; 0115 cit_set + 1; 0116 cit_set - 1; 0117 0118 QSetIterator<QString> i(my_set); 0119 i.hasPrevious(); 0120 i.previous(); 0121 i.peekPrevious(); 0122 i.findPrevious(a_string); 0123 0124 QSet<int> s; 0125 s << 1 << 17 << 61 << 127 << 911; 0126 s.rbegin(); 0127 s.rend(); 0128 s.crbegin(); 0129 s.crend(); 0130 0131 int my_int = 2; 0132 QWidget* my_qwidget; 0133 QObject* my_qobject; 0134 QSignalMapper sigMap; 0135 sigMap.mappedInt(1); 0136 sigMap.mappedInt(my_int); 0137 sigMap.mappedString("astring"); 0138 sigMap.mappedString(a_string); 0139 sigMap.mappedObject(my_qwidget); 0140 sigMap.mappedObject(my_qobject); 0141 0142 QHash<QString, QString> my_hash; 0143 QHash<QString, QString>::iterator it_hash = my_hash.begin(); 0144 QHash<QString, QString>::const_iterator cit_hash = my_hash.cbegin(); 0145 --it_hash; 0146 it_hash + 1; 0147 it_hash - 1; 0148 it_hash += 1; 0149 it_hash -= 1; 0150 ++it_hash; //ok 0151 cit_hash -= 2; 0152 cit_hash += 1; 0153 cit_hash + 1; 0154 cit_hash - 1; 0155 0156 QHashIterator<QString, QString> ih(my_hash); 0157 ih.hasPrevious(); 0158 ih.previous(); 0159 ih.peekPrevious(); 0160 ih.findPrevious(a_string); 0161 0162 QLinkedList<QString> linkList; 0163 0164 qrand(); 0165 qsrand(1); 0166 0167 QTimeLine timeline; 0168 timeline.setCurveShape(QTimeLine::CurveShape::EaseInCurve); 0169 timeline.curveShape(); 0170 0171 QDate myDate; 0172 QDate *myOtherDate = new QDate(); 0173 QCalendar myCalendar; 0174 myDate.toString(Qt::DateFormat::TextDate); 0175 myDate.toString("format", myCalendar); 0176 QDateTime myDateTime = myDate.startOfDay(); 0177 myDateTime = myOtherDate->startOfDay(); 0178 0179 QVariant var1; 0180 QVariant *var3; 0181 QVariant var2; 0182 bool bool1 = QVariant::compare(var1, var2) > 0; 0183 bool bool2 = (QVariant::compare(var1, (var2)) >= 0); 0184 bool bool3 = (QVariant::compare((*var3), var2) < 0); 0185 bool bool4 = (QVariant::compare(*var3, var2) <= 0); 0186 bool bool5 = (QVariant::compare(*var3, test_class.m_variant) <= 0); 0187 bool bool6 = (QVariant::compare(test_class_bis->m_variant, test_class.m_variant) <= 0); 0188 0189 0190 } 0191 0192 void function1(QLinkedList<QString> arg) {}; 0193 QLinkedList<QString> function2() { return {}; }; 0194 0195 class aclass 0196 { 0197 public: 0198 QLinkedList<QString> m_linkList; 0199 void m_function1(QLinkedList<QString> arg) {}; 0200 }; 0201 0202 namespace Qt { 0203 void test_1() { 0204 uint matchtype = 4; 0205 if (matchtype == MatchRegularExpression) 0206 matchtype = 0; 0207 QTextStream out; 0208 out << "blabla" << endl; 0209 out << hex << endl; 0210 0211 QString a_string = "eeoaaoii"; 0212 QString sep = "o"; 0213 QStringList my_list = a_string.split(sep, KeepEmptyParts); 0214 SplitBehavior behavior = KeepEmptyParts; 0215 0216 } 0217 } 0218 0219 void test_widgets() 0220 { 0221 QWizard wizard; 0222 wizard.visitedIds(); 0223 0224 QButtonGroup buttonGroup; 0225 buttonGroup.idClicked(1); 0226 buttonGroup.idPressed(1); 0227 buttonGroup.idReleased(1); 0228 buttonGroup.idToggled(1, true); 0229 0230 QComboBox combobox; 0231 combobox.setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLength); 0232 QString astring = "asdf"; 0233 combobox.currentIndexChanged(astring); 0234 combobox.textActivated(astring); 0235 combobox.textHighlighted(astring); 0236 0237 QMacCocoaViewContainer *cocoa = NULL; 0238 QMacNativeWidget *native = NULL; 0239 0240 QWidget *a_widget = NULL; 0241 QSplashScreen *splash1 = new QSplashScreen(a_widget); 0242 QScreen *a_screen = NULL; 0243 QSplashScreen *splash2 = new QSplashScreen(a_screen); 0244 0245 QTextBrowser browser; 0246 QString a_string = "aaa"; 0247 browser.highlighted(a_string); 0248 QUrl a_url; 0249 browser.highlighted(a_url); 0250 0251 QDockWidget dock; 0252 dock.setFeatures(QDockWidget::AllDockWidgetFeatures); 0253 0254 QDirModel dirModel; 0255 0256 QGraphicsView graphview; 0257 QMatrix matrix = graphview.matrix(); 0258 graphview.setMatrix(matrix); 0259 graphview.resetMatrix(); 0260 0261 QStyle *style = NULL; 0262 style->pixelMetric(QStyle::PixelMetric::PM_DefaultTopLevelMargin); 0263 style->pixelMetric(QStyle::PixelMetric::PM_DefaultChildMargin); 0264 style->pixelMetric(QStyle::PixelMetric::PM_DefaultLayoutSpacing); 0265 style->subElementRect(QStyle::SubElement::SE_DialogButtonBoxLayoutItem, NULL); 0266 0267 } 0268 0269 void func_coco (QMacCocoaViewContainer *cocoa) {} 0270 void func_native (QMacNativeWidget *native){}