From 9158f5a979fa36a944c736d64cdac2c4b6621a76 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 2 Aug 2011 10:54:43 +0200 Subject: Fix the lifespan of the test CA cert used by the autotests. The test CA I used for the QSslCertificate autotests had a short lifespan which meant that the tests now fail. See bug QTBUG-20582. This change gives it a lifespan of 10 years matching the leaf certificates. In addition, remove the temporary QEXPECT_FAIL statements. Change-Id: Ic1918e6e31f5cc755ec43d899663140ebe95a2a9 Merge-request: 37 Task-number: QTBUG-20582 Reviewed-by: Peter Hartmann Reviewed-on: http://codereview.qt.nokia.com/2548 Reviewed-by: Qt Sanity Bot --- .../more-certificates/test-cn-two-cns-cert.pem | 76 +++++++++++----------- .../more-certificates/test-cn-with-drink-cert.pem | 74 ++++++++++----------- tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 3 - tests/auto/qsslcertificate/verify-certs/cacert.pem | 30 ++++----- .../verify-certs/test-intermediate-ca-cert.pem | 74 ++++++++++----------- .../verify-certs/test-intermediate-is-ca-cert.pem | 56 ++++++++-------- .../verify-certs/test-intermediate-not-ca-cert.pem | 56 ++++++++-------- .../verify-certs/test-ocsp-good-cert.pem | 74 ++++++++++----------- 8 files changed, 220 insertions(+), 223 deletions(-) diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem b/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem index bc43c63f21..08176289d7 100644 --- a/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem +++ b/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority Validity - Not Before: Jun 21 21:32:19 2011 GMT - Not After : Jun 18 21:32:19 2021 GMT + Not Before: Jul 31 21:01:17 2011 GMT + Not After : Jul 28 21:01:17 2021 GMT Subject: CN=www.example.com, CN=www2.example.com, ST=Lancashire, C=UK, O=Some organisation Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:b8:b3:72:13:cd:17:2c:01:78:16:62:5d:72:71: - 33:14:41:be:0c:17:ac:85:db:f8:1e:e8:55:98:3e: - 7b:46:a5:08:a7:db:0e:dc:78:d8:b7:1e:e0:78:30: - 6e:b9:e2:43:2e:f2:7d:98:fb:b4:a8:5e:63:42:e8: - 5c:26:79:20:5e:f6:0e:1d:12:ac:c5:0e:a4:b6:68: - 79:5f:3d:52:ce:44:f9:20:c9:8e:b3:fb:20:42:d5: - 97:9f:a4:41:8f:b8:b1:8d:c3:14:61:70:b8:d1:f7: - ff:48:99:c1:a0:dd:71:cb:8b:91:e6:60:29:1e:af: - a9:00:91:d2:c3:af:7f:cd:f9 + 00:e8:61:96:bd:d0:d2:c6:54:92:15:fe:42:2b:86: + 20:dc:74:51:82:c8:b4:5e:5e:c5:3b:01:6e:1e:84: + 8d:4a:8c:6f:d8:63:21:a7:74:16:02:62:c3:84:1f: + ac:83:00:ad:6d:f8:79:d0:48:19:4a:a4:45:bf:24: + 88:db:89:f7:96:80:70:b1:f9:94:46:8d:52:cd:47: + 11:86:74:3b:04:c6:d2:08:3b:4d:70:b0:d4:a2:5a: + ae:54:43:4e:8c:26:05:77:b4:52:8b:bf:43:26:cd: + 6e:b6:04:ca:36:e1:cf:c3:70:52:7b:73:40:1d:1f: + 2a:44:b9:fc:d3:be:77:5a:df Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -29,39 +29,39 @@ Certificate: OCSP - URI:http://ocsp.example.com:8888/ Signature Algorithm: sha1WithRSAEncryption - 4c:c8:bc:0e:84:4b:bb:9e:c1:7b:81:4d:65:60:e5:d1:86:6a: - 00:f2:fb:ff:6d:a1:23:a1:88:c7:85:4a:b2:3d:24:cf:92:c8: - ab:60:10:b8:17:fa:d2:4f:60:cd:94:40:2a:b7:6e:4a:e9:f9: - 2b:e6:54:70:7f:f3:71:f8:fc:45:df:cf:43:f4:26:d6:73:69: - b3:ff:d9:da:dc:12:05:e2:52:62:2f:d4:b0:0a:e3:a1:e8:f2: - c1:80:b7:44:8e:3a:46:ca:1b:6d:82:c0:16:c2:f6:4f:56:89: - 24:86:42:8e:f9:5e:63:91:7d:88:ff:c4:bd:0d:f5:00:ad:ba: - 6c:fd:5d:02:32:4f:94:3f:4e:10:4a:a6:15:c2:77:e6:be:a0: - ea:15:e3:49:40:e8:f0:7d:e0:fe:33:f2:6b:36:a6:a6:70:52: - 21:d2:ff:ee:ce:2d:46:50:dd:c2:19:4d:9a:1a:f1:a8:e8:45: - 41:2d:6e:29:d3:c8:59:69:dd:1b:5c:21:21:31:b6:be:98:64: - 31:a2:3e:a6:36:9c:27:8f:86:bb:0e:aa:67:f1:0b:e1:ea:d6: - d6:50:72:6c:24:cd:85:8e:32:26:45:44:2e:7c:83:69:54:9b: - 8b:1b:94:71:ba:8e:49:77:dd:d1:d4:30:a6:56:80:95:5e:6b: - b8:11:bf:b0 + a7:ce:f4:72:aa:54:01:d5:a0:ef:fb:54:a5:79:d0:51:87:27: + 93:37:d7:a8:92:a0:51:a4:56:a6:93:ea:3b:f4:e2:07:68:29: + 2b:59:e6:eb:71:d8:78:0a:b2:e2:df:13:9f:68:f9:6b:d8:42: + c6:ff:3b:e1:2e:01:91:9b:eb:90:7f:da:54:7e:5a:47:ba:40: + 18:fb:a5:f7:8a:3a:b0:05:37:03:a8:b8:23:61:d4:58:37:97: + 87:54:57:62:aa:7f:e6:73:8f:74:f4:3b:57:29:af:bb:f7:bc: + 33:72:d4:f3:02:22:44:3e:70:1f:48:59:7d:6e:a0:af:c4:91: + 58:4c:99:6b:33:28:36:09:59:c7:71:a7:94:ba:0e:af:87:d2: + 47:75:86:c1:ac:2d:ab:89:83:03:a9:97:cb:50:39:c1:66:a3: + a2:92:f6:c8:42:05:5b:d3:e4:13:17:84:10:57:8f:3e:ae:d0: + 5e:f7:15:54:dd:04:61:2f:d6:d4:25:00:d6:6f:02:bb:b9:9f: + ff:ab:d2:a0:32:87:a0:d2:ff:91:29:bf:5d:74:61:d8:86:e5: + 89:29:5e:c0:85:b1:05:e1:79:68:50:fa:21:98:cc:26:09:d1: + 86:18:4d:2e:84:21:33:d1:ff:b5:bf:78:2d:0b:9e:8c:51:82: + 09:9c:03:ec -----BEGIN CERTIFICATE----- MIIDXjCCAkagAwIBAgIBCjANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xMTA2MjEyMTMyMTlaFw0yMTA2MTgyMTMyMTlaMHMx +aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMTdaFw0yMTA3MjgyMTAxMTdaMHMx GDAWBgNVBAMTD3d3dy5leGFtcGxlLmNvbTEZMBcGA1UEAxMQd3d3Mi5leGFtcGxl LmNvbTETMBEGA1UECBMKTGFuY2FzaGlyZTELMAkGA1UEBhMCVUsxGjAYBgNVBAoT -EVNvbWUgb3JnYW5pc2F0aW9uMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4 -s3ITzRcsAXgWYl1ycTMUQb4MF6yF2/ge6FWYPntGpQin2w7ceNi3HuB4MG654kMu -8n2Y+7SoXmNC6FwmeSBe9g4dEqzFDqS2aHlfPVLORPkgyY6z+yBC1ZefpEGPuLGN -wxRhcLjR9/9ImcGg3XHLi5HmYCker6kAkdLDr3/N+QIDAQABo0gwRjAJBgNVHRME +EVNvbWUgb3JnYW5pc2F0aW9uMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo +YZa90NLGVJIV/kIrhiDcdFGCyLReXsU7AW4ehI1KjG/YYyGndBYCYsOEH6yDAK1t ++HnQSBlKpEW/JIjbifeWgHCx+ZRGjVLNRxGGdDsExtIIO01wsNSiWq5UQ06MJgV3 +tFKLv0MmzW62BMo24c/DcFJ7c0AdHypEufzTvnda3wIDAQABo0gwRjAJBgNVHRME AjAAMDkGCCsGAQUFBwEBBC0wKzApBggrBgEFBQcwAYYdaHR0cDovL29jc3AuZXhh -bXBsZS5jb206ODg4OC8wDQYJKoZIhvcNAQEFBQADggEBAEzIvA6ES7uewXuBTWVg -5dGGagDy+/9toSOhiMeFSrI9JM+SyKtgELgX+tJPYM2UQCq3bkrp+SvmVHB/83H4 -/EXfz0P0JtZzabP/2drcEgXiUmIv1LAK46Ho8sGAt0SOOkbKG22CwBbC9k9WiSSG -Qo75XmORfYj/xL0N9QCtumz9XQIyT5Q/ThBKphXCd+a+oOoV40lA6PB94P4z8ms2 -pqZwUiHS/+7OLUZQ3cIZTZoa8ajoRUEtbinTyFlp3RtcISExtr6YZDGiPqY2nCeP -hrsOqmfxC+Hq1tZQcmwkzYWOMiZFRC58g2lUm4sblHG6jkl33dHUMKZWgJVea7gR -v7A= +bXBsZS5jb206ODg4OC8wDQYJKoZIhvcNAQEFBQADggEBAKfO9HKqVAHVoO/7VKV5 +0FGHJ5M316iSoFGkVqaT6jv04gdoKStZ5utx2HgKsuLfE59o+WvYQsb/O+EuAZGb +65B/2lR+Wke6QBj7pfeKOrAFNwOouCNh1Fg3l4dUV2Kqf+Zzj3T0O1cpr7v3vDNy +1PMCIkQ+cB9IWX1uoK/EkVhMmWszKDYJWcdxp5S6Dq+H0kd1hsGsLauJgwOpl8tQ +OcFmo6KS9shCBVvT5BMXhBBXjz6u0F73FVTdBGEv1tQlANZvAru5n/+r0qAyh6DS +/5Epv110YdiG5YkpXsCFsQXheWhQ+iGYzCYJ0YYYTS6EITPR/7W/eC0LnoxRggmc +A+w= -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem index 952b711aa2..ed8823a520 100644 --- a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem +++ b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority Validity - Not Before: Jun 26 19:36:40 2011 GMT - Not After : Jun 23 19:36:40 2021 GMT + Not Before: Jul 31 21:01:17 2011 GMT + Not After : Jul 28 21:01:17 2021 GMT Subject: CN=example.com/emailAddress=test@example.com/favouriteDrink=tequila Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:a5:88:9c:fd:1b:8d:26:90:7d:ed:b2:66:14:09: - 88:9f:c5:96:87:97:84:33:db:fd:a9:32:20:d0:4d: - 03:ce:34:a6:b3:e2:db:33:27:e5:5b:09:3b:6f:49: - 36:c8:99:63:88:4c:33:f2:55:bc:04:02:07:50:59: - 6a:34:52:4c:83:74:cb:d5:54:b5:a9:41:91:07:0e: - cf:50:3b:87:09:a5:5f:d8:71:f3:ee:d8:10:6d:5c: - 5d:69:ab:dc:98:d7:1a:38:63:c6:15:4e:d7:31:19: - 96:4c:db:be:d3:32:9d:ad:8b:1d:85:1b:aa:cf:d1: - b1:a4:ce:bf:5a:0f:30:a0:63 + 00:b8:2a:88:dd:a3:5b:4a:44:69:03:d5:6e:18:e9: + 9e:55:0d:35:d0:e6:9a:c2:cc:f8:b5:c5:b6:15:00: + a1:24:33:af:e8:fb:93:b9:cc:b9:22:28:ef:69:57: + b0:a2:d0:e3:9e:e5:73:3e:90:55:5b:91:26:0b:c4: + 1a:a6:b6:9d:a2:68:5b:e8:5b:45:3f:21:ff:84:64: + a7:84:bb:61:b7:72:e7:ea:cb:49:66:40:23:be:bf: + f0:8d:60:f2:fb:71:b2:fc:fe:6b:e7:07:94:35:65: + 66:d8:06:90:82:4d:b1:ba:6c:78:f4:42:17:cb:3c: + 0e:10:70:21:a9:31:3b:88:41 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -29,38 +29,38 @@ Certificate: OCSP - URI:http://ocsp.example.com:8888/ Signature Algorithm: sha1WithRSAEncryption - 21:55:2f:82:17:e6:8c:2c:39:af:2a:ce:b7:83:7f:cf:76:ce: - 25:39:b5:08:3c:9b:33:a2:9b:f7:3f:df:7d:67:7b:11:c7:e3: - ac:6f:59:c0:4f:25:3b:6d:3c:ec:3e:c2:0d:4c:a4:43:dd:4f: - c4:4c:5a:67:9d:a9:7a:91:c3:48:ed:40:5e:4d:6f:18:46:38: - 9c:e2:9a:7f:c9:d8:26:0c:35:fa:60:87:67:45:56:42:81:ba: - 4b:b6:03:6f:6c:7d:d1:f9:78:a1:08:9e:4a:f1:00:07:4b:ca: - ec:a4:1d:26:ad:63:46:63:5f:b2:64:2e:d3:cd:80:35:87:4f: - c4:16:1a:91:97:50:95:16:31:c5:97:49:70:19:68:a9:a8:6c: - 0f:c3:5b:8f:6a:1f:3f:e7:3b:ba:48:76:2c:b0:8d:b3:de:ce: - 7b:c7:bf:0f:80:34:7c:73:d5:d6:45:63:83:02:c5:4d:73:9b: - 66:8a:3a:66:dc:0c:9f:75:1a:a7:15:d1:1d:7f:12:af:f4:5d: - 9c:80:99:55:9b:26:69:ec:76:11:fe:4e:65:f7:57:7d:32:bb: - 9a:25:51:76:f5:68:99:2a:d2:a5:53:17:87:b6:ad:08:f1:24: - db:6f:45:07:d2:f1:60:50:ac:a0:d0:b7:0b:45:aa:e2:27:38: - 1f:4c:41:a3 + 4b:a3:3d:37:e4:fa:61:3b:8c:94:c7:b1:49:55:a6:63:c4:b8: + 13:33:8c:0b:ad:c9:f6:38:d1:a6:d3:5e:7f:10:23:be:d5:4c: + 63:de:15:9b:eb:f1:08:0c:32:95:ff:87:bc:c7:41:c3:17:af: + 73:c9:ac:18:2c:3d:6d:87:9b:41:71:92:e4:57:f0:da:b7:f4: + f3:92:dd:db:a0:b3:82:1a:8d:88:d4:ff:b2:8e:ac:65:6f:b0: + 59:0a:4e:cf:12:cd:fe:ce:35:85:da:13:1c:5e:d0:30:38:8a: + ec:46:eb:d7:a7:87:93:1b:08:a0:28:b0:2d:fc:7d:36:51:2f: + df:6b:67:57:15:b3:a7:cf:dd:55:ee:81:fc:66:fc:a7:22:5f: + e7:86:91:0b:3f:35:56:5f:fa:41:9c:71:06:03:d0:62:d2:3b: + e2:08:ab:af:42:2b:1f:68:9f:17:0a:20:3b:de:a1:fa:0a:44: + a8:67:67:c2:96:7a:ec:fa:92:4d:8f:c8:ba:be:d7:0c:c7:c8: + 6d:9f:b1:6c:c8:1d:e9:b9:5c:30:f3:a2:52:43:e5:43:2a:54: + 24:15:b3:d5:95:af:f8:01:ab:f3:c3:3f:1d:8e:35:58:11:6c: + 12:82:6f:ad:c3:78:c1:cd:43:ff:93:90:25:9f:97:17:36:8e: + 74:28:e8:a9 -----BEGIN CERTIFICATE----- MIIDOzCCAiOgAwIBAgIBCzANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xMTA2MjYxOTM2NDBaFw0yMTA2MjMxOTM2NDBaMFAx +aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMTdaFw0yMTA3MjgyMTAxMTdaMFAx FDASBgNVBAMTC2V4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1w bGUuY29tMRcwFQYKCZImiZPyLGQBBRMHdGVxdWlsYTCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEApYic/RuNJpB97bJmFAmIn8WWh5eEM9v9qTIg0E0DzjSms+Lb -MyflWwk7b0k2yJljiEwz8lW8BAIHUFlqNFJMg3TL1VS1qUGRBw7PUDuHCaVf2HHz -7tgQbVxdaavcmNcaOGPGFU7XMRmWTNu+0zKdrYsdhRuqz9GxpM6/Wg8woGMCAwEA +AAOBjQAwgYkCgYEAuCqI3aNbSkRpA9VuGOmeVQ010Oaawsz4tcW2FQChJDOv6PuT +ucy5IijvaVewotDjnuVzPpBVW5EmC8Qapradomhb6FtFPyH/hGSnhLtht3Ln6stJ +ZkAjvr/wjWDy+3Gy/P5r5weUNWVm2AaQgk2xumx49EIXyzwOEHAhqTE7iEECAwEA AaNIMEYwCQYDVR0TBAIwADA5BggrBgEFBQcBAQQtMCswKQYIKwYBBQUHMAGGHWh0 -dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3DQEBBQUAA4IBAQAh -VS+CF+aMLDmvKs63g3/Pds4lObUIPJszopv3P999Z3sRx+Osb1nATyU7bTzsPsIN -TKRD3U/ETFpnnal6kcNI7UBeTW8YRjic4pp/ydgmDDX6YIdnRVZCgbpLtgNvbH3R -+XihCJ5K8QAHS8rspB0mrWNGY1+yZC7TzYA1h0/EFhqRl1CVFjHFl0lwGWipqGwP -w1uPah8/5zu6SHYssI2z3s57x78PgDR8c9XWRWODAsVNc5tmijpm3AyfdRqnFdEd -fxKv9F2cgJlVmyZp7HYR/k5l91d9MruaJVF29WiZKtKlUxeHtq0I8STbb0UH0vFg -UKyg0LcLRariJzgfTEGj +dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3DQEBBQUAA4IBAQBL +oz035PphO4yUx7FJVaZjxLgTM4wLrcn2ONGm015/ECO+1Uxj3hWb6/EIDDKV/4e8 +x0HDF69zyawYLD1th5tBcZLkV/Dat/Tzkt3boLOCGo2I1P+yjqxlb7BZCk7PEs3+ +zjWF2hMcXtAwOIrsRuvXp4eTGwigKLAt/H02US/fa2dXFbOnz91V7oH8ZvynIl/n +hpELPzVWX/pBnHEGA9Bi0jviCKuvQisfaJ8XCiA73qH6CkSoZ2fClnrs+pJNj8i6 +vtcMx8htn7FsyB3puVww86JSQ+VDKlQkFbPVla/4Aavzwz8djjVYEWwSgm+tw3jB +zUP/k5Aln5cXNo50KOip -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index e0bc029c71..7e67d08cba 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -929,7 +929,6 @@ void tst_QSslCertificate::verify() toVerify = QSslCertificate::fromPath(SRCDIR "verify-certs/test-ocsp-good-cert.pem"); errors = QSslCertificate::verify(toVerify); - QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue); VERIFY_VERBOSE(errors.count() == 0); errors.clear(); @@ -965,12 +964,10 @@ void tst_QSslCertificate::verify() toVerify << QSslCertificate::fromPath(SRCDIR "verify-certs/test-intermediate-is-ca-cert.pem").first(); toVerify << QSslCertificate::fromPath(SRCDIR "verify-certs/test-intermediate-ca-cert.pem").first(); errors = QSslCertificate::verify(toVerify); - QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue); VERIFY_VERBOSE(errors.count() == 0); // Recheck the above with hostname validation errors = QSslCertificate::verify(toVerify, QLatin1String("example.com")); - QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue); VERIFY_VERBOSE(errors.count() == 0); // Recheck the above with a bad hostname diff --git a/tests/auto/qsslcertificate/verify-certs/cacert.pem b/tests/auto/qsslcertificate/verify-certs/cacert.pem index 0e06285766..8c75c54bcb 100644 --- a/tests/auto/qsslcertificate/verify-certs/cacert.pem +++ b/tests/auto/qsslcertificate/verify-certs/cacert.pem @@ -1,23 +1,23 @@ -----BEGIN CERTIFICATE----- -MIID6zCCAtOgAwIBAgIJALIOhqebAhS9MA0GCSqGSIb3DQEBBQUAMIGrMSYwJAYD +MIID6zCCAtOgAwIBAgIJAP4bjANFSx0BMA0GCSqGSIb3DQEBBQUAMIGrMSYwJAYD VQQDEx1XZXN0cG9pbnQgQ2VydGlmaWNhdGUgVGVzdCBDQTETMBEGA1UECBMKTGFu Y2FzaGlyZTELMAkGA1UEBhMCVUsxHTAbBgkqhkiG9w0BCQEWDmNhQGV4YW1wbGUu Y29tMUAwPgYDVQQKEzdXZXN0cG9pbnQgQ2VydGlmaWNhdGUgVGVzdCBSb290IENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTExMDYyNjE5MzYzOVoXDTExMDcyNjE5 -MzYzOVowgasxJjAkBgNVBAMTHVdlc3Rwb2ludCBDZXJ0aWZpY2F0ZSBUZXN0IENB +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTExMDczMTIxMDExNloXDTIxMDcyODIx +MDExNlowgasxJjAkBgNVBAMTHVdlc3Rwb2ludCBDZXJ0aWZpY2F0ZSBUZXN0IENB MRMwEQYDVQQIEwpMYW5jYXNoaXJlMQswCQYDVQQGEwJVSzEdMBsGCSqGSIb3DQEJ ARYOY2FAZXhhbXBsZS5jb20xQDA+BgNVBAoTN1dlc3Rwb2ludCBDZXJ0aWZpY2F0 ZSBUZXN0IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCoP3znXuxcIAWkyu51aPWwXYX0kSPnBO1gcJj6 -xQa4ycOHv9Cs9XTVTGvpj4aoc6lP+6/jUe14cVCR7018zHRe7u5g4ozO1aZqISqS -Y4hdWkTSFPmFoiyXkACl0ZGwcfv6QdFhNnK4COBrff4D6lndfQUZu8CnRYxlKGuR -1vGiUcJ88t0dDmMEFEdYNtlDnYlxXHbTS4VdRb2u3EGFzV24ENJwgqYuFrBAG/+N -TRXahWMsdfP0whCYJOsaNBwXaoeoxGlYz35gMU8A8AFmYOJLohsWqHcHmMV3X6hn -aKGnL3nOa8zlNKNr948Dwenucaggf5KquDCHVf2Ms+ROxlfTAgMBAAGjEDAOMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAGmY4+AeMyx+FkpPxeNY3DAH -Jys0WfndLZFABARYfKdJE1dqQi3uXaRkKMkV7npb46cw92jmwFT+v9rHd88UmgMs -KGJNWjARD6Ai1dzenMNYBJz9GFkDJ0Pr4Gqj2tR9JuzEOdxss+nZ4r6vhC+/yeAB -4jGT4QMuYU+14Rfsv5Aw0HjbcH955zTy1pJ6ck9OWWyzET8ALxz+RTFOok/4r4++ -yhE5Hh8+2aE52AcZqKa4hKXdVBCb9oewl93h3rmYcA/Yz36w+GRkSnOPZUgDDL5D -HKnICDidtf9ZZBZ4iJxaBg4iCraeuei20V+0g+9/1aoIWJ5TrelVYVCx8O0x+E0= +DQEBAQUAA4IBDwAwggEKAoIBAQC5xMKXviXuxFO67WzFIImO5RY3Y+dqt7maTB+p +JiHkn98rJoBB4J1cDnEUIs5ErO+kqOjW7JwF50fePNJ5K+I6SbRVn9gxAI59ZA6O +9UvOPZOw4/6GM24UY4B4mUcp8oXg9fhwgtjVhfXiMD2GvKQq3RazIiCoSW4aJWEq +L58Q+sIo+jL72qwk648xIwIhuC3XzcOOE/+rCOtZmu812/NN08UfsL2qup0aaaGv +aL36n6OIx5AYFcCD5uOxXAmUy14mhwQyDHAl6K42ghSm5b43VMMSQ+N9AQpentWl +RH6Vt1eY52YTxjNxpRlj88GBnYxdr8WgjKOV7v8OPGXP6zWlAgMBAAGjEDAOMAwG +A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADptDEfvsh8aq/tTc7ciGkHG +jh7WFELVTcdWBTyveZ24298Hl9UOfsAfLqjMGMs3delAaZocchba9Og2xSZyRstH +GUtlJXd4PnSJSx/TksPf2DCANo5sxBWBITs1Iprm3Nlm3/xPZM2QLIamRYi2J6Ed +JTfWvMpoaW1umJX49jKqk1gfdcS6eUSaXetgYP2FQV7DstqPLYfQ731nEXZ1LXFM +PO7IoPccqk4YJ0KOV7hFb7NCq4a6cz/Gf0S0qJ44vqHz6iRZpmWIo5UFivwtLw9r +iMbdJ1mCCMR0oN5om3muKc7Sz+l2ItxdYMcLkZ1/3ouvQqOX+qIOrYEUN1RZCzI= -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem b/tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem index ab4c2dacf6..d00490caba 100644 --- a/tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem +++ b/tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority Validity - Not Before: Jun 26 19:36:42 2011 GMT - Not After : Jun 23 19:36:42 2021 GMT + Not Before: Jul 31 21:01:18 2011 GMT + Not After : Jul 28 21:01:18 2021 GMT Subject: ST=Lancashire, C=UK/emailAddress=test@example.com, O=Test intermediate CA Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:a7:ed:3f:86:ee:ad:f8:b7:60:44:63:fc:1b:2c: - 79:3c:90:8b:47:b8:51:b5:3e:96:6d:5d:f1:97:b3: - de:90:b2:9a:aa:9e:54:7e:2b:b1:6d:91:ae:20:29: - b6:69:7b:8a:e5:6c:41:10:b6:d3:73:4c:20:30:38: - 57:c9:c8:ef:67:7e:76:39:c4:1c:df:6b:73:4e:2b: - 21:2d:79:5a:c5:60:5e:85:11:52:3b:8e:ef:b0:e5: - 2f:0c:e8:a3:fc:05:27:91:08:64:ea:2e:5a:f2:82: - 0c:08:48:bc:bc:ca:60:02:1c:6a:38:eb:c8:02:a6: - f7:e8:c8:31:20:29:e6:e4:8d + 00:bc:bd:83:c1:bc:36:d8:9c:74:68:5a:46:48:25: + 83:59:f8:35:1e:8f:dc:2c:52:3b:7c:2e:ea:40:c4: + 93:b6:39:31:df:f5:a6:f8:01:17:67:93:21:59:9b: + 89:7f:ed:2a:19:7b:25:a5:e1:71:12:99:e5:14:28: + df:75:b5:17:1c:3b:1d:3d:74:48:4f:b7:42:f4:3a: + ab:56:05:2b:fc:d3:27:97:01:08:5b:ad:26:9b:f2: + 87:51:9c:7e:e1:f1:ef:1c:bf:ad:7e:38:d9:76:89: + 30:a6:8c:2f:6f:87:9f:9e:57:13:14:b4:45:30:f3: + be:58:df:8a:d2:ee:7b:1d:89 Exponent: 65537 (0x10001) X509v3 extensions: Authority Information Access: @@ -29,38 +29,38 @@ Certificate: X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption - 94:1a:91:6a:05:41:0c:40:f9:46:35:e9:46:15:f1:3e:e4:d9: - 50:d6:0e:14:d8:1f:85:9e:a6:98:a2:db:db:ee:ff:56:55:6c: - 46:fd:0e:b0:03:79:a6:96:0f:c1:85:c3:3e:68:e0:17:10:a6: - 9c:10:34:88:96:f7:c8:ef:32:31:24:f4:3c:2d:eb:51:08:d6: - 87:83:f7:db:68:43:ed:d9:af:46:a2:48:74:d2:9d:c9:af:0f: - 29:42:ad:a2:cf:1e:ab:50:6f:ef:33:18:d3:07:ef:13:13:10: - 50:db:a9:56:db:f4:38:c1:db:05:fa:5a:67:92:72:69:fb:7a: - 5b:ec:d4:dd:fd:a2:21:06:59:b0:0d:48:5f:53:c1:65:94:aa: - d4:4e:1c:e8:9f:b4:7d:9b:10:85:4a:b6:be:df:d8:33:b5:72: - b0:ac:46:a9:67:55:1e:3e:58:a5:52:ed:b6:4a:cb:e9:d2:e5: - f8:fe:56:b4:2c:5e:9f:3c:d1:7f:b4:eb:05:8d:46:1f:47:32: - 2b:4f:2e:ac:8d:c3:3c:eb:f1:0c:2f:3a:e0:fa:46:0b:e4:c5: - f2:03:24:70:fc:ef:1a:fd:7b:a9:9c:d9:b6:4f:0e:74:07:52: - 23:eb:cd:66:61:67:a1:91:7f:76:a2:9d:42:54:d4:c6:5e:10: - 26:eb:37:e7 + 33:84:9d:0e:b2:59:04:dc:ef:e3:04:8b:00:6c:64:ea:58:9e: + 36:59:76:27:59:a0:b8:ee:0d:86:83:ff:db:65:eb:6c:1f:16: + 47:e7:f5:e6:c3:88:81:73:7e:ed:12:8d:7e:fd:5e:b1:5c:68: + 47:f8:f9:ca:e3:e0:c0:f3:12:b2:24:3b:77:2c:98:de:05:6d: + a8:ec:27:b8:af:ab:84:25:26:73:b4:58:4c:7c:c1:74:97:98: + ab:0e:e6:99:70:bc:38:b0:9a:e3:d9:5c:75:fa:46:d2:87:55: + 09:86:8f:ef:4a:e4:ef:3e:32:c6:ac:9d:27:86:29:b8:78:38: + 7b:87:6c:57:72:bd:57:99:73:36:db:fa:52:bd:7b:a7:05:cd: + 28:b8:85:fc:11:47:5e:c6:77:72:6a:fb:73:3e:8b:a4:6d:f8: + 17:f4:12:d5:36:e0:ef:5c:f8:b2:a1:69:3e:4c:cf:86:5f:63: + f6:02:60:95:7f:61:e8:cb:7f:14:66:da:36:2e:78:13:3e:68: + ae:3f:13:c1:79:88:18:18:3f:23:f3:9a:e1:e7:7e:ae:50:e4: + b7:80:76:31:92:74:79:2c:de:d0:74:fe:81:7c:f6:01:14:6a: + 1f:5f:88:85:6a:11:1d:50:af:f1:97:4d:67:40:c3:e9:ae:6f: + 60:e2:bc:e2 -----BEGIN CERTIFICATE----- MIIDUDCCAjigAwIBAgIBHDANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xMTA2MjYxOTM2NDJaFw0yMTA2MjMxOTM2NDJaMGIx +aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMThaFw0yMTA3MjgyMTAxMThaMGIx EzARBgNVBAgTCkxhbmNhc2hpcmUxCzAJBgNVBAYTAlVLMR8wHQYJKoZIhvcNAQkB FhB0ZXN0QGV4YW1wbGUuY29tMR0wGwYDVQQKExRUZXN0IGludGVybWVkaWF0ZSBD -QTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAp+0/hu6t+LdgRGP8Gyx5PJCL -R7hRtT6WbV3xl7PekLKaqp5UfiuxbZGuICm2aXuK5WxBELbTc0wgMDhXycjvZ352 -OcQc32tzTishLXlaxWBehRFSO47vsOUvDOij/AUnkQhk6i5a8oIMCEi8vMpgAhxq -OOvIAqb36MgxICnm5I0CAwEAAaNLMEkwOQYIKwYBBQUHAQEELTArMCkGCCsGAQUF +QTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvL2Dwbw22Jx0aFpGSCWDWfg1 +Ho/cLFI7fC7qQMSTtjkx3/Wm+AEXZ5MhWZuJf+0qGXslpeFxEpnlFCjfdbUXHDsd +PXRIT7dC9DqrVgUr/NMnlwEIW60mm/KHUZx+4fHvHL+tfjjZdokwpowvb4efnlcT +FLRFMPO+WN+K0u57HYkCAwEAAaNLMEkwOQYIKwYBBQUHAQEELTArMCkGCCsGAQUF BzABhh1odHRwOi8vb2NzcC5leGFtcGxlLmNvbTo4ODg4LzAMBgNVHRMEBTADAQH/ -MA0GCSqGSIb3DQEBBQUAA4IBAQCUGpFqBUEMQPlGNelGFfE+5NlQ1g4U2B+FnqaY -otvb7v9WVWxG/Q6wA3mmlg/BhcM+aOAXEKacEDSIlvfI7zIxJPQ8LetRCNaHg/fb -aEPt2a9Gokh00p3Jrw8pQq2izx6rUG/vMxjTB+8TExBQ26lW2/Q4wdsF+lpnknJp -+3pb7NTd/aIhBlmwDUhfU8FllKrUThzon7R9mxCFSra+39gztXKwrEapZ1UePlil -Uu22Ssvp0uX4/la0LF6fPNF/tOsFjUYfRzIrTy6sjcM86/EMLzrg+kYL5MXyAyRw -/O8a/XupnNm2Tw50B1Ij681mYWehkX92op1CVNTGXhAm6zfn +MA0GCSqGSIb3DQEBBQUAA4IBAQAzhJ0OslkE3O/jBIsAbGTqWJ42WXYnWaC47g2G +g//bZetsHxZH5/Xmw4iBc37tEo1+/V6xXGhH+PnK4+DA8xKyJDt3LJjeBW2o7Ce4 +r6uEJSZztFhMfMF0l5irDuaZcLw4sJrj2Vx1+kbSh1UJho/vSuTvPjLGrJ0nhim4 +eDh7h2xXcr1XmXM22/pSvXunBc0ouIX8EUdexndyavtzPoukbfgX9BLVNuDvXPiy +oWk+TM+GX2P2AmCVf2Hoy38UZto2LngTPmiuPxPBeYgYGD8j85rh536uUOS3gHYx +knR5LN7QdP6BfPYBFGofX4iFahEdUK/xl01nQMPprm9g4rzi -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem b/tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem index 27945856b7..396cad86cb 100644 --- a/tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem +++ b/tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: ST=Lancashire, C=UK/emailAddress=test@example.com, O=Test intermediate CA Validity - Not Before: Jun 26 19:36:42 2011 GMT - Not After : Jun 23 19:36:42 2021 GMT + Not Before: Jul 31 21:01:18 2011 GMT + Not After : Jul 28 21:01:18 2021 GMT Subject: CN=example.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:ba:f2:dc:f9:77:b0:ad:fd:9d:42:4f:22:15:6d: - 87:40:ed:30:8a:04:ad:ac:7a:0b:d4:7a:a4:a7:ef: - e0:e7:9b:f2:5e:62:56:24:ed:88:bd:bd:e3:64:d2: - d4:b4:01:39:b8:9e:6f:c7:b0:fc:b9:fd:a8:4d:46: - c8:9e:6a:43:82:ca:56:83:d4:4b:ea:63:d5:56:d1: - 99:46:4f:8b:28:d0:2f:db:bf:04:65:64:82:c2:61: - aa:66:50:27:e5:7a:57:e3:72:e3:ae:22:8d:92:7e: - 25:90:a2:7c:0c:04:79:c5:ab:64:58:a9:83:79:67: - 7f:72:33:cc:5f:5b:cd:74:bb + 00:c9:bb:98:5b:27:cd:b1:8a:a9:38:fc:aa:bb:ad: + a1:ed:cb:94:94:3e:79:90:ae:35:f3:87:b1:2a:4e: + d5:ff:55:93:e0:1a:68:2a:36:94:05:38:a7:72:64: + a3:31:0f:61:5c:ec:76:41:f1:35:4a:5e:bc:ef:51: + 90:9e:33:b4:08:7a:3f:f0:04:a8:46:99:96:25:b3: + 03:c8:cd:8c:33:42:76:82:b9:db:61:c6:91:ed:76: + 86:ae:04:38:d7:e5:5c:a9:a9:f9:b6:13:f4:90:40: + 6d:ec:2f:ba:ed:bc:ff:88:05:f0:7b:c8:ac:bd:d0: + 72:3a:91:64:86:06:89:66:0d Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -29,25 +29,25 @@ Certificate: OCSP - URI:http://ocsp.example.com:8888/ Signature Algorithm: sha1WithRSAEncryption - 19:e8:ce:9d:4d:ef:cc:4f:6c:e5:ab:df:aa:e2:3c:d8:6b:a8: - dd:b8:fa:50:e4:b6:04:fc:66:92:fb:e8:11:73:81:60:1a:88: - b2:18:0b:8c:89:05:47:16:50:09:be:bc:a6:3c:fe:2e:45:01: - 00:e3:27:30:72:f6:93:49:7f:d0:3b:a8:0e:cb:e7:01:95:28: - 8b:40:95:f7:b1:5b:c9:ff:26:ff:ad:4a:c4:e4:99:f7:65:fc: - e4:5e:d2:56:ea:98:42:dc:93:62:46:1a:33:53:0d:43:9d:ef: - 14:03:35:a7:13:fa:27:24:92:2f:9a:f9:0a:62:99:cc:c0:80: - 79:10 + 22:30:97:01:ea:d0:a8:d8:b5:32:97:c8:c9:8b:7d:01:02:53: + 74:f8:0a:10:dc:fc:73:b2:50:bb:59:47:f3:e4:9f:44:94:d5: + ca:c0:64:da:83:00:95:43:15:a5:e3:30:ce:66:ca:55:8c:16: + 03:1e:55:02:8b:c7:ad:ed:2e:ae:ee:31:59:53:37:ff:26:86: + 93:9d:e2:69:2e:c0:2a:66:38:a5:b5:54:a1:02:0a:83:67:e0: + 91:cf:fc:09:c3:70:71:b6:cf:fc:d3:e9:9f:f5:1c:4d:55:ec: + 66:f7:07:71:fc:d6:17:de:e1:ab:e6:f2:7b:83:46:1e:b9:96: + 95:8f -----BEGIN CERTIFICATE----- MIICNjCCAZ+gAwIBAgIBHTANBgkqhkiG9w0BAQUFADBiMRMwEQYDVQQIEwpMYW5j YXNoaXJlMQswCQYDVQQGEwJVSzEfMB0GCSqGSIb3DQEJARYQdGVzdEBleGFtcGxl -LmNvbTEdMBsGA1UEChMUVGVzdCBpbnRlcm1lZGlhdGUgQ0EwHhcNMTEwNjI2MTkz -NjQyWhcNMjEwNjIzMTkzNjQyWjAWMRQwEgYDVQQDEwtleGFtcGxlLmNvbTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuvLc+Xewrf2dQk8iFW2HQO0wigStrHoL -1Hqkp+/g55vyXmJWJO2Ivb3jZNLUtAE5uJ5vx7D8uf2oTUbInmpDgspWg9RL6mPV -VtGZRk+LKNAv278EZWSCwmGqZlAn5XpX43LjriKNkn4lkKJ8DAR5xatkWKmDeWd/ -cjPMX1vNdLsCAwEAAaNIMEYwCQYDVR0TBAIwADA5BggrBgEFBQcBAQQtMCswKQYI +LmNvbTEdMBsGA1UEChMUVGVzdCBpbnRlcm1lZGlhdGUgQ0EwHhcNMTEwNzMxMjEw +MTE4WhcNMjEwNzI4MjEwMTE4WjAWMRQwEgYDVQQDEwtleGFtcGxlLmNvbTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAybuYWyfNsYqpOPyqu62h7cuUlD55kK41 +84exKk7V/1WT4BpoKjaUBTincmSjMQ9hXOx2QfE1Sl6871GQnjO0CHo/8ASoRpmW +JbMDyM2MM0J2grnbYcaR7XaGrgQ41+Vcqan5thP0kEBt7C+67bz/iAXwe8isvdBy +OpFkhgaJZg0CAwEAAaNIMEYwCQYDVR0TBAIwADA5BggrBgEFBQcBAQQtMCswKQYI KwYBBQUHMAGGHWh0dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3 -DQEBBQUAA4GBABnozp1N78xPbOWr36riPNhrqN24+lDktgT8ZpL76BFzgWAaiLIY -C4yJBUcWUAm+vKY8/i5FAQDjJzBy9pNJf9A7qA7L5wGVKItAlfexW8n/Jv+tSsTk -mfdl/ORe0lbqmELck2JGGjNTDUOd7xQDNacT+ickki+a+QpimczAgHkQ +DQEBBQUAA4GBACIwlwHq0KjYtTKXyMmLfQECU3T4ChDc/HOyULtZR/Pkn0SU1crA +ZNqDAJVDFaXjMM5mylWMFgMeVQKLx63tLq7uMVlTN/8mhpOd4mkuwCpmOKW1VKEC +CoNn4JHP/AnDcHG2z/zT6Z/1HE1V7Gb3B3H81hfe4avm8nuDRh65lpWP -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem b/tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem index 704346c958..34ad2b10a8 100644 --- a/tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem +++ b/tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: CN=example.com, ST=Lancashire, C=UK/emailAddress=test@example.com, O=Some organisation Validity - Not Before: Jun 26 19:36:42 2011 GMT - Not After : Jun 23 19:36:42 2021 GMT + Not Before: Jul 31 21:01:18 2011 GMT + Not After : Jul 28 21:01:18 2021 GMT Subject: CN=example.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:d7:b6:a8:07:83:27:b8:72:da:85:ad:50:bf:c2: - 3f:cc:d4:e7:97:55:b5:45:aa:d2:cb:df:b6:34:6f: - c2:8f:86:e2:15:8a:cd:3e:af:f5:c0:f9:2e:61:80: - 70:17:d3:db:0f:8a:e6:2c:a8:e3:12:2d:92:e1:8d: - 10:e0:e7:30:94:98:ec:b0:21:c3:86:f7:ff:29:58: - 2b:ab:b1:23:e4:ca:66:66:6a:18:b5:73:dc:c7:44: - 04:30:55:bf:f9:3b:74:f6:de:bd:d9:ef:46:b0:15: - 56:3b:43:cc:55:c2:cc:2e:5d:17:f8:04:dc:3d:bf: - 1b:cc:0a:41:61:c8:35:02:1b + 00:ea:d6:97:b5:3c:f4:37:8a:58:b4:7a:49:31:55: + dd:c8:84:ee:36:f6:72:3a:31:99:d1:df:af:bb:f9: + 17:e9:d8:47:d2:20:4b:94:ce:ea:c1:6b:23:9a:da: + 02:41:29:51:34:05:13:c0:98:4d:87:f8:91:a8:85: + 81:e4:ab:26:3d:26:59:29:16:7d:04:db:57:7b:f0: + b6:2b:5d:cf:e7:82:ba:83:a7:bc:63:43:03:2a:2b: + 18:40:89:4c:1e:90:bc:bf:10:24:81:50:0d:2e:e8: + 8e:a9:0a:fc:f8:cd:97:98:3c:cc:55:b7:f2:b2:0d: + 0e:36:53:3a:b2:d0:45:90:8b Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -29,26 +29,26 @@ Certificate: OCSP - URI:http://ocsp.example.com:8888/ Signature Algorithm: sha1WithRSAEncryption - 18:e2:06:f3:4b:42:46:b6:29:d1:8d:50:ef:5b:8b:e5:33:24: - f3:f1:3e:58:4d:7f:3e:51:e9:c4:a2:cb:64:5f:d1:51:ce:8d: - b6:15:63:23:30:4b:7c:70:30:61:ce:1f:70:bb:99:63:5b:15: - d9:ce:aa:da:65:87:66:ab:ad:64:e8:09:37:ea:79:d0:3a:a2: - e0:cf:0b:1b:a7:35:3d:f8:45:4c:4b:96:15:ec:fe:64:9f:e0: - 1d:04:52:35:a1:b4:7e:31:34:84:7e:e6:e0:58:1e:14:02:df: - 68:f6:b6:eb:dc:10:eb:da:fe:8e:06:ab:52:b7:ca:15:c3:8d: - 5a:8a + 82:d8:53:9c:d8:0b:0a:b3:9d:b4:0a:9f:93:ec:96:a6:31:6b: + 79:c9:d2:1c:76:0b:b7:f3:9f:b9:7a:dd:d7:b7:7b:26:ba:0a: + 54:2a:a3:ad:89:8e:3c:b8:8e:ea:09:53:58:73:9a:b3:a0:40: + 90:02:f2:60:04:b8:f0:2a:61:bd:91:9b:5e:81:5f:bf:cc:f2: + 33:33:8a:70:07:f5:ea:c0:05:38:34:f7:dc:ea:0c:74:01:5d: + dd:92:ab:f2:87:64:1b:7c:be:ae:37:c1:6c:ae:99:73:a5:aa: + 45:20:32:57:19:cb:30:45:61:2c:3b:23:52:ee:f0:cc:12:80: + 97:34 -----BEGIN CERTIFICATE----- MIICSTCCAbKgAwIBAgIBGzANBgkqhkiG9w0BAQUFADB1MRQwEgYDVQQDEwtleGFt cGxlLmNvbTETMBEGA1UECBMKTGFuY2FzaGlyZTELMAkGA1UEBhMCVUsxHzAdBgkq hkiG9w0BCQEWEHRlc3RAZXhhbXBsZS5jb20xGjAYBgNVBAoTEVNvbWUgb3JnYW5p -c2F0aW9uMB4XDTExMDYyNjE5MzY0MloXDTIxMDYyMzE5MzY0MlowFjEUMBIGA1UE -AxMLZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANe2qAeD -J7hy2oWtUL/CP8zU55dVtUWq0svftjRvwo+G4hWKzT6v9cD5LmGAcBfT2w+K5iyo -4xItkuGNEODnMJSY7LAhw4b3/ylYK6uxI+TKZmZqGLVz3MdEBDBVv/k7dPbevdnv -RrAVVjtDzFXCzC5dF/gE3D2/G8wKQWHINQIbAgMBAAGjSDBGMAkGA1UdEwQCMAAw +c2F0aW9uMB4XDTExMDczMTIxMDExOFoXDTIxMDcyODIxMDExOFowFjEUMBIGA1UE +AxMLZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOrWl7U8 +9DeKWLR6STFV3ciE7jb2cjoxmdHfr7v5F+nYR9IgS5TO6sFrI5raAkEpUTQFE8CY +TYf4kaiFgeSrJj0mWSkWfQTbV3vwtitdz+eCuoOnvGNDAyorGECJTB6QvL8QJIFQ +DS7ojqkK/PjNl5g8zFW38rINDjZTOrLQRZCLAgMBAAGjSDBGMAkGA1UdEwQCMAAw OQYIKwYBBQUHAQEELTArMCkGCCsGAQUFBzABhh1odHRwOi8vb2NzcC5leGFtcGxl -LmNvbTo4ODg4LzANBgkqhkiG9w0BAQUFAAOBgQAY4gbzS0JGtinRjVDvW4vlMyTz -8T5YTX8+UenEostkX9FRzo22FWMjMEt8cDBhzh9wu5ljWxXZzqraZYdmq61k6Ak3 -6nnQOqLgzwsbpzU9+EVMS5YV7P5kn+AdBFI1obR+MTSEfubgWB4UAt9o9rbr3BDr -2v6OBqtSt8oVw41aig== +LmNvbTo4ODg4LzANBgkqhkiG9w0BAQUFAAOBgQCC2FOc2AsKs520Cp+T7JamMWt5 +ydIcdgu385+5et3Xt3smugpUKqOtiY48uI7qCVNYc5qzoECQAvJgBLjwKmG9kZte +gV+/zPIzM4pwB/XqwAU4NPfc6gx0AV3dkqvyh2QbfL6uN8FsrplzpapFIDJXGcsw +RWEsOyNS7vDMEoCXNA== -----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem b/tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem index 1e138cef8a..34b26c6d5e 100644 --- a/tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem +++ b/tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem @@ -5,22 +5,22 @@ Certificate: Signature Algorithm: sha1WithRSAEncryption Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority Validity - Not Before: Jun 26 19:36:39 2011 GMT - Not After : Jun 23 19:36:39 2021 GMT + Not Before: Jul 31 21:01:16 2011 GMT + Not After : Jul 28 21:01:16 2021 GMT Subject: CN=example.com, ST=Lancashire, C=UK/emailAddress=test@example.com, O=Some organisation Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: - 00:c7:d8:d4:a7:c0:a0:e7:82:b4:ec:67:52:bf:50: - bf:b9:a6:f2:10:19:67:53:8c:99:5e:c8:fc:03:07: - 71:24:a3:a9:c4:49:f8:15:34:4a:45:ee:92:81:aa: - 3c:5a:1a:42:2b:db:d7:30:9e:85:e6:b8:74:bc:ae: - f0:ae:7d:05:4e:c9:0f:00:33:b2:86:ba:b6:49:9a: - 07:18:92:f9:35:69:d2:ac:39:b9:85:ac:78:99:81: - 06:f5:fa:2e:5b:18:f7:6a:16:d0:e6:f9:71:0f:b0: - 05:c4:f0:5f:ed:90:81:3c:96:f5:e3:45:73:72:5f: - ce:dc:ce:0b:56:2e:be:d2:eb + 00:97:c9:92:27:81:a7:4c:64:82:a2:30:d6:07:b7: + 57:e0:9c:ea:cd:eb:53:be:ea:b6:b5:47:66:d0:68: + 54:25:a7:ed:21:5c:dc:fd:da:41:f6:c7:c0:35:ae: + 97:72:fd:8b:af:29:3d:38:5a:67:8b:39:8a:ce:86: + 25:0f:38:a7:b5:38:b3:8e:81:f0:ea:79:99:cb:f5: + 23:64:55:f3:4b:a4:b6:23:64:29:ea:ba:f3:29:52: + a7:7f:32:dc:0d:b6:d9:d4:e6:13:de:01:41:86:9a: + 2d:8f:bb:0c:18:88:09:ac:d4:6a:e9:cb:8a:17:8a: + 85:09:a6:ae:a6:1c:05:e9:55 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -29,39 +29,39 @@ Certificate: OCSP - URI:http://ocsp.example.com:8888/ Signature Algorithm: sha1WithRSAEncryption - 76:84:40:52:b8:1d:6c:64:58:f1:10:30:03:db:16:91:da:b1: - 70:28:54:6f:0f:32:1c:84:65:b3:14:99:c6:59:f9:ec:f9:3f: - 46:1f:12:77:4e:f1:26:ad:46:4b:ee:48:78:bd:bf:2a:11:01: - 5b:02:cd:d2:6e:2d:8c:08:ea:a7:5a:18:16:71:e8:5d:c8:e7: - 7d:f2:4f:23:6c:59:3c:17:93:02:60:c0:d0:62:09:d2:a3:7d: - 90:77:6c:f7:0c:b2:e4:9e:73:d2:f8:dd:a3:0c:70:36:2f:5a: - 58:2b:2d:3e:0e:71:43:b2:14:00:e2:eb:2d:0e:09:91:47:83: - e8:02:d4:7d:5c:1f:ce:d8:f5:ad:1f:ee:82:4f:23:47:db:f4: - 71:48:1b:e1:82:f1:d1:86:db:0f:b6:bb:3a:8f:40:05:48:b7: - f2:a8:c7:c9:46:e1:ea:28:b2:02:00:90:04:00:19:32:6f:8d: - 3e:c2:67:ca:b0:80:3a:32:e3:35:92:18:a2:62:30:9d:7a:f5: - 13:3b:c7:00:3f:4e:17:a9:01:5d:a1:2c:71:76:d7:37:c8:16: - 92:f8:82:69:15:5f:7d:5e:b0:ba:0b:9f:bd:53:ad:e5:a6:b3: - bc:6b:e4:1a:79:29:31:ff:ff:a1:2d:0b:30:46:d3:a5:2d:62: - e6:be:68:df + 8b:9b:96:fb:8e:1b:77:f5:70:39:fe:76:51:ac:a9:6b:80:a5: + b7:95:8b:c3:1a:9c:1f:bb:d1:d1:68:43:40:96:62:d6:a6:da: + d9:fd:9d:9a:9e:8a:84:fa:f5:54:ce:a8:d7:37:c7:0c:95:fc: + 11:8b:e9:32:53:e5:59:61:0a:53:70:f3:d6:ed:3f:b1:f4:49: + bf:86:c1:77:0d:b1:ac:65:7e:62:d2:f2:5a:31:50:a7:ed:28: + bb:63:d5:f3:4f:43:3a:3f:bf:3b:d0:94:aa:a1:74:95:be:a4: + 0f:8b:e0:6f:d8:33:84:76:71:b2:da:f4:0e:1e:d2:eb:f0:c3: + 1e:33:79:21:35:93:18:05:38:db:63:85:1a:e4:84:41:0a:c3: + fb:fd:5c:69:3d:18:0a:38:b8:16:18:d3:23:b9:51:47:2e:54: + 08:d1:fc:2e:b6:63:62:78:9c:26:59:c2:5e:5a:38:76:47:e7: + f0:f8:7b:b7:00:46:34:b0:44:28:a9:33:d7:e5:1d:52:c8:fb: + 32:a5:25:86:21:0c:80:f0:4b:37:60:a0:45:69:9f:6b:b0:34: + 91:5e:4c:62:45:99:83:1d:80:48:78:bb:ee:d4:83:39:76:c3: + e6:fb:31:e9:20:f0:64:90:24:4e:c6:07:75:40:1f:7e:97:77: + 1f:bf:a2:ef -----BEGIN CERTIFICATE----- MIIDYDCCAkigAwIBAgIBATANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xMTA2MjYxOTM2MzlaFw0yMTA2MjMxOTM2MzlaMHUx +aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMTZaFw0yMTA3MjgyMTAxMTZaMHUx FDASBgNVBAMTC2V4YW1wbGUuY29tMRMwEQYDVQQIEwpMYW5jYXNoaXJlMQswCQYD VQQGEwJVSzEfMB0GCSqGSIb3DQEJARYQdGVzdEBleGFtcGxlLmNvbTEaMBgGA1UE ChMRU29tZSBvcmdhbmlzYXRpb24wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB -AMfY1KfAoOeCtOxnUr9Qv7mm8hAZZ1OMmV7I/AMHcSSjqcRJ+BU0SkXukoGqPFoa -Qivb1zCehea4dLyu8K59BU7JDwAzsoa6tkmaBxiS+TVp0qw5uYWseJmBBvX6LlsY -92oW0Ob5cQ+wBcTwX+2QgTyW9eNFc3JfztzOC1YuvtLrAgMBAAGjSDBGMAkGA1Ud +AJfJkieBp0xkgqIw1ge3V+Cc6s3rU77qtrVHZtBoVCWn7SFc3P3aQfbHwDWul3L9 +i68pPThaZ4s5is6GJQ84p7U4s46B8Op5mcv1I2RV80uktiNkKeq68ylSp38y3A22 +2dTmE94BQYaaLY+7DBiICazUaunLiheKhQmmrqYcBelVAgMBAAGjSDBGMAkGA1Ud EwQCMAAwOQYIKwYBBQUHAQEELTArMCkGCCsGAQUFBzABhh1odHRwOi8vb2NzcC5l -eGFtcGxlLmNvbTo4ODg4LzANBgkqhkiG9w0BAQUFAAOCAQEAdoRAUrgdbGRY8RAw -A9sWkdqxcChUbw8yHIRlsxSZxln57Pk/Rh8Sd07xJq1GS+5IeL2/KhEBWwLN0m4t -jAjqp1oYFnHoXcjnffJPI2xZPBeTAmDA0GIJ0qN9kHds9wyy5J5z0vjdowxwNi9a -WCstPg5xQ7IUAOLrLQ4JkUeD6ALUfVwfztj1rR/ugk8jR9v0cUgb4YLx0YbbD7a7 -Oo9ABUi38qjHyUbh6iiyAgCQBAAZMm+NPsJnyrCAOjLjNZIYomIwnXr1EzvHAD9O -F6kBXaEscXbXN8gWkviCaRVffV6wugufvVOt5aazvGvkGnkpMf//oS0LMEbTpS1i -5r5o3w== +eGFtcGxlLmNvbTo4ODg4LzANBgkqhkiG9w0BAQUFAAOCAQEAi5uW+44bd/VwOf52 +Uaypa4Clt5WLwxqcH7vR0WhDQJZi1qba2f2dmp6KhPr1VM6o1zfHDJX8EYvpMlPl +WWEKU3Dz1u0/sfRJv4bBdw2xrGV+YtLyWjFQp+0ou2PV809DOj+/O9CUqqF0lb6k +D4vgb9gzhHZxstr0Dh7S6/DDHjN5ITWTGAU422OFGuSEQQrD+/1caT0YCji4FhjT +I7lRRy5UCNH8LrZjYnicJlnCXlo4dkfn8Ph7twBGNLBEKKkz1+UdUsj7MqUlhiEM +gPBLN2CgRWmfa7A0kV5MYkWZgx2ASHi77tSDOXbD5vsx6SDwZJAkTsYHdUAffpd3 +H7+i7w== -----END CERTIFICATE----- -- cgit v1.2.3 From beb3dfed07b35d74050fcd40a99f705c033597f7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 4 Aug 2011 13:01:04 +0300 Subject: Support QImage and others in Wayland clipboard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wayland plugin's clipboard implementation lacked support for data set via QMimeData::setImageData, QClipboard::setPixmap, etc. because everything was treated as a QByteArray. A variant having an image cannot however be converted to a byte array. Therefore, to make these convenience functions to work, the image is now encoded via QImageWriter before sending it. On the receiving side QMimeData is capable of decoding images from byte arrays, so no problem there. The patch also renames an internal QWaylandMimeData class to a more suitable clipboard-specific name as the functionality is clipboard specific. Change-Id: I77e7df903b8dbe9731613fdbb9693b2a37b05d18 Reviewed-on: http://codereview.qt.nokia.com/2616 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- .../platforms/wayland/qwaylandclipboard.cpp | 17 ++--- src/plugins/platforms/wayland/qwaylandclipboard.h | 4 +- src/plugins/platforms/wayland/qwaylandmime.cpp | 83 ++++++++++++++++++++++ src/plugins/platforms/wayland/qwaylandmime.h | 55 ++++++++++++++ src/plugins/platforms/wayland/wayland.pro | 6 +- 5 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandmime.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandmime.h diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 1ef063fec1..d20f183efe 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -42,6 +42,7 @@ #include "qwaylandclipboard.h" #include "qwaylanddisplay.h" #include "qwaylandinputdevice.h" +#include "qwaylandmime.h" #include #include #include @@ -52,7 +53,7 @@ static QWaylandClipboard *clipboard = 0; -class QWaylandMimeData : public QInternalMimeData +class QWaylandClipboardMimeData : public QInternalMimeData { public: void clearAll(); @@ -64,28 +65,28 @@ private: QStringList mFormatList; }; -void QWaylandMimeData::clearAll() +void QWaylandClipboardMimeData::clearAll() { clear(); mFormatList.clear(); } -void QWaylandMimeData::setFormats(const QStringList &formatList) +void QWaylandClipboardMimeData::setFormats(const QStringList &formatList) { mFormatList = formatList; } -bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const +bool QWaylandClipboardMimeData::hasFormat_sys(const QString &mimeType) const { return formats().contains(mimeType); } -QStringList QWaylandMimeData::formats_sys() const +QStringList QWaylandClipboardMimeData::formats_sys() const { return mFormatList; } -QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const +QVariant QWaylandClipboardMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const { return clipboard->retrieveData(mimeType, type); } @@ -147,7 +148,7 @@ void QWaylandSelection::send(void *data, Q_UNUSED(selection); QWaylandSelection *self = static_cast(data); QString mimeType = QString::fromLatin1(mime_type); - QByteArray content = self->mMimeData->data(mimeType); + QByteArray content = QWaylandMimeHelper::getByteArray(self->mMimeData, mimeType); if (!content.isEmpty()) { QFile f; if (f.open(fd, QIODevice::WriteOnly)) @@ -230,7 +231,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) if (!mSelections.isEmpty()) return mSelections.last()->mMimeData; if (!mMimeDataIn) - mMimeDataIn = new QWaylandMimeData; + mMimeDataIn = new QWaylandClipboardMimeData; mMimeDataIn->clearAll(); if (!mOfferedMimeTypes.isEmpty() && mOffer) mMimeDataIn->setFormats(mOfferedMimeTypes); diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h index 87294342d7..6b113ae5b0 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.h +++ b/src/plugins/platforms/wayland/qwaylandclipboard.h @@ -48,7 +48,7 @@ class QWaylandDisplay; class QWaylandSelection; -class QWaylandMimeData; +class QWaylandClipboardMimeData; struct wl_selection_offer; class QWaylandClipboardSignalEmitter : public QObject @@ -90,7 +90,7 @@ private: static void forceRoundtrip(struct wl_display *display); QWaylandDisplay *mDisplay; - QWaylandMimeData *mMimeDataIn; + QWaylandClipboardMimeData *mMimeDataIn; QList mSelections; QStringList mOfferedMimeTypes; struct wl_selection_offer *mOffer; diff --git a/src/plugins/platforms/wayland/qwaylandmime.cpp b/src/plugins/platforms/wayland/qwaylandmime.cpp new file mode 100644 index 0000000000..c218d7ddb8 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandmime.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandmime.h" +#include +#include +#include +#include +#include + +QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType) +{ + QByteArray content; + if (mimeType == QLatin1String("text/plain")) { + content = mimeData->text().toUtf8(); + } else if (mimeData->hasImage() + && (mimeType == QLatin1String("application/x-qt-image") + || mimeType.startsWith("image/"))) { + QImage image = qvariant_cast(mimeData->imageData()); + if (!image.isNull()) { + QBuffer buf; + buf.open(QIODevice::ReadWrite); + QByteArray fmt = "BMP"; + if (mimeType.startsWith("image/")) { + QByteArray imgFmt = mimeType.mid(6).toUpper().toAscii(); + if (QImageWriter::supportedImageFormats().contains(imgFmt)) + fmt = imgFmt; + } + QImageWriter wr(&buf, fmt); + wr.write(image); + content = buf.buffer(); + } + } else if (mimeType == QLatin1String("application/x-color")) { + content = qvariant_cast(mimeData->colorData()).name().toAscii(); + } else if (mimeType == QLatin1String("text/uri-list")) { + QList urls = mimeData->urls(); + for (int i = 0; i < urls.count(); ++i) { + content.append(urls.at(i).toEncoded()); + content.append('\n'); + } + } else { + content = mimeData->data(mimeType); + } + return content; +} diff --git a/src/plugins/platforms/wayland/qwaylandmime.h b/src/plugins/platforms/wayland/qwaylandmime.h new file mode 100644 index 0000000000..5f6ed954a1 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandmime.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDMIME_H +#define QWAYLANDMIME_H + +#include +#include +#include + +class QWaylandMimeHelper +{ +public: + static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType); +}; + +#endif diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 857a2918ce..1e0bbe6cdd 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -20,7 +20,8 @@ SOURCES = main.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ - qwaylandclipboard.cpp + qwaylandclipboard.cpp \ + qwaylandmime.cpp HEADERS = qwaylandintegration.h \ qwaylandnativeinterface.h \ @@ -31,7 +32,8 @@ HEADERS = qwaylandintegration.h \ qwaylandshmsurface.h \ qwaylandbuffer.h \ qwaylandshmwindow.h \ - qwaylandclipboard.h + qwaylandclipboard.h \ + qwaylandmime.h INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND LIBS += $$QMAKE_LIBS_WAYLAND -- cgit v1.2.3 From 69d6012de469185aa70c86fec69fcb908acfde0c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 2 Aug 2011 12:35:01 +1000 Subject: test: fixed tst_qundogroup and removed CONFIG+=insignificant_test This test had an invalid circular dependency: the test is in qtbase, and it depends on lrelease in qttools, which depends on qtbase. Change the test to skip if lrelease is not available or not working. Change-Id: I964ddaf9485a2afed5a1bd4f88d9bdccadf1cfca Reviewed-on: http://codereview.qt.nokia.com/2472 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qundogroup/qundogroup.pro | 2 -- tests/auto/qundogroup/tst_qundogroup.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/qundogroup/qundogroup.pro b/tests/auto/qundogroup/qundogroup.pro index 9a700c64b7..587143d045 100644 --- a/tests/auto/qundogroup/qundogroup.pro +++ b/tests/auto/qundogroup/qundogroup.pro @@ -1,5 +1,3 @@ CONFIG += qttest_p4 SOURCES += tst_qundogroup.cpp TARGET = tst_qundogroup - -CONFIG+=insignificant_test diff --git a/tests/auto/qundogroup/tst_qundogroup.cpp b/tests/auto/qundogroup/tst_qundogroup.cpp index 55aa73be69..6d51252e22 100644 --- a/tests/auto/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/qundogroup/tst_qundogroup.cpp @@ -608,6 +608,11 @@ void tst_QUndoGroup::addStackAndDie() void tst_QUndoGroup::commandTextFormat() { QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath); + + if (QProcess::execute(binDir + "/lrelease -version") != 0) { + QSKIP("lrelease is missing or broken", SkipAll); + } + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/qundogroup.ts")); QTranslator translator; -- cgit v1.2.3 From 8ef86d05f199ebab216da43d5e0a9dc322b657b3 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 3 Aug 2011 18:36:55 +0200 Subject: QSslCertificate: deprecate alternateSubjectNames() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and add a new method subjectAlternativeNames() instead. This was a typo in the API. Change-Id: Id8704c387c9ff8e1af2b9a524ff628f5c053a294 Reviewed-on: http://codereview.qt.nokia.com/2618 Reviewed-by: Qt Sanity Bot Reviewed-by: João Abecasis --- dist/changes-5.0.0 | 4 ++++ src/network/ssl/qssl.cpp | 6 +++--- src/network/ssl/qssl.h | 6 +++++- src/network/ssl/qsslcertificate.cpp | 8 ++++---- src/network/ssl/qsslcertificate.h | 8 ++++++-- src/network/ssl/qsslsocket_openssl.cpp | 2 +- tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 22 +++++++++++----------- 7 files changed, 34 insertions(+), 22 deletions(-) diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 523d649573..32ca8dbd66 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -20,6 +20,10 @@ information about a particular change. - QLibrary::resolve() now returns a function pointer instead of a void pointer. +- QSslCertificate::alternateSubjectNames() is deprecated (but can be enabled + via QT_DISABLE_DEPRECATED_BEFORE), use + QSslCertificate::subjectAlternativeNames() instead. + **************************************************************************** * General * **************************************************************************** diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 586c8944ca..17f8014e52 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -82,9 +82,9 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QSsl::AlternateNameEntryType + \enum QSsl::AlternativeNameEntryType - Describes the key types for alternate name entries in QSslCertificate. + Describes the key types for alternative name entries in QSslCertificate. \value EmailEntry An email entry; the entry contains an email address that the certificate is valid for. @@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE \value DnsEntry A DNS host name entry; the entry contains a host name entry that the certificate is valid for. The entry may contain wildcards. - \sa QSslCertificate::alternateSubjectNames() + \sa QSslCertificate::subjectAlternativeNames() */ diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index 2ecd1c363c..7b76b64b4c 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -67,11 +67,15 @@ namespace QSsl { Dsa }; - enum AlternateNameEntryType { + enum AlternativeNameEntryType { EmailEntry, DnsEntry }; +#if QT_DEPRECATED_SINCE(5,0) + typedef AlternativeNameEntryType AlternateNameEntryType; +#endif + enum SslProtocol { SslV3, SslV2, diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 94273b0754..af265db6e4 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -426,7 +426,7 @@ QList QSslCertificate::issuerInfoAttributes() const /*! Returns the list of alternative subject names for this - certificate. The alternate subject names typically contain host + certificate. The alternative names typically contain host names, optionally with wildcards, that are valid for this certificate. @@ -437,9 +437,9 @@ QList QSslCertificate::issuerInfoAttributes() const \sa subjectInfo() */ -QMultiMap QSslCertificate::alternateSubjectNames() const +QMultiMap QSslCertificate::subjectAlternativeNames() const { - QMultiMap result; + QMultiMap result; if (!d->x509) return result; @@ -922,7 +922,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate) << ',' << certificate.digest().toBase64() << ',' << certificate.issuerInfo(QSslCertificate::Organization) << ',' << certificate.subjectInfo(QSslCertificate::Organization) - << ',' << certificate.alternateSubjectNames() + << ',' << certificate.subjectAlternativeNames() #ifndef QT_NO_TEXTSTREAM << ',' << certificate.effectiveDate() << ',' << certificate.expiryDate() diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h index a057d7a17d..0498d162c4 100644 --- a/src/network/ssl/qsslcertificate.h +++ b/src/network/ssl/qsslcertificate.h @@ -48,6 +48,7 @@ #include #include #include +#include #include typedef struct x509_st X509; // ### check if this works @@ -65,7 +66,6 @@ class QIODevice; class QSslError; class QSslKey; class QStringList; -template class QMultiMap; class QSslCertificatePrivate; class Q_NETWORK_EXPORT QSslCertificate @@ -106,7 +106,11 @@ public: QStringList subjectInfo(const QByteArray &attribute) const; QList subjectInfoAttributes() const; QList issuerInfoAttributes() const; - QMultiMap alternateSubjectNames() const; +#if QT_DEPRECATED_SINCE(5,0) + QT_DEPRECATED inline QMultiMap + alternateSubjectNames() const { return subjectAlternativeNames(); } +#endif + QMultiMap subjectAlternativeNames() const; QDateTime effectiveDate() const; QDateTime expiryDate() const; QSslKey publicKey() const; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 11b2ff8bcd..300a5c84d5 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1435,7 +1435,7 @@ bool QSslSocketBackendPrivate::isMatchingHostname(const QSslCertificate &cert, c } } - foreach (const QString &altName, cert.alternateSubjectNames().values(QSsl::DnsEntry)) { + foreach (const QString &altName, cert.subjectAlternativeNames().values(QSsl::DnsEntry)) { if (isMatchingHostname(altName.toLower(), peerName.toLower())) { return true; } diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index 7e67d08cba..bcd21eefe2 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -95,9 +95,9 @@ private slots: void copyAndAssign(); void digest_data(); void digest(); - void alternateSubjectNames_data(); + void subjectAlternativeNames_data(); void utf8SubjectNames(); - void alternateSubjectNames(); + void subjectAlternativeNames(); void publicKey_data(); void publicKey(); void toPemOrDer_data(); @@ -203,7 +203,7 @@ void tst_QSslCertificate::emptyConstructor() QCOMPARE(certificate.digest(), QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5)); QCOMPARE(certificate.issuerInfo(QSslCertificate::Organization), QStringList()); QCOMPARE(certificate.subjectInfo(QSslCertificate::Organization), QStringList()); - QCOMPARE(certificate.alternateSubjectNames(),(QMultiMap())); + QCOMPARE(certificate.subjectAlternativeNames(),(QMultiMap())); #ifndef QT_NO_TEXTSTREAM QCOMPARE(certificate.effectiveDate(), QDateTime()); QCOMPARE(certificate.expiryDate(), QDateTime()); @@ -272,7 +272,7 @@ void tst_QSslCertificate::compareCertificates( QCOMPARE(cert1.issuerInfo(subjectInfo), cert2.issuerInfo(subjectInfo)); QCOMPARE(cert1.subjectInfo(subjectInfo), cert2.subjectInfo(subjectInfo)); } - QCOMPARE(cert1.alternateSubjectNames(), cert2.alternateSubjectNames()); + QCOMPARE(cert1.subjectAlternativeNames(), cert2.subjectAlternativeNames()); QCOMPARE(cert1.effectiveDate(), cert2.effectiveDate()); QCOMPARE(cert1.expiryDate(), cert2.expiryDate()); QCOMPARE(cert1.version(), cert2.version()); @@ -352,7 +352,7 @@ void tst_QSslCertificate::digest() certificate.digest(QCryptographicHash::Sha1)); } -void tst_QSslCertificate::alternateSubjectNames_data() +void tst_QSslCertificate::subjectAlternativeNames_data() { QTest::addColumn("certFilePath"); QTest::addColumn("format"); @@ -368,7 +368,7 @@ void tst_QSslCertificate::alternateSubjectNames_data() } } -void tst_QSslCertificate::alternateSubjectNames() +void tst_QSslCertificate::subjectAlternativeNames() { if (!QSslSocket::supportsSsl()) return; @@ -383,11 +383,11 @@ void tst_QSslCertificate::alternateSubjectNames() QByteArray fileContents = readFile(subjAltNameFilePath); - const QMultiMap altSubjectNames = - certificate.alternateSubjectNames(); + const QMultiMap altSubjectNames = + certificate.subjectAlternativeNames(); // verify that each entry in subjAltNames is present in fileContents - QMapIterator it(altSubjectNames); + QMapIterator it(altSubjectNames); while (it.hasNext()) { it.next(); QString type; @@ -404,7 +404,7 @@ void tst_QSslCertificate::alternateSubjectNames() // verify that each entry in fileContents is present in subjAltNames QRegExp rx(QLatin1String("(email|DNS):([^,\\r\\n]+)")); for (int pos = 0; (pos = rx.indexIn(fileContents, pos)) != -1; pos += rx.matchedLength()) { - QSsl::AlternateNameEntryType key; + QSsl::AlternativeNameEntryType key; if (rx.cap(1) == QLatin1String("email")) key = QSsl::EmailEntry; else if (rx.cap(1) == QLatin1String("DNS")) @@ -811,7 +811,7 @@ void tst_QSslCertificate::nulInSan() const QSslCertificate &cert = certList.at(0); QVERIFY(!cert.isNull()); - QMultiMap san = cert.alternateSubjectNames(); + QMultiMap san = cert.subjectAlternativeNames(); QVERIFY(!san.isEmpty()); QString dnssan = san.value(QSsl::DnsEntry); -- cgit v1.2.3 From dcd435b7fcc24b87737076789b6bdd2a6d857ddc Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 4 Aug 2011 15:54:50 -0500 Subject: Allow adding to @ignore_headers from sync.profile We need this to avoid syncing certain files in QtDeclarative on Windows. Change-Id: Ia9fc95262ac18bafc39efc038ea70a1b5d67cddd Reviewed-on: http://codereview.qt.nokia.com/2641 Reviewed-by: Qt Sanity Bot Reviewed-by: Marius Storm-Olsen --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index 0dcbc4d58e..e5f93bd1c4 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -777,8 +777,8 @@ die "Cannot automatically detect/use provided path to QtBase's build directory!\ # if we have no $basedir we cannot be sure which sources you want, so die die "Could not find any sync.profile for your module!\nPass to syncqt to sync your header files.\nsyncqt failed" if (!$basedir); -my @ignore_headers = (); my $class_lib_map_contents = ""; +our @ignore_headers = (); our @ignore_for_master_contents = (); our @ignore_for_include_check = (); our @ignore_for_qt_begin_header_check = (); -- cgit v1.2.3 From 1eea4773236a246cf6185f69374c27852905ff5e Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 4 Aug 2011 12:41:32 +0200 Subject: test: fixed tst_qundostack and removed CONFIG+=insignificant_test This test had an invalid circular dependency: the test is in qtbase, and it depends on lrelease in qttools, which depends on qtbase. Change the test to skip if lrelease is not available or not working. Change-Id: I4696f4a178a6f8c0f2e76b5c4ae7f60c4f953334 Reviewed-on: http://codereview.qt.nokia.com/2619 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- tests/auto/qundostack/qundostack.pro | 2 -- tests/auto/qundostack/tst_qundostack.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/qundostack/qundostack.pro b/tests/auto/qundostack/qundostack.pro index 91fdcab025..beb0b103b2 100644 --- a/tests/auto/qundostack/qundostack.pro +++ b/tests/auto/qundostack/qundostack.pro @@ -1,5 +1,3 @@ CONFIG += qttest_p4 SOURCES += tst_qundostack.cpp TARGET = tst_qundostack - -CONFIG+=insignificant_test diff --git a/tests/auto/qundostack/tst_qundostack.cpp b/tests/auto/qundostack/tst_qundostack.cpp index 5a09b9a2ae..834c2d5d50 100644 --- a/tests/auto/qundostack/tst_qundostack.cpp +++ b/tests/auto/qundostack/tst_qundostack.cpp @@ -2970,6 +2970,11 @@ void tst_QUndoStack::undoLimit() void tst_QUndoStack::commandTextFormat() { QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath); + + if (QProcess::execute(binDir + "/lrelease -version") != 0) { + QSKIP("lrelease is missing or broken", SkipAll); + } + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/qundostack.ts")); QTranslator translator; -- cgit v1.2.3 From 4334d07f52dfc1d7fce6ebbad6e9f377ef33dedb Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Aug 2011 11:26:24 +1000 Subject: Use more numerically robust algorithm to compute QBezier::pointAt(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QBezier::pointAt() could potentially return values outside the bezier's bounds, even when the bezier was a straight horizontal line. For example, with y = 0.5, it would produce y=0.5 or y=0.49999999999999 for different values of t, which when rounded cause jittering in a QML PathView. Task-number: QTBUG-17007 Task-number: QTBUG-18133 Cherry-pick-of: 8b66982ec7b4b5d2071931c288973dce73dc9875 Change-Id: I4ecac7b9085aaaaaaaaaaaaaaaaaaaaaa7d7b0bc Reviewed-on: http://codereview.qt.nokia.com/2467 Reviewed-by: Samuel Rødal --- src/gui/painting/qbezier_p.h | 36 ++++++++++++++-------------- tests/auto/qpainterpath/tst_qpainterpath.cpp | 21 ++++++++++++++++ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h index 399dd89140..f1f7eb155a 100644 --- a/src/gui/painting/qbezier_p.h +++ b/src/gui/painting/qbezier_p.h @@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal & inline QPointF QBezier::pointAt(qreal t) const { -#if 1 - qreal a, b, c, d; - coefficients(t, a, b, c, d); - return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4); -#else // numerically more stable: + qreal x, y; + qreal m_t = 1. - t; - qreal a = x1*m_t + x2*t; - qreal b = x2*m_t + x3*t; - qreal c = x3*m_t + x4*t; - a = a*m_t + b*t; - b = b*m_t + c*t; - qreal x = a*m_t + b*t; - qreal a = y1*m_t + y2*t; - qreal b = y2*m_t + y3*t; - qreal c = y3*m_t + y4*t; - a = a*m_t + b*t; - b = b*m_t + c*t; - qreal y = a*m_t + b*t; + { + qreal a = x1*m_t + x2*t; + qreal b = x2*m_t + x3*t; + qreal c = x3*m_t + x4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + x = a*m_t + b*t; + } + { + qreal a = y1*m_t + y2*t; + qreal b = y2*m_t + y3*t; + qreal c = y3*m_t + y4*t; + a = a*m_t + b*t; + b = b*m_t + c*t; + y = a*m_t + b*t; + } return QPointF(x, y); -#endif } inline QPointF QBezier::normalVector(qreal t) const diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index 3941a11460..33315adc06 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -114,6 +114,8 @@ private slots: void connectPathMoveTo(); void translate(); + + void lineWithinBounds(); }; // Testing get/set functions @@ -1306,6 +1308,25 @@ void tst_QPainterPath::translate() QCOMPARE(complexPath.translated(-offset), untranslatedComplexPath); } + +void tst_QPainterPath::lineWithinBounds() +{ + const int iteration_count = 3; + volatile const qreal yVal = 0.5; + QPointF a(0.0, yVal); + QPointF b(1000.0, yVal); + QPointF c(2000.0, yVal); + QPointF d(3000.0, yVal); + QPainterPath path; + path.moveTo(QPointF(0, yVal)); + path.cubicTo(QPointF(1000.0, yVal), QPointF(2000.0, yVal), QPointF(3000.0, yVal)); + for(int i=0; i<=iteration_count; i++) { + qreal actual = path.pointAtPercent(qreal(i) / iteration_count).y(); + QVERIFY(actual == yVal); // don't use QCOMPARE, don't want fuzzy comparison + } +} + + QTEST_APPLESS_MAIN(tst_QPainterPath) #include "tst_qpainterpath.moc" -- cgit v1.2.3 From 7ce8491280990350162933a0716d1b014f65aeb6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Aug 2011 21:16:10 +0200 Subject: support xcb-icccm 3.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this is a rather crude hack, but whatever. Change-Id: I3fa363572842b207202d4aac8526951c0e16bf5b Reviewed-on: http://codereview.qt.nokia.com/2602 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbwindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0a02c7eff5..20e4187541 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -49,7 +49,17 @@ #include "qdri2context.h" #endif +#define class class_name // Yeah, in 2011 ... #include +#undef class + +// xcb-icccm 3.8 support +#ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS +#define xcb_wm_hints_t xcb_icccm_wm_hints_t +#define xcb_wm_hints_set_iconic xcb_icccm_wm_hints_set_iconic +#define xcb_wm_hints_set_normal xcb_icccm_wm_hints_set_normal +#define xcb_set_wm_hints xcb_icccm_set_wm_hints +#endif #include #include -- cgit v1.2.3 From e95edf644ee7c66708e878469ed3aec00c90e75c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 5 Aug 2011 10:59:34 +0200 Subject: Fix weight parsing in QBasicUnixFontDatabase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First check the usWeightClass in OS/2 font table, then check the weight byte in panose structure because Nokia Pure Text fonts only have that set correctly. Change-Id: Idce2626c8df17ce74ba78b317846cb42c3f1fe84 Reviewed-by: Jørgen Lind Reviewed-on: http://codereview.qt.nokia.com/2682 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- .../basicunix/qbasicunixfontdatabase.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index 001d377ca0..6b844f9df1 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -308,6 +308,33 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const }; writingSystems = determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange); + + if (os2->usWeightClass == 0) + ; + else if (os2->usWeightClass < 350) + weight = QFont::Light; + else if (os2->usWeightClass < 450) + weight = QFont::Normal; + else if (os2->usWeightClass < 650) + weight = QFont::DemiBold; + else if (os2->usWeightClass < 750) + weight = QFont::Bold; + else if (os2->usWeightClass < 1000) + weight = QFont::Black; + + if (os2->panose[2] >= 2) { + int w = os2->panose[2]; + if (w <= 3) + weight = QFont::Light; + else if (w <= 5) + weight = QFont::Normal; + else if (w <= 7) + weight = QFont::DemiBold; + else if (w <= 8) + weight = QFont::Bold; + else if (w <= 10) + weight = QFont::Black; + } } QString family = QString::fromAscii(face->family_name); -- cgit v1.2.3 From 24fd1ae14d9563954109d300e6a2257220440953 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 10:30:55 +1000 Subject: test: fixed tst_qabstractitemview for qpa Test uses QCursor::setPos(), which is broken for QPA. Task-number: QTBUG-20753 Change-Id: Ibeb1278f46dc5dec081c19ba25dd83cc8390aef3 Reviewed-on: http://codereview.qt.nokia.com/2652 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qabstractitemview/tst_qabstractitemview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index c919df136f..db9110f525 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -1244,8 +1244,12 @@ void tst_QAbstractItemView::task200665_itemEntered() QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) ); QSignalSpy spy(&view, SIGNAL(entered(QModelIndex))); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); - QCOMPARE(spy.count(), 1); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20753 QCursor::setPos() is broken for QPA", Continue); +#endif + + QCOMPARE(spy.count(), 1); } void tst_QAbstractItemView::task257481_emptyEditor() -- cgit v1.2.3 From dccdeb77c7adaeb581c3c3f48d1e00551336cb35 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 10:32:05 +1000 Subject: test: fixed tst_qfont for qpa Extend the QWS skip case to also cover QPA. Change-Id: I2bb93b179a384cf4304284d4d550c0bf4b61f4ca Reviewed-on: http://codereview.qt.nokia.com/2653 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qfont/tst_qfont.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index 711ffc0b53..a564e71e19 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -604,8 +604,8 @@ void tst_QFont::serializeSpacing() void tst_QFont::lastResortFont() { -#ifdef Q_WS_QWS - QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS", SkipAll); +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) + QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS/QPA", SkipAll); // ...if absolutely no font is found. Just as ducumented for QFont::lastResortFont(). // This happens on our CI machines which run QWS autotests. #endif -- cgit v1.2.3 From 06a7e8c017a774bc45d54b004b23e52aee7890cf Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 11:56:45 +1000 Subject: test: blacklist crashing tst_qfontdialog for qpa, xcb Task-number: QTBUG-20756 Change-Id: I04b5ace4d357f756a3148597170b87a60b008cf5 Reviewed-on: http://codereview.qt.nokia.com/2655 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qfontdialog/qfontdialog.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qfontdialog/qfontdialog.pro b/tests/auto/qfontdialog/qfontdialog.pro index d4edaaca21..656c4d12f8 100644 --- a/tests/auto/qfontdialog/qfontdialog.pro +++ b/tests/auto/qfontdialog/qfontdialog.pro @@ -8,3 +8,5 @@ mac:!qpa { OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm LIBS += -framework Cocoa } + +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb -- cgit v1.2.3 From 791bcba20307e3471a28ed1fde95b4112a7931e5 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 14:12:16 +1000 Subject: test: mark expected failures in tst_qfontmetrics for qpa Task-number: QTBUG-20759 Change-Id: Idb9493f5bf4ce031d7800b2187bf7c15757eb963 Reviewed-on: http://codereview.qt.nokia.com/2656 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 1df194d020..982cfc11d9 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -277,12 +277,20 @@ void tst_QFontMetrics::inFontUcs4() { QFontMetrics fm(font); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue); +#endif + QVERIFY(fm.inFontUcs4(0x1D7FF)); } { QFontMetricsF fm(font); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue); +#endif + QVERIFY(fm.inFontUcs4(0x1D7FF)); } @@ -303,6 +311,11 @@ void tst_QFontMetrics::lineWidth() const QFontMetrics bigFontMetrics(bigFont); QVERIFY(smallFontMetrics.lineWidth() >= 1); + +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue); +#endif + QVERIFY(smallFontMetrics.lineWidth() < bigFontMetrics.lineWidth()); } -- cgit v1.2.3 From b4cc8fcbdd5491e975583e813e31850e525e4570 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 14:17:30 +1000 Subject: test: mark expected failures in tst_qglyphrun for qpa Task-number: QTBUG-20760 Change-Id: Id046abfc8dcce2c6d068e5febf8c2b8777b50f53 Reviewed-on: http://codereview.qt.nokia.com/2657 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qglyphrun/tst_qglyphrun.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp index a18a2ac8dd..a5a5cd19cc 100644 --- a/tests/auto/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp @@ -93,6 +93,10 @@ void tst_QGlyphRun::initTestCase() m_testFont = QFont("QtsSpecialTestFont"); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue); +#endif + QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont")); } @@ -237,6 +241,11 @@ void tst_QGlyphRun::textLayoutGlyphIndexes() layout.endLayout(); QList listOfGlyphs = layout.glyphRuns(); + +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort); +#endif + QCOMPARE(listOfGlyphs.size(), 1); QGlyphRun glyphs = listOfGlyphs.at(0); @@ -283,6 +292,10 @@ void tst_QGlyphRun::drawExistingGlyphs() drawGlyphs.save("drawExistingGlyphs_drawGlyphIndexes.png"); #endif +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue); +#endif + QCOMPARE(textLayoutDraw, drawGlyphs); } -- cgit v1.2.3 From 687c33ea79dbd22cb187827a675af504347f7132 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 15:21:01 +1000 Subject: test: mark tst_qgraphicseffect as insignificant for qpa This test unstably fails for qpa, xcb, so mark it as insignificant. Task-number: QTBUG-20761 Change-Id: I0b4228c2803946ef87d7d11f4167017c2ffd0ad6 Reviewed-on: http://codereview.qt.nokia.com/2658 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qgraphicseffect/qgraphicseffect.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qgraphicseffect/qgraphicseffect.pro b/tests/auto/qgraphicseffect/qgraphicseffect.pro index 963eca25c4..db69e19cac 100644 --- a/tests/auto/qgraphicseffect/qgraphicseffect.pro +++ b/tests/auto/qgraphicseffect/qgraphicseffect.pro @@ -4,3 +4,5 @@ QT += core-private gui-private SOURCES += tst_qgraphicseffect.cpp CONFIG += parallel_test + +qpa:CONFIG+=insignificant_test # QTBUG-20761 -- cgit v1.2.3 From 6729dfbe0ed52d1fd5e1722d28c584cdcdd64545 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 5 Aug 2011 15:49:21 +0200 Subject: Fix fallbacksForFamily in QBasicUnixFontDatabase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that this function instead of the one in QPlatformFontDatabase will be called. Change-Id: Ifdb75ada27723c688e42067c7633b08391d66467 Reviewed-on: http://codereview.qt.nokia.com/2696 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- .../platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp | 2 +- src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index 6b844f9df1..d91cce59a9 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -237,7 +237,7 @@ QFontEngine *QBasicUnixFontDatabase::fontEngine(const QFontDef &fontDef, QUnicod return engine; } -QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const { Q_UNUSED(family); Q_UNUSED(style); diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h index f7fc0e547b..0e17ed55b6 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h @@ -57,7 +57,7 @@ class QBasicUnixFontDatabase : public QPlatformFontDatabase public: void populateFontDatabase(); QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); - QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; + QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const; QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); void releaseHandle(void *handle); -- cgit v1.2.3 From 230b088c373f0d8080d730797b477a8de4418605 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Mon, 8 Aug 2011 11:31:46 +1000 Subject: add qml related usage help message Change-Id: Ieabbca64793ba128746193786bac3d0213e8e746 Reviewed-on: http://codereview.qt.nokia.com/2716 Reviewed-by: Qt Sanity Bot Reviewed-by: Charles Yin --- src/testlib/qtestcase.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 023df89d98..27a897c263 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1076,9 +1076,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) " -minimumvalue n : Sets the minimum acceptable measurement value\n" " -iterations n : Sets the number of accumulation iterations.\n" " -median n : Sets the number of median iterations.\n" - " -vb : Print out verbose benchmarking information.\n" - "\n" - " -help : This help\n"; + " -vb : Print out verbose benchmarking information.\n"; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0 @@ -1086,6 +1084,17 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) printf(" Usage: %s [options] [testfunction[:testdata]]...\n" " By default, all testfunctions will be run.\n\n" "%s", argv[0], testOptions); + + if (qml) { + printf ("\nqmltest related options:\n" + " -import : Specify an import directory.\n" + " -input : Specify the root directory for test cases.\n" + " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n" + ); + } + + printf("\n" + " -help : This help\n"); exit(0); } else if (strcmp(argv[i], "-functions") == 0) { if (qml) { @@ -1228,6 +1237,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) } } else if (argv[i][0] == '-') { printf("Unknown option: '%s'\n\n%s", argv[i], testOptions); + if (qml) { + printf ("\nqmltest related options:\n" + " -import : Specify an import directory.\n" + " -input : Specify the root directory for test cases.\n" + " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n" + ); + } + + printf("\n" + " -help : This help\n"); exit(1); } else if (qml) { // We can't check the availability of test functions until -- cgit v1.2.3 From 532ba5aa702b6b17dd7489f50c946ba1b02852c7 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 8 Aug 2011 10:31:58 +1000 Subject: test: fixed usage of QEXPECT_FAIL in tst_qglyphrun::initTestCase The rest of this test gives unpredictable results if initTestCase fails. Normally, a failure in initTestCase skips the rest of the test, but this is not the case if QEXPECT_FAIL is used. Adjust the test to ensure the rest of it is still correctly skipped. Change-Id: I8ba76161e788f10801029ef10693e9ac275a2897 Reviewed-on: http://codereview.qt.nokia.com/2713 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qglyphrun/tst_qglyphrun.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp index a5a5cd19cc..e84915428f 100644 --- a/tests/auto/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp @@ -55,6 +55,7 @@ class tst_QGlyphRun: public QObject #if !defined(QT_NO_RAWFONT) private slots: void initTestCase(); + void init(); void cleanupTestCase(); void constructionAndDestruction(); @@ -78,6 +79,7 @@ private slots: private: int m_testFontId; QFont m_testFont; + bool m_testFont_ok; #endif // QT_NO_RAWFONT }; @@ -88,16 +90,27 @@ Q_DECLARE_METATYPE(QGlyphRun); void tst_QGlyphRun::initTestCase() { + m_testFont_ok = false; + m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf"); QVERIFY(m_testFontId >= 0); m_testFont = QFont("QtsSpecialTestFont"); #ifdef Q_WS_QPA - QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue); + QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort); #endif QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont")); + + m_testFont_ok = true; +} + +void tst_QGlyphRun::init() +{ + if (!m_testFont_ok) { + QSKIP("Test font is not working correctly", SkipAll); + } } void tst_QGlyphRun::cleanupTestCase() @@ -242,10 +255,6 @@ void tst_QGlyphRun::textLayoutGlyphIndexes() QList listOfGlyphs = layout.glyphRuns(); -#ifdef Q_WS_QPA - QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort); -#endif - QCOMPARE(listOfGlyphs.size(), 1); QGlyphRun glyphs = listOfGlyphs.at(0); @@ -292,10 +301,6 @@ void tst_QGlyphRun::drawExistingGlyphs() drawGlyphs.save("drawExistingGlyphs_drawGlyphIndexes.png"); #endif -#ifdef Q_WS_QPA - QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Continue); -#endif - QCOMPARE(textLayoutDraw, drawGlyphs); } -- cgit v1.2.3 From 3e522ca6e2f3913b8b0c004806c5b236387517c0 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 8 Aug 2011 11:13:58 +1000 Subject: tests: handle many expected crashing tests on qpa, xcb Mark all of these autotests as `insignificant' until the underlying crash bug is fixed. Task-number: QTBUG-20756 Change-Id: I18fb7038dd86ef2e9a5f37c8f26d7fe76032754e Reviewed-on: http://codereview.qt.nokia.com/2714 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro | 2 +- tests/auto/qgraphicsitem/qgraphicsitem.pro | 2 +- tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro | 2 +- tests/auto/qgraphicsscene/qgraphicsscene.pro | 1 + tests/auto/qgraphicsview/qgraphicsview.pro | 1 + tests/auto/qpainter/qpainter.pro | 1 + tests/auto/qtableview/qtableview.pro | 1 + tests/auto/qtextedit/qtextedit.pro | 2 ++ tests/auto/qtreeview/qtreeview.pro | 2 +- 9 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro index d66d639cdd..bde005fcf6 100644 --- a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicsgridlayout.cpp CONFIG += parallel_test - +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qgraphicsitem/qgraphicsitem.pro b/tests/auto/qgraphicsitem/qgraphicsitem.pro index ed30cae759..77fd00fe5d 100644 --- a/tests/auto/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/qgraphicsitem/qgraphicsitem.pro @@ -5,4 +5,4 @@ DEFINES += QT_NO_CAST_TO_ASCII win32:!wince*: LIBS += -lUser32 - +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro index 7217008317..9f63a48998 100644 --- a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro +++ b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro @@ -4,4 +4,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicsproxywidget.cpp - +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 635fb9b4e6..7dfb30a2c6 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -19,3 +19,4 @@ wince*:{ } symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # Min 1Mb, max 16Mb +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qgraphicsview/qgraphicsview.pro b/tests/auto/qgraphicsview/qgraphicsview.pro index 4d80caebaf..9e603af4f9 100644 --- a/tests/auto/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/qgraphicsview/qgraphicsview.pro @@ -6,3 +6,4 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp DEFINES += QT_NO_CAST_TO_ASCII symbian:TARGET.EPOCHEAPSIZE = 1000000 10000000 +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro index 88f35f5dd7..f29e39afec 100644 --- a/tests/auto/qpainter/qpainter.pro +++ b/tests/auto/qpainter/qpainter.pro @@ -17,3 +17,4 @@ wince* { mac*:CONFIG+=insignificant_test +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qtableview/qtableview.pro b/tests/auto/qtableview/qtableview.pro index 16284b23b4..0a2b5171ad 100644 --- a/tests/auto/qtableview/qtableview.pro +++ b/tests/auto/qtableview/qtableview.pro @@ -5,3 +5,4 @@ QT += core-private gui-private TARGET.EPOCHEAPSIZE = 0x200000 0x800000 SOURCES += tst_qtableview.cpp +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index 5851763310..594e53fda4 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -17,3 +17,5 @@ wince* { } else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qtreeview/qtreeview.pro b/tests/auto/qtreeview/qtreeview.pro index b7d30bd9cc..75c89094d6 100644 --- a/tests/auto/qtreeview/qtreeview.pro +++ b/tests/auto/qtreeview/qtreeview.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qtreeview.cpp - +contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb -- cgit v1.2.3 From 991033cf4690cace4fead03a588aa5ecaad18d3f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 8 Aug 2011 13:06:28 +1000 Subject: test: mark tst_qgraphicswidget as insignificant on qpa, xcb This autotest is unstable. Task-number: QTBUG-20778 Change-Id: If862a64d2be2f3f66ea8435b0412bfb401f9aceb Reviewed-on: http://codereview.qt.nokia.com/2721 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qgraphicswidget/qgraphicswidget.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qgraphicswidget/qgraphicswidget.pro b/tests/auto/qgraphicswidget/qgraphicswidget.pro index 533138c43b..64de1fc739 100644 --- a/tests/auto/qgraphicswidget/qgraphicswidget.pro +++ b/tests/auto/qgraphicswidget/qgraphicswidget.pro @@ -6,3 +6,4 @@ SOURCES += tst_qgraphicswidget.cpp mac*:CONFIG+=insignificant_test +qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-20778 unstable on qpa, xcb -- cgit v1.2.3 From ffb279a14986af9a6d34796e5c1aff53d4cd8b47 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2011 13:07:56 +0300 Subject: Change mouse and wheel QPA events to use QPointF. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least QMouseEvent already uses QPointF so there is no reason to restrict handleMouseEvent to integer positions. Change-Id: I9c72d2e0e99518b40a1898aec9ad2b3421a3e9e2 Reviewed-on: http://codereview.qt.nokia.com/2739 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/gui/kernel/qapplication_qpa.cpp | 32 +++++++++++++-------------- src/gui/kernel/qcursor_qpa.cpp | 4 ++-- src/gui/kernel/qwindowsysteminterface_qpa.cpp | 8 +++---- src/gui/kernel/qwindowsysteminterface_qpa.h | 8 +++---- src/gui/kernel/qwindowsysteminterface_qpa_p.h | 12 +++++----- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 1059ead210..dfac850716 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -76,8 +76,8 @@ QWidget *qt_button_down = 0; // widget got last button-down static bool app_do_modal = false; extern QWidgetList *qt_modal_stack; // stack of modal widgets -int qt_last_x = 0; -int qt_last_y = 0; +qreal qt_last_x = 0; +qreal qt_last_y = 0; QPointer qt_last_mouse_receiver = 0; static Qt::MouseButtons buttons = Qt::NoButton; @@ -621,7 +621,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse QEvent::Type type; // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; - if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { + if (e->globalPos != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop @@ -630,8 +630,8 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse QWidget * tlw = e->widget.data(); - QPoint localPoint = e->localPos; - QPoint globalPoint = e->globalPos; + QPointF localPoint = e->localPos; + QPointF globalPoint = e->globalPos; QWidget *mouseWindow = tlw; Qt::MouseButton button = Qt::NoButton; @@ -694,7 +694,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse // find the tlw if we didn't get it from the plugin if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); + mouseWindow = QApplication::topLevelAt(globalPoint.toPoint()); } if (!mouseWindow && !implicit_mouse_grabber) @@ -702,13 +702,13 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse if (mouseWindow && mouseWindow != tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it - localPoint = mouseWindow->mapFromGlobal(globalPoint); + localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint()); } // which child should have it? QWidget *mouseWidget = mouseWindow; if (mouseWindow) { - QWidget *w = mouseWindow->childAt(localPoint); + QWidget *w = mouseWindow->childAt(localPoint.toPoint()); if (w) { mouseWidget = w; } @@ -724,13 +724,13 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse mouseWidget = implicit_mouse_grabber.data(); mouseWindow = mouseWidget->window(); if (mouseWindow != tlw) - localPoint = mouseWindow->mapFromGlobal(globalPoint); + localPoint = mouseWindow->mapFromGlobal(globalPoint.toPoint()); } Q_ASSERT(mouseWidget); //localPoint is local to mouseWindow, but it needs to be local to mouseWidget - localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); + localPoint = mouseWidget->mapFrom(mouseWindow, localPoint.toPoint()); if (buttons == Qt::NoButton) { //qDebug() << "resetting mouse grabber"; @@ -760,7 +760,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse #ifndef QT_NO_CONTEXTMENU if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QApplication::keyboardModifiers()); + QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint.toPoint(), globalPoint.toPoint(), QApplication::keyboardModifiers()); QApplication::sendSpontaneousEvent(mouseWidget, &e); } #endif // QT_NO_CONTEXTMENU @@ -772,7 +772,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { // QPoint localPoint = ev.pos(); - QPoint globalPoint = e->globalPos; + QPointF globalPoint = e->globalPos; // bool trustLocalPoint = !!tlw; //is there something the local point can be local to? QWidget *mouseWidget; @@ -783,7 +783,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wheel // find the tlw if we didn't get it from the plugin if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); + mouseWindow = QApplication::topLevelAt(globalPoint.toPoint()); } if (!mouseWindow) @@ -795,11 +795,11 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wheel qDebug() << "modal blocked wheel event" << mouseWindow; return; } - QPoint p = mouseWindow->mapFromGlobal(globalPoint); - QWidget *w = mouseWindow->childAt(p); + QPointF p = mouseWindow->mapFromGlobal(globalPoint.toPoint()); + QWidget *w = mouseWindow->childAt(p.toPoint()); if (w) { mouseWidget = w; - p = mouseWidget->mapFromGlobal(globalPoint); + p = mouseWidget->mapFromGlobal(globalPoint.toPoint()); } QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(), diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp index c0b27bebd8..d4cf6f4995 100644 --- a/src/gui/kernel/qcursor_qpa.cpp +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -107,11 +107,11 @@ void QCursorData::update() #endif //QT_NO_CURSOR -extern int qt_last_x,qt_last_y; +extern qreal qt_last_x,qt_last_y; QPoint QCursor::pos() { - return QPoint(qt_last_x, qt_last_y); + return QPointF(qt_last_x, qt_last_y).toPoint(); } void QCursor::setPos(int x, int y) diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 0ae18d5a48..5ae30148d3 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -115,12 +115,12 @@ void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) */ -void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { +void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleMouseEvent(w, time, local, global, b); } -void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) +void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { if (tlw) { QWidgetData *data = qt_qwidget_data(tlw); @@ -180,12 +180,12 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestam QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } -void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { +void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleWheelEvent(w, time, local, global, d, o); } -void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) +void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { if (tlw) { QWidgetData *data = qt_qwidget_data(tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 585d79f56a..5a811b90c1 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -58,8 +58,8 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QWindowSystemInterface { public: - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b); - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + static void handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b); + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b); static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); @@ -75,8 +75,8 @@ public: const QString& text = QString(), bool autorep = false, ushort count = 1); - static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); struct TouchPoint { int id; // for application use diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 7be64e620d..385175cc60 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -121,20 +121,20 @@ public: class MouseEvent : public UserEvent { public: - MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + MouseEvent(QWidget * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b) : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { } - QPoint localPos; - QPoint globalPos; + QPointF localPos; + QPointF globalPos; Qt::MouseButtons buttons; }; class WheelEvent : public UserEvent { public: - WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + WheelEvent(QWidget *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { } int delta; - QPoint localPos; - QPoint globalPos; + QPointF localPos; + QPointF globalPos; Qt::Orientation orient; }; -- cgit v1.2.3 From 92d88e475518b9f34dd068803d439892bdeaba9a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 8 Aug 2011 16:27:02 +0200 Subject: Support -qtnamespace and -qtlibinfix in qtbase examples Task-number: QTBUG-19971 Change-Id: Ie20eb2fc133658dd34e1ec25a3b80c36f0f01aa3 Reviewed-on: http://codereview.qt.nokia.com/2754 Reviewed-by: Qt Sanity Bot Reviewed-by: Liang Qi --- examples/opengl/cube/mainwidget.h | 2 ++ examples/widgets/orientation/mainwindow.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h index c6da29faa5..eb509d0d40 100644 --- a/examples/opengl/cube/mainwidget.h +++ b/examples/opengl/cube/mainwidget.h @@ -48,8 +48,10 @@ #include #include +QT_BEGIN_NAMESPACE class QBasicTimer; class QGLShaderProgram; +QT_END_NAMESPACE class GeometryEngine; diff --git a/examples/widgets/orientation/mainwindow.h b/examples/widgets/orientation/mainwindow.h index 400a6a5a7f..45907c31be 100644 --- a/examples/widgets/orientation/mainwindow.h +++ b/examples/widgets/orientation/mainwindow.h @@ -46,7 +46,9 @@ #include "ui_landscape.h" #include "ui_portrait.h" +QT_BEGIN_NAMESPACE class QAbstractButton; +QT_END_NAMESPACE //! [0] class MainWindow : public QWidget -- cgit v1.2.3 From ad9f5c7e938b1d80b455acdfd0809448f2b5e1db Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 9 Aug 2011 11:30:03 +0200 Subject: Remove all non-const operator== We had to leave the non-const operator== for binary compatibility. Remove them all, just leave the const version in there. 100% source compatible. Change-Id: Ib7a70fb441fe51d5164d9cbf495cbeda0f48fafe Reviewed-on: http://codereview.qt.nokia.com/2773 Reviewed-by: Qt Sanity Bot Reviewed-by: Robert Griebl --- src/corelib/io/qfileinfo.cpp | 36 +++++++++------------- src/corelib/io/qfileinfo.h | 2 -- src/corelib/tools/qmap.h | 4 +-- src/gui/graphicsview/qgraphicslayout_p.h | 4 +-- src/gui/itemviews/qwidgetitemdata_p.h | 2 +- src/gui/kernel/qeventdispatcher_mac_p.h | 2 +- src/gui/painting/qbrush.cpp | 8 ----- src/gui/painting/qbrush.h | 2 -- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qfontmetrics.cpp | 30 ------------------ src/gui/text/qfontmetrics.h | 4 --- .../gl2paintengineex/qglengineshadermanager_p.h | 2 +- 12 files changed, 22 insertions(+), 76 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index f54818e0a6..c83c39195a 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -366,7 +366,7 @@ QFileInfo::~QFileInfo() } /*! - \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) + \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) const Returns true if this QFileInfo object refers to a different file than the one specified by \a fileinfo; otherwise returns false. @@ -380,7 +380,19 @@ QFileInfo::~QFileInfo() */ /*! - \overload + Returns true if this QFileInfo object refers to a file in the same + location as \a fileinfo; otherwise returns false. + + Note that the result of comparing two empty QFileInfo objects, + containing no file references, is undefined. + + \warning This will not compare two different symbolic links + pointing to the same file. + + \warning Long and short file names that refer to the same file on Windows + are treated as if they referred to different files. + + \sa operator!=() */ bool QFileInfo::operator==(const QFileInfo &fileinfo) const { @@ -409,26 +421,6 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0; } -/*! - Returns true if this QFileInfo object refers to a file in the same - location as \a fileinfo; otherwise returns false. - - Note that the result of comparing two empty QFileInfo objects, - containing no file references, is undefined. - - \warning This will not compare two different symbolic links - pointing to the same file. - - \warning Long and short file names that refer to the same file on Windows - are treated as if they referred to different files. - - \sa operator!=() -*/ -bool QFileInfo::operator==(const QFileInfo &fileinfo) -{ - return const_cast(this)->operator==(fileinfo); -} - /*! Makes a copy of the given \a fileinfo and assigns it to this QFileInfo. */ diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index 6ca0ae79e0..ab3d2dc847 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -75,9 +75,7 @@ public: inline QFileInfo&operator=(QFileInfo &&other) { qSwap(d_ptr, other.d_ptr); return *this; } #endif - bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me bool operator==(const QFileInfo &fileinfo) const; - inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); } void setFile(const QString &file); diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 36d8eefbdb..771959a3bf 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -352,8 +352,8 @@ public: // ### Qt 5: not sure this is necessary anymore #ifdef QT_STRICT_ITERATORS private: - inline bool operator==(const iterator &o) { return operator==(const_iterator(o)); } - inline bool operator!=(const iterator &o) { return operator!=(const_iterator(o)); } + inline bool operator==(const iterator &o) const { return operator==(const_iterator(o)); } + inline bool operator!=(const iterator &o) const { return operator!=(const_iterator(o)); } #endif private: diff --git a/src/gui/graphicsview/qgraphicslayout_p.h b/src/gui/graphicsview/qgraphicslayout_p.h index 586cbc77e3..071a2ade25 100644 --- a/src/gui/graphicsview/qgraphicslayout_p.h +++ b/src/gui/graphicsview/qgraphicslayout_p.h @@ -98,9 +98,9 @@ public: inline QStyle *style() const { return m_style; } inline QWidget *widget() const { return m_widget; } - inline bool operator==(const QLayoutStyleInfo &other) + inline bool operator==(const QLayoutStyleInfo &other) const { return m_style == other.m_style && m_widget == other.m_widget; } - inline bool operator!=(const QLayoutStyleInfo &other) + inline bool operator!=(const QLayoutStyleInfo &other) const { return !(*this == other); } inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){ diff --git a/src/gui/itemviews/qwidgetitemdata_p.h b/src/gui/itemviews/qwidgetitemdata_p.h index 19724a3ccc..e7a08de378 100644 --- a/src/gui/itemviews/qwidgetitemdata_p.h +++ b/src/gui/itemviews/qwidgetitemdata_p.h @@ -62,7 +62,7 @@ public: inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {} int role; QVariant value; - inline bool operator==(const QWidgetItemData &other) { return role == other.role && value == other.value; } + inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; } }; #ifndef QT_NO_DATASTREAM diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 485b14c38f..f4cf16e8a0 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -141,7 +141,7 @@ struct MacTimerInfo { QObject *obj; bool pending; CFRunLoopTimerRef runLoopTimer; - bool operator==(const MacTimerInfo &other) + bool operator==(const MacTimerInfo &other) const { return (id == other.id); } diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 97ea4dbc15..742a4ea071 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1567,14 +1567,6 @@ bool QGradient::operator==(const QGradient &gradient) const return stops() == gradient.stops(); } -/*! - \internal -*/ -bool QGradient::operator==(const QGradient &gradient) -{ - return const_cast(this)->operator==(gradient); -} - /*! \class QLinearGradient \ingroup painting diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 4a0bfcc8e4..edf99924a3 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -249,8 +249,6 @@ public: inline bool operator!=(const QGradient &other) const { return !operator==(other); } - bool operator==(const QGradient &gradient); // ### Qt 5: remove - private: friend class QLinearGradient; friend class QRadialGradient; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 5570768ddb..5f779e155a 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -291,7 +291,7 @@ private: struct GlyphCacheEntry { void *context; QExplicitlySharedDataPointer cache; - bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; } + bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; } }; mutable QLinkedList m_glyphCaches; diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9e1646f046..9fce85f25b 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -224,7 +224,6 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm) } /*! - \overload Returns true if \a other is equal to this object; otherwise returns false. @@ -239,21 +238,6 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const return d == other.d; } -/*! - Returns true if \a other is equal to this object; otherwise - returns false. - - Two font metrics are considered equal if they were constructed - from the same QFont and the paint devices they were constructed - for are considered compatible. - - \sa operator!=() -*/ -bool QFontMetrics::operator ==(const QFontMetrics &other) -{ - return d == other.d; -} - /*! \fn bool QFontMetrics::operator!=(const QFontMetrics &other) @@ -1118,7 +1102,6 @@ QFontMetricsF &QFontMetricsF::operator=(const QFontMetricsF &fm) } /*! - \overload Returns true if the font metrics are equal to the \a other font metrics; otherwise returns false. @@ -1131,19 +1114,6 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const return d == other.d; } -/*! - Returns true if the font metrics are equal to the \a other font - metrics; otherwise returns false. - - Two font metrics are considered equal if they were constructed from the - same QFont and the paint devices they were constructed for are - considered to be compatible. -*/ -bool QFontMetricsF::operator ==(const QFontMetricsF &other) -{ - return d == other.d; -} - /*! \fn bool QFontMetricsF::operator!=(const QFontMetricsF &other) diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 6a2db60b03..a23bb34e0d 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -117,9 +117,7 @@ public: int strikeOutPos() const; int lineWidth() const; - bool operator==(const QFontMetrics &other); // 5.0 - remove me bool operator==(const QFontMetrics &other) const; - inline bool operator !=(const QFontMetrics &other) { return !operator==(other); } // 5.0 - remove me inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); } #ifdef QT3_SUPPORT @@ -192,9 +190,7 @@ public: qreal strikeOutPos() const; qreal lineWidth() const; - bool operator==(const QFontMetricsF &other); // 5.0 - remove me bool operator==(const QFontMetricsF &other) const; - inline bool operator !=(const QFontMetricsF &other) { return !operator==(other); } // 5.0 - remove me inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); } private: diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index e5f032747b..921df369f4 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -401,7 +401,7 @@ public: bool useOpacityAttribute; bool usePmvMatrixAttribute; - bool operator==(const QGLEngineShaderProg& other) { + bool operator==(const QGLEngineShaderProg& other) const { // We don't care about the program return ( mainVertexShader == other.mainVertexShader && positionVertexShader == other.positionVertexShader && -- cgit v1.2.3 From 61d60402bf2f24390afdba395a6bffc9e5bc3b92 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 10 Aug 2011 11:45:02 +1000 Subject: test: mark tst_qftp as insignificant As virtually all of our tests which use the live qt-test-server, this test is inherently unstable. Change-Id: I27fc07a28b8dd6cd4dd3cb6414389e3cf41d0318 Reviewed-on: http://codereview.qt.nokia.com/2795 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qftp/qftp.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro index 69f89572ba..8f63d6e26e 100644 --- a/tests/auto/qftp/qftp.pro +++ b/tests/auto/qftp/qftp.pro @@ -18,3 +18,5 @@ wince*: { } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +CONFIG+=insignificant_test # uses live qt-test-server, inherently unstable -- cgit v1.2.3 From 5d481fa2400b08bd11aae364e4f31ccc7a8e909c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 8 Aug 2011 11:55:35 +1000 Subject: test: only QEXPECT_FAIL tst_qgraphicstransform in release mode The floating point problem which causes this test to fail is not triggered if Qt is compiled in debug mode. Enable QEXPECT_FAIL more narrowly. Task-number: QTBUG-20661 Change-Id: I25f3260b516cd4fda9d8b711aa1140cbda821412 Reviewed-on: http://codereview.qt.nokia.com/2719 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qgraphicstransform/qgraphicstransform.pro | 2 ++ tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro index 67c939ed8b..3da3408d29 100644 --- a/tests/auto/qgraphicstransform/qgraphicstransform.pro +++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro @@ -1,3 +1,5 @@ load(qttest_p4) SOURCES += tst_qgraphicstransform.cpp CONFIG += parallel_test + +linux-*:contains(QT_CONFIG,release):DEFINES+=MAY_HIT_QTBUG_20661 diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 7b928909ff..1a116b7f30 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -359,7 +359,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis() exp.rotate(angle, axis); QTransform expected = exp.toTransform(1024.0f); -#ifdef Q_OS_LINUX +#if defined(MAY_HIT_QTBUG_20661) // These failures possibly relate to the float vs qreal issue mentioned // in the comment above fuzzyCompare(). if (sizeof(qreal) == sizeof(double)) { -- cgit v1.2.3 From de9caf16fe125b7b139287936eda555614648534 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 5 Aug 2011 11:44:39 +1000 Subject: test: mark tst_qfontdatabase qpa failures as expected Task-number: QTBUG-20754 Change-Id: Ibb57e7724d453b390a8e37e62f6e5cf2691f48f8 Reviewed-on: http://codereview.qt.nokia.com/2654 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada --- tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index 735c7e4350..1df61d0a06 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -160,6 +160,13 @@ void tst_QFontDatabase::fixedPitch() if (!fdb.families().contains(font)) QSKIP( "Font not installed", SkipSingle); +#ifdef Q_WS_QPA + if (fixedPitch) { + // fixedPitch() never returns true on qpa + QEXPECT_FAIL("", "QTBUG-20754 fails on qpa", Abort); + } +#endif + QCOMPARE(fdb.isFixedPitch(font), fixedPitch); QFont qfont(font); @@ -229,6 +236,10 @@ void tst_QFontDatabase::addAppFont() QFontDatabase db; +#ifdef Q_WS_QPA + QEXPECT_FAIL("memory font", "QTBUG-20754 fails on qpa", Abort); +#endif + const QStringList oldFamilies = db.families(); QVERIFY(!oldFamilies.isEmpty()); @@ -262,6 +273,10 @@ void tst_QFontDatabase::addAppFont() const QStringList addedFamilies = QFontDatabase::applicationFontFamilies(id); QVERIFY(!addedFamilies.isEmpty()); +#ifdef Q_WS_QPA + QEXPECT_FAIL("font file", "QTBUG-20754 fails on qpa", Abort); +#endif + const QStringList newFamilies = db.families(); QVERIFY(!newFamilies.isEmpty()); QVERIFY(newFamilies.count() >= oldFamilies.count()); -- cgit v1.2.3 From 81d15e059fe2367788b3b0d1aa34171a2cc9692b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 10 Aug 2011 11:49:46 +1000 Subject: configure: fixed debug-and-release default for qpa on mac debug/release is always supposed to default on for platforms where debug/release affects linkage (i.e. mac and windows). Previously, it did not correctly default on for qpa mac builds. Change-Id: I8d3c418f3fb787136ab120872fdd4d2ebf82c90e Reviewed-on: http://codereview.qt.nokia.com/2796 Reviewed-by: Qt Sanity Bot Reviewed-by: Toby Tomkins --- configure | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 877b13eb96..28e3d3aab0 100755 --- a/configure +++ b/configure @@ -2510,23 +2510,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye echo fi -# detect build style -if [ "$CFG_DEBUG" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then - CFG_DEBUG_RELEASE=yes - CFG_DEBUG=yes - elif [ "$CFG_DEV" = "yes" ]; then - CFG_DEBUG_RELEASE=no - CFG_DEBUG=yes - else - CFG_DEBUG_RELEASE=no - CFG_DEBUG=no - fi -fi -if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then - QMAKE_CONFIG="$QMAKE_CONFIG build_all" -fi - if [ "$CFG_SILENT" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG silent" fi @@ -3243,6 +3226,23 @@ fi # tests that don't need qmake (must be run before displaying help) #------------------------------------------------------------------------------- +# detect build style +if [ "$CFG_DEBUG" = "auto" ]; then + if [ "$CFG_ARCH" = "macosx" -o "$XPLATFORM_MINGW" = "yes" ]; then + CFG_DEBUG_RELEASE=yes + CFG_DEBUG=yes + elif [ "$CFG_DEV" = "yes" ]; then + CFG_DEBUG_RELEASE=no + CFG_DEBUG=yes + else + CFG_DEBUG_RELEASE=no + CFG_DEBUG=no + fi +fi +if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG build_all" +fi + if [ -z "$PKG_CONFIG" ]; then # See if PKG_CONFIG is set in the mkspec: PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '` -- cgit v1.2.3 From ca3120aa20038b22810d675c93cd1eac1dcc88d1 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Wed, 27 Jul 2011 10:38:16 +1000 Subject: Don't print the "Configuration tests:" header if there aren't any. Change-Id: Ie7f0022348aba90e240f5b68e838430ec4e43ae9 Reviewed-on: http://codereview.qt.nokia.com/2228 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- bin/qtmodule-configtests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/qtmodule-configtests b/bin/qtmodule-configtests index f6cc2052da..0552f8e614 100755 --- a/bin/qtmodule-configtests +++ b/bin/qtmodule-configtests @@ -262,7 +262,7 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) { $| = 1; # Now run the configuration tests - print "Configuration tests:\n"; + print "Configuration tests:\n" if (%configtests); while ((my $testName, my $testParameters) = each %configtests) { printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up -- cgit v1.2.3 From 661fcee7791a5c19c14ba87b60aaf2b46db19422 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 2 Aug 2011 16:09:24 +0200 Subject: QLabel documentation: add warning about sanitizing input make users more aware of QLabel guessing the text format. Reviewed-by: Gabriel de Dietrich (cherry picked from commit 31f7ecbdcdbafbac5bbfa693e4d060757244941b) Change-Id: I681c7daf568a6107b01908fa85d2da2a7e4e228a Reviewed-on: http://codereview.qt.nokia.com/2817 Reviewed-by: Qt Sanity Bot Reviewed-by: Peter Hartmann --- src/gui/widgets/qlabel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 26dd0e1120..7a94f42125 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -88,6 +88,13 @@ QT_BEGIN_NAMESPACE by clear(). \endtable + \warning When passing a QString to the constructor or calling setText(), + make sure to sanitize your input, as QLabel tries to guess whether it + displays the text as plain text or as rich text. You may want to call + setTextFormat() explicitly, e.g. in case you expect the text to be in + plain format but cannot control the text source (for instance when + displaying data loaded from the Web). + When the content is changed using any of these functions, any previous content is cleared. -- cgit v1.2.3 From 7ebfe33e38a81f2a47bb251e093aeb718dbe34e6 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 11 Aug 2011 13:14:14 +1000 Subject: configure: fixed usage of rpath on mac This logic should be used for all mac platforms. Currently it is erroneously skipped for qpa on mac. Change-Id: Ibc8e0bb38d4c08f48292639c614bc328c703b1bc Reviewed-on: http://codereview.qt.nokia.com/2836 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 28e3d3aab0..f4691e12c2 100755 --- a/configure +++ b/configure @@ -7311,7 +7311,7 @@ fi [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS" [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS" -if [ "$PLATFORM_MAC" = "yes" ]; then +if [ "$CFG_ARCH" = "macosx" ]; then if [ "$CFG_RPATH" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname" fi -- cgit v1.2.3 From 96d987edac0bbbb1a02382eae3389d75b655406b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 11 Aug 2011 11:53:10 +1000 Subject: Let CONFIG+=no_default_target also disable `check' by default If the compilation of a subdir was explicitly disabled by default, then the testing of that subdir should also be disabled by default. Change-Id: I928e232393e89a7c27813b7a48864d4e0fb687f8 Reviewed-on: http://codereview.qt.nokia.com/2835 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- mkspecs/features/default_post.prf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 3f93220cc4..b16492b324 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -99,10 +99,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST # Let every project have a standard GNU `check' target !contains(QMAKE_EXTRA_TARGETS, check) { # `make check' should iterate through all subdirs + # (except those with no_default_target) contains(TEMPLATE, subdirs) { check.CONFIG = recursive - check.recurse = $$SUBDIRS check.recurse_target = check + + for(subdir, SUBDIRS) { + subdir_config=$$eval($${subdir}.CONFIG) + !contains(subdir_config, no_default_target):check.recurse += $$subdir + unset(subdir_config) + } } # `make check' should imply building the project else { -- cgit v1.2.3 From f2b3dfd1f17952627fce9fde1264207958f87f43 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 11 Aug 2011 15:17:40 +0200 Subject: QXmlStream lives in QtCore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can finally remove the hack where a copy of QXmlStream was compiled into QtXml on some platforms. Change-Id: Ia164caa73dfb470ac86d1b4062031093b433d10c Reviewed-on: http://codereview.qt.nokia.com/2869 Reviewed-by: Qt Sanity Bot Reviewed-by: João Abecasis --- src/xml/stream/qxmlstream.h | 73 ---------------------------------- src/xml/stream/stream.pri | 9 ----- src/xml/xml.pro | 1 - tests/auto/selftests/tst_selftests.cpp | 2 +- tools/uilib/abstractformbuilder.cpp | 2 +- 5 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 src/xml/stream/qxmlstream.h delete mode 100644 src/xml/stream/stream.pri diff --git a/src/xml/stream/qxmlstream.h b/src/xml/stream/qxmlstream.h deleted file mode 100644 index 7023ab236b..0000000000 --- a/src/xml/stream/qxmlstream.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtXml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef OLD_QXMLSTREAM_H -#define OLD_QXMLSTREAM_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Xml) - -#if 0 -// make syncqt generate forwarding headers for this file too -#pragma qt_class(QXmlStreamAttribute) -#pragma qt_class(QXmlStreamAttributes) -#pragma qt_class(QXmlStreamEntityDeclaration) -#pragma qt_class(QXmlStreamEntityDeclarations) -#pragma qt_class(QXmlStreamEntityResolver) -#pragma qt_class(QXmlStreamNamespaceDeclaration) -#pragma qt_class(QXmlStreamNamespaceDeclarations) -#pragma qt_class(QXmlStreamNotationDeclaration) -#pragma qt_class(QXmlStreamNotationDeclarations) -#pragma qt_class(QXmlStreamReader) -#pragma qt_class(QXmlStreamStringRef) -#pragma qt_class(QXmlStreamWriter) -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // OLD_QXMLSTREAM_H diff --git a/src/xml/stream/stream.pri b/src/xml/stream/stream.pri deleted file mode 100644 index a5ba3a22fa..0000000000 --- a/src/xml/stream/stream.pri +++ /dev/null @@ -1,9 +0,0 @@ -# compatibility header: -HEADERS += stream/qxmlstream.h - -!static { - # The platforms that require the symbol to be present in QtXml: - win32:!wince-*:SOURCES += ../corelib/xml/qxmlstream.cpp - mac:SOURCES += ../corelib/xml/qxmlstream.cpp - aix-*:SOURCES += ../corelib/xml/qxmlstream.cpp -} diff --git a/src/xml/xml.pro b/src/xml/xml.pro index f1d2baca50..a764fa6094 100644 --- a/src/xml/xml.pro +++ b/src/xml/xml.pro @@ -25,6 +25,5 @@ win32-borland { include(dom/dom.pri) include(sax/sax.pri) -include(stream/stream.pri) symbian:TARGET.UID3=0x2001B2E0 diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a9542002f..78f0620779 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include class tst_Selftests: public QObject diff --git a/tools/uilib/abstractformbuilder.cpp b/tools/uilib/abstractformbuilder.cpp index 71c7b8a8ad..72c1d6ff30 100644 --- a/tools/uilib/abstractformbuilder.cpp +++ b/tools/uilib/abstractformbuilder.cpp @@ -82,7 +82,7 @@ # include // Compiling within Designer #endif -#include +#include #include -- cgit v1.2.3 From 32ae0d2bdd6ef0660a1b226ed53ff4786a4199b9 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 09:18:51 +1000 Subject: test: skip tst_QPrinter::testNonExistentPrinter for qpa Since the test is irrelevant for Q_WS_X11 and Q_WS_QWS, it's almost certainly irrelevant for Q_WS_QPA too. Change-Id: Icc563046baf4c2a5217b87dee150afc7f6fd034d Reviewed-on: http://codereview.qt.nokia.com/2876 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qprinter/tst_qprinter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 57f79b26db..f67f8af3bd 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -423,8 +423,8 @@ void tst_QPrinter::testMargins() void tst_QPrinter::testNonExistentPrinter() { -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_MAC) - QSKIP("QPrinter::testNonExistentPrinter() is not relevant for X11/Embedded/Mac", SkipAll); +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_MAC) + QSKIP("QPrinter::testNonExistentPrinter() is not relevant for this platform", SkipAll); #else QPrinter printer; QPainter painter; -- cgit v1.2.3 From 11594673533e8ceaea9a823842c69c727e9264cd Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 09:58:45 +1000 Subject: test: skip some broken tests in tst_qpixmap for qpa These tests cannot be written properly for qpa, due to missing API. Task-number: QTBUG-20864 Task-number: QTBUG-20863 Change-Id: I2b311833a6738b1830c1cd8be1f20293492bebda Reviewed-on: http://codereview.qt.nokia.com/2877 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qpixmap/tst_qpixmap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 7f7c339fcb..e62708fc3d 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -876,6 +876,9 @@ void tst_QPixmap::grabWidget() void tst_QPixmap::grabWindow() { +#ifdef Q_WS_QPA + QSKIP("QTBUG-20863 grabWindow is broken on most qpa backends", SkipAll); +#endif #ifdef Q_OS_WINCE // We get out of memory, if the desktop itself is too big. if (QApplication::desktop()->width() <= 480) @@ -1333,6 +1336,9 @@ void tst_QPixmap::toSymbianCFbsBitmap() void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() { +#ifdef Q_WS_QPA + QSKIP("QTBUG-20864 can't determine if threaded pixmaps are available for qpa", SkipAll); +#endif #if !defined(Q_WS_WIN) && !defined(Q_WS_MAC) class Thread : public QThread { -- cgit v1.2.3 From 4a33154406418b472270ae5c33c0e302bdc11d6d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 13:47:17 +1000 Subject: test: skip tst_QMenu::task258920_mouseBorder on qpa This test can't work because QCursor::setPos() isn't yet implemented for qpa. Task-number: QTBUG-20753 Change-Id: I2da8f920bd2d4706bbbcd983e11d2cc19055d2bf Reviewed-on: http://codereview.qt.nokia.com/2891 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qmenu/tst_qmenu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index b3c41e1c2b..331f0e9a2d 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -826,6 +826,9 @@ void tst_QMenu::task258920_mouseBorder() { #ifdef Q_OS_WINCE_WM QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); +#endif +#ifdef Q_WS_QPA + QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa", SkipAll); #endif Menu258920 menu; // On Symbian, styleHint(QStyle::SH_Menu_MouseTracking) in QS60Style is false. -- cgit v1.2.3 From 80e7ea928f3b69dec90c0020671c5d7354c37227 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 10 Aug 2011 10:05:03 +0300 Subject: Handle EINTR gracefully in Wayland clipboard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idd5082f02eb6708685421492afb8ad5b8546a5d6 Reviewed-on: http://codereview.qt.nokia.com/2810 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandclipboard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index d20f183efe..45f0abc00a 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -50,6 +50,7 @@ #include #include #include +#include // for QT_READ static QWaylandClipboard *clipboard = 0; @@ -219,7 +220,7 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type char buf[256]; int n; close(pipefd[1]); - while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) + while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0) content.append(buf, n); close(pipefd[0]); return content; -- cgit v1.2.3 From 879e351961e4203cb0e4c62b5658bc5563b145a1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Aug 2011 11:37:32 +0200 Subject: Submit ui4.cpp/h as generated by corresponding change in qttools. Change: 6b02fc50ec6a5236f628b08ebeca50e62b22f362 (Remove QDom code). Also introduces QStringLiteral. Remove QtXml from uitools profile. Done-with: Kai Koehne Change-Id: I56ee88a5dc76041eeb3685a982f2e9c60bcebd13 Reviewed-on: http://codereview.qt.nokia.com/2907 Reviewed-by: Qt Sanity Bot Reviewed-by: Friedemann Kleint --- src/tools/uic/ui4.cpp | 3501 +++++++++-------------------------------------- src/tools/uic/ui4.h | 204 --- src/uitools/uitools.pro | 3 +- tools/uilib/ui4.cpp | 3501 +++++++++-------------------------------------- tools/uilib/ui4_p.h | 204 --- 5 files changed, 1255 insertions(+), 6158 deletions(-) diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index cd1cd1d6a6..5374fe9202 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -40,9 +40,6 @@ ****************************************************************************/ #include "ui4.h" -#ifdef QUILOADER_QDOM_READ -#include -#endif QT_BEGIN_NAMESPACE #ifdef QFORMINTERNAL_NAMESPACE @@ -139,126 +136,126 @@ void DomUI::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("version")) { + if (name == QStringLiteral("version")) { setAttributeVersion(attribute.value().toString()); continue; } - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QLatin1String("displayname")) { + if (name == QStringLiteral("displayname")) { setAttributeDisplayname(attribute.value().toString()); continue; } - if (name == QLatin1String("stdsetdef")) { + if (name == QStringLiteral("stdsetdef")) { setAttributeStdsetdef(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("stdSetDef")) { + if (name == QStringLiteral("stdSetDef")) { setAttributeStdSetDef(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("author")) { + if (tag == QStringLiteral("author")) { setElementAuthor(reader.readElementText()); continue; } - if (tag == QLatin1String("comment")) { + if (tag == QStringLiteral("comment")) { setElementComment(reader.readElementText()); continue; } - if (tag == QLatin1String("exportmacro")) { + if (tag == QStringLiteral("exportmacro")) { setElementExportMacro(reader.readElementText()); continue; } - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QLatin1String("layoutdefault")) { + if (tag == QStringLiteral("layoutdefault")) { DomLayoutDefault *v = new DomLayoutDefault(); v->read(reader); setElementLayoutDefault(v); continue; } - if (tag == QLatin1String("layoutfunction")) { + if (tag == QStringLiteral("layoutfunction")) { DomLayoutFunction *v = new DomLayoutFunction(); v->read(reader); setElementLayoutFunction(v); continue; } - if (tag == QLatin1String("pixmapfunction")) { + if (tag == QStringLiteral("pixmapfunction")) { setElementPixmapFunction(reader.readElementText()); continue; } - if (tag == QLatin1String("customwidgets")) { + if (tag == QStringLiteral("customwidgets")) { DomCustomWidgets *v = new DomCustomWidgets(); v->read(reader); setElementCustomWidgets(v); continue; } - if (tag == QLatin1String("tabstops")) { + if (tag == QStringLiteral("tabstops")) { DomTabStops *v = new DomTabStops(); v->read(reader); setElementTabStops(v); continue; } - if (tag == QLatin1String("images")) { + if (tag == QStringLiteral("images")) { DomImages *v = new DomImages(); v->read(reader); setElementImages(v); continue; } - if (tag == QLatin1String("includes")) { + if (tag == QStringLiteral("includes")) { DomIncludes *v = new DomIncludes(); v->read(reader); setElementIncludes(v); continue; } - if (tag == QLatin1String("resources")) { + if (tag == QStringLiteral("resources")) { DomResources *v = new DomResources(); v->read(reader); setElementResources(v); continue; } - if (tag == QLatin1String("connections")) { + if (tag == QStringLiteral("connections")) { DomConnections *v = new DomConnections(); v->read(reader); setElementConnections(v); continue; } - if (tag == QLatin1String("designerdata")) { + if (tag == QStringLiteral("designerdata")) { DomDesignerData *v = new DomDesignerData(); v->read(reader); setElementDesignerdata(v); continue; } - if (tag == QLatin1String("slots")) { + if (tag == QStringLiteral("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QLatin1String("buttongroups")) { + if (tag == QStringLiteral("buttongroups")) { DomButtonGroups *v = new DomButtonGroups(); v->read(reader); setElementButtonGroups(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -274,211 +271,91 @@ void DomUI::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomUI::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("version"))) - setAttributeVersion(node.attribute(QLatin1String("version"))); - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - if (node.hasAttribute(QLatin1String("displayname"))) - setAttributeDisplayname(node.attribute(QLatin1String("displayname"))); - if (node.hasAttribute(QLatin1String("stdsetdef"))) - setAttributeStdsetdef(node.attribute(QLatin1String("stdsetdef")).toInt()); - if (node.hasAttribute(QLatin1String("stdSetDef"))) - setAttributeStdSetDef(node.attribute(QLatin1String("stdSetDef")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("author")) { - setElementAuthor(e.text()); - continue; - } - if (tag == QLatin1String("comment")) { - setElementComment(e.text()); - continue; - } - if (tag == QLatin1String("exportmacro")) { - setElementExportMacro(e.text()); - continue; - } - if (tag == QLatin1String("class")) { - setElementClass(e.text()); - continue; - } - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - setElementWidget(v); - continue; - } - if (tag == QLatin1String("layoutdefault")) { - DomLayoutDefault *v = new DomLayoutDefault(); - v->read(e); - setElementLayoutDefault(v); - continue; - } - if (tag == QLatin1String("layoutfunction")) { - DomLayoutFunction *v = new DomLayoutFunction(); - v->read(e); - setElementLayoutFunction(v); - continue; - } - if (tag == QLatin1String("pixmapfunction")) { - setElementPixmapFunction(e.text()); - continue; - } - if (tag == QLatin1String("customwidgets")) { - DomCustomWidgets *v = new DomCustomWidgets(); - v->read(e); - setElementCustomWidgets(v); - continue; - } - if (tag == QLatin1String("tabstops")) { - DomTabStops *v = new DomTabStops(); - v->read(e); - setElementTabStops(v); - continue; - } - if (tag == QLatin1String("images")) { - DomImages *v = new DomImages(); - v->read(e); - setElementImages(v); - continue; - } - if (tag == QLatin1String("includes")) { - DomIncludes *v = new DomIncludes(); - v->read(e); - setElementIncludes(v); - continue; - } - if (tag == QLatin1String("resources")) { - DomResources *v = new DomResources(); - v->read(e); - setElementResources(v); - continue; - } - if (tag == QLatin1String("connections")) { - DomConnections *v = new DomConnections(); - v->read(e); - setElementConnections(v); - continue; - } - if (tag == QLatin1String("designerdata")) { - DomDesignerData *v = new DomDesignerData(); - v->read(e); - setElementDesignerdata(v); - continue; - } - if (tag == QLatin1String("slots")) { - DomSlots *v = new DomSlots(); - v->read(e); - setElementSlots(v); - continue; - } - if (tag == QLatin1String("buttongroups")) { - DomButtonGroups *v = new DomButtonGroups(); - v->read(e); - setElementButtonGroups(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("ui") : tagName.toLower()); if (hasAttributeVersion()) - writer.writeAttribute(QLatin1String("version"), attributeVersion()); + writer.writeAttribute(QStringLiteral("version"), attributeVersion()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (hasAttributeDisplayname()) - writer.writeAttribute(QLatin1String("displayname"), attributeDisplayname()); + writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname()); if (hasAttributeStdsetdef()) - writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdsetdef())); + writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef())); if (hasAttributeStdSetDef()) - writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdSetDef())); + writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef())); if (m_children & Author) { - writer.writeTextElement(QLatin1String("author"), m_author); + writer.writeTextElement(QStringLiteral("author"), m_author); } if (m_children & Comment) { - writer.writeTextElement(QLatin1String("comment"), m_comment); + writer.writeTextElement(QStringLiteral("comment"), m_comment); } if (m_children & ExportMacro) { - writer.writeTextElement(QLatin1String("exportmacro"), m_exportMacro); + writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro); } if (m_children & Class) { - writer.writeTextElement(QLatin1String("class"), m_class); + writer.writeTextElement(QStringLiteral("class"), m_class); } if (m_children & Widget) { - m_widget->write(writer, QLatin1String("widget")); + m_widget->write(writer, QStringLiteral("widget")); } if (m_children & LayoutDefault) { - m_layoutDefault->write(writer, QLatin1String("layoutdefault")); + m_layoutDefault->write(writer, QStringLiteral("layoutdefault")); } if (m_children & LayoutFunction) { - m_layoutFunction->write(writer, QLatin1String("layoutfunction")); + m_layoutFunction->write(writer, QStringLiteral("layoutfunction")); } if (m_children & PixmapFunction) { - writer.writeTextElement(QLatin1String("pixmapfunction"), m_pixmapFunction); + writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction); } if (m_children & CustomWidgets) { - m_customWidgets->write(writer, QLatin1String("customwidgets")); + m_customWidgets->write(writer, QStringLiteral("customwidgets")); } if (m_children & TabStops) { - m_tabStops->write(writer, QLatin1String("tabstops")); + m_tabStops->write(writer, QStringLiteral("tabstops")); } if (m_children & Images) { - m_images->write(writer, QLatin1String("images")); + m_images->write(writer, QStringLiteral("images")); } if (m_children & Includes) { - m_includes->write(writer, QLatin1String("includes")); + m_includes->write(writer, QStringLiteral("includes")); } if (m_children & Resources) { - m_resources->write(writer, QLatin1String("resources")); + m_resources->write(writer, QStringLiteral("resources")); } if (m_children & Connections) { - m_connections->write(writer, QLatin1String("connections")); + m_connections->write(writer, QStringLiteral("connections")); } if (m_children & Designerdata) { - m_designerdata->write(writer, QLatin1String("designerdata")); + m_designerdata->write(writer, QStringLiteral("designerdata")); } if (m_children & Slots) { - m_slots->write(writer, QLatin1String("slots")); + m_slots->write(writer, QStringLiteral("slots")); } if (m_children & ButtonGroups) { - m_buttonGroups->write(writer, QLatin1String("buttongroups")); + m_buttonGroups->write(writer, QStringLiteral("buttongroups")); } if (!m_text.isEmpty()) @@ -836,13 +713,13 @@ void DomIncludes::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("include")) { + if (tag == QStringLiteral("include")) { DomInclude *v = new DomInclude(); v->read(reader); m_include.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -858,36 +735,13 @@ void DomIncludes::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomIncludes::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("include")) { - DomInclude *v = new DomInclude(); - v->read(e); - m_include.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("includes") : tagName.toLower()); for (int i = 0; i < m_include.size(); ++i) { DomInclude* v = m_include[i]; - v->write(writer, QLatin1String("include")); + v->write(writer, QStringLiteral("include")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -905,7 +759,7 @@ void DomInclude::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_location = false; m_has_attr_impldecl = false; } @@ -918,7 +772,7 @@ DomInclude::DomInclude() m_children = 0; m_has_attr_location = false; m_has_attr_impldecl = false; - m_text = QLatin1String(""); + m_text.clear(); } DomInclude::~DomInclude() @@ -930,22 +784,22 @@ void DomInclude::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - if (name == QLatin1String("impldecl")) { + if (name == QStringLiteral("impldecl")) { setAttributeImpldecl(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -961,37 +815,15 @@ void DomInclude::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomInclude::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - if (node.hasAttribute(QLatin1String("impldecl"))) - setAttributeImpldecl(node.attribute(QLatin1String("impldecl"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("include") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (hasAttributeImpldecl()) - writer.writeAttribute(QLatin1String("impldecl"), attributeImpldecl()); + writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1029,24 +861,24 @@ void DomResources::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("include")) { + if (tag == QStringLiteral("include")) { DomResource *v = new DomResource(); v->read(reader); m_include.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1062,42 +894,16 @@ void DomResources::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResources::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("include")) { - DomResource *v = new DomResource(); - v->read(e); - m_include.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resources") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_include.size(); ++i) { DomResource* v = m_include[i]; - v->write(writer, QLatin1String("include")); + v->write(writer, QStringLiteral("include")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1137,18 +943,18 @@ void DomResource::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1164,32 +970,12 @@ void DomResource::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResource::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resource") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1239,42 +1025,42 @@ void DomActionGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("action")) { + if (tag == QStringLiteral("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QLatin1String("actiongroup")) { + if (tag == QStringLiteral("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1290,72 +1076,28 @@ void DomActionGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomActionGroup::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("action")) { - DomAction *v = new DomAction(); - v->read(e); - m_action.append(v); - continue; - } - if (tag == QLatin1String("actiongroup")) { - DomActionGroup *v = new DomActionGroup(); - v->read(e); - m_actionGroup.append(v); - continue; - } - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actiongroup") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_action.size(); ++i) { DomAction* v = m_action[i]; - v->write(writer, QLatin1String("action")); + v->write(writer, QStringLiteral("action")); } for (int i = 0; i < m_actionGroup.size(); ++i) { DomActionGroup* v = m_actionGroup[i]; - v->write(writer, QLatin1String("actiongroup")); + v->write(writer, QStringLiteral("actiongroup")); } for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1423,34 +1165,34 @@ void DomAction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("menu")) { + if (name == QStringLiteral("menu")) { setAttributeMenu(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1466,57 +1208,23 @@ void DomAction::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomAction::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("menu"))) - setAttributeMenu(node.attribute(QLatin1String("menu"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("action") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeMenu()) - writer.writeAttribute(QLatin1String("menu"), attributeMenu()); + writer.writeAttribute(QStringLiteral("menu"), attributeMenu()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1562,18 +1270,18 @@ void DomActionRef::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1589,32 +1297,12 @@ void DomActionRef::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomActionRef::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actionref") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1656,30 +1344,30 @@ void DomButtonGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1695,52 +1383,20 @@ void DomButtonGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomButtonGroup::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroup") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1790,13 +1446,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("buttongroup")) { + if (tag == QStringLiteral("buttongroup")) { DomButtonGroup *v = new DomButtonGroup(); v->read(reader); m_buttonGroup.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1812,36 +1468,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomButtonGroups::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("buttongroup")) { - DomButtonGroup *v = new DomButtonGroup(); - v->read(e); - m_buttonGroup.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroups") : tagName.toLower()); for (int i = 0; i < m_buttonGroup.size(); ++i) { DomButtonGroup* v = m_buttonGroup[i]; - v->write(writer, QLatin1String("buttongroup")); + v->write(writer, QStringLiteral("buttongroup")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1885,13 +1518,13 @@ void DomImages::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("image")) { + if (tag == QStringLiteral("image")) { DomImage *v = new DomImage(); v->read(reader); m_image.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1907,36 +1540,13 @@ void DomImages::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImages::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("image")) { - DomImage *v = new DomImage(); - v->read(e); - m_image.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("images") : tagName.toLower()); for (int i = 0; i < m_image.size(); ++i) { DomImage* v = m_image[i]; - v->write(writer, QLatin1String("image")); + v->write(writer, QStringLiteral("image")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1980,24 +1590,24 @@ void DomImage::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("data")) { + if (tag == QStringLiteral("data")) { DomImageData *v = new DomImageData(); v->read(reader); setElementData(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2013,41 +1623,15 @@ void DomImage::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImage::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("data")) { - DomImageData *v = new DomImageData(); - v->read(e); - setElementData(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("image") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (m_children & Data) { - m_data->write(writer, QLatin1String("data")); + m_data->write(writer, QStringLiteral("data")); } if (!m_text.isEmpty()) @@ -2082,7 +1666,7 @@ void DomImageData::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_format = false; m_has_attr_length = false; m_attr_length = 0; @@ -2097,7 +1681,7 @@ DomImageData::DomImageData() m_has_attr_format = false; m_has_attr_length = false; m_attr_length = 0; - m_text = QLatin1String(""); + m_text.clear(); } DomImageData::~DomImageData() @@ -2109,22 +1693,22 @@ void DomImageData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("format")) { + if (name == QStringLiteral("format")) { setAttributeFormat(attribute.value().toString()); continue; } - if (name == QLatin1String("length")) { + if (name == QStringLiteral("length")) { setAttributeLength(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2140,37 +1724,15 @@ void DomImageData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImageData::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("format"))) - setAttributeFormat(node.attribute(QLatin1String("format"))); - if (node.hasAttribute(QLatin1String("length"))) - setAttributeLength(node.attribute(QLatin1String("length")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("imagedata") : tagName.toLower()); if (hasAttributeFormat()) - writer.writeAttribute(QLatin1String("format"), attributeFormat()); + writer.writeAttribute(QStringLiteral("format"), attributeFormat()); if (hasAttributeLength()) - writer.writeAttribute(QLatin1String("length"), QString::number(attributeLength())); + writer.writeAttribute(QStringLiteral("length"), QString::number(attributeLength())); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2208,13 +1770,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("customwidget")) { + if (tag == QStringLiteral("customwidget")) { DomCustomWidget *v = new DomCustomWidget(); v->read(reader); m_customWidget.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2230,36 +1792,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomCustomWidgets::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("customwidget")) { - DomCustomWidget *v = new DomCustomWidget(); - v->read(e); - m_customWidget.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidgets") : tagName.toLower()); for (int i = 0; i < m_customWidget.size(); ++i) { DomCustomWidget* v = m_customWidget[i]; - v->write(writer, QLatin1String("customwidget")); + v->write(writer, QStringLiteral("customwidget")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2277,7 +1816,7 @@ void DomHeader::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_location = false; } @@ -2288,7 +1827,7 @@ DomHeader::DomHeader() { m_children = 0; m_has_attr_location = false; - m_text = QLatin1String(""); + m_text.clear(); } DomHeader::~DomHeader() @@ -2300,18 +1839,18 @@ void DomHeader::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2327,32 +1866,12 @@ void DomHeader::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomHeader::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("header") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2416,69 +1935,69 @@ void DomCustomWidget::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QLatin1String("extends")) { + if (tag == QStringLiteral("extends")) { setElementExtends(reader.readElementText()); continue; } - if (tag == QLatin1String("header")) { + if (tag == QStringLiteral("header")) { DomHeader *v = new DomHeader(); v->read(reader); setElementHeader(v); continue; } - if (tag == QLatin1String("sizehint")) { + if (tag == QStringLiteral("sizehint")) { DomSize *v = new DomSize(); v->read(reader); setElementSizeHint(v); continue; } - if (tag == QLatin1String("addpagemethod")) { + if (tag == QStringLiteral("addpagemethod")) { setElementAddPageMethod(reader.readElementText()); continue; } - if (tag == QLatin1String("container")) { + if (tag == QStringLiteral("container")) { setElementContainer(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("sizepolicy")) { + if (tag == QStringLiteral("sizepolicy")) { DomSizePolicyData *v = new DomSizePolicyData(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QLatin1String("pixmap")) { + if (tag == QStringLiteral("pixmap")) { setElementPixmap(reader.readElementText()); continue; } - if (tag == QLatin1String("script")) { + if (tag == QStringLiteral("script")) { DomScript *v = new DomScript(); v->read(reader); setElementScript(v); continue; } - if (tag == QLatin1String("properties")) { + if (tag == QStringLiteral("properties")) { DomProperties *v = new DomProperties(); v->read(reader); setElementProperties(v); continue; } - if (tag == QLatin1String("slots")) { + if (tag == QStringLiteral("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QLatin1String("propertyspecifications")) { + if (tag == QStringLiteral("propertyspecifications")) { DomPropertySpecifications *v = new DomPropertySpecifications(); v->read(reader); setElementPropertyspecifications(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2494,135 +2013,56 @@ void DomCustomWidget::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomCustomWidget::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("class")) { - setElementClass(e.text()); - continue; - } - if (tag == QLatin1String("extends")) { - setElementExtends(e.text()); - continue; - } - if (tag == QLatin1String("header")) { - DomHeader *v = new DomHeader(); - v->read(e); - setElementHeader(v); - continue; - } - if (tag == QLatin1String("sizehint")) { - DomSize *v = new DomSize(); - v->read(e); - setElementSizeHint(v); - continue; - } - if (tag == QLatin1String("addpagemethod")) { - setElementAddPageMethod(e.text()); - continue; - } - if (tag == QLatin1String("container")) { - setElementContainer(e.text().toInt()); - continue; - } - if (tag == QLatin1String("sizepolicy")) { - DomSizePolicyData *v = new DomSizePolicyData(); - v->read(e); - setElementSizePolicy(v); - continue; - } - if (tag == QLatin1String("pixmap")) { - setElementPixmap(e.text()); - continue; - } - if (tag == QLatin1String("script")) { - DomScript *v = new DomScript(); - v->read(e); - setElementScript(v); - continue; - } - if (tag == QLatin1String("properties")) { - DomProperties *v = new DomProperties(); - v->read(e); - setElementProperties(v); - continue; - } - if (tag == QLatin1String("slots")) { - DomSlots *v = new DomSlots(); - v->read(e); - setElementSlots(v); - continue; - } - if (tag == QLatin1String("propertyspecifications")) { - DomPropertySpecifications *v = new DomPropertySpecifications(); - v->read(e); - setElementPropertyspecifications(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - -void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const +void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidget") : tagName.toLower()); if (m_children & Class) { - writer.writeTextElement(QLatin1String("class"), m_class); + writer.writeTextElement(QStringLiteral("class"), m_class); } if (m_children & Extends) { - writer.writeTextElement(QLatin1String("extends"), m_extends); + writer.writeTextElement(QStringLiteral("extends"), m_extends); } if (m_children & Header) { - m_header->write(writer, QLatin1String("header")); + m_header->write(writer, QStringLiteral("header")); } if (m_children & SizeHint) { - m_sizeHint->write(writer, QLatin1String("sizehint")); + m_sizeHint->write(writer, QStringLiteral("sizehint")); } if (m_children & AddPageMethod) { - writer.writeTextElement(QLatin1String("addpagemethod"), m_addPageMethod); + writer.writeTextElement(QStringLiteral("addpagemethod"), m_addPageMethod); } if (m_children & Container) { - writer.writeTextElement(QLatin1String("container"), QString::number(m_container)); + writer.writeTextElement(QStringLiteral("container"), QString::number(m_container)); } if (m_children & SizePolicy) { - m_sizePolicy->write(writer, QLatin1String("sizepolicy")); + m_sizePolicy->write(writer, QStringLiteral("sizepolicy")); } if (m_children & Pixmap) { - writer.writeTextElement(QLatin1String("pixmap"), m_pixmap); + writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap); } if (m_children & Script) { - m_script->write(writer, QLatin1String("script")); + m_script->write(writer, QStringLiteral("script")); } if (m_children & Properties) { - m_properties->write(writer, QLatin1String("properties")); + m_properties->write(writer, QStringLiteral("properties")); } if (m_children & Slots) { - m_slots->write(writer, QLatin1String("slots")); + m_slots->write(writer, QStringLiteral("slots")); } if (m_children & Propertyspecifications) { - m_propertyspecifications->write(writer, QLatin1String("propertyspecifications")); + m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications")); } if (!m_text.isEmpty()) @@ -2870,13 +2310,13 @@ void DomProperties::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomPropertyData *v = new DomPropertyData(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2892,36 +2332,13 @@ void DomProperties::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomProperties::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomPropertyData *v = new DomPropertyData(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("properties") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomPropertyData* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2961,18 +2378,18 @@ void DomPropertyData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2988,32 +2405,12 @@ void DomPropertyData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPropertyData::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertydata") : tagName.toLower()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3051,15 +2448,15 @@ void DomSizePolicyData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hordata")) { + if (tag == QStringLiteral("hordata")) { setElementHorData(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("verdata")) { + if (tag == QStringLiteral("verdata")) { setElementVerData(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3075,41 +2472,16 @@ void DomSizePolicyData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSizePolicyData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hordata")) { - setElementHorData(e.text().toInt()); - continue; - } - if (tag == QLatin1String("verdata")) { - setElementVerData(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicydata") : tagName.toLower()); if (m_children & HorData) { - writer.writeTextElement(QLatin1String("hordata"), QString::number(m_horData)); + writer.writeTextElement(QStringLiteral("hordata"), QString::number(m_horData)); } if (m_children & VerData) { - writer.writeTextElement(QLatin1String("verdata"), QString::number(m_verData)); + writer.writeTextElement(QStringLiteral("verdata"), QString::number(m_verData)); } if (!m_text.isEmpty()) @@ -3172,22 +2544,22 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("spacing")) { + if (name == QStringLiteral("spacing")) { setAttributeSpacing(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("margin")) { + if (name == QStringLiteral("margin")) { setAttributeMargin(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3203,37 +2575,15 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutDefault::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("spacing"))) - setAttributeSpacing(node.attribute(QLatin1String("spacing")).toInt()); - if (node.hasAttribute(QLatin1String("margin"))) - setAttributeMargin(node.attribute(QLatin1String("margin")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutdefault") : tagName.toLower()); if (hasAttributeSpacing()) - writer.writeAttribute(QLatin1String("spacing"), QString::number(attributeSpacing())); + writer.writeAttribute(QStringLiteral("spacing"), QString::number(attributeSpacing())); if (hasAttributeMargin()) - writer.writeAttribute(QLatin1String("margin"), QString::number(attributeMargin())); + writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin())); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3269,22 +2619,22 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("spacing")) { + if (name == QStringLiteral("spacing")) { setAttributeSpacing(attribute.value().toString()); continue; } - if (name == QLatin1String("margin")) { + if (name == QStringLiteral("margin")) { setAttributeMargin(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3300,37 +2650,15 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutFunction::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("spacing"))) - setAttributeSpacing(node.attribute(QLatin1String("spacing"))); - if (node.hasAttribute(QLatin1String("margin"))) - setAttributeMargin(node.attribute(QLatin1String("margin"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutfunction") : tagName.toLower()); if (hasAttributeSpacing()) - writer.writeAttribute(QLatin1String("spacing"), attributeSpacing()); + writer.writeAttribute(QStringLiteral("spacing"), attributeSpacing()); if (hasAttributeMargin()) - writer.writeAttribute(QLatin1String("margin"), attributeMargin()); + writer.writeAttribute(QStringLiteral("margin"), attributeMargin()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3366,11 +2694,11 @@ void DomTabStops::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("tabstop")) { + if (tag == QStringLiteral("tabstop")) { m_tabStop.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3386,34 +2714,13 @@ void DomTabStops::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomTabStops::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("tabstop")) { - m_tabStop.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("tabstops") : tagName.toLower()); for (int i = 0; i < m_tabStop.size(); ++i) { QString v = m_tabStop[i]; - writer.writeTextElement(QLatin1String("tabstop"), v); + writer.writeTextElement(QStringLiteral("tabstop"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3477,60 +2784,60 @@ void DomLayout::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("class")) { + if (name == QStringLiteral("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("stretch")) { + if (name == QStringLiteral("stretch")) { setAttributeStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("rowstretch")) { + if (name == QStringLiteral("rowstretch")) { setAttributeRowStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("columnstretch")) { + if (name == QStringLiteral("columnstretch")) { setAttributeColumnStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("rowminimumheight")) { + if (name == QStringLiteral("rowminimumheight")) { setAttributeRowMinimumHeight(attribute.value().toString()); continue; } - if (name == QLatin1String("columnminimumwidth")) { + if (name == QStringLiteral("columnminimumwidth")) { setAttributeColumnMinimumWidth(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomLayoutItem *v = new DomLayoutItem(); v->read(reader); m_item.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3546,92 +2853,42 @@ void DomLayout::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayout::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("class"))) - setAttributeClass(node.attribute(QLatin1String("class"))); - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("stretch"))) - setAttributeStretch(node.attribute(QLatin1String("stretch"))); - if (node.hasAttribute(QLatin1String("rowstretch"))) - setAttributeRowStretch(node.attribute(QLatin1String("rowstretch"))); - if (node.hasAttribute(QLatin1String("columnstretch"))) - setAttributeColumnStretch(node.attribute(QLatin1String("columnstretch"))); - if (node.hasAttribute(QLatin1String("rowminimumheight"))) - setAttributeRowMinimumHeight(node.attribute(QLatin1String("rowminimumheight"))); - if (node.hasAttribute(QLatin1String("columnminimumwidth"))) - setAttributeColumnMinimumWidth(node.attribute(QLatin1String("columnminimumwidth"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomLayoutItem *v = new DomLayoutItem(); - v->read(e); - m_item.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layout") : tagName.toLower()); if (hasAttributeClass()) - writer.writeAttribute(QLatin1String("class"), attributeClass()); + writer.writeAttribute(QStringLiteral("class"), attributeClass()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeStretch()) - writer.writeAttribute(QLatin1String("stretch"), attributeStretch()); + writer.writeAttribute(QStringLiteral("stretch"), attributeStretch()); if (hasAttributeRowStretch()) - writer.writeAttribute(QLatin1String("rowstretch"), attributeRowStretch()); + writer.writeAttribute(QStringLiteral("rowstretch"), attributeRowStretch()); if (hasAttributeColumnStretch()) - writer.writeAttribute(QLatin1String("columnstretch"), attributeColumnStretch()); + writer.writeAttribute(QStringLiteral("columnstretch"), attributeColumnStretch()); if (hasAttributeRowMinimumHeight()) - writer.writeAttribute(QLatin1String("rowminimumheight"), attributeRowMinimumHeight()); + writer.writeAttribute(QStringLiteral("rowminimumheight"), attributeRowMinimumHeight()); if (hasAttributeColumnMinimumWidth()) - writer.writeAttribute(QLatin1String("columnminimumwidth"), attributeColumnMinimumWidth()); + writer.writeAttribute(QStringLiteral("columnminimumwidth"), attributeColumnMinimumWidth()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } for (int i = 0; i < m_item.size(); ++i) { DomLayoutItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3713,52 +2970,52 @@ void DomLayoutItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("row")) { + if (name == QStringLiteral("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("column")) { + if (name == QStringLiteral("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("rowspan")) { + if (name == QStringLiteral("rowspan")) { setAttributeRowSpan(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("colspan")) { + if (name == QStringLiteral("colspan")) { setAttributeColSpan(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("alignment")) { + if (name == QStringLiteral("alignment")) { setAttributeAlignment(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QLatin1String("layout")) { + if (tag == QStringLiteral("layout")) { DomLayout *v = new DomLayout(); v->read(reader); setElementLayout(v); continue; } - if (tag == QLatin1String("spacer")) { + if (tag == QStringLiteral("spacer")) { DomSpacer *v = new DomSpacer(); v->read(reader); setElementSpacer(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3774,90 +3031,44 @@ void DomLayoutItem::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutItem::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("row"))) - setAttributeRow(node.attribute(QLatin1String("row")).toInt()); - if (node.hasAttribute(QLatin1String("column"))) - setAttributeColumn(node.attribute(QLatin1String("column")).toInt()); - if (node.hasAttribute(QLatin1String("rowspan"))) - setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt()); - if (node.hasAttribute(QLatin1String("colspan"))) - setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt()); - if (node.hasAttribute(QLatin1String("alignment"))) - setAttributeAlignment(node.attribute(QLatin1String("alignment"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - setElementWidget(v); - continue; - } - if (tag == QLatin1String("layout")) { - DomLayout *v = new DomLayout(); - v->read(e); - setElementLayout(v); - continue; - } - if (tag == QLatin1String("spacer")) { - DomSpacer *v = new DomSpacer(); - v->read(e); - setElementSpacer(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutitem") : tagName.toLower()); if (hasAttributeRow()) - writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow())); + writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow())); if (hasAttributeColumn()) - writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn())); + writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn())); if (hasAttributeRowSpan()) - writer.writeAttribute(QLatin1String("rowspan"), QString::number(attributeRowSpan())); + writer.writeAttribute(QStringLiteral("rowspan"), QString::number(attributeRowSpan())); if (hasAttributeColSpan()) - writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan())); + writer.writeAttribute(QStringLiteral("colspan"), QString::number(attributeColSpan())); if (hasAttributeAlignment()) - writer.writeAttribute(QLatin1String("alignment"), attributeAlignment()); + writer.writeAttribute(QStringLiteral("alignment"), attributeAlignment()); switch (kind()) { case Widget: { DomWidget* v = elementWidget(); if (v != 0) { - v->write(writer, QLatin1String("widget")); + v->write(writer, QStringLiteral("widget")); } break; } case Layout: { DomLayout* v = elementLayout(); if (v != 0) { - v->write(writer, QLatin1String("layout")); + v->write(writer, QStringLiteral("layout")); } break; } case Spacer: { DomSpacer* v = elementSpacer(); if (v != 0) { - v->write(writer, QLatin1String("spacer")); + v->write(writer, QStringLiteral("spacer")); } break; } @@ -3942,13 +3153,13 @@ void DomRow::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3964,36 +3175,13 @@ void DomRow::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRow::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("row") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4037,13 +3225,13 @@ void DomColumn::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4059,36 +3247,13 @@ void DomColumn::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColumn::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("column") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4142,34 +3307,34 @@ void DomItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("row")) { + if (name == QStringLiteral("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("column")) { + if (name == QStringLiteral("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4185,57 +3350,23 @@ void DomItem::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomItem::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("row"))) - setAttributeRow(node.attribute(QLatin1String("row")).toInt()); - if (node.hasAttribute(QLatin1String("column"))) - setAttributeColumn(node.attribute(QLatin1String("column")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomItem *v = new DomItem(); - v->read(e); - m_item.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("item") : tagName.toLower()); if (hasAttributeRow()) - writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow())); + writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow())); if (hasAttributeColumn()) - writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn())); + writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn())); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_item.size(); ++i) { DomItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4339,106 +3470,106 @@ void DomWidget::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("class")) { + if (name == QStringLiteral("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("native")) { + if (name == QStringLiteral("native")) { setAttributeNative((attribute.value().toString() == QLatin1String("true") ? true : false)); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { m_class.append(reader.readElementText()); continue; } - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("script")) { + if (tag == QStringLiteral("script")) { DomScript *v = new DomScript(); v->read(reader); m_script.append(v); continue; } - if (tag == QLatin1String("widgetdata")) { + if (tag == QStringLiteral("widgetdata")) { DomWidgetData *v = new DomWidgetData(); v->read(reader); m_widgetData.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QLatin1String("row")) { + if (tag == QStringLiteral("row")) { DomRow *v = new DomRow(); v->read(reader); m_row.append(v); continue; } - if (tag == QLatin1String("column")) { + if (tag == QStringLiteral("column")) { DomColumn *v = new DomColumn(); v->read(reader); m_column.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); continue; } - if (tag == QLatin1String("layout")) { + if (tag == QStringLiteral("layout")) { DomLayout *v = new DomLayout(); v->read(reader); m_layout.append(v); continue; } - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); m_widget.append(v); continue; } - if (tag == QLatin1String("action")) { + if (tag == QStringLiteral("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QLatin1String("actiongroup")) { + if (tag == QStringLiteral("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QLatin1String("addaction")) { + if (tag == QStringLiteral("addaction")) { DomActionRef *v = new DomActionRef(); v->read(reader); m_addAction.append(v); continue; } - if (tag == QLatin1String("zorder")) { + if (tag == QStringLiteral("zorder")) { m_zOrder.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4454,178 +3585,74 @@ void DomWidget::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomWidget::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("class"))) - setAttributeClass(node.attribute(QLatin1String("class"))); - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("native"))) - setAttributeNative((node.attribute(QLatin1String("native")) == QLatin1String("true") ? true : false)); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("class")) { - m_class.append(e.text()); - continue; - } - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("script")) { - DomScript *v = new DomScript(); - v->read(e); - m_script.append(v); - continue; - } - if (tag == QLatin1String("widgetdata")) { - DomWidgetData *v = new DomWidgetData(); - v->read(e); - m_widgetData.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - if (tag == QLatin1String("row")) { - DomRow *v = new DomRow(); - v->read(e); - m_row.append(v); - continue; - } - if (tag == QLatin1String("column")) { - DomColumn *v = new DomColumn(); - v->read(e); - m_column.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomItem *v = new DomItem(); - v->read(e); - m_item.append(v); - continue; - } - if (tag == QLatin1String("layout")) { - DomLayout *v = new DomLayout(); - v->read(e); - m_layout.append(v); - continue; - } - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - m_widget.append(v); - continue; - } - if (tag == QLatin1String("action")) { - DomAction *v = new DomAction(); - v->read(e); - m_action.append(v); - continue; - } - if (tag == QLatin1String("actiongroup")) { - DomActionGroup *v = new DomActionGroup(); - v->read(e); - m_actionGroup.append(v); - continue; - } - if (tag == QLatin1String("addaction")) { - DomActionRef *v = new DomActionRef(); - v->read(e); - m_addAction.append(v); - continue; - } - if (tag == QLatin1String("zorder")) { - m_zOrder.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widget") : tagName.toLower()); if (hasAttributeClass()) - writer.writeAttribute(QLatin1String("class"), attributeClass()); + writer.writeAttribute(QStringLiteral("class"), attributeClass()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeNative()) - writer.writeAttribute(QLatin1String("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false"))); + writer.writeAttribute(QStringLiteral("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false"))); for (int i = 0; i < m_class.size(); ++i) { QString v = m_class[i]; - writer.writeTextElement(QLatin1String("class"), v); + writer.writeTextElement(QStringLiteral("class"), v); } for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_script.size(); ++i) { DomScript* v = m_script[i]; - v->write(writer, QLatin1String("script")); + v->write(writer, QStringLiteral("script")); } for (int i = 0; i < m_widgetData.size(); ++i) { DomWidgetData* v = m_widgetData[i]; - v->write(writer, QLatin1String("widgetdata")); + v->write(writer, QStringLiteral("widgetdata")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } for (int i = 0; i < m_row.size(); ++i) { DomRow* v = m_row[i]; - v->write(writer, QLatin1String("row")); + v->write(writer, QStringLiteral("row")); } for (int i = 0; i < m_column.size(); ++i) { DomColumn* v = m_column[i]; - v->write(writer, QLatin1String("column")); + v->write(writer, QStringLiteral("column")); } for (int i = 0; i < m_item.size(); ++i) { DomItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } for (int i = 0; i < m_layout.size(); ++i) { DomLayout* v = m_layout[i]; - v->write(writer, QLatin1String("layout")); + v->write(writer, QStringLiteral("layout")); } for (int i = 0; i < m_widget.size(); ++i) { DomWidget* v = m_widget[i]; - v->write(writer, QLatin1String("widget")); + v->write(writer, QStringLiteral("widget")); } for (int i = 0; i < m_action.size(); ++i) { DomAction* v = m_action[i]; - v->write(writer, QLatin1String("action")); + v->write(writer, QStringLiteral("action")); } for (int i = 0; i < m_actionGroup.size(); ++i) { DomActionGroup* v = m_actionGroup[i]; - v->write(writer, QLatin1String("actiongroup")); + v->write(writer, QStringLiteral("actiongroup")); } for (int i = 0; i < m_addAction.size(); ++i) { DomActionRef* v = m_addAction[i]; - v->write(writer, QLatin1String("addaction")); + v->write(writer, QStringLiteral("addaction")); } for (int i = 0; i < m_zOrder.size(); ++i) { QString v = m_zOrder[i]; - writer.writeTextElement(QLatin1String("zorder"), v); + writer.writeTextElement(QStringLiteral("zorder"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4747,24 +3774,24 @@ void DomSpacer::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4780,42 +3807,16 @@ void DomSpacer::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSpacer::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("spacer") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4863,30 +3864,30 @@ void DomColor::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("alpha")) { + if (name == QStringLiteral("alpha")) { setAttributeAlpha(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("red")) { + if (tag == QStringLiteral("red")) { setElementRed(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("green")) { + if (tag == QStringLiteral("green")) { setElementGreen(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("blue")) { + if (tag == QStringLiteral("blue")) { setElementBlue(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4902,55 +3903,23 @@ void DomColor::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColor::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("alpha"))) - setAttributeAlpha(node.attribute(QLatin1String("alpha")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("red")) { - setElementRed(e.text().toInt()); - continue; - } - if (tag == QLatin1String("green")) { - setElementGreen(e.text().toInt()); - continue; - } - if (tag == QLatin1String("blue")) { - setElementBlue(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("color") : tagName.toLower()); if (hasAttributeAlpha()) - writer.writeAttribute(QLatin1String("alpha"), QString::number(attributeAlpha())); + writer.writeAttribute(QStringLiteral("alpha"), QString::number(attributeAlpha())); if (m_children & Red) { - writer.writeTextElement(QLatin1String("red"), QString::number(m_red)); + writer.writeTextElement(QStringLiteral("red"), QString::number(m_red)); } if (m_children & Green) { - writer.writeTextElement(QLatin1String("green"), QString::number(m_green)); + writer.writeTextElement(QStringLiteral("green"), QString::number(m_green)); } if (m_children & Blue) { - writer.writeTextElement(QLatin1String("blue"), QString::number(m_blue)); + writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue)); } if (!m_text.isEmpty()) @@ -5024,24 +3993,24 @@ void DomGradientStop::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("position")) { + if (name == QStringLiteral("position")) { setAttributePosition(attribute.value().toString().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5057,41 +4026,15 @@ void DomGradientStop::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomGradientStop::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("position"))) - setAttributePosition(node.attribute(QLatin1String("position")).toDouble()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradientstop") : tagName.toLower()); if (hasAttributePosition()) - writer.writeAttribute(QLatin1String("position"), QString::number(attributePosition(), 'f', 15)); + writer.writeAttribute(QStringLiteral("position"), QString::number(attributePosition(), 'f', 15)); if (m_children & Color) { - m_color->write(writer, QLatin1String("color")); + m_color->write(writer, QStringLiteral("color")); } if (!m_text.isEmpty()) @@ -5196,72 +4139,72 @@ void DomGradient::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("startx")) { + if (name == QStringLiteral("startx")) { setAttributeStartX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("starty")) { + if (name == QStringLiteral("starty")) { setAttributeStartY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("endx")) { + if (name == QStringLiteral("endx")) { setAttributeEndX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("endy")) { + if (name == QStringLiteral("endy")) { setAttributeEndY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("centralx")) { + if (name == QStringLiteral("centralx")) { setAttributeCentralX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("centraly")) { + if (name == QStringLiteral("centraly")) { setAttributeCentralY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("focalx")) { + if (name == QStringLiteral("focalx")) { setAttributeFocalX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("focaly")) { + if (name == QStringLiteral("focaly")) { setAttributeFocalY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("radius")) { + if (name == QStringLiteral("radius")) { setAttributeRadius(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("angle")) { + if (name == QStringLiteral("angle")) { setAttributeAngle(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QLatin1String("spread")) { + if (name == QStringLiteral("spread")) { setAttributeSpread(attribute.value().toString()); continue; } - if (name == QLatin1String("coordinatemode")) { + if (name == QStringLiteral("coordinatemode")) { setAttributeCoordinateMode(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("gradientstop")) { + if (tag == QStringLiteral("gradientstop")) { DomGradientStop *v = new DomGradientStop(); v->read(reader); m_gradientStop.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5277,102 +4220,52 @@ void DomGradient::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomGradient::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("startx"))) - setAttributeStartX(node.attribute(QLatin1String("startx")).toDouble()); - if (node.hasAttribute(QLatin1String("starty"))) - setAttributeStartY(node.attribute(QLatin1String("starty")).toDouble()); - if (node.hasAttribute(QLatin1String("endx"))) - setAttributeEndX(node.attribute(QLatin1String("endx")).toDouble()); - if (node.hasAttribute(QLatin1String("endy"))) - setAttributeEndY(node.attribute(QLatin1String("endy")).toDouble()); - if (node.hasAttribute(QLatin1String("centralx"))) - setAttributeCentralX(node.attribute(QLatin1String("centralx")).toDouble()); - if (node.hasAttribute(QLatin1String("centraly"))) - setAttributeCentralY(node.attribute(QLatin1String("centraly")).toDouble()); - if (node.hasAttribute(QLatin1String("focalx"))) - setAttributeFocalX(node.attribute(QLatin1String("focalx")).toDouble()); - if (node.hasAttribute(QLatin1String("focaly"))) - setAttributeFocalY(node.attribute(QLatin1String("focaly")).toDouble()); - if (node.hasAttribute(QLatin1String("radius"))) - setAttributeRadius(node.attribute(QLatin1String("radius")).toDouble()); - if (node.hasAttribute(QLatin1String("angle"))) - setAttributeAngle(node.attribute(QLatin1String("angle")).toDouble()); - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - if (node.hasAttribute(QLatin1String("spread"))) - setAttributeSpread(node.attribute(QLatin1String("spread"))); - if (node.hasAttribute(QLatin1String("coordinatemode"))) - setAttributeCoordinateMode(node.attribute(QLatin1String("coordinatemode"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("gradientstop")) { - DomGradientStop *v = new DomGradientStop(); - v->read(e); - m_gradientStop.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradient") : tagName.toLower()); if (hasAttributeStartX()) - writer.writeAttribute(QLatin1String("startx"), QString::number(attributeStartX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("startx"), QString::number(attributeStartX(), 'f', 15)); if (hasAttributeStartY()) - writer.writeAttribute(QLatin1String("starty"), QString::number(attributeStartY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("starty"), QString::number(attributeStartY(), 'f', 15)); if (hasAttributeEndX()) - writer.writeAttribute(QLatin1String("endx"), QString::number(attributeEndX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("endx"), QString::number(attributeEndX(), 'f', 15)); if (hasAttributeEndY()) - writer.writeAttribute(QLatin1String("endy"), QString::number(attributeEndY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("endy"), QString::number(attributeEndY(), 'f', 15)); if (hasAttributeCentralX()) - writer.writeAttribute(QLatin1String("centralx"), QString::number(attributeCentralX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("centralx"), QString::number(attributeCentralX(), 'f', 15)); if (hasAttributeCentralY()) - writer.writeAttribute(QLatin1String("centraly"), QString::number(attributeCentralY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("centraly"), QString::number(attributeCentralY(), 'f', 15)); if (hasAttributeFocalX()) - writer.writeAttribute(QLatin1String("focalx"), QString::number(attributeFocalX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("focalx"), QString::number(attributeFocalX(), 'f', 15)); if (hasAttributeFocalY()) - writer.writeAttribute(QLatin1String("focaly"), QString::number(attributeFocalY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("focaly"), QString::number(attributeFocalY(), 'f', 15)); if (hasAttributeRadius()) - writer.writeAttribute(QLatin1String("radius"), QString::number(attributeRadius(), 'f', 15)); + writer.writeAttribute(QStringLiteral("radius"), QString::number(attributeRadius(), 'f', 15)); if (hasAttributeAngle()) - writer.writeAttribute(QLatin1String("angle"), QString::number(attributeAngle(), 'f', 15)); + writer.writeAttribute(QStringLiteral("angle"), QString::number(attributeAngle(), 'f', 15)); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (hasAttributeSpread()) - writer.writeAttribute(QLatin1String("spread"), attributeSpread()); + writer.writeAttribute(QStringLiteral("spread"), attributeSpread()); if (hasAttributeCoordinateMode()) - writer.writeAttribute(QLatin1String("coordinatemode"), attributeCoordinateMode()); + writer.writeAttribute(QStringLiteral("coordinatemode"), attributeCoordinateMode()); for (int i = 0; i < m_gradientStop.size(); ++i) { DomGradientStop* v = m_gradientStop[i]; - v->write(writer, QLatin1String("gradientstop")); + v->write(writer, QStringLiteral("gradientstop")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -5426,36 +4319,36 @@ void DomBrush::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("brushstyle")) { + if (name == QStringLiteral("brushstyle")) { setAttributeBrushStyle(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QLatin1String("texture")) { + if (tag == QStringLiteral("texture")) { DomProperty *v = new DomProperty(); v->read(reader); setElementTexture(v); continue; } - if (tag == QLatin1String("gradient")) { + if (tag == QStringLiteral("gradient")) { DomGradient *v = new DomGradient(); v->read(reader); setElementGradient(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5471,70 +4364,32 @@ void DomBrush::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomBrush::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("brushstyle"))) - setAttributeBrushStyle(node.attribute(QLatin1String("brushstyle"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - if (tag == QLatin1String("texture")) { - DomProperty *v = new DomProperty(); - v->read(e); - setElementTexture(v); - continue; - } - if (tag == QLatin1String("gradient")) { - DomGradient *v = new DomGradient(); - v->read(e); - setElementGradient(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("brush") : tagName.toLower()); if (hasAttributeBrushStyle()) - writer.writeAttribute(QLatin1String("brushstyle"), attributeBrushStyle()); + writer.writeAttribute(QStringLiteral("brushstyle"), attributeBrushStyle()); switch (kind()) { case Color: { DomColor* v = elementColor(); if (v != 0) { - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } break; } case Texture: { DomProperty* v = elementTexture(); if (v != 0) { - v->write(writer, QLatin1String("texture")); + v->write(writer, QStringLiteral("texture")); } break; } case Gradient: { DomGradient* v = elementGradient(); if (v != 0) { - v->write(writer, QLatin1String("gradient")); + v->write(writer, QStringLiteral("gradient")); } break; } @@ -5619,24 +4474,24 @@ void DomColorRole::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("role")) { + if (name == QStringLiteral("role")) { setAttributeRole(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("brush")) { + if (tag == QStringLiteral("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5652,41 +4507,15 @@ void DomColorRole::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColorRole::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("role"))) - setAttributeRole(node.attribute(QLatin1String("role"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("brush")) { - DomBrush *v = new DomBrush(); - v->read(e); - setElementBrush(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorrole") : tagName.toLower()); if (hasAttributeRole()) - writer.writeAttribute(QLatin1String("role"), attributeRole()); + writer.writeAttribute(QStringLiteral("role"), attributeRole()); if (m_children & Brush) { - m_brush->write(writer, QLatin1String("brush")); + m_brush->write(writer, QStringLiteral("brush")); } if (!m_text.isEmpty()) @@ -5751,19 +4580,19 @@ void DomColorGroup::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("colorrole")) { + if (tag == QStringLiteral("colorrole")) { DomColorRole *v = new DomColorRole(); v->read(reader); m_colorRole.append(v); continue; } - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); m_color.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5779,46 +4608,17 @@ void DomColorGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColorGroup::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("colorrole")) { - DomColorRole *v = new DomColorRole(); - v->read(e); - m_colorRole.append(v); - continue; - } - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - m_color.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorgroup") : tagName.toLower()); for (int i = 0; i < m_colorRole.size(); ++i) { DomColorRole* v = m_colorRole[i]; - v->write(writer, QLatin1String("colorrole")); + v->write(writer, QStringLiteral("colorrole")); } for (int i = 0; i < m_color.size(); ++i) { DomColor* v = m_color[i]; - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -5876,89 +4676,54 @@ void DomPalette::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("active")) { + if (tag == QStringLiteral("active")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementActive(v); continue; } - if (tag == QLatin1String("inactive")) { + if (tag == QStringLiteral("inactive")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementInactive(v); continue; } - if (tag == QLatin1String("disabled")) { + if (tag == QStringLiteral("disabled")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementDisabled(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : finished = true; break; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -#ifdef QUILOADER_QDOM_READ -void DomPalette::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("active")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementActive(v); - continue; - } - if (tag == QLatin1String("inactive")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementInactive(v); - continue; - } - if (tag == QLatin1String("disabled")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementDisabled(v); - continue; - } + case QXmlStreamReader::Characters : + if (!reader.isWhitespace()) + m_text.append(reader.text().toString()); + break; + default : + break; + } } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } } -#endif void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("palette") : tagName.toLower()); if (m_children & Active) { - m_active->write(writer, QLatin1String("active")); + m_active->write(writer, QStringLiteral("active")); } if (m_children & Inactive) { - m_inactive->write(writer, QLatin1String("inactive")); + m_inactive->write(writer, QStringLiteral("inactive")); } if (m_children & Disabled) { - m_disabled->write(writer, QLatin1String("disabled")); + m_disabled->write(writer, QStringLiteral("disabled")); } if (!m_text.isEmpty()) @@ -6075,47 +4840,47 @@ void DomFont::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("family")) { + if (tag == QStringLiteral("family")) { setElementFamily(reader.readElementText()); continue; } - if (tag == QLatin1String("pointsize")) { + if (tag == QStringLiteral("pointsize")) { setElementPointSize(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("weight")) { + if (tag == QStringLiteral("weight")) { setElementWeight(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("italic")) { + if (tag == QStringLiteral("italic")) { setElementItalic((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("bold")) { + if (tag == QStringLiteral("bold")) { setElementBold((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("underline")) { + if (tag == QStringLiteral("underline")) { setElementUnderline((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("strikeout")) { + if (tag == QStringLiteral("strikeout")) { setElementStrikeOut((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("antialiasing")) { + if (tag == QStringLiteral("antialiasing")) { setElementAntialiasing((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("stylestrategy")) { + if (tag == QStringLiteral("stylestrategy")) { setElementStyleStrategy(reader.readElementText()); continue; } - if (tag == QLatin1String("kerning")) { + if (tag == QStringLiteral("kerning")) { setElementKerning((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6131,105 +4896,48 @@ void DomFont::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomFont::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("family")) { - setElementFamily(e.text()); - continue; - } - if (tag == QLatin1String("pointsize")) { - setElementPointSize(e.text().toInt()); - continue; - } - if (tag == QLatin1String("weight")) { - setElementWeight(e.text().toInt()); - continue; - } - if (tag == QLatin1String("italic")) { - setElementItalic((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("bold")) { - setElementBold((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("underline")) { - setElementUnderline((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("strikeout")) { - setElementStrikeOut((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("antialiasing")) { - setElementAntialiasing((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("stylestrategy")) { - setElementStyleStrategy(e.text()); - continue; - } - if (tag == QLatin1String("kerning")) { - setElementKerning((e.text() == QLatin1String("true") ? true : false)); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("font") : tagName.toLower()); if (m_children & Family) { - writer.writeTextElement(QLatin1String("family"), m_family); + writer.writeTextElement(QStringLiteral("family"), m_family); } if (m_children & PointSize) { - writer.writeTextElement(QLatin1String("pointsize"), QString::number(m_pointSize)); + writer.writeTextElement(QStringLiteral("pointsize"), QString::number(m_pointSize)); } if (m_children & Weight) { - writer.writeTextElement(QLatin1String("weight"), QString::number(m_weight)); + writer.writeTextElement(QStringLiteral("weight"), QString::number(m_weight)); } if (m_children & Italic) { - writer.writeTextElement(QLatin1String("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Bold) { - writer.writeTextElement(QLatin1String("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Underline) { - writer.writeTextElement(QLatin1String("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & StrikeOut) { - writer.writeTextElement(QLatin1String("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Antialiasing) { - writer.writeTextElement(QLatin1String("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & StyleStrategy) { - writer.writeTextElement(QLatin1String("stylestrategy"), m_styleStrategy); + writer.writeTextElement(QStringLiteral("stylestrategy"), m_styleStrategy); } if (m_children & Kerning) { - writer.writeTextElement(QLatin1String("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); } if (!m_text.isEmpty()) @@ -6386,7 +5094,7 @@ void DomPoint::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6402,31 +5110,6 @@ void DomPoint::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPoint::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("point") : tagName.toLower()); @@ -6509,15 +5192,15 @@ void DomRect::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6533,39 +5216,6 @@ void DomRect::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRect::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rect") : tagName.toLower()); @@ -6579,11 +5229,11 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const } if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); } if (!m_text.isEmpty()) @@ -6664,22 +5314,22 @@ void DomLocale::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QLatin1String("country")) { + if (name == QStringLiteral("country")) { setAttributeCountry(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6695,37 +5345,15 @@ void DomLocale::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLocale::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - if (node.hasAttribute(QLatin1String("country"))) - setAttributeCountry(node.attribute(QLatin1String("country"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("locale") : tagName.toLower()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (hasAttributeCountry()) - writer.writeAttribute(QLatin1String("country"), attributeCountry()); + writer.writeAttribute(QStringLiteral("country"), attributeCountry()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -6769,38 +5397,38 @@ void DomSizePolicy::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("hsizetype")) { + if (name == QStringLiteral("hsizetype")) { setAttributeHSizeType(attribute.value().toString()); continue; } - if (name == QLatin1String("vsizetype")) { + if (name == QStringLiteral("vsizetype")) { setAttributeVSizeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hsizetype")) { + if (tag == QStringLiteral("hsizetype")) { setElementHSizeType(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("vsizetype")) { + if (tag == QStringLiteral("vsizetype")) { setElementVSizeType(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("horstretch")) { + if (tag == QStringLiteral("horstretch")) { setElementHorStretch(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("verstretch")) { + if (tag == QStringLiteral("verstretch")) { setElementVerStretch(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6816,68 +5444,30 @@ void DomSizePolicy::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSizePolicy::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("hsizetype"))) - setAttributeHSizeType(node.attribute(QLatin1String("hsizetype"))); - if (node.hasAttribute(QLatin1String("vsizetype"))) - setAttributeVSizeType(node.attribute(QLatin1String("vsizetype"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hsizetype")) { - setElementHSizeType(e.text().toInt()); - continue; - } - if (tag == QLatin1String("vsizetype")) { - setElementVSizeType(e.text().toInt()); - continue; - } - if (tag == QLatin1String("horstretch")) { - setElementHorStretch(e.text().toInt()); - continue; - } - if (tag == QLatin1String("verstretch")) { - setElementVerStretch(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicy") : tagName.toLower()); if (hasAttributeHSizeType()) - writer.writeAttribute(QLatin1String("hsizetype"), attributeHSizeType()); + writer.writeAttribute(QStringLiteral("hsizetype"), attributeHSizeType()); if (hasAttributeVSizeType()) - writer.writeAttribute(QLatin1String("vsizetype"), attributeVSizeType()); + writer.writeAttribute(QStringLiteral("vsizetype"), attributeVSizeType()); if (m_children & HSizeType) { - writer.writeTextElement(QLatin1String("hsizetype"), QString::number(m_hSizeType)); + writer.writeTextElement(QStringLiteral("hsizetype"), QString::number(m_hSizeType)); } if (m_children & VSizeType) { - writer.writeTextElement(QLatin1String("vsizetype"), QString::number(m_vSizeType)); + writer.writeTextElement(QStringLiteral("vsizetype"), QString::number(m_vSizeType)); } if (m_children & HorStretch) { - writer.writeTextElement(QLatin1String("horstretch"), QString::number(m_horStretch)); + writer.writeTextElement(QStringLiteral("horstretch"), QString::number(m_horStretch)); } if (m_children & VerStretch) { - writer.writeTextElement(QLatin1String("verstretch"), QString::number(m_verStretch)); + writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch)); } if (!m_text.isEmpty()) @@ -6960,15 +5550,15 @@ void DomSize::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6984,41 +5574,16 @@ void DomSize::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSize::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("size") : tagName.toLower()); if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); } if (!m_text.isEmpty()) @@ -7081,19 +5646,19 @@ void DomDate::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("year")) { + if (tag == QStringLiteral("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("month")) { + if (tag == QStringLiteral("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("day")) { + if (tag == QStringLiteral("day")) { setElementDay(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7109,49 +5674,20 @@ void DomDate::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDate::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("year")) { - setElementYear(e.text().toInt()); - continue; - } - if (tag == QLatin1String("month")) { - setElementMonth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("day")) { - setElementDay(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("date") : tagName.toLower()); if (m_children & Year) { - writer.writeTextElement(QLatin1String("year"), QString::number(m_year)); + writer.writeTextElement(QStringLiteral("year"), QString::number(m_year)); } if (m_children & Month) { - writer.writeTextElement(QLatin1String("month"), QString::number(m_month)); + writer.writeTextElement(QStringLiteral("month"), QString::number(m_month)); } if (m_children & Day) { - writer.writeTextElement(QLatin1String("day"), QString::number(m_day)); + writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); } if (!m_text.isEmpty()) @@ -7225,19 +5761,19 @@ void DomTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hour")) { + if (tag == QStringLiteral("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("minute")) { + if (tag == QStringLiteral("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("second")) { + if (tag == QStringLiteral("second")) { setElementSecond(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7253,49 +5789,20 @@ void DomTime::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomTime::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hour")) { - setElementHour(e.text().toInt()); - continue; - } - if (tag == QLatin1String("minute")) { - setElementMinute(e.text().toInt()); - continue; - } - if (tag == QLatin1String("second")) { - setElementSecond(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("time") : tagName.toLower()); if (m_children & Hour) { - writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour)); + writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour)); } if (m_children & Minute) { - writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute)); + writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute)); } if (m_children & Second) { - writer.writeTextElement(QLatin1String("second"), QString::number(m_second)); + writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); } if (!m_text.isEmpty()) @@ -7375,31 +5882,31 @@ void DomDateTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hour")) { + if (tag == QStringLiteral("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("minute")) { + if (tag == QStringLiteral("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("second")) { + if (tag == QStringLiteral("second")) { setElementSecond(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("year")) { + if (tag == QStringLiteral("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("month")) { + if (tag == QStringLiteral("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("day")) { + if (tag == QStringLiteral("day")) { setElementDay(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7415,73 +5922,32 @@ void DomDateTime::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDateTime::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hour")) { - setElementHour(e.text().toInt()); - continue; - } - if (tag == QLatin1String("minute")) { - setElementMinute(e.text().toInt()); - continue; - } - if (tag == QLatin1String("second")) { - setElementSecond(e.text().toInt()); - continue; - } - if (tag == QLatin1String("year")) { - setElementYear(e.text().toInt()); - continue; - } - if (tag == QLatin1String("month")) { - setElementMonth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("day")) { - setElementDay(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("datetime") : tagName.toLower()); if (m_children & Hour) { - writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour)); + writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour)); } if (m_children & Minute) { - writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute)); + writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute)); } if (m_children & Second) { - writer.writeTextElement(QLatin1String("second"), QString::number(m_second)); + writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); } if (m_children & Year) { - writer.writeTextElement(QLatin1String("year"), QString::number(m_year)); + writer.writeTextElement(QStringLiteral("year"), QString::number(m_year)); } if (m_children & Month) { - writer.writeTextElement(QLatin1String("month"), QString::number(m_month)); + writer.writeTextElement(QStringLiteral("month"), QString::number(m_month)); } if (m_children & Day) { - writer.writeTextElement(QLatin1String("day"), QString::number(m_day)); + writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); } if (!m_text.isEmpty()) @@ -7584,11 +6050,11 @@ void DomStringList::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { m_string.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7604,34 +6070,13 @@ void DomStringList::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomStringList::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("string")) { - m_string.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringlist") : tagName.toLower()); for (int i = 0; i < m_string.size(); ++i) { QString v = m_string[i]; - writer.writeTextElement(QLatin1String("string"), v); + writer.writeTextElement(QStringLiteral("string"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -7649,7 +6094,7 @@ void DomResourcePixmap::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_resource = false; m_has_attr_alias = false; } @@ -7662,7 +6107,7 @@ DomResourcePixmap::DomResourcePixmap() m_children = 0; m_has_attr_resource = false; m_has_attr_alias = false; - m_text = QLatin1String(""); + m_text.clear(); } DomResourcePixmap::~DomResourcePixmap() @@ -7674,22 +6119,22 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("resource")) { + if (name == QStringLiteral("resource")) { setAttributeResource(attribute.value().toString()); continue; } - if (name == QLatin1String("alias")) { + if (name == QStringLiteral("alias")) { setAttributeAlias(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7705,37 +6150,15 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResourcePixmap::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("resource"))) - setAttributeResource(node.attribute(QLatin1String("resource"))); - if (node.hasAttribute(QLatin1String("alias"))) - setAttributeAlias(node.attribute(QLatin1String("alias"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourcepixmap") : tagName.toLower()); if (hasAttributeResource()) - writer.writeAttribute(QLatin1String("resource"), attributeResource()); + writer.writeAttribute(QStringLiteral("resource"), attributeResource()); if (hasAttributeAlias()) - writer.writeAttribute(QLatin1String("alias"), attributeAlias()); + writer.writeAttribute(QStringLiteral("alias"), attributeAlias()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -7755,7 +6178,7 @@ void DomResourceIcon::clear(bool clear_all) delete m_selectedOn; if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_theme = false; m_has_attr_resource = false; } @@ -7776,7 +6199,7 @@ DomResourceIcon::DomResourceIcon() m_children = 0; m_has_attr_theme = false; m_has_attr_resource = false; - m_text = QLatin1String(""); + m_text.clear(); m_normalOff = 0; m_normalOn = 0; m_disabledOff = 0; @@ -7804,70 +6227,70 @@ void DomResourceIcon::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("theme")) { + if (name == QStringLiteral("theme")) { setAttributeTheme(attribute.value().toString()); continue; } - if (name == QLatin1String("resource")) { + if (name == QStringLiteral("resource")) { setAttributeResource(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("normaloff")) { + if (tag == QStringLiteral("normaloff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOff(v); continue; } - if (tag == QLatin1String("normalon")) { + if (tag == QStringLiteral("normalon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOn(v); continue; } - if (tag == QLatin1String("disabledoff")) { + if (tag == QStringLiteral("disabledoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOff(v); continue; } - if (tag == QLatin1String("disabledon")) { + if (tag == QStringLiteral("disabledon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOn(v); continue; } - if (tag == QLatin1String("activeoff")) { + if (tag == QStringLiteral("activeoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOff(v); continue; } - if (tag == QLatin1String("activeon")) { + if (tag == QStringLiteral("activeon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOn(v); continue; } - if (tag == QLatin1String("selectedoff")) { + if (tag == QStringLiteral("selectedoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOff(v); continue; } - if (tag == QLatin1String("selectedon")) { + if (tag == QStringLiteral("selectedon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOn(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7883,116 +6306,46 @@ void DomResourceIcon::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResourceIcon::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("theme"))) - setAttributeTheme(node.attribute(QLatin1String("theme"))); - if (node.hasAttribute(QLatin1String("resource"))) - setAttributeResource(node.attribute(QLatin1String("resource"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("normaloff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementNormalOff(v); - continue; - } - if (tag == QLatin1String("normalon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementNormalOn(v); - continue; - } - if (tag == QLatin1String("disabledoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementDisabledOff(v); - continue; - } - if (tag == QLatin1String("disabledon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementDisabledOn(v); - continue; - } - if (tag == QLatin1String("activeoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementActiveOff(v); - continue; - } - if (tag == QLatin1String("activeon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementActiveOn(v); - continue; - } - if (tag == QLatin1String("selectedoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementSelectedOff(v); - continue; - } - if (tag == QLatin1String("selectedon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementSelectedOn(v); - continue; - } - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower()); if (hasAttributeTheme()) - writer.writeAttribute(QLatin1String("theme"), attributeTheme()); + writer.writeAttribute(QStringLiteral("theme"), attributeTheme()); if (hasAttributeResource()) - writer.writeAttribute(QLatin1String("resource"), attributeResource()); + writer.writeAttribute(QStringLiteral("resource"), attributeResource()); if (m_children & NormalOff) { - m_normalOff->write(writer, QLatin1String("normaloff")); + m_normalOff->write(writer, QStringLiteral("normaloff")); } if (m_children & NormalOn) { - m_normalOn->write(writer, QLatin1String("normalon")); + m_normalOn->write(writer, QStringLiteral("normalon")); } if (m_children & DisabledOff) { - m_disabledOff->write(writer, QLatin1String("disabledoff")); + m_disabledOff->write(writer, QStringLiteral("disabledoff")); } if (m_children & DisabledOn) { - m_disabledOn->write(writer, QLatin1String("disabledon")); + m_disabledOn->write(writer, QStringLiteral("disabledon")); } if (m_children & ActiveOff) { - m_activeOff->write(writer, QLatin1String("activeoff")); + m_activeOff->write(writer, QStringLiteral("activeoff")); } if (m_children & ActiveOn) { - m_activeOn->write(writer, QLatin1String("activeon")); + m_activeOn->write(writer, QStringLiteral("activeon")); } if (m_children & SelectedOff) { - m_selectedOff->write(writer, QLatin1String("selectedoff")); + m_selectedOff->write(writer, QStringLiteral("selectedoff")); } if (m_children & SelectedOn) { - m_selectedOn->write(writer, QLatin1String("selectedon")); + m_selectedOn->write(writer, QStringLiteral("selectedon")); } if (!m_text.isEmpty()) @@ -8181,7 +6534,7 @@ void DomString::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_notr = false; m_has_attr_comment = false; m_has_attr_extraComment = false; @@ -8196,7 +6549,7 @@ DomString::DomString() m_has_attr_notr = false; m_has_attr_comment = false; m_has_attr_extraComment = false; - m_text = QLatin1String(""); + m_text.clear(); } DomString::~DomString() @@ -8208,26 +6561,26 @@ void DomString::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("notr")) { + if (name == QStringLiteral("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - if (name == QLatin1String("comment")) { + if (name == QStringLiteral("comment")) { setAttributeComment(attribute.value().toString()); continue; } - if (name == QLatin1String("extracomment")) { + if (name == QStringLiteral("extracomment")) { setAttributeExtraComment(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8243,42 +6596,18 @@ void DomString::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomString::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("notr"))) - setAttributeNotr(node.attribute(QLatin1String("notr"))); - if (node.hasAttribute(QLatin1String("comment"))) - setAttributeComment(node.attribute(QLatin1String("comment"))); - if (node.hasAttribute(QLatin1String("extracomment"))) - setAttributeExtraComment(node.attribute(QLatin1String("extracomment"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("string") : tagName.toLower()); if (hasAttributeNotr()) - writer.writeAttribute(QLatin1String("notr"), attributeNotr()); + writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); if (hasAttributeComment()) - writer.writeAttribute(QLatin1String("comment"), attributeComment()); + writer.writeAttribute(QStringLiteral("comment"), attributeComment()); if (hasAttributeExtraComment()) - writer.writeAttribute(QLatin1String("extracomment"), attributeExtraComment()); + writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -8324,7 +6653,7 @@ void DomPointF::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8340,31 +6669,6 @@ void DomPointF::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPointF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toDouble()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toDouble()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("pointf") : tagName.toLower()); @@ -8447,15 +6751,15 @@ void DomRectF::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8471,39 +6775,6 @@ void DomRectF::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRectF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toDouble()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toDouble()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rectf") : tagName.toLower()); @@ -8517,11 +6788,11 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const } if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); } if (!m_text.isEmpty()) @@ -8604,15 +6875,15 @@ void DomSizeF::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8622,47 +6893,22 @@ void DomSizeF::read(QXmlStreamReader &reader) if (!reader.isWhitespace()) m_text.append(reader.text().toString()); break; - default : - break; - } - } -} - -#ifdef QUILOADER_QDOM_READ -void DomSizeF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toDouble()); - continue; - } + default : + break; + } } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } } -#endif void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizef") : tagName.toLower()); if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); } if (!m_text.isEmpty()) @@ -8721,11 +6967,11 @@ void DomChar::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("unicode")) { + if (tag == QStringLiteral("unicode")) { setElementUnicode(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8741,33 +6987,12 @@ void DomChar::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomChar::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("unicode")) { - setElementUnicode(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("char") : tagName.toLower()); if (m_children & Unicode) { - writer.writeTextElement(QLatin1String("unicode"), QString::number(m_unicode)); + writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode)); } if (!m_text.isEmpty()) @@ -8817,13 +7042,13 @@ void DomUrl::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8839,35 +7064,12 @@ void DomUrl::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomUrl::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("string")) { - DomString *v = new DomString(); - v->read(e); - setElementString(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("url") : tagName.toLower()); if (m_children & String) { - m_string->write(writer, QLatin1String("string")); + m_string->write(writer, QStringLiteral("string")); } if (!m_text.isEmpty()) @@ -9028,196 +7230,196 @@ void DomProperty::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("stdset")) { + if (name == QStringLiteral("stdset")) { setAttributeStdset(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("bool")) { + if (tag == QStringLiteral("bool")) { setElementBool(reader.readElementText()); continue; } - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QLatin1String("cstring")) { + if (tag == QStringLiteral("cstring")) { setElementCstring(reader.readElementText()); continue; } - if (tag == QLatin1String("cursor")) { + if (tag == QStringLiteral("cursor")) { setElementCursor(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("cursorshape")) { + if (tag == QStringLiteral("cursorshape")) { setElementCursorShape(reader.readElementText()); continue; } - if (tag == QLatin1String("enum")) { + if (tag == QStringLiteral("enum")) { setElementEnum(reader.readElementText()); continue; } - if (tag == QLatin1String("font")) { + if (tag == QStringLiteral("font")) { DomFont *v = new DomFont(); v->read(reader); setElementFont(v); continue; } - if (tag == QLatin1String("iconset")) { + if (tag == QStringLiteral("iconset")) { DomResourceIcon *v = new DomResourceIcon(); v->read(reader); setElementIconSet(v); continue; } - if (tag == QLatin1String("pixmap")) { + if (tag == QStringLiteral("pixmap")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementPixmap(v); continue; } - if (tag == QLatin1String("palette")) { + if (tag == QStringLiteral("palette")) { DomPalette *v = new DomPalette(); v->read(reader); setElementPalette(v); continue; } - if (tag == QLatin1String("point")) { + if (tag == QStringLiteral("point")) { DomPoint *v = new DomPoint(); v->read(reader); setElementPoint(v); continue; } - if (tag == QLatin1String("rect")) { + if (tag == QStringLiteral("rect")) { DomRect *v = new DomRect(); v->read(reader); setElementRect(v); continue; } - if (tag == QLatin1String("set")) { + if (tag == QStringLiteral("set")) { setElementSet(reader.readElementText()); continue; } - if (tag == QLatin1String("locale")) { + if (tag == QStringLiteral("locale")) { DomLocale *v = new DomLocale(); v->read(reader); setElementLocale(v); continue; } - if (tag == QLatin1String("sizepolicy")) { + if (tag == QStringLiteral("sizepolicy")) { DomSizePolicy *v = new DomSizePolicy(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QLatin1String("size")) { + if (tag == QStringLiteral("size")) { DomSize *v = new DomSize(); v->read(reader); setElementSize(v); continue; } - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); continue; } - if (tag == QLatin1String("stringlist")) { + if (tag == QStringLiteral("stringlist")) { DomStringList *v = new DomStringList(); v->read(reader); setElementStringList(v); continue; } - if (tag == QLatin1String("number")) { + if (tag == QStringLiteral("number")) { setElementNumber(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("float")) { + if (tag == QStringLiteral("float")) { setElementFloat(reader.readElementText().toFloat()); continue; } - if (tag == QLatin1String("double")) { + if (tag == QStringLiteral("double")) { setElementDouble(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("date")) { + if (tag == QStringLiteral("date")) { DomDate *v = new DomDate(); v->read(reader); setElementDate(v); continue; } - if (tag == QLatin1String("time")) { + if (tag == QStringLiteral("time")) { DomTime *v = new DomTime(); v->read(reader); setElementTime(v); continue; } - if (tag == QLatin1String("datetime")) { + if (tag == QStringLiteral("datetime")) { DomDateTime *v = new DomDateTime(); v->read(reader); setElementDateTime(v); continue; } - if (tag == QLatin1String("pointf")) { + if (tag == QStringLiteral("pointf")) { DomPointF *v = new DomPointF(); v->read(reader); setElementPointF(v); continue; } - if (tag == QLatin1String("rectf")) { + if (tag == QStringLiteral("rectf")) { DomRectF *v = new DomRectF(); v->read(reader); setElementRectF(v); continue; } - if (tag == QLatin1String("sizef")) { + if (tag == QStringLiteral("sizef")) { DomSizeF *v = new DomSizeF(); v->read(reader); setElementSizeF(v); continue; } - if (tag == QLatin1String("longlong")) { + if (tag == QStringLiteral("longlong")) { setElementLongLong(reader.readElementText().toLongLong()); continue; } - if (tag == QLatin1String("char")) { + if (tag == QStringLiteral("char")) { DomChar *v = new DomChar(); v->read(reader); setElementChar(v); continue; } - if (tag == QLatin1String("url")) { + if (tag == QStringLiteral("url")) { DomUrl *v = new DomUrl(); v->read(reader); setElementUrl(v); continue; } - if (tag == QLatin1String("uint")) { + if (tag == QStringLiteral("uint")) { setElementUInt(reader.readElementText().toUInt()); continue; } - if (tag == QLatin1String("ulonglong")) { + if (tag == QStringLiteral("ulonglong")) { setElementULongLong(reader.readElementText().toULongLong()); continue; } - if (tag == QLatin1String("brush")) { + if (tag == QStringLiteral("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -9233,405 +7435,209 @@ void DomProperty::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomProperty::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("stdset"))) - setAttributeStdset(node.attribute(QLatin1String("stdset")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("bool")) { - setElementBool(e.text()); - continue; - } - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - if (tag == QLatin1String("cstring")) { - setElementCstring(e.text()); - continue; - } - if (tag == QLatin1String("cursor")) { - setElementCursor(e.text().toInt()); - continue; - } - if (tag == QLatin1String("cursorshape")) { - setElementCursorShape(e.text()); - continue; - } - if (tag == QLatin1String("enum")) { - setElementEnum(e.text()); - continue; - } - if (tag == QLatin1String("font")) { - DomFont *v = new DomFont(); - v->read(e); - setElementFont(v); - continue; - } - if (tag == QLatin1String("iconset")) { - DomResourceIcon *v = new DomResourceIcon(); - v->read(e); - setElementIconSet(v); - continue; - } - if (tag == QLatin1String("pixmap")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementPixmap(v); - continue; - } - if (tag == QLatin1String("palette")) { - DomPalette *v = new DomPalette(); - v->read(e); - setElementPalette(v); - continue; - } - if (tag == QLatin1String("point")) { - DomPoint *v = new DomPoint(); - v->read(e); - setElementPoint(v); - continue; - } - if (tag == QLatin1String("rect")) { - DomRect *v = new DomRect(); - v->read(e); - setElementRect(v); - continue; - } - if (tag == QLatin1String("set")) { - setElementSet(e.text()); - continue; - } - if (tag == QLatin1String("locale")) { - DomLocale *v = new DomLocale(); - v->read(e); - setElementLocale(v); - continue; - } - if (tag == QLatin1String("sizepolicy")) { - DomSizePolicy *v = new DomSizePolicy(); - v->read(e); - setElementSizePolicy(v); - continue; - } - if (tag == QLatin1String("size")) { - DomSize *v = new DomSize(); - v->read(e); - setElementSize(v); - continue; - } - if (tag == QLatin1String("string")) { - DomString *v = new DomString(); - v->read(e); - setElementString(v); - continue; - } - if (tag == QLatin1String("stringlist")) { - DomStringList *v = new DomStringList(); - v->read(e); - setElementStringList(v); - continue; - } - if (tag == QLatin1String("number")) { - setElementNumber(e.text().toInt()); - continue; - } - if (tag == QLatin1String("float")) { - setElementFloat(e.text().toFloat()); - continue; - } - if (tag == QLatin1String("double")) { - setElementDouble(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("date")) { - DomDate *v = new DomDate(); - v->read(e); - setElementDate(v); - continue; - } - if (tag == QLatin1String("time")) { - DomTime *v = new DomTime(); - v->read(e); - setElementTime(v); - continue; - } - if (tag == QLatin1String("datetime")) { - DomDateTime *v = new DomDateTime(); - v->read(e); - setElementDateTime(v); - continue; - } - if (tag == QLatin1String("pointf")) { - DomPointF *v = new DomPointF(); - v->read(e); - setElementPointF(v); - continue; - } - if (tag == QLatin1String("rectf")) { - DomRectF *v = new DomRectF(); - v->read(e); - setElementRectF(v); - continue; - } - if (tag == QLatin1String("sizef")) { - DomSizeF *v = new DomSizeF(); - v->read(e); - setElementSizeF(v); - continue; - } - if (tag == QLatin1String("longlong")) { - setElementLongLong(e.text().toLongLong()); - continue; - } - if (tag == QLatin1String("char")) { - DomChar *v = new DomChar(); - v->read(e); - setElementChar(v); - continue; - } - if (tag == QLatin1String("url")) { - DomUrl *v = new DomUrl(); - v->read(e); - setElementUrl(v); - continue; - } - if (tag == QLatin1String("uint")) { - setElementUInt(e.text().toUInt()); - continue; - } - if (tag == QLatin1String("ulonglong")) { - setElementULongLong(e.text().toULongLong()); - continue; - } - if (tag == QLatin1String("brush")) { - DomBrush *v = new DomBrush(); - v->read(e); - setElementBrush(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("property") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeStdset()) - writer.writeAttribute(QLatin1String("stdset"), QString::number(attributeStdset())); + writer.writeAttribute(QStringLiteral("stdset"), QString::number(attributeStdset())); switch (kind()) { case Bool: { - writer.writeTextElement(QLatin1String("bool"), elementBool()); + writer.writeTextElement(QStringLiteral("bool"), elementBool()); break; } case Color: { DomColor* v = elementColor(); if (v != 0) { - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } break; } case Cstring: { - writer.writeTextElement(QLatin1String("cstring"), elementCstring()); + writer.writeTextElement(QStringLiteral("cstring"), elementCstring()); break; } case Cursor: { - writer.writeTextElement(QLatin1String("cursor"), QString::number(elementCursor())); + writer.writeTextElement(QStringLiteral("cursor"), QString::number(elementCursor())); break; } case CursorShape: { - writer.writeTextElement(QLatin1String("cursorShape"), elementCursorShape()); + writer.writeTextElement(QStringLiteral("cursorShape"), elementCursorShape()); break; } case Enum: { - writer.writeTextElement(QLatin1String("enum"), elementEnum()); + writer.writeTextElement(QStringLiteral("enum"), elementEnum()); break; } case Font: { DomFont* v = elementFont(); if (v != 0) { - v->write(writer, QLatin1String("font")); + v->write(writer, QStringLiteral("font")); } break; } case IconSet: { DomResourceIcon* v = elementIconSet(); if (v != 0) { - v->write(writer, QLatin1String("iconset")); + v->write(writer, QStringLiteral("iconset")); } break; } case Pixmap: { DomResourcePixmap* v = elementPixmap(); if (v != 0) { - v->write(writer, QLatin1String("pixmap")); + v->write(writer, QStringLiteral("pixmap")); } break; } case Palette: { DomPalette* v = elementPalette(); if (v != 0) { - v->write(writer, QLatin1String("palette")); + v->write(writer, QStringLiteral("palette")); } break; } case Point: { DomPoint* v = elementPoint(); if (v != 0) { - v->write(writer, QLatin1String("point")); + v->write(writer, QStringLiteral("point")); } break; } case Rect: { DomRect* v = elementRect(); if (v != 0) { - v->write(writer, QLatin1String("rect")); + v->write(writer, QStringLiteral("rect")); } break; } case Set: { - writer.writeTextElement(QLatin1String("set"), elementSet()); + writer.writeTextElement(QStringLiteral("set"), elementSet()); break; } case Locale: { DomLocale* v = elementLocale(); if (v != 0) { - v->write(writer, QLatin1String("locale")); + v->write(writer, QStringLiteral("locale")); } break; } case SizePolicy: { DomSizePolicy* v = elementSizePolicy(); if (v != 0) { - v->write(writer, QLatin1String("sizepolicy")); + v->write(writer, QStringLiteral("sizepolicy")); } break; } case Size: { DomSize* v = elementSize(); if (v != 0) { - v->write(writer, QLatin1String("size")); + v->write(writer, QStringLiteral("size")); } break; } case String: { DomString* v = elementString(); if (v != 0) { - v->write(writer, QLatin1String("string")); + v->write(writer, QStringLiteral("string")); } break; } case StringList: { DomStringList* v = elementStringList(); if (v != 0) { - v->write(writer, QLatin1String("stringlist")); + v->write(writer, QStringLiteral("stringlist")); } break; } case Number: { - writer.writeTextElement(QLatin1String("number"), QString::number(elementNumber())); + writer.writeTextElement(QStringLiteral("number"), QString::number(elementNumber())); break; } case Float: { - writer.writeTextElement(QLatin1String("float"), QString::number(elementFloat(), 'f', 8)); + writer.writeTextElement(QStringLiteral("float"), QString::number(elementFloat(), 'f', 8)); break; } case Double: { - writer.writeTextElement(QLatin1String("double"), QString::number(elementDouble(), 'f', 15)); + writer.writeTextElement(QStringLiteral("double"), QString::number(elementDouble(), 'f', 15)); break; } case Date: { DomDate* v = elementDate(); if (v != 0) { - v->write(writer, QLatin1String("date")); + v->write(writer, QStringLiteral("date")); } break; } case Time: { DomTime* v = elementTime(); if (v != 0) { - v->write(writer, QLatin1String("time")); + v->write(writer, QStringLiteral("time")); } break; } case DateTime: { DomDateTime* v = elementDateTime(); if (v != 0) { - v->write(writer, QLatin1String("datetime")); + v->write(writer, QStringLiteral("datetime")); } break; } case PointF: { DomPointF* v = elementPointF(); if (v != 0) { - v->write(writer, QLatin1String("pointf")); + v->write(writer, QStringLiteral("pointf")); } break; } case RectF: { DomRectF* v = elementRectF(); if (v != 0) { - v->write(writer, QLatin1String("rectf")); + v->write(writer, QStringLiteral("rectf")); } break; } case SizeF: { DomSizeF* v = elementSizeF(); if (v != 0) { - v->write(writer, QLatin1String("sizef")); + v->write(writer, QStringLiteral("sizef")); } break; } case LongLong: { - writer.writeTextElement(QLatin1String("longLong"), QString::number(elementLongLong())); + writer.writeTextElement(QStringLiteral("longLong"), QString::number(elementLongLong())); break; } case Char: { DomChar* v = elementChar(); if (v != 0) { - v->write(writer, QLatin1String("char")); + v->write(writer, QStringLiteral("char")); } break; } case Url: { DomUrl* v = elementUrl(); if (v != 0) { - v->write(writer, QLatin1String("url")); + v->write(writer, QStringLiteral("url")); } break; } case UInt: { - writer.writeTextElement(QLatin1String("UInt"), QString::number(elementUInt())); + writer.writeTextElement(QStringLiteral("UInt"), QString::number(elementUInt())); break; } case ULongLong: { - writer.writeTextElement(QLatin1String("uLongLong"), QString::number(elementULongLong())); + writer.writeTextElement(QStringLiteral("uLongLong"), QString::number(elementULongLong())); break; } case Brush: { DomBrush* v = elementBrush(); if (v != 0) { - v->write(writer, QLatin1String("brush")); + v->write(writer, QStringLiteral("brush")); } break; } @@ -10052,13 +8058,13 @@ void DomConnections::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("connection")) { + if (tag == QStringLiteral("connection")) { DomConnection *v = new DomConnection(); v->read(reader); m_connection.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10074,36 +8080,13 @@ void DomConnections::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnections::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("connection")) { - DomConnection *v = new DomConnection(); - v->read(e); - m_connection.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connections") : tagName.toLower()); for (int i = 0; i < m_connection.size(); ++i) { DomConnection* v = m_connection[i]; - v->write(writer, QLatin1String("connection")); + v->write(writer, QStringLiteral("connection")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10147,29 +8130,29 @@ void DomConnection::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("sender")) { + if (tag == QStringLiteral("sender")) { setElementSender(reader.readElementText()); continue; } - if (tag == QLatin1String("signal")) { + if (tag == QStringLiteral("signal")) { setElementSignal(reader.readElementText()); continue; } - if (tag == QLatin1String("receiver")) { + if (tag == QStringLiteral("receiver")) { setElementReceiver(reader.readElementText()); continue; } - if (tag == QLatin1String("slot")) { + if (tag == QStringLiteral("slot")) { setElementSlot(reader.readElementText()); continue; } - if (tag == QLatin1String("hints")) { + if (tag == QStringLiteral("hints")) { DomConnectionHints *v = new DomConnectionHints(); v->read(reader); setElementHints(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10185,67 +8168,28 @@ void DomConnection::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnection::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("sender")) { - setElementSender(e.text()); - continue; - } - if (tag == QLatin1String("signal")) { - setElementSignal(e.text()); - continue; - } - if (tag == QLatin1String("receiver")) { - setElementReceiver(e.text()); - continue; - } - if (tag == QLatin1String("slot")) { - setElementSlot(e.text()); - continue; - } - if (tag == QLatin1String("hints")) { - DomConnectionHints *v = new DomConnectionHints(); - v->read(e); - setElementHints(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connection") : tagName.toLower()); if (m_children & Sender) { - writer.writeTextElement(QLatin1String("sender"), m_sender); + writer.writeTextElement(QStringLiteral("sender"), m_sender); } if (m_children & Signal) { - writer.writeTextElement(QLatin1String("signal"), m_signal); + writer.writeTextElement(QStringLiteral("signal"), m_signal); } if (m_children & Receiver) { - writer.writeTextElement(QLatin1String("receiver"), m_receiver); + writer.writeTextElement(QStringLiteral("receiver"), m_receiver); } if (m_children & Slot) { - writer.writeTextElement(QLatin1String("slot"), m_slot); + writer.writeTextElement(QStringLiteral("slot"), m_slot); } if (m_children & Hints) { - m_hints->write(writer, QLatin1String("hints")); + m_hints->write(writer, QStringLiteral("hints")); } if (!m_text.isEmpty()) @@ -10350,13 +8294,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hint")) { + if (tag == QStringLiteral("hint")) { DomConnectionHint *v = new DomConnectionHint(); v->read(reader); m_hint.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10372,36 +8316,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnectionHints::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hint")) { - DomConnectionHint *v = new DomConnectionHint(); - v->read(e); - m_hint.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhints") : tagName.toLower()); for (int i = 0; i < m_hint.size(); ++i) { DomConnectionHint* v = m_hint[i]; - v->write(writer, QLatin1String("hint")); + v->write(writer, QStringLiteral("hint")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10445,11 +8366,11 @@ void DomConnectionHint::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { @@ -10464,7 +8385,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10480,40 +8401,12 @@ void DomConnectionHint::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnectionHint::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhint") : tagName.toLower()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (m_children & X) { writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x)); @@ -10579,22 +8472,22 @@ void DomScript::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("source")) { + if (name == QStringLiteral("source")) { setAttributeSource(attribute.value().toString()); continue; } - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10610,37 +8503,15 @@ void DomScript::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomScript::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("source"))) - setAttributeSource(node.attribute(QLatin1String("source"))); - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("script") : tagName.toLower()); if (hasAttributeSource()) - writer.writeAttribute(QLatin1String("source"), attributeSource()); + writer.writeAttribute(QStringLiteral("source"), attributeSource()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10678,13 +8549,13 @@ void DomWidgetData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10700,36 +8571,13 @@ void DomWidgetData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomWidgetData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widgetdata") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10773,13 +8621,13 @@ void DomDesignerData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10795,36 +8643,13 @@ void DomDesignerData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDesignerData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("designerdata") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10868,15 +8693,15 @@ void DomSlots::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("signal")) { + if (tag == QStringLiteral("signal")) { m_signal.append(reader.readElementText()); continue; } - if (tag == QLatin1String("slot")) { + if (tag == QStringLiteral("slot")) { m_slot.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10892,42 +8717,17 @@ void DomSlots::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSlots::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("signal")) { - m_signal.append(e.text()); - continue; - } - if (tag == QLatin1String("slot")) { - m_slot.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("slots") : tagName.toLower()); for (int i = 0; i < m_signal.size(); ++i) { QString v = m_signal[i]; - writer.writeTextElement(QLatin1String("signal"), v); + writer.writeTextElement(QStringLiteral("signal"), v); } for (int i = 0; i < m_slot.size(); ++i) { QString v = m_slot[i]; - writer.writeTextElement(QLatin1String("slot"), v); + writer.writeTextElement(QStringLiteral("slot"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10977,13 +8777,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("stringpropertyspecification")) { + if (tag == QStringLiteral("stringpropertyspecification")) { DomStringPropertySpecification *v = new DomStringPropertySpecification(); v->read(reader); m_stringpropertyspecification.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10999,36 +8799,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPropertySpecifications::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("stringpropertyspecification")) { - DomStringPropertySpecification *v = new DomStringPropertySpecification(); - v->read(e); - m_stringpropertyspecification.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower()); for (int i = 0; i < m_stringpropertyspecification.size(); ++i) { DomStringPropertySpecification* v = m_stringpropertyspecification[i]; - v->write(writer, QLatin1String("stringpropertyspecification")); + v->write(writer, QStringLiteral("stringpropertyspecification")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -11072,26 +8849,26 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QLatin1String("notr")) { + if (name == QStringLiteral("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -11107,42 +8884,18 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomStringPropertySpecification::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - if (node.hasAttribute(QLatin1String("notr"))) - setAttributeNotr(node.attribute(QLatin1String("notr"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (hasAttributeNotr()) - writer.writeAttribute(QLatin1String("notr"), attributeNotr()); + writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index 8d7f108065..6a56c9eadc 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -62,17 +62,8 @@ #include #include -#if defined(QT_UIC3) - #define QUILOADER_QDOM_READ -#endif - QT_BEGIN_NAMESPACE -#ifdef QUILOADER_QDOM_READ - class QDomElement; -#endif - - #define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT #define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT @@ -174,9 +165,6 @@ public: ~DomUI(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -374,9 +362,6 @@ public: ~DomIncludes(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -408,9 +393,6 @@ public: ~DomInclude(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -451,9 +433,6 @@ public: ~DomResources(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -493,9 +472,6 @@ public: ~DomResource(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -528,9 +504,6 @@ public: ~DomActionGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -585,9 +558,6 @@ public: ~DomAction(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -640,9 +610,6 @@ public: ~DomActionRef(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -675,9 +642,6 @@ public: ~DomButtonGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -722,9 +686,6 @@ public: ~DomButtonGroups(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -756,9 +717,6 @@ public: ~DomImages(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -790,9 +748,6 @@ public: ~DomImage(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -835,9 +790,6 @@ public: ~DomImageData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -878,9 +830,6 @@ public: ~DomCustomWidgets(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -912,9 +861,6 @@ public: ~DomHeader(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -947,9 +893,6 @@ public: ~DomCustomWidget(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1067,9 +1010,6 @@ public: ~DomProperties(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1101,9 +1041,6 @@ public: ~DomPropertyData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1136,9 +1073,6 @@ public: ~DomSizePolicyData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1179,9 +1113,6 @@ public: ~DomLayoutDefault(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1222,9 +1153,6 @@ public: ~DomLayoutFunction(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1265,9 +1193,6 @@ public: ~DomTabStops(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1299,9 +1224,6 @@ public: ~DomLayout(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1399,9 +1321,6 @@ public: ~DomLayoutItem(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1484,9 +1403,6 @@ public: ~DomRow(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1518,9 +1434,6 @@ public: ~DomColumn(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1552,9 +1465,6 @@ public: ~DomItem(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1607,9 +1517,6 @@ public: ~DomWidget(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1730,9 +1637,6 @@ public: ~DomSpacer(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1772,9 +1676,6 @@ public: ~DomColor(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1830,9 +1731,6 @@ public: ~DomGradientStop(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1875,9 +1773,6 @@ public: ~DomGradient(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2013,9 +1908,6 @@ public: ~DomBrush(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2066,9 +1958,6 @@ public: ~DomColorRole(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2111,9 +2000,6 @@ public: ~DomColorGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2150,9 +2036,6 @@ public: ~DomPalette(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2203,9 +2086,6 @@ public: ~DomFont(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2302,9 +2182,6 @@ public: ~DomPoint(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2345,9 +2222,6 @@ public: ~DomRect(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2402,9 +2276,6 @@ public: ~DomLocale(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2445,9 +2316,6 @@ public: ~DomSizePolicy(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2518,9 +2386,6 @@ public: ~DomSize(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2561,9 +2426,6 @@ public: ~DomDate(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2611,9 +2473,6 @@ public: ~DomTime(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2661,9 +2520,6 @@ public: ~DomDateTime(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2732,9 +2588,6 @@ public: ~DomStringList(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2766,9 +2619,6 @@ public: ~DomResourcePixmap(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2809,9 +2659,6 @@ public: ~DomResourceIcon(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2918,9 +2765,6 @@ public: ~DomString(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2969,9 +2813,6 @@ public: ~DomPointF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3012,9 +2853,6 @@ public: ~DomRectF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3069,9 +2907,6 @@ public: ~DomSizeF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3112,9 +2947,6 @@ public: ~DomChar(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3148,9 +2980,6 @@ public: ~DomUrl(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3185,9 +3014,6 @@ public: ~DomProperty(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3384,9 +3210,6 @@ public: ~DomConnections(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3418,9 +3241,6 @@ public: ~DomConnection(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3483,9 +3303,6 @@ public: ~DomConnectionHints(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3517,9 +3334,6 @@ public: ~DomConnectionHint(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3568,9 +3382,6 @@ public: ~DomScript(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3611,9 +3422,6 @@ public: ~DomWidgetData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3645,9 +3453,6 @@ public: ~DomDesignerData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3679,9 +3484,6 @@ public: ~DomSlots(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3718,9 +3520,6 @@ public: ~DomPropertySpecifications(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3752,9 +3551,6 @@ public: ~DomStringPropertySpecification(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } diff --git a/src/uitools/uitools.pro b/src/uitools/uitools.pro index 3f9f166dbd..be8c9c88a1 100644 --- a/src/uitools/uitools.pro +++ b/src/uitools/uitools.pro @@ -1,7 +1,7 @@ QPRO_PWD = $$PWD TEMPLATE = lib TARGET = $$qtLibraryTarget(QtUiTools) -QT = core xml +QT = core CONFIG += qt staticlib module MODULE = uitools @@ -56,5 +56,4 @@ unix|win32-g++* { QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] QMAKE_PKGCONFIG_DESTDIR = pkgconfig - QMAKE_PKGCONFIG_REQUIRES += QtXml } diff --git a/tools/uilib/ui4.cpp b/tools/uilib/ui4.cpp index f34df3c7c6..5c232c862c 100644 --- a/tools/uilib/ui4.cpp +++ b/tools/uilib/ui4.cpp @@ -40,9 +40,6 @@ ****************************************************************************/ #include "ui4_p.h" -#ifdef QUILOADER_QDOM_READ -#include -#endif QT_BEGIN_NAMESPACE #ifdef QFORMINTERNAL_NAMESPACE @@ -139,126 +136,126 @@ void DomUI::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("version")) { + if (name == QStringLiteral("version")) { setAttributeVersion(attribute.value().toString()); continue; } - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QLatin1String("displayname")) { + if (name == QStringLiteral("displayname")) { setAttributeDisplayname(attribute.value().toString()); continue; } - if (name == QLatin1String("stdsetdef")) { + if (name == QStringLiteral("stdsetdef")) { setAttributeStdsetdef(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("stdSetDef")) { + if (name == QStringLiteral("stdSetDef")) { setAttributeStdSetDef(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("author")) { + if (tag == QStringLiteral("author")) { setElementAuthor(reader.readElementText()); continue; } - if (tag == QLatin1String("comment")) { + if (tag == QStringLiteral("comment")) { setElementComment(reader.readElementText()); continue; } - if (tag == QLatin1String("exportmacro")) { + if (tag == QStringLiteral("exportmacro")) { setElementExportMacro(reader.readElementText()); continue; } - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QLatin1String("layoutdefault")) { + if (tag == QStringLiteral("layoutdefault")) { DomLayoutDefault *v = new DomLayoutDefault(); v->read(reader); setElementLayoutDefault(v); continue; } - if (tag == QLatin1String("layoutfunction")) { + if (tag == QStringLiteral("layoutfunction")) { DomLayoutFunction *v = new DomLayoutFunction(); v->read(reader); setElementLayoutFunction(v); continue; } - if (tag == QLatin1String("pixmapfunction")) { + if (tag == QStringLiteral("pixmapfunction")) { setElementPixmapFunction(reader.readElementText()); continue; } - if (tag == QLatin1String("customwidgets")) { + if (tag == QStringLiteral("customwidgets")) { DomCustomWidgets *v = new DomCustomWidgets(); v->read(reader); setElementCustomWidgets(v); continue; } - if (tag == QLatin1String("tabstops")) { + if (tag == QStringLiteral("tabstops")) { DomTabStops *v = new DomTabStops(); v->read(reader); setElementTabStops(v); continue; } - if (tag == QLatin1String("images")) { + if (tag == QStringLiteral("images")) { DomImages *v = new DomImages(); v->read(reader); setElementImages(v); continue; } - if (tag == QLatin1String("includes")) { + if (tag == QStringLiteral("includes")) { DomIncludes *v = new DomIncludes(); v->read(reader); setElementIncludes(v); continue; } - if (tag == QLatin1String("resources")) { + if (tag == QStringLiteral("resources")) { DomResources *v = new DomResources(); v->read(reader); setElementResources(v); continue; } - if (tag == QLatin1String("connections")) { + if (tag == QStringLiteral("connections")) { DomConnections *v = new DomConnections(); v->read(reader); setElementConnections(v); continue; } - if (tag == QLatin1String("designerdata")) { + if (tag == QStringLiteral("designerdata")) { DomDesignerData *v = new DomDesignerData(); v->read(reader); setElementDesignerdata(v); continue; } - if (tag == QLatin1String("slots")) { + if (tag == QStringLiteral("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QLatin1String("buttongroups")) { + if (tag == QStringLiteral("buttongroups")) { DomButtonGroups *v = new DomButtonGroups(); v->read(reader); setElementButtonGroups(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -274,211 +271,91 @@ void DomUI::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomUI::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("version"))) - setAttributeVersion(node.attribute(QLatin1String("version"))); - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - if (node.hasAttribute(QLatin1String("displayname"))) - setAttributeDisplayname(node.attribute(QLatin1String("displayname"))); - if (node.hasAttribute(QLatin1String("stdsetdef"))) - setAttributeStdsetdef(node.attribute(QLatin1String("stdsetdef")).toInt()); - if (node.hasAttribute(QLatin1String("stdSetDef"))) - setAttributeStdSetDef(node.attribute(QLatin1String("stdSetDef")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("author")) { - setElementAuthor(e.text()); - continue; - } - if (tag == QLatin1String("comment")) { - setElementComment(e.text()); - continue; - } - if (tag == QLatin1String("exportmacro")) { - setElementExportMacro(e.text()); - continue; - } - if (tag == QLatin1String("class")) { - setElementClass(e.text()); - continue; - } - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - setElementWidget(v); - continue; - } - if (tag == QLatin1String("layoutdefault")) { - DomLayoutDefault *v = new DomLayoutDefault(); - v->read(e); - setElementLayoutDefault(v); - continue; - } - if (tag == QLatin1String("layoutfunction")) { - DomLayoutFunction *v = new DomLayoutFunction(); - v->read(e); - setElementLayoutFunction(v); - continue; - } - if (tag == QLatin1String("pixmapfunction")) { - setElementPixmapFunction(e.text()); - continue; - } - if (tag == QLatin1String("customwidgets")) { - DomCustomWidgets *v = new DomCustomWidgets(); - v->read(e); - setElementCustomWidgets(v); - continue; - } - if (tag == QLatin1String("tabstops")) { - DomTabStops *v = new DomTabStops(); - v->read(e); - setElementTabStops(v); - continue; - } - if (tag == QLatin1String("images")) { - DomImages *v = new DomImages(); - v->read(e); - setElementImages(v); - continue; - } - if (tag == QLatin1String("includes")) { - DomIncludes *v = new DomIncludes(); - v->read(e); - setElementIncludes(v); - continue; - } - if (tag == QLatin1String("resources")) { - DomResources *v = new DomResources(); - v->read(e); - setElementResources(v); - continue; - } - if (tag == QLatin1String("connections")) { - DomConnections *v = new DomConnections(); - v->read(e); - setElementConnections(v); - continue; - } - if (tag == QLatin1String("designerdata")) { - DomDesignerData *v = new DomDesignerData(); - v->read(e); - setElementDesignerdata(v); - continue; - } - if (tag == QLatin1String("slots")) { - DomSlots *v = new DomSlots(); - v->read(e); - setElementSlots(v); - continue; - } - if (tag == QLatin1String("buttongroups")) { - DomButtonGroups *v = new DomButtonGroups(); - v->read(e); - setElementButtonGroups(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("ui") : tagName.toLower()); if (hasAttributeVersion()) - writer.writeAttribute(QLatin1String("version"), attributeVersion()); + writer.writeAttribute(QStringLiteral("version"), attributeVersion()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (hasAttributeDisplayname()) - writer.writeAttribute(QLatin1String("displayname"), attributeDisplayname()); + writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname()); if (hasAttributeStdsetdef()) - writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdsetdef())); + writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef())); if (hasAttributeStdSetDef()) - writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdSetDef())); + writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef())); if (m_children & Author) { - writer.writeTextElement(QLatin1String("author"), m_author); + writer.writeTextElement(QStringLiteral("author"), m_author); } if (m_children & Comment) { - writer.writeTextElement(QLatin1String("comment"), m_comment); + writer.writeTextElement(QStringLiteral("comment"), m_comment); } if (m_children & ExportMacro) { - writer.writeTextElement(QLatin1String("exportmacro"), m_exportMacro); + writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro); } if (m_children & Class) { - writer.writeTextElement(QLatin1String("class"), m_class); + writer.writeTextElement(QStringLiteral("class"), m_class); } if (m_children & Widget) { - m_widget->write(writer, QLatin1String("widget")); + m_widget->write(writer, QStringLiteral("widget")); } if (m_children & LayoutDefault) { - m_layoutDefault->write(writer, QLatin1String("layoutdefault")); + m_layoutDefault->write(writer, QStringLiteral("layoutdefault")); } if (m_children & LayoutFunction) { - m_layoutFunction->write(writer, QLatin1String("layoutfunction")); + m_layoutFunction->write(writer, QStringLiteral("layoutfunction")); } if (m_children & PixmapFunction) { - writer.writeTextElement(QLatin1String("pixmapfunction"), m_pixmapFunction); + writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction); } if (m_children & CustomWidgets) { - m_customWidgets->write(writer, QLatin1String("customwidgets")); + m_customWidgets->write(writer, QStringLiteral("customwidgets")); } if (m_children & TabStops) { - m_tabStops->write(writer, QLatin1String("tabstops")); + m_tabStops->write(writer, QStringLiteral("tabstops")); } if (m_children & Images) { - m_images->write(writer, QLatin1String("images")); + m_images->write(writer, QStringLiteral("images")); } if (m_children & Includes) { - m_includes->write(writer, QLatin1String("includes")); + m_includes->write(writer, QStringLiteral("includes")); } if (m_children & Resources) { - m_resources->write(writer, QLatin1String("resources")); + m_resources->write(writer, QStringLiteral("resources")); } if (m_children & Connections) { - m_connections->write(writer, QLatin1String("connections")); + m_connections->write(writer, QStringLiteral("connections")); } if (m_children & Designerdata) { - m_designerdata->write(writer, QLatin1String("designerdata")); + m_designerdata->write(writer, QStringLiteral("designerdata")); } if (m_children & Slots) { - m_slots->write(writer, QLatin1String("slots")); + m_slots->write(writer, QStringLiteral("slots")); } if (m_children & ButtonGroups) { - m_buttonGroups->write(writer, QLatin1String("buttongroups")); + m_buttonGroups->write(writer, QStringLiteral("buttongroups")); } if (!m_text.isEmpty()) @@ -836,13 +713,13 @@ void DomIncludes::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("include")) { + if (tag == QStringLiteral("include")) { DomInclude *v = new DomInclude(); v->read(reader); m_include.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -858,36 +735,13 @@ void DomIncludes::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomIncludes::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("include")) { - DomInclude *v = new DomInclude(); - v->read(e); - m_include.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("includes") : tagName.toLower()); for (int i = 0; i < m_include.size(); ++i) { DomInclude* v = m_include[i]; - v->write(writer, QLatin1String("include")); + v->write(writer, QStringLiteral("include")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -905,7 +759,7 @@ void DomInclude::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_location = false; m_has_attr_impldecl = false; } @@ -918,7 +772,7 @@ DomInclude::DomInclude() m_children = 0; m_has_attr_location = false; m_has_attr_impldecl = false; - m_text = QLatin1String(""); + m_text.clear(); } DomInclude::~DomInclude() @@ -930,22 +784,22 @@ void DomInclude::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - if (name == QLatin1String("impldecl")) { + if (name == QStringLiteral("impldecl")) { setAttributeImpldecl(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -961,37 +815,15 @@ void DomInclude::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomInclude::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - if (node.hasAttribute(QLatin1String("impldecl"))) - setAttributeImpldecl(node.attribute(QLatin1String("impldecl"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("include") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (hasAttributeImpldecl()) - writer.writeAttribute(QLatin1String("impldecl"), attributeImpldecl()); + writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1029,24 +861,24 @@ void DomResources::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("include")) { + if (tag == QStringLiteral("include")) { DomResource *v = new DomResource(); v->read(reader); m_include.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1062,42 +894,16 @@ void DomResources::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResources::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("include")) { - DomResource *v = new DomResource(); - v->read(e); - m_include.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resources") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_include.size(); ++i) { DomResource* v = m_include[i]; - v->write(writer, QLatin1String("include")); + v->write(writer, QStringLiteral("include")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1137,18 +943,18 @@ void DomResource::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1164,32 +970,12 @@ void DomResource::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResource::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resource") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1239,42 +1025,42 @@ void DomActionGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("action")) { + if (tag == QStringLiteral("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QLatin1String("actiongroup")) { + if (tag == QStringLiteral("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1290,72 +1076,28 @@ void DomActionGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomActionGroup::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("action")) { - DomAction *v = new DomAction(); - v->read(e); - m_action.append(v); - continue; - } - if (tag == QLatin1String("actiongroup")) { - DomActionGroup *v = new DomActionGroup(); - v->read(e); - m_actionGroup.append(v); - continue; - } - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actiongroup") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_action.size(); ++i) { DomAction* v = m_action[i]; - v->write(writer, QLatin1String("action")); + v->write(writer, QStringLiteral("action")); } for (int i = 0; i < m_actionGroup.size(); ++i) { DomActionGroup* v = m_actionGroup[i]; - v->write(writer, QLatin1String("actiongroup")); + v->write(writer, QStringLiteral("actiongroup")); } for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1423,34 +1165,34 @@ void DomAction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("menu")) { + if (name == QStringLiteral("menu")) { setAttributeMenu(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1466,57 +1208,23 @@ void DomAction::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomAction::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("menu"))) - setAttributeMenu(node.attribute(QLatin1String("menu"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("action") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeMenu()) - writer.writeAttribute(QLatin1String("menu"), attributeMenu()); + writer.writeAttribute(QStringLiteral("menu"), attributeMenu()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1562,18 +1270,18 @@ void DomActionRef::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1589,32 +1297,12 @@ void DomActionRef::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomActionRef::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actionref") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1656,30 +1344,30 @@ void DomButtonGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1695,52 +1383,20 @@ void DomButtonGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomButtonGroup::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroup") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1790,13 +1446,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("buttongroup")) { + if (tag == QStringLiteral("buttongroup")) { DomButtonGroup *v = new DomButtonGroup(); v->read(reader); m_buttonGroup.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1812,36 +1468,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomButtonGroups::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("buttongroup")) { - DomButtonGroup *v = new DomButtonGroup(); - v->read(e); - m_buttonGroup.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroups") : tagName.toLower()); for (int i = 0; i < m_buttonGroup.size(); ++i) { DomButtonGroup* v = m_buttonGroup[i]; - v->write(writer, QLatin1String("buttongroup")); + v->write(writer, QStringLiteral("buttongroup")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1885,13 +1518,13 @@ void DomImages::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("image")) { + if (tag == QStringLiteral("image")) { DomImage *v = new DomImage(); v->read(reader); m_image.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -1907,36 +1540,13 @@ void DomImages::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImages::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("image")) { - DomImage *v = new DomImage(); - v->read(e); - m_image.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("images") : tagName.toLower()); for (int i = 0; i < m_image.size(); ++i) { DomImage* v = m_image[i]; - v->write(writer, QLatin1String("image")); + v->write(writer, QStringLiteral("image")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -1980,24 +1590,24 @@ void DomImage::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("data")) { + if (tag == QStringLiteral("data")) { DomImageData *v = new DomImageData(); v->read(reader); setElementData(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2013,41 +1623,15 @@ void DomImage::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImage::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("data")) { - DomImageData *v = new DomImageData(); - v->read(e); - setElementData(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("image") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (m_children & Data) { - m_data->write(writer, QLatin1String("data")); + m_data->write(writer, QStringLiteral("data")); } if (!m_text.isEmpty()) @@ -2082,7 +1666,7 @@ void DomImageData::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_format = false; m_has_attr_length = false; m_attr_length = 0; @@ -2097,7 +1681,7 @@ DomImageData::DomImageData() m_has_attr_format = false; m_has_attr_length = false; m_attr_length = 0; - m_text = QLatin1String(""); + m_text.clear(); } DomImageData::~DomImageData() @@ -2109,22 +1693,22 @@ void DomImageData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("format")) { + if (name == QStringLiteral("format")) { setAttributeFormat(attribute.value().toString()); continue; } - if (name == QLatin1String("length")) { + if (name == QStringLiteral("length")) { setAttributeLength(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2140,37 +1724,15 @@ void DomImageData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomImageData::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("format"))) - setAttributeFormat(node.attribute(QLatin1String("format"))); - if (node.hasAttribute(QLatin1String("length"))) - setAttributeLength(node.attribute(QLatin1String("length")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("imagedata") : tagName.toLower()); if (hasAttributeFormat()) - writer.writeAttribute(QLatin1String("format"), attributeFormat()); + writer.writeAttribute(QStringLiteral("format"), attributeFormat()); if (hasAttributeLength()) - writer.writeAttribute(QLatin1String("length"), QString::number(attributeLength())); + writer.writeAttribute(QStringLiteral("length"), QString::number(attributeLength())); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2208,13 +1770,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("customwidget")) { + if (tag == QStringLiteral("customwidget")) { DomCustomWidget *v = new DomCustomWidget(); v->read(reader); m_customWidget.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2230,36 +1792,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomCustomWidgets::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("customwidget")) { - DomCustomWidget *v = new DomCustomWidget(); - v->read(e); - m_customWidget.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidgets") : tagName.toLower()); for (int i = 0; i < m_customWidget.size(); ++i) { DomCustomWidget* v = m_customWidget[i]; - v->write(writer, QLatin1String("customwidget")); + v->write(writer, QStringLiteral("customwidget")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2277,7 +1816,7 @@ void DomHeader::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_location = false; } @@ -2288,7 +1827,7 @@ DomHeader::DomHeader() { m_children = 0; m_has_attr_location = false; - m_text = QLatin1String(""); + m_text.clear(); } DomHeader::~DomHeader() @@ -2300,18 +1839,18 @@ void DomHeader::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("location")) { + if (name == QStringLiteral("location")) { setAttributeLocation(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2327,32 +1866,12 @@ void DomHeader::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomHeader::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("location"))) - setAttributeLocation(node.attribute(QLatin1String("location"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("header") : tagName.toLower()); if (hasAttributeLocation()) - writer.writeAttribute(QLatin1String("location"), attributeLocation()); + writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2416,69 +1935,69 @@ void DomCustomWidget::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QLatin1String("extends")) { + if (tag == QStringLiteral("extends")) { setElementExtends(reader.readElementText()); continue; } - if (tag == QLatin1String("header")) { + if (tag == QStringLiteral("header")) { DomHeader *v = new DomHeader(); v->read(reader); setElementHeader(v); continue; } - if (tag == QLatin1String("sizehint")) { + if (tag == QStringLiteral("sizehint")) { DomSize *v = new DomSize(); v->read(reader); setElementSizeHint(v); continue; } - if (tag == QLatin1String("addpagemethod")) { + if (tag == QStringLiteral("addpagemethod")) { setElementAddPageMethod(reader.readElementText()); continue; } - if (tag == QLatin1String("container")) { + if (tag == QStringLiteral("container")) { setElementContainer(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("sizepolicy")) { + if (tag == QStringLiteral("sizepolicy")) { DomSizePolicyData *v = new DomSizePolicyData(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QLatin1String("pixmap")) { + if (tag == QStringLiteral("pixmap")) { setElementPixmap(reader.readElementText()); continue; } - if (tag == QLatin1String("script")) { + if (tag == QStringLiteral("script")) { DomScript *v = new DomScript(); v->read(reader); setElementScript(v); continue; } - if (tag == QLatin1String("properties")) { + if (tag == QStringLiteral("properties")) { DomProperties *v = new DomProperties(); v->read(reader); setElementProperties(v); continue; } - if (tag == QLatin1String("slots")) { + if (tag == QStringLiteral("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QLatin1String("propertyspecifications")) { + if (tag == QStringLiteral("propertyspecifications")) { DomPropertySpecifications *v = new DomPropertySpecifications(); v->read(reader); setElementPropertyspecifications(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2494,135 +2013,56 @@ void DomCustomWidget::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomCustomWidget::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("class")) { - setElementClass(e.text()); - continue; - } - if (tag == QLatin1String("extends")) { - setElementExtends(e.text()); - continue; - } - if (tag == QLatin1String("header")) { - DomHeader *v = new DomHeader(); - v->read(e); - setElementHeader(v); - continue; - } - if (tag == QLatin1String("sizehint")) { - DomSize *v = new DomSize(); - v->read(e); - setElementSizeHint(v); - continue; - } - if (tag == QLatin1String("addpagemethod")) { - setElementAddPageMethod(e.text()); - continue; - } - if (tag == QLatin1String("container")) { - setElementContainer(e.text().toInt()); - continue; - } - if (tag == QLatin1String("sizepolicy")) { - DomSizePolicyData *v = new DomSizePolicyData(); - v->read(e); - setElementSizePolicy(v); - continue; - } - if (tag == QLatin1String("pixmap")) { - setElementPixmap(e.text()); - continue; - } - if (tag == QLatin1String("script")) { - DomScript *v = new DomScript(); - v->read(e); - setElementScript(v); - continue; - } - if (tag == QLatin1String("properties")) { - DomProperties *v = new DomProperties(); - v->read(e); - setElementProperties(v); - continue; - } - if (tag == QLatin1String("slots")) { - DomSlots *v = new DomSlots(); - v->read(e); - setElementSlots(v); - continue; - } - if (tag == QLatin1String("propertyspecifications")) { - DomPropertySpecifications *v = new DomPropertySpecifications(); - v->read(e); - setElementPropertyspecifications(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - -void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const +void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidget") : tagName.toLower()); if (m_children & Class) { - writer.writeTextElement(QLatin1String("class"), m_class); + writer.writeTextElement(QStringLiteral("class"), m_class); } if (m_children & Extends) { - writer.writeTextElement(QLatin1String("extends"), m_extends); + writer.writeTextElement(QStringLiteral("extends"), m_extends); } if (m_children & Header) { - m_header->write(writer, QLatin1String("header")); + m_header->write(writer, QStringLiteral("header")); } if (m_children & SizeHint) { - m_sizeHint->write(writer, QLatin1String("sizehint")); + m_sizeHint->write(writer, QStringLiteral("sizehint")); } if (m_children & AddPageMethod) { - writer.writeTextElement(QLatin1String("addpagemethod"), m_addPageMethod); + writer.writeTextElement(QStringLiteral("addpagemethod"), m_addPageMethod); } if (m_children & Container) { - writer.writeTextElement(QLatin1String("container"), QString::number(m_container)); + writer.writeTextElement(QStringLiteral("container"), QString::number(m_container)); } if (m_children & SizePolicy) { - m_sizePolicy->write(writer, QLatin1String("sizepolicy")); + m_sizePolicy->write(writer, QStringLiteral("sizepolicy")); } if (m_children & Pixmap) { - writer.writeTextElement(QLatin1String("pixmap"), m_pixmap); + writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap); } if (m_children & Script) { - m_script->write(writer, QLatin1String("script")); + m_script->write(writer, QStringLiteral("script")); } if (m_children & Properties) { - m_properties->write(writer, QLatin1String("properties")); + m_properties->write(writer, QStringLiteral("properties")); } if (m_children & Slots) { - m_slots->write(writer, QLatin1String("slots")); + m_slots->write(writer, QStringLiteral("slots")); } if (m_children & Propertyspecifications) { - m_propertyspecifications->write(writer, QLatin1String("propertyspecifications")); + m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications")); } if (!m_text.isEmpty()) @@ -2870,13 +2310,13 @@ void DomProperties::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomPropertyData *v = new DomPropertyData(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2892,36 +2332,13 @@ void DomProperties::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomProperties::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomPropertyData *v = new DomPropertyData(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("properties") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomPropertyData* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -2961,18 +2378,18 @@ void DomPropertyData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -2988,32 +2405,12 @@ void DomPropertyData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPropertyData::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertydata") : tagName.toLower()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3051,15 +2448,15 @@ void DomSizePolicyData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hordata")) { + if (tag == QStringLiteral("hordata")) { setElementHorData(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("verdata")) { + if (tag == QStringLiteral("verdata")) { setElementVerData(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3075,41 +2472,16 @@ void DomSizePolicyData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSizePolicyData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hordata")) { - setElementHorData(e.text().toInt()); - continue; - } - if (tag == QLatin1String("verdata")) { - setElementVerData(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicydata") : tagName.toLower()); if (m_children & HorData) { - writer.writeTextElement(QLatin1String("hordata"), QString::number(m_horData)); + writer.writeTextElement(QStringLiteral("hordata"), QString::number(m_horData)); } if (m_children & VerData) { - writer.writeTextElement(QLatin1String("verdata"), QString::number(m_verData)); + writer.writeTextElement(QStringLiteral("verdata"), QString::number(m_verData)); } if (!m_text.isEmpty()) @@ -3172,22 +2544,22 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("spacing")) { + if (name == QStringLiteral("spacing")) { setAttributeSpacing(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("margin")) { + if (name == QStringLiteral("margin")) { setAttributeMargin(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3203,37 +2575,15 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutDefault::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("spacing"))) - setAttributeSpacing(node.attribute(QLatin1String("spacing")).toInt()); - if (node.hasAttribute(QLatin1String("margin"))) - setAttributeMargin(node.attribute(QLatin1String("margin")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutdefault") : tagName.toLower()); if (hasAttributeSpacing()) - writer.writeAttribute(QLatin1String("spacing"), QString::number(attributeSpacing())); + writer.writeAttribute(QStringLiteral("spacing"), QString::number(attributeSpacing())); if (hasAttributeMargin()) - writer.writeAttribute(QLatin1String("margin"), QString::number(attributeMargin())); + writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin())); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3269,22 +2619,22 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("spacing")) { + if (name == QStringLiteral("spacing")) { setAttributeSpacing(attribute.value().toString()); continue; } - if (name == QLatin1String("margin")) { + if (name == QStringLiteral("margin")) { setAttributeMargin(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3300,37 +2650,15 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutFunction::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("spacing"))) - setAttributeSpacing(node.attribute(QLatin1String("spacing"))); - if (node.hasAttribute(QLatin1String("margin"))) - setAttributeMargin(node.attribute(QLatin1String("margin"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutfunction") : tagName.toLower()); if (hasAttributeSpacing()) - writer.writeAttribute(QLatin1String("spacing"), attributeSpacing()); + writer.writeAttribute(QStringLiteral("spacing"), attributeSpacing()); if (hasAttributeMargin()) - writer.writeAttribute(QLatin1String("margin"), attributeMargin()); + writer.writeAttribute(QStringLiteral("margin"), attributeMargin()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3366,11 +2694,11 @@ void DomTabStops::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("tabstop")) { + if (tag == QStringLiteral("tabstop")) { m_tabStop.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3386,34 +2714,13 @@ void DomTabStops::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomTabStops::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("tabstop")) { - m_tabStop.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("tabstops") : tagName.toLower()); for (int i = 0; i < m_tabStop.size(); ++i) { QString v = m_tabStop[i]; - writer.writeTextElement(QLatin1String("tabstop"), v); + writer.writeTextElement(QStringLiteral("tabstop"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3477,60 +2784,60 @@ void DomLayout::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("class")) { + if (name == QStringLiteral("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("stretch")) { + if (name == QStringLiteral("stretch")) { setAttributeStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("rowstretch")) { + if (name == QStringLiteral("rowstretch")) { setAttributeRowStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("columnstretch")) { + if (name == QStringLiteral("columnstretch")) { setAttributeColumnStretch(attribute.value().toString()); continue; } - if (name == QLatin1String("rowminimumheight")) { + if (name == QStringLiteral("rowminimumheight")) { setAttributeRowMinimumHeight(attribute.value().toString()); continue; } - if (name == QLatin1String("columnminimumwidth")) { + if (name == QStringLiteral("columnminimumwidth")) { setAttributeColumnMinimumWidth(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomLayoutItem *v = new DomLayoutItem(); v->read(reader); m_item.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3546,92 +2853,42 @@ void DomLayout::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayout::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("class"))) - setAttributeClass(node.attribute(QLatin1String("class"))); - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("stretch"))) - setAttributeStretch(node.attribute(QLatin1String("stretch"))); - if (node.hasAttribute(QLatin1String("rowstretch"))) - setAttributeRowStretch(node.attribute(QLatin1String("rowstretch"))); - if (node.hasAttribute(QLatin1String("columnstretch"))) - setAttributeColumnStretch(node.attribute(QLatin1String("columnstretch"))); - if (node.hasAttribute(QLatin1String("rowminimumheight"))) - setAttributeRowMinimumHeight(node.attribute(QLatin1String("rowminimumheight"))); - if (node.hasAttribute(QLatin1String("columnminimumwidth"))) - setAttributeColumnMinimumWidth(node.attribute(QLatin1String("columnminimumwidth"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomLayoutItem *v = new DomLayoutItem(); - v->read(e); - m_item.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layout") : tagName.toLower()); if (hasAttributeClass()) - writer.writeAttribute(QLatin1String("class"), attributeClass()); + writer.writeAttribute(QStringLiteral("class"), attributeClass()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeStretch()) - writer.writeAttribute(QLatin1String("stretch"), attributeStretch()); + writer.writeAttribute(QStringLiteral("stretch"), attributeStretch()); if (hasAttributeRowStretch()) - writer.writeAttribute(QLatin1String("rowstretch"), attributeRowStretch()); + writer.writeAttribute(QStringLiteral("rowstretch"), attributeRowStretch()); if (hasAttributeColumnStretch()) - writer.writeAttribute(QLatin1String("columnstretch"), attributeColumnStretch()); + writer.writeAttribute(QStringLiteral("columnstretch"), attributeColumnStretch()); if (hasAttributeRowMinimumHeight()) - writer.writeAttribute(QLatin1String("rowminimumheight"), attributeRowMinimumHeight()); + writer.writeAttribute(QStringLiteral("rowminimumheight"), attributeRowMinimumHeight()); if (hasAttributeColumnMinimumWidth()) - writer.writeAttribute(QLatin1String("columnminimumwidth"), attributeColumnMinimumWidth()); + writer.writeAttribute(QStringLiteral("columnminimumwidth"), attributeColumnMinimumWidth()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } for (int i = 0; i < m_item.size(); ++i) { DomLayoutItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -3713,52 +2970,52 @@ void DomLayoutItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("row")) { + if (name == QStringLiteral("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("column")) { + if (name == QStringLiteral("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("rowspan")) { + if (name == QStringLiteral("rowspan")) { setAttributeRowSpan(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("colspan")) { + if (name == QStringLiteral("colspan")) { setAttributeColSpan(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("alignment")) { + if (name == QStringLiteral("alignment")) { setAttributeAlignment(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QLatin1String("layout")) { + if (tag == QStringLiteral("layout")) { DomLayout *v = new DomLayout(); v->read(reader); setElementLayout(v); continue; } - if (tag == QLatin1String("spacer")) { + if (tag == QStringLiteral("spacer")) { DomSpacer *v = new DomSpacer(); v->read(reader); setElementSpacer(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3774,90 +3031,44 @@ void DomLayoutItem::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLayoutItem::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("row"))) - setAttributeRow(node.attribute(QLatin1String("row")).toInt()); - if (node.hasAttribute(QLatin1String("column"))) - setAttributeColumn(node.attribute(QLatin1String("column")).toInt()); - if (node.hasAttribute(QLatin1String("rowspan"))) - setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt()); - if (node.hasAttribute(QLatin1String("colspan"))) - setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt()); - if (node.hasAttribute(QLatin1String("alignment"))) - setAttributeAlignment(node.attribute(QLatin1String("alignment"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - setElementWidget(v); - continue; - } - if (tag == QLatin1String("layout")) { - DomLayout *v = new DomLayout(); - v->read(e); - setElementLayout(v); - continue; - } - if (tag == QLatin1String("spacer")) { - DomSpacer *v = new DomSpacer(); - v->read(e); - setElementSpacer(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutitem") : tagName.toLower()); if (hasAttributeRow()) - writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow())); + writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow())); if (hasAttributeColumn()) - writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn())); + writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn())); if (hasAttributeRowSpan()) - writer.writeAttribute(QLatin1String("rowspan"), QString::number(attributeRowSpan())); + writer.writeAttribute(QStringLiteral("rowspan"), QString::number(attributeRowSpan())); if (hasAttributeColSpan()) - writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan())); + writer.writeAttribute(QStringLiteral("colspan"), QString::number(attributeColSpan())); if (hasAttributeAlignment()) - writer.writeAttribute(QLatin1String("alignment"), attributeAlignment()); + writer.writeAttribute(QStringLiteral("alignment"), attributeAlignment()); switch (kind()) { case Widget: { DomWidget* v = elementWidget(); if (v != 0) { - v->write(writer, QLatin1String("widget")); + v->write(writer, QStringLiteral("widget")); } break; } case Layout: { DomLayout* v = elementLayout(); if (v != 0) { - v->write(writer, QLatin1String("layout")); + v->write(writer, QStringLiteral("layout")); } break; } case Spacer: { DomSpacer* v = elementSpacer(); if (v != 0) { - v->write(writer, QLatin1String("spacer")); + v->write(writer, QStringLiteral("spacer")); } break; } @@ -3942,13 +3153,13 @@ void DomRow::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -3964,36 +3175,13 @@ void DomRow::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRow::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("row") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4037,13 +3225,13 @@ void DomColumn::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4059,36 +3247,13 @@ void DomColumn::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColumn::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("column") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4142,34 +3307,34 @@ void DomItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("row")) { + if (name == QStringLiteral("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QLatin1String("column")) { + if (name == QStringLiteral("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4185,57 +3350,23 @@ void DomItem::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomItem::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("row"))) - setAttributeRow(node.attribute(QLatin1String("row")).toInt()); - if (node.hasAttribute(QLatin1String("column"))) - setAttributeColumn(node.attribute(QLatin1String("column")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomItem *v = new DomItem(); - v->read(e); - m_item.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("item") : tagName.toLower()); if (hasAttributeRow()) - writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow())); + writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow())); if (hasAttributeColumn()) - writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn())); + writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn())); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_item.size(); ++i) { DomItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4339,106 +3470,106 @@ void DomWidget::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("class")) { + if (name == QStringLiteral("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("native")) { + if (name == QStringLiteral("native")) { setAttributeNative((attribute.value().toString() == QLatin1String("true") ? true : false)); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("class")) { + if (tag == QStringLiteral("class")) { m_class.append(reader.readElementText()); continue; } - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QLatin1String("script")) { + if (tag == QStringLiteral("script")) { DomScript *v = new DomScript(); v->read(reader); m_script.append(v); continue; } - if (tag == QLatin1String("widgetdata")) { + if (tag == QStringLiteral("widgetdata")) { DomWidgetData *v = new DomWidgetData(); v->read(reader); m_widgetData.append(v); continue; } - if (tag == QLatin1String("attribute")) { + if (tag == QStringLiteral("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QLatin1String("row")) { + if (tag == QStringLiteral("row")) { DomRow *v = new DomRow(); v->read(reader); m_row.append(v); continue; } - if (tag == QLatin1String("column")) { + if (tag == QStringLiteral("column")) { DomColumn *v = new DomColumn(); v->read(reader); m_column.append(v); continue; } - if (tag == QLatin1String("item")) { + if (tag == QStringLiteral("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); continue; } - if (tag == QLatin1String("layout")) { + if (tag == QStringLiteral("layout")) { DomLayout *v = new DomLayout(); v->read(reader); m_layout.append(v); continue; } - if (tag == QLatin1String("widget")) { + if (tag == QStringLiteral("widget")) { DomWidget *v = new DomWidget(); v->read(reader); m_widget.append(v); continue; } - if (tag == QLatin1String("action")) { + if (tag == QStringLiteral("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QLatin1String("actiongroup")) { + if (tag == QStringLiteral("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QLatin1String("addaction")) { + if (tag == QStringLiteral("addaction")) { DomActionRef *v = new DomActionRef(); v->read(reader); m_addAction.append(v); continue; } - if (tag == QLatin1String("zorder")) { + if (tag == QStringLiteral("zorder")) { m_zOrder.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4454,178 +3585,74 @@ void DomWidget::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomWidget::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("class"))) - setAttributeClass(node.attribute(QLatin1String("class"))); - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("native"))) - setAttributeNative((node.attribute(QLatin1String("native")) == QLatin1String("true") ? true : false)); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("class")) { - m_class.append(e.text()); - continue; - } - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - if (tag == QLatin1String("script")) { - DomScript *v = new DomScript(); - v->read(e); - m_script.append(v); - continue; - } - if (tag == QLatin1String("widgetdata")) { - DomWidgetData *v = new DomWidgetData(); - v->read(e); - m_widgetData.append(v); - continue; - } - if (tag == QLatin1String("attribute")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_attribute.append(v); - continue; - } - if (tag == QLatin1String("row")) { - DomRow *v = new DomRow(); - v->read(e); - m_row.append(v); - continue; - } - if (tag == QLatin1String("column")) { - DomColumn *v = new DomColumn(); - v->read(e); - m_column.append(v); - continue; - } - if (tag == QLatin1String("item")) { - DomItem *v = new DomItem(); - v->read(e); - m_item.append(v); - continue; - } - if (tag == QLatin1String("layout")) { - DomLayout *v = new DomLayout(); - v->read(e); - m_layout.append(v); - continue; - } - if (tag == QLatin1String("widget")) { - DomWidget *v = new DomWidget(); - v->read(e); - m_widget.append(v); - continue; - } - if (tag == QLatin1String("action")) { - DomAction *v = new DomAction(); - v->read(e); - m_action.append(v); - continue; - } - if (tag == QLatin1String("actiongroup")) { - DomActionGroup *v = new DomActionGroup(); - v->read(e); - m_actionGroup.append(v); - continue; - } - if (tag == QLatin1String("addaction")) { - DomActionRef *v = new DomActionRef(); - v->read(e); - m_addAction.append(v); - continue; - } - if (tag == QLatin1String("zorder")) { - m_zOrder.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widget") : tagName.toLower()); if (hasAttributeClass()) - writer.writeAttribute(QLatin1String("class"), attributeClass()); + writer.writeAttribute(QStringLiteral("class"), attributeClass()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeNative()) - writer.writeAttribute(QLatin1String("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false"))); + writer.writeAttribute(QStringLiteral("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false"))); for (int i = 0; i < m_class.size(); ++i) { QString v = m_class[i]; - writer.writeTextElement(QLatin1String("class"), v); + writer.writeTextElement(QStringLiteral("class"), v); } for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } for (int i = 0; i < m_script.size(); ++i) { DomScript* v = m_script[i]; - v->write(writer, QLatin1String("script")); + v->write(writer, QStringLiteral("script")); } for (int i = 0; i < m_widgetData.size(); ++i) { DomWidgetData* v = m_widgetData[i]; - v->write(writer, QLatin1String("widgetdata")); + v->write(writer, QStringLiteral("widgetdata")); } for (int i = 0; i < m_attribute.size(); ++i) { DomProperty* v = m_attribute[i]; - v->write(writer, QLatin1String("attribute")); + v->write(writer, QStringLiteral("attribute")); } for (int i = 0; i < m_row.size(); ++i) { DomRow* v = m_row[i]; - v->write(writer, QLatin1String("row")); + v->write(writer, QStringLiteral("row")); } for (int i = 0; i < m_column.size(); ++i) { DomColumn* v = m_column[i]; - v->write(writer, QLatin1String("column")); + v->write(writer, QStringLiteral("column")); } for (int i = 0; i < m_item.size(); ++i) { DomItem* v = m_item[i]; - v->write(writer, QLatin1String("item")); + v->write(writer, QStringLiteral("item")); } for (int i = 0; i < m_layout.size(); ++i) { DomLayout* v = m_layout[i]; - v->write(writer, QLatin1String("layout")); + v->write(writer, QStringLiteral("layout")); } for (int i = 0; i < m_widget.size(); ++i) { DomWidget* v = m_widget[i]; - v->write(writer, QLatin1String("widget")); + v->write(writer, QStringLiteral("widget")); } for (int i = 0; i < m_action.size(); ++i) { DomAction* v = m_action[i]; - v->write(writer, QLatin1String("action")); + v->write(writer, QStringLiteral("action")); } for (int i = 0; i < m_actionGroup.size(); ++i) { DomActionGroup* v = m_actionGroup[i]; - v->write(writer, QLatin1String("actiongroup")); + v->write(writer, QStringLiteral("actiongroup")); } for (int i = 0; i < m_addAction.size(); ++i) { DomActionRef* v = m_addAction[i]; - v->write(writer, QLatin1String("addaction")); + v->write(writer, QStringLiteral("addaction")); } for (int i = 0; i < m_zOrder.size(); ++i) { QString v = m_zOrder[i]; - writer.writeTextElement(QLatin1String("zorder"), v); + writer.writeTextElement(QStringLiteral("zorder"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4747,24 +3774,24 @@ void DomSpacer::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4780,42 +3807,16 @@ void DomSpacer::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSpacer::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("spacer") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -4863,30 +3864,30 @@ void DomColor::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("alpha")) { + if (name == QStringLiteral("alpha")) { setAttributeAlpha(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("red")) { + if (tag == QStringLiteral("red")) { setElementRed(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("green")) { + if (tag == QStringLiteral("green")) { setElementGreen(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("blue")) { + if (tag == QStringLiteral("blue")) { setElementBlue(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -4902,55 +3903,23 @@ void DomColor::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColor::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("alpha"))) - setAttributeAlpha(node.attribute(QLatin1String("alpha")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("red")) { - setElementRed(e.text().toInt()); - continue; - } - if (tag == QLatin1String("green")) { - setElementGreen(e.text().toInt()); - continue; - } - if (tag == QLatin1String("blue")) { - setElementBlue(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("color") : tagName.toLower()); if (hasAttributeAlpha()) - writer.writeAttribute(QLatin1String("alpha"), QString::number(attributeAlpha())); + writer.writeAttribute(QStringLiteral("alpha"), QString::number(attributeAlpha())); if (m_children & Red) { - writer.writeTextElement(QLatin1String("red"), QString::number(m_red)); + writer.writeTextElement(QStringLiteral("red"), QString::number(m_red)); } if (m_children & Green) { - writer.writeTextElement(QLatin1String("green"), QString::number(m_green)); + writer.writeTextElement(QStringLiteral("green"), QString::number(m_green)); } if (m_children & Blue) { - writer.writeTextElement(QLatin1String("blue"), QString::number(m_blue)); + writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue)); } if (!m_text.isEmpty()) @@ -5024,24 +3993,24 @@ void DomGradientStop::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("position")) { + if (name == QStringLiteral("position")) { setAttributePosition(attribute.value().toString().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5057,41 +4026,15 @@ void DomGradientStop::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomGradientStop::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("position"))) - setAttributePosition(node.attribute(QLatin1String("position")).toDouble()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradientstop") : tagName.toLower()); if (hasAttributePosition()) - writer.writeAttribute(QLatin1String("position"), QString::number(attributePosition(), 'f', 15)); + writer.writeAttribute(QStringLiteral("position"), QString::number(attributePosition(), 'f', 15)); if (m_children & Color) { - m_color->write(writer, QLatin1String("color")); + m_color->write(writer, QStringLiteral("color")); } if (!m_text.isEmpty()) @@ -5196,72 +4139,72 @@ void DomGradient::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("startx")) { + if (name == QStringLiteral("startx")) { setAttributeStartX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("starty")) { + if (name == QStringLiteral("starty")) { setAttributeStartY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("endx")) { + if (name == QStringLiteral("endx")) { setAttributeEndX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("endy")) { + if (name == QStringLiteral("endy")) { setAttributeEndY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("centralx")) { + if (name == QStringLiteral("centralx")) { setAttributeCentralX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("centraly")) { + if (name == QStringLiteral("centraly")) { setAttributeCentralY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("focalx")) { + if (name == QStringLiteral("focalx")) { setAttributeFocalX(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("focaly")) { + if (name == QStringLiteral("focaly")) { setAttributeFocalY(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("radius")) { + if (name == QStringLiteral("radius")) { setAttributeRadius(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("angle")) { + if (name == QStringLiteral("angle")) { setAttributeAngle(attribute.value().toString().toDouble()); continue; } - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QLatin1String("spread")) { + if (name == QStringLiteral("spread")) { setAttributeSpread(attribute.value().toString()); continue; } - if (name == QLatin1String("coordinatemode")) { + if (name == QStringLiteral("coordinatemode")) { setAttributeCoordinateMode(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("gradientstop")) { + if (tag == QStringLiteral("gradientstop")) { DomGradientStop *v = new DomGradientStop(); v->read(reader); m_gradientStop.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5277,102 +4220,52 @@ void DomGradient::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomGradient::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("startx"))) - setAttributeStartX(node.attribute(QLatin1String("startx")).toDouble()); - if (node.hasAttribute(QLatin1String("starty"))) - setAttributeStartY(node.attribute(QLatin1String("starty")).toDouble()); - if (node.hasAttribute(QLatin1String("endx"))) - setAttributeEndX(node.attribute(QLatin1String("endx")).toDouble()); - if (node.hasAttribute(QLatin1String("endy"))) - setAttributeEndY(node.attribute(QLatin1String("endy")).toDouble()); - if (node.hasAttribute(QLatin1String("centralx"))) - setAttributeCentralX(node.attribute(QLatin1String("centralx")).toDouble()); - if (node.hasAttribute(QLatin1String("centraly"))) - setAttributeCentralY(node.attribute(QLatin1String("centraly")).toDouble()); - if (node.hasAttribute(QLatin1String("focalx"))) - setAttributeFocalX(node.attribute(QLatin1String("focalx")).toDouble()); - if (node.hasAttribute(QLatin1String("focaly"))) - setAttributeFocalY(node.attribute(QLatin1String("focaly")).toDouble()); - if (node.hasAttribute(QLatin1String("radius"))) - setAttributeRadius(node.attribute(QLatin1String("radius")).toDouble()); - if (node.hasAttribute(QLatin1String("angle"))) - setAttributeAngle(node.attribute(QLatin1String("angle")).toDouble()); - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - if (node.hasAttribute(QLatin1String("spread"))) - setAttributeSpread(node.attribute(QLatin1String("spread"))); - if (node.hasAttribute(QLatin1String("coordinatemode"))) - setAttributeCoordinateMode(node.attribute(QLatin1String("coordinatemode"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("gradientstop")) { - DomGradientStop *v = new DomGradientStop(); - v->read(e); - m_gradientStop.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradient") : tagName.toLower()); if (hasAttributeStartX()) - writer.writeAttribute(QLatin1String("startx"), QString::number(attributeStartX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("startx"), QString::number(attributeStartX(), 'f', 15)); if (hasAttributeStartY()) - writer.writeAttribute(QLatin1String("starty"), QString::number(attributeStartY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("starty"), QString::number(attributeStartY(), 'f', 15)); if (hasAttributeEndX()) - writer.writeAttribute(QLatin1String("endx"), QString::number(attributeEndX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("endx"), QString::number(attributeEndX(), 'f', 15)); if (hasAttributeEndY()) - writer.writeAttribute(QLatin1String("endy"), QString::number(attributeEndY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("endy"), QString::number(attributeEndY(), 'f', 15)); if (hasAttributeCentralX()) - writer.writeAttribute(QLatin1String("centralx"), QString::number(attributeCentralX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("centralx"), QString::number(attributeCentralX(), 'f', 15)); if (hasAttributeCentralY()) - writer.writeAttribute(QLatin1String("centraly"), QString::number(attributeCentralY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("centraly"), QString::number(attributeCentralY(), 'f', 15)); if (hasAttributeFocalX()) - writer.writeAttribute(QLatin1String("focalx"), QString::number(attributeFocalX(), 'f', 15)); + writer.writeAttribute(QStringLiteral("focalx"), QString::number(attributeFocalX(), 'f', 15)); if (hasAttributeFocalY()) - writer.writeAttribute(QLatin1String("focaly"), QString::number(attributeFocalY(), 'f', 15)); + writer.writeAttribute(QStringLiteral("focaly"), QString::number(attributeFocalY(), 'f', 15)); if (hasAttributeRadius()) - writer.writeAttribute(QLatin1String("radius"), QString::number(attributeRadius(), 'f', 15)); + writer.writeAttribute(QStringLiteral("radius"), QString::number(attributeRadius(), 'f', 15)); if (hasAttributeAngle()) - writer.writeAttribute(QLatin1String("angle"), QString::number(attributeAngle(), 'f', 15)); + writer.writeAttribute(QStringLiteral("angle"), QString::number(attributeAngle(), 'f', 15)); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (hasAttributeSpread()) - writer.writeAttribute(QLatin1String("spread"), attributeSpread()); + writer.writeAttribute(QStringLiteral("spread"), attributeSpread()); if (hasAttributeCoordinateMode()) - writer.writeAttribute(QLatin1String("coordinatemode"), attributeCoordinateMode()); + writer.writeAttribute(QStringLiteral("coordinatemode"), attributeCoordinateMode()); for (int i = 0; i < m_gradientStop.size(); ++i) { DomGradientStop* v = m_gradientStop[i]; - v->write(writer, QLatin1String("gradientstop")); + v->write(writer, QStringLiteral("gradientstop")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -5426,36 +4319,36 @@ void DomBrush::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("brushstyle")) { + if (name == QStringLiteral("brushstyle")) { setAttributeBrushStyle(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QLatin1String("texture")) { + if (tag == QStringLiteral("texture")) { DomProperty *v = new DomProperty(); v->read(reader); setElementTexture(v); continue; } - if (tag == QLatin1String("gradient")) { + if (tag == QStringLiteral("gradient")) { DomGradient *v = new DomGradient(); v->read(reader); setElementGradient(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5471,70 +4364,32 @@ void DomBrush::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomBrush::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("brushstyle"))) - setAttributeBrushStyle(node.attribute(QLatin1String("brushstyle"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - if (tag == QLatin1String("texture")) { - DomProperty *v = new DomProperty(); - v->read(e); - setElementTexture(v); - continue; - } - if (tag == QLatin1String("gradient")) { - DomGradient *v = new DomGradient(); - v->read(e); - setElementGradient(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("brush") : tagName.toLower()); if (hasAttributeBrushStyle()) - writer.writeAttribute(QLatin1String("brushstyle"), attributeBrushStyle()); + writer.writeAttribute(QStringLiteral("brushstyle"), attributeBrushStyle()); switch (kind()) { case Color: { DomColor* v = elementColor(); if (v != 0) { - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } break; } case Texture: { DomProperty* v = elementTexture(); if (v != 0) { - v->write(writer, QLatin1String("texture")); + v->write(writer, QStringLiteral("texture")); } break; } case Gradient: { DomGradient* v = elementGradient(); if (v != 0) { - v->write(writer, QLatin1String("gradient")); + v->write(writer, QStringLiteral("gradient")); } break; } @@ -5619,24 +4474,24 @@ void DomColorRole::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("role")) { + if (name == QStringLiteral("role")) { setAttributeRole(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("brush")) { + if (tag == QStringLiteral("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5652,41 +4507,15 @@ void DomColorRole::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColorRole::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("role"))) - setAttributeRole(node.attribute(QLatin1String("role"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("brush")) { - DomBrush *v = new DomBrush(); - v->read(e); - setElementBrush(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorrole") : tagName.toLower()); if (hasAttributeRole()) - writer.writeAttribute(QLatin1String("role"), attributeRole()); + writer.writeAttribute(QStringLiteral("role"), attributeRole()); if (m_children & Brush) { - m_brush->write(writer, QLatin1String("brush")); + m_brush->write(writer, QStringLiteral("brush")); } if (!m_text.isEmpty()) @@ -5751,19 +4580,19 @@ void DomColorGroup::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("colorrole")) { + if (tag == QStringLiteral("colorrole")) { DomColorRole *v = new DomColorRole(); v->read(reader); m_colorRole.append(v); continue; } - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); m_color.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -5779,46 +4608,17 @@ void DomColorGroup::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomColorGroup::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("colorrole")) { - DomColorRole *v = new DomColorRole(); - v->read(e); - m_colorRole.append(v); - continue; - } - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - m_color.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorgroup") : tagName.toLower()); for (int i = 0; i < m_colorRole.size(); ++i) { DomColorRole* v = m_colorRole[i]; - v->write(writer, QLatin1String("colorrole")); + v->write(writer, QStringLiteral("colorrole")); } for (int i = 0; i < m_color.size(); ++i) { DomColor* v = m_color[i]; - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -5876,89 +4676,54 @@ void DomPalette::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("active")) { + if (tag == QStringLiteral("active")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementActive(v); continue; } - if (tag == QLatin1String("inactive")) { + if (tag == QStringLiteral("inactive")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementInactive(v); continue; } - if (tag == QLatin1String("disabled")) { + if (tag == QStringLiteral("disabled")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementDisabled(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : finished = true; break; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -#ifdef QUILOADER_QDOM_READ -void DomPalette::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("active")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementActive(v); - continue; - } - if (tag == QLatin1String("inactive")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementInactive(v); - continue; - } - if (tag == QLatin1String("disabled")) { - DomColorGroup *v = new DomColorGroup(); - v->read(e); - setElementDisabled(v); - continue; - } + case QXmlStreamReader::Characters : + if (!reader.isWhitespace()) + m_text.append(reader.text().toString()); + break; + default : + break; + } } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } } -#endif void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("palette") : tagName.toLower()); if (m_children & Active) { - m_active->write(writer, QLatin1String("active")); + m_active->write(writer, QStringLiteral("active")); } if (m_children & Inactive) { - m_inactive->write(writer, QLatin1String("inactive")); + m_inactive->write(writer, QStringLiteral("inactive")); } if (m_children & Disabled) { - m_disabled->write(writer, QLatin1String("disabled")); + m_disabled->write(writer, QStringLiteral("disabled")); } if (!m_text.isEmpty()) @@ -6075,47 +4840,47 @@ void DomFont::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("family")) { + if (tag == QStringLiteral("family")) { setElementFamily(reader.readElementText()); continue; } - if (tag == QLatin1String("pointsize")) { + if (tag == QStringLiteral("pointsize")) { setElementPointSize(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("weight")) { + if (tag == QStringLiteral("weight")) { setElementWeight(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("italic")) { + if (tag == QStringLiteral("italic")) { setElementItalic((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("bold")) { + if (tag == QStringLiteral("bold")) { setElementBold((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("underline")) { + if (tag == QStringLiteral("underline")) { setElementUnderline((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("strikeout")) { + if (tag == QStringLiteral("strikeout")) { setElementStrikeOut((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("antialiasing")) { + if (tag == QStringLiteral("antialiasing")) { setElementAntialiasing((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - if (tag == QLatin1String("stylestrategy")) { + if (tag == QStringLiteral("stylestrategy")) { setElementStyleStrategy(reader.readElementText()); continue; } - if (tag == QLatin1String("kerning")) { + if (tag == QStringLiteral("kerning")) { setElementKerning((reader.readElementText() == QLatin1String("true") ? true : false)); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6131,105 +4896,48 @@ void DomFont::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomFont::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("family")) { - setElementFamily(e.text()); - continue; - } - if (tag == QLatin1String("pointsize")) { - setElementPointSize(e.text().toInt()); - continue; - } - if (tag == QLatin1String("weight")) { - setElementWeight(e.text().toInt()); - continue; - } - if (tag == QLatin1String("italic")) { - setElementItalic((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("bold")) { - setElementBold((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("underline")) { - setElementUnderline((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("strikeout")) { - setElementStrikeOut((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("antialiasing")) { - setElementAntialiasing((e.text() == QLatin1String("true") ? true : false)); - continue; - } - if (tag == QLatin1String("stylestrategy")) { - setElementStyleStrategy(e.text()); - continue; - } - if (tag == QLatin1String("kerning")) { - setElementKerning((e.text() == QLatin1String("true") ? true : false)); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("font") : tagName.toLower()); if (m_children & Family) { - writer.writeTextElement(QLatin1String("family"), m_family); + writer.writeTextElement(QStringLiteral("family"), m_family); } if (m_children & PointSize) { - writer.writeTextElement(QLatin1String("pointsize"), QString::number(m_pointSize)); + writer.writeTextElement(QStringLiteral("pointsize"), QString::number(m_pointSize)); } if (m_children & Weight) { - writer.writeTextElement(QLatin1String("weight"), QString::number(m_weight)); + writer.writeTextElement(QStringLiteral("weight"), QString::number(m_weight)); } if (m_children & Italic) { - writer.writeTextElement(QLatin1String("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Bold) { - writer.writeTextElement(QLatin1String("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Underline) { - writer.writeTextElement(QLatin1String("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & StrikeOut) { - writer.writeTextElement(QLatin1String("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & Antialiasing) { - writer.writeTextElement(QLatin1String("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false"))); } if (m_children & StyleStrategy) { - writer.writeTextElement(QLatin1String("stylestrategy"), m_styleStrategy); + writer.writeTextElement(QStringLiteral("stylestrategy"), m_styleStrategy); } if (m_children & Kerning) { - writer.writeTextElement(QLatin1String("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); + writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); } if (!m_text.isEmpty()) @@ -6386,7 +5094,7 @@ void DomPoint::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6402,31 +5110,6 @@ void DomPoint::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPoint::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("point") : tagName.toLower()); @@ -6509,15 +5192,15 @@ void DomRect::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6533,39 +5216,6 @@ void DomRect::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRect::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rect") : tagName.toLower()); @@ -6579,11 +5229,11 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const } if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); } if (!m_text.isEmpty()) @@ -6664,22 +5314,22 @@ void DomLocale::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QLatin1String("country")) { + if (name == QStringLiteral("country")) { setAttributeCountry(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6695,37 +5345,15 @@ void DomLocale::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomLocale::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - if (node.hasAttribute(QLatin1String("country"))) - setAttributeCountry(node.attribute(QLatin1String("country"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("locale") : tagName.toLower()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (hasAttributeCountry()) - writer.writeAttribute(QLatin1String("country"), attributeCountry()); + writer.writeAttribute(QStringLiteral("country"), attributeCountry()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -6769,38 +5397,38 @@ void DomSizePolicy::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("hsizetype")) { + if (name == QStringLiteral("hsizetype")) { setAttributeHSizeType(attribute.value().toString()); continue; } - if (name == QLatin1String("vsizetype")) { + if (name == QStringLiteral("vsizetype")) { setAttributeVSizeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hsizetype")) { + if (tag == QStringLiteral("hsizetype")) { setElementHSizeType(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("vsizetype")) { + if (tag == QStringLiteral("vsizetype")) { setElementVSizeType(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("horstretch")) { + if (tag == QStringLiteral("horstretch")) { setElementHorStretch(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("verstretch")) { + if (tag == QStringLiteral("verstretch")) { setElementVerStretch(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6816,68 +5444,30 @@ void DomSizePolicy::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSizePolicy::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("hsizetype"))) - setAttributeHSizeType(node.attribute(QLatin1String("hsizetype"))); - if (node.hasAttribute(QLatin1String("vsizetype"))) - setAttributeVSizeType(node.attribute(QLatin1String("vsizetype"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hsizetype")) { - setElementHSizeType(e.text().toInt()); - continue; - } - if (tag == QLatin1String("vsizetype")) { - setElementVSizeType(e.text().toInt()); - continue; - } - if (tag == QLatin1String("horstretch")) { - setElementHorStretch(e.text().toInt()); - continue; - } - if (tag == QLatin1String("verstretch")) { - setElementVerStretch(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicy") : tagName.toLower()); if (hasAttributeHSizeType()) - writer.writeAttribute(QLatin1String("hsizetype"), attributeHSizeType()); + writer.writeAttribute(QStringLiteral("hsizetype"), attributeHSizeType()); if (hasAttributeVSizeType()) - writer.writeAttribute(QLatin1String("vsizetype"), attributeVSizeType()); + writer.writeAttribute(QStringLiteral("vsizetype"), attributeVSizeType()); if (m_children & HSizeType) { - writer.writeTextElement(QLatin1String("hsizetype"), QString::number(m_hSizeType)); + writer.writeTextElement(QStringLiteral("hsizetype"), QString::number(m_hSizeType)); } if (m_children & VSizeType) { - writer.writeTextElement(QLatin1String("vsizetype"), QString::number(m_vSizeType)); + writer.writeTextElement(QStringLiteral("vsizetype"), QString::number(m_vSizeType)); } if (m_children & HorStretch) { - writer.writeTextElement(QLatin1String("horstretch"), QString::number(m_horStretch)); + writer.writeTextElement(QStringLiteral("horstretch"), QString::number(m_horStretch)); } if (m_children & VerStretch) { - writer.writeTextElement(QLatin1String("verstretch"), QString::number(m_verStretch)); + writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch)); } if (!m_text.isEmpty()) @@ -6960,15 +5550,15 @@ void DomSize::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -6984,41 +5574,16 @@ void DomSize::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSize::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("size") : tagName.toLower()); if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); } if (!m_text.isEmpty()) @@ -7081,19 +5646,19 @@ void DomDate::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("year")) { + if (tag == QStringLiteral("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("month")) { + if (tag == QStringLiteral("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("day")) { + if (tag == QStringLiteral("day")) { setElementDay(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7109,49 +5674,20 @@ void DomDate::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDate::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("year")) { - setElementYear(e.text().toInt()); - continue; - } - if (tag == QLatin1String("month")) { - setElementMonth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("day")) { - setElementDay(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("date") : tagName.toLower()); if (m_children & Year) { - writer.writeTextElement(QLatin1String("year"), QString::number(m_year)); + writer.writeTextElement(QStringLiteral("year"), QString::number(m_year)); } if (m_children & Month) { - writer.writeTextElement(QLatin1String("month"), QString::number(m_month)); + writer.writeTextElement(QStringLiteral("month"), QString::number(m_month)); } if (m_children & Day) { - writer.writeTextElement(QLatin1String("day"), QString::number(m_day)); + writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); } if (!m_text.isEmpty()) @@ -7225,19 +5761,19 @@ void DomTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hour")) { + if (tag == QStringLiteral("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("minute")) { + if (tag == QStringLiteral("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("second")) { + if (tag == QStringLiteral("second")) { setElementSecond(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7253,49 +5789,20 @@ void DomTime::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomTime::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hour")) { - setElementHour(e.text().toInt()); - continue; - } - if (tag == QLatin1String("minute")) { - setElementMinute(e.text().toInt()); - continue; - } - if (tag == QLatin1String("second")) { - setElementSecond(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("time") : tagName.toLower()); if (m_children & Hour) { - writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour)); + writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour)); } if (m_children & Minute) { - writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute)); + writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute)); } if (m_children & Second) { - writer.writeTextElement(QLatin1String("second"), QString::number(m_second)); + writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); } if (!m_text.isEmpty()) @@ -7375,31 +5882,31 @@ void DomDateTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hour")) { + if (tag == QStringLiteral("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("minute")) { + if (tag == QStringLiteral("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("second")) { + if (tag == QStringLiteral("second")) { setElementSecond(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("year")) { + if (tag == QStringLiteral("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("month")) { + if (tag == QStringLiteral("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("day")) { + if (tag == QStringLiteral("day")) { setElementDay(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7415,73 +5922,32 @@ void DomDateTime::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDateTime::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hour")) { - setElementHour(e.text().toInt()); - continue; - } - if (tag == QLatin1String("minute")) { - setElementMinute(e.text().toInt()); - continue; - } - if (tag == QLatin1String("second")) { - setElementSecond(e.text().toInt()); - continue; - } - if (tag == QLatin1String("year")) { - setElementYear(e.text().toInt()); - continue; - } - if (tag == QLatin1String("month")) { - setElementMonth(e.text().toInt()); - continue; - } - if (tag == QLatin1String("day")) { - setElementDay(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("datetime") : tagName.toLower()); if (m_children & Hour) { - writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour)); + writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour)); } if (m_children & Minute) { - writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute)); + writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute)); } if (m_children & Second) { - writer.writeTextElement(QLatin1String("second"), QString::number(m_second)); + writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); } if (m_children & Year) { - writer.writeTextElement(QLatin1String("year"), QString::number(m_year)); + writer.writeTextElement(QStringLiteral("year"), QString::number(m_year)); } if (m_children & Month) { - writer.writeTextElement(QLatin1String("month"), QString::number(m_month)); + writer.writeTextElement(QStringLiteral("month"), QString::number(m_month)); } if (m_children & Day) { - writer.writeTextElement(QLatin1String("day"), QString::number(m_day)); + writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); } if (!m_text.isEmpty()) @@ -7584,11 +6050,11 @@ void DomStringList::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { m_string.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7604,34 +6070,13 @@ void DomStringList::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomStringList::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("string")) { - m_string.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringlist") : tagName.toLower()); for (int i = 0; i < m_string.size(); ++i) { QString v = m_string[i]; - writer.writeTextElement(QLatin1String("string"), v); + writer.writeTextElement(QStringLiteral("string"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -7649,7 +6094,7 @@ void DomResourcePixmap::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_resource = false; m_has_attr_alias = false; } @@ -7662,7 +6107,7 @@ DomResourcePixmap::DomResourcePixmap() m_children = 0; m_has_attr_resource = false; m_has_attr_alias = false; - m_text = QLatin1String(""); + m_text.clear(); } DomResourcePixmap::~DomResourcePixmap() @@ -7674,22 +6119,22 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("resource")) { + if (name == QStringLiteral("resource")) { setAttributeResource(attribute.value().toString()); continue; } - if (name == QLatin1String("alias")) { + if (name == QStringLiteral("alias")) { setAttributeAlias(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7705,37 +6150,15 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResourcePixmap::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("resource"))) - setAttributeResource(node.attribute(QLatin1String("resource"))); - if (node.hasAttribute(QLatin1String("alias"))) - setAttributeAlias(node.attribute(QLatin1String("alias"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourcepixmap") : tagName.toLower()); if (hasAttributeResource()) - writer.writeAttribute(QLatin1String("resource"), attributeResource()); + writer.writeAttribute(QStringLiteral("resource"), attributeResource()); if (hasAttributeAlias()) - writer.writeAttribute(QLatin1String("alias"), attributeAlias()); + writer.writeAttribute(QStringLiteral("alias"), attributeAlias()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -7755,7 +6178,7 @@ void DomResourceIcon::clear(bool clear_all) delete m_selectedOn; if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_theme = false; m_has_attr_resource = false; } @@ -7776,7 +6199,7 @@ DomResourceIcon::DomResourceIcon() m_children = 0; m_has_attr_theme = false; m_has_attr_resource = false; - m_text = QLatin1String(""); + m_text.clear(); m_normalOff = 0; m_normalOn = 0; m_disabledOff = 0; @@ -7804,70 +6227,70 @@ void DomResourceIcon::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("theme")) { + if (name == QStringLiteral("theme")) { setAttributeTheme(attribute.value().toString()); continue; } - if (name == QLatin1String("resource")) { + if (name == QStringLiteral("resource")) { setAttributeResource(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("normaloff")) { + if (tag == QStringLiteral("normaloff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOff(v); continue; } - if (tag == QLatin1String("normalon")) { + if (tag == QStringLiteral("normalon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOn(v); continue; } - if (tag == QLatin1String("disabledoff")) { + if (tag == QStringLiteral("disabledoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOff(v); continue; } - if (tag == QLatin1String("disabledon")) { + if (tag == QStringLiteral("disabledon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOn(v); continue; } - if (tag == QLatin1String("activeoff")) { + if (tag == QStringLiteral("activeoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOff(v); continue; } - if (tag == QLatin1String("activeon")) { + if (tag == QStringLiteral("activeon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOn(v); continue; } - if (tag == QLatin1String("selectedoff")) { + if (tag == QStringLiteral("selectedoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOff(v); continue; } - if (tag == QLatin1String("selectedon")) { + if (tag == QStringLiteral("selectedon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOn(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -7883,116 +6306,46 @@ void DomResourceIcon::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomResourceIcon::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("theme"))) - setAttributeTheme(node.attribute(QLatin1String("theme"))); - if (node.hasAttribute(QLatin1String("resource"))) - setAttributeResource(node.attribute(QLatin1String("resource"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("normaloff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementNormalOff(v); - continue; - } - if (tag == QLatin1String("normalon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementNormalOn(v); - continue; - } - if (tag == QLatin1String("disabledoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementDisabledOff(v); - continue; - } - if (tag == QLatin1String("disabledon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementDisabledOn(v); - continue; - } - if (tag == QLatin1String("activeoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementActiveOff(v); - continue; - } - if (tag == QLatin1String("activeon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementActiveOn(v); - continue; - } - if (tag == QLatin1String("selectedoff")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementSelectedOff(v); - continue; - } - if (tag == QLatin1String("selectedon")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementSelectedOn(v); - continue; - } - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower()); if (hasAttributeTheme()) - writer.writeAttribute(QLatin1String("theme"), attributeTheme()); + writer.writeAttribute(QStringLiteral("theme"), attributeTheme()); if (hasAttributeResource()) - writer.writeAttribute(QLatin1String("resource"), attributeResource()); + writer.writeAttribute(QStringLiteral("resource"), attributeResource()); if (m_children & NormalOff) { - m_normalOff->write(writer, QLatin1String("normaloff")); + m_normalOff->write(writer, QStringLiteral("normaloff")); } if (m_children & NormalOn) { - m_normalOn->write(writer, QLatin1String("normalon")); + m_normalOn->write(writer, QStringLiteral("normalon")); } if (m_children & DisabledOff) { - m_disabledOff->write(writer, QLatin1String("disabledoff")); + m_disabledOff->write(writer, QStringLiteral("disabledoff")); } if (m_children & DisabledOn) { - m_disabledOn->write(writer, QLatin1String("disabledon")); + m_disabledOn->write(writer, QStringLiteral("disabledon")); } if (m_children & ActiveOff) { - m_activeOff->write(writer, QLatin1String("activeoff")); + m_activeOff->write(writer, QStringLiteral("activeoff")); } if (m_children & ActiveOn) { - m_activeOn->write(writer, QLatin1String("activeon")); + m_activeOn->write(writer, QStringLiteral("activeon")); } if (m_children & SelectedOff) { - m_selectedOff->write(writer, QLatin1String("selectedoff")); + m_selectedOff->write(writer, QStringLiteral("selectedoff")); } if (m_children & SelectedOn) { - m_selectedOn->write(writer, QLatin1String("selectedon")); + m_selectedOn->write(writer, QStringLiteral("selectedon")); } if (!m_text.isEmpty()) @@ -8181,7 +6534,7 @@ void DomString::clear(bool clear_all) { if (clear_all) { - m_text = QLatin1String(""); + m_text.clear(); m_has_attr_notr = false; m_has_attr_comment = false; m_has_attr_extraComment = false; @@ -8196,7 +6549,7 @@ DomString::DomString() m_has_attr_notr = false; m_has_attr_comment = false; m_has_attr_extraComment = false; - m_text = QLatin1String(""); + m_text.clear(); } DomString::~DomString() @@ -8208,26 +6561,26 @@ void DomString::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("notr")) { + if (name == QStringLiteral("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - if (name == QLatin1String("comment")) { + if (name == QStringLiteral("comment")) { setAttributeComment(attribute.value().toString()); continue; } - if (name == QLatin1String("extracomment")) { + if (name == QStringLiteral("extracomment")) { setAttributeExtraComment(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8243,42 +6596,18 @@ void DomString::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomString::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("notr"))) - setAttributeNotr(node.attribute(QLatin1String("notr"))); - if (node.hasAttribute(QLatin1String("comment"))) - setAttributeComment(node.attribute(QLatin1String("comment"))); - if (node.hasAttribute(QLatin1String("extracomment"))) - setAttributeExtraComment(node.attribute(QLatin1String("extracomment"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text = QLatin1String(""); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("string") : tagName.toLower()); if (hasAttributeNotr()) - writer.writeAttribute(QLatin1String("notr"), attributeNotr()); + writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); if (hasAttributeComment()) - writer.writeAttribute(QLatin1String("comment"), attributeComment()); + writer.writeAttribute(QStringLiteral("comment"), attributeComment()); if (hasAttributeExtraComment()) - writer.writeAttribute(QLatin1String("extracomment"), attributeExtraComment()); + writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -8324,7 +6653,7 @@ void DomPointF::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8340,31 +6669,6 @@ void DomPointF::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPointF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toDouble()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toDouble()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("pointf") : tagName.toLower()); @@ -8447,15 +6751,15 @@ void DomRectF::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8471,39 +6775,6 @@ void DomRectF::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomRectF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toDouble()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toDouble()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rectf") : tagName.toLower()); @@ -8517,11 +6788,11 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const } if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); } if (!m_text.isEmpty()) @@ -8604,15 +6875,15 @@ void DomSizeF::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("width")) { + if (tag == QStringLiteral("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("height")) { + if (tag == QStringLiteral("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8622,47 +6893,22 @@ void DomSizeF::read(QXmlStreamReader &reader) if (!reader.isWhitespace()) m_text.append(reader.text().toString()); break; - default : - break; - } - } -} - -#ifdef QUILOADER_QDOM_READ -void DomSizeF::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("width")) { - setElementWidth(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("height")) { - setElementHeight(e.text().toDouble()); - continue; - } + default : + break; + } } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } } -#endif void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizef") : tagName.toLower()); if (m_children & Width) { - writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15)); + writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15)); } if (m_children & Height) { - writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15)); + writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); } if (!m_text.isEmpty()) @@ -8721,11 +6967,11 @@ void DomChar::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("unicode")) { + if (tag == QStringLiteral("unicode")) { setElementUnicode(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8741,33 +6987,12 @@ void DomChar::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomChar::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("unicode")) { - setElementUnicode(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("char") : tagName.toLower()); if (m_children & Unicode) { - writer.writeTextElement(QLatin1String("unicode"), QString::number(m_unicode)); + writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode)); } if (!m_text.isEmpty()) @@ -8817,13 +7042,13 @@ void DomUrl::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -8839,35 +7064,12 @@ void DomUrl::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomUrl::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("string")) { - DomString *v = new DomString(); - v->read(e); - setElementString(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("url") : tagName.toLower()); if (m_children & String) { - m_string->write(writer, QLatin1String("string")); + m_string->write(writer, QStringLiteral("string")); } if (!m_text.isEmpty()) @@ -9028,196 +7230,196 @@ void DomProperty::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("stdset")) { + if (name == QStringLiteral("stdset")) { setAttributeStdset(attribute.value().toString().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("bool")) { + if (tag == QStringLiteral("bool")) { setElementBool(reader.readElementText()); continue; } - if (tag == QLatin1String("color")) { + if (tag == QStringLiteral("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QLatin1String("cstring")) { + if (tag == QStringLiteral("cstring")) { setElementCstring(reader.readElementText()); continue; } - if (tag == QLatin1String("cursor")) { + if (tag == QStringLiteral("cursor")) { setElementCursor(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("cursorshape")) { + if (tag == QStringLiteral("cursorshape")) { setElementCursorShape(reader.readElementText()); continue; } - if (tag == QLatin1String("enum")) { + if (tag == QStringLiteral("enum")) { setElementEnum(reader.readElementText()); continue; } - if (tag == QLatin1String("font")) { + if (tag == QStringLiteral("font")) { DomFont *v = new DomFont(); v->read(reader); setElementFont(v); continue; } - if (tag == QLatin1String("iconset")) { + if (tag == QStringLiteral("iconset")) { DomResourceIcon *v = new DomResourceIcon(); v->read(reader); setElementIconSet(v); continue; } - if (tag == QLatin1String("pixmap")) { + if (tag == QStringLiteral("pixmap")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementPixmap(v); continue; } - if (tag == QLatin1String("palette")) { + if (tag == QStringLiteral("palette")) { DomPalette *v = new DomPalette(); v->read(reader); setElementPalette(v); continue; } - if (tag == QLatin1String("point")) { + if (tag == QStringLiteral("point")) { DomPoint *v = new DomPoint(); v->read(reader); setElementPoint(v); continue; } - if (tag == QLatin1String("rect")) { + if (tag == QStringLiteral("rect")) { DomRect *v = new DomRect(); v->read(reader); setElementRect(v); continue; } - if (tag == QLatin1String("set")) { + if (tag == QStringLiteral("set")) { setElementSet(reader.readElementText()); continue; } - if (tag == QLatin1String("locale")) { + if (tag == QStringLiteral("locale")) { DomLocale *v = new DomLocale(); v->read(reader); setElementLocale(v); continue; } - if (tag == QLatin1String("sizepolicy")) { + if (tag == QStringLiteral("sizepolicy")) { DomSizePolicy *v = new DomSizePolicy(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QLatin1String("size")) { + if (tag == QStringLiteral("size")) { DomSize *v = new DomSize(); v->read(reader); setElementSize(v); continue; } - if (tag == QLatin1String("string")) { + if (tag == QStringLiteral("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); continue; } - if (tag == QLatin1String("stringlist")) { + if (tag == QStringLiteral("stringlist")) { DomStringList *v = new DomStringList(); v->read(reader); setElementStringList(v); continue; } - if (tag == QLatin1String("number")) { + if (tag == QStringLiteral("number")) { setElementNumber(reader.readElementText().toInt()); continue; } - if (tag == QLatin1String("float")) { + if (tag == QStringLiteral("float")) { setElementFloat(reader.readElementText().toFloat()); continue; } - if (tag == QLatin1String("double")) { + if (tag == QStringLiteral("double")) { setElementDouble(reader.readElementText().toDouble()); continue; } - if (tag == QLatin1String("date")) { + if (tag == QStringLiteral("date")) { DomDate *v = new DomDate(); v->read(reader); setElementDate(v); continue; } - if (tag == QLatin1String("time")) { + if (tag == QStringLiteral("time")) { DomTime *v = new DomTime(); v->read(reader); setElementTime(v); continue; } - if (tag == QLatin1String("datetime")) { + if (tag == QStringLiteral("datetime")) { DomDateTime *v = new DomDateTime(); v->read(reader); setElementDateTime(v); continue; } - if (tag == QLatin1String("pointf")) { + if (tag == QStringLiteral("pointf")) { DomPointF *v = new DomPointF(); v->read(reader); setElementPointF(v); continue; } - if (tag == QLatin1String("rectf")) { + if (tag == QStringLiteral("rectf")) { DomRectF *v = new DomRectF(); v->read(reader); setElementRectF(v); continue; } - if (tag == QLatin1String("sizef")) { + if (tag == QStringLiteral("sizef")) { DomSizeF *v = new DomSizeF(); v->read(reader); setElementSizeF(v); continue; } - if (tag == QLatin1String("longlong")) { + if (tag == QStringLiteral("longlong")) { setElementLongLong(reader.readElementText().toLongLong()); continue; } - if (tag == QLatin1String("char")) { + if (tag == QStringLiteral("char")) { DomChar *v = new DomChar(); v->read(reader); setElementChar(v); continue; } - if (tag == QLatin1String("url")) { + if (tag == QStringLiteral("url")) { DomUrl *v = new DomUrl(); v->read(reader); setElementUrl(v); continue; } - if (tag == QLatin1String("uint")) { + if (tag == QStringLiteral("uint")) { setElementUInt(reader.readElementText().toUInt()); continue; } - if (tag == QLatin1String("ulonglong")) { + if (tag == QStringLiteral("ulonglong")) { setElementULongLong(reader.readElementText().toULongLong()); continue; } - if (tag == QLatin1String("brush")) { + if (tag == QStringLiteral("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -9233,405 +7435,209 @@ void DomProperty::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomProperty::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("stdset"))) - setAttributeStdset(node.attribute(QLatin1String("stdset")).toInt()); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("bool")) { - setElementBool(e.text()); - continue; - } - if (tag == QLatin1String("color")) { - DomColor *v = new DomColor(); - v->read(e); - setElementColor(v); - continue; - } - if (tag == QLatin1String("cstring")) { - setElementCstring(e.text()); - continue; - } - if (tag == QLatin1String("cursor")) { - setElementCursor(e.text().toInt()); - continue; - } - if (tag == QLatin1String("cursorshape")) { - setElementCursorShape(e.text()); - continue; - } - if (tag == QLatin1String("enum")) { - setElementEnum(e.text()); - continue; - } - if (tag == QLatin1String("font")) { - DomFont *v = new DomFont(); - v->read(e); - setElementFont(v); - continue; - } - if (tag == QLatin1String("iconset")) { - DomResourceIcon *v = new DomResourceIcon(); - v->read(e); - setElementIconSet(v); - continue; - } - if (tag == QLatin1String("pixmap")) { - DomResourcePixmap *v = new DomResourcePixmap(); - v->read(e); - setElementPixmap(v); - continue; - } - if (tag == QLatin1String("palette")) { - DomPalette *v = new DomPalette(); - v->read(e); - setElementPalette(v); - continue; - } - if (tag == QLatin1String("point")) { - DomPoint *v = new DomPoint(); - v->read(e); - setElementPoint(v); - continue; - } - if (tag == QLatin1String("rect")) { - DomRect *v = new DomRect(); - v->read(e); - setElementRect(v); - continue; - } - if (tag == QLatin1String("set")) { - setElementSet(e.text()); - continue; - } - if (tag == QLatin1String("locale")) { - DomLocale *v = new DomLocale(); - v->read(e); - setElementLocale(v); - continue; - } - if (tag == QLatin1String("sizepolicy")) { - DomSizePolicy *v = new DomSizePolicy(); - v->read(e); - setElementSizePolicy(v); - continue; - } - if (tag == QLatin1String("size")) { - DomSize *v = new DomSize(); - v->read(e); - setElementSize(v); - continue; - } - if (tag == QLatin1String("string")) { - DomString *v = new DomString(); - v->read(e); - setElementString(v); - continue; - } - if (tag == QLatin1String("stringlist")) { - DomStringList *v = new DomStringList(); - v->read(e); - setElementStringList(v); - continue; - } - if (tag == QLatin1String("number")) { - setElementNumber(e.text().toInt()); - continue; - } - if (tag == QLatin1String("float")) { - setElementFloat(e.text().toFloat()); - continue; - } - if (tag == QLatin1String("double")) { - setElementDouble(e.text().toDouble()); - continue; - } - if (tag == QLatin1String("date")) { - DomDate *v = new DomDate(); - v->read(e); - setElementDate(v); - continue; - } - if (tag == QLatin1String("time")) { - DomTime *v = new DomTime(); - v->read(e); - setElementTime(v); - continue; - } - if (tag == QLatin1String("datetime")) { - DomDateTime *v = new DomDateTime(); - v->read(e); - setElementDateTime(v); - continue; - } - if (tag == QLatin1String("pointf")) { - DomPointF *v = new DomPointF(); - v->read(e); - setElementPointF(v); - continue; - } - if (tag == QLatin1String("rectf")) { - DomRectF *v = new DomRectF(); - v->read(e); - setElementRectF(v); - continue; - } - if (tag == QLatin1String("sizef")) { - DomSizeF *v = new DomSizeF(); - v->read(e); - setElementSizeF(v); - continue; - } - if (tag == QLatin1String("longlong")) { - setElementLongLong(e.text().toLongLong()); - continue; - } - if (tag == QLatin1String("char")) { - DomChar *v = new DomChar(); - v->read(e); - setElementChar(v); - continue; - } - if (tag == QLatin1String("url")) { - DomUrl *v = new DomUrl(); - v->read(e); - setElementUrl(v); - continue; - } - if (tag == QLatin1String("uint")) { - setElementUInt(e.text().toUInt()); - continue; - } - if (tag == QLatin1String("ulonglong")) { - setElementULongLong(e.text().toULongLong()); - continue; - } - if (tag == QLatin1String("brush")) { - DomBrush *v = new DomBrush(); - v->read(e); - setElementBrush(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("property") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeStdset()) - writer.writeAttribute(QLatin1String("stdset"), QString::number(attributeStdset())); + writer.writeAttribute(QStringLiteral("stdset"), QString::number(attributeStdset())); switch (kind()) { case Bool: { - writer.writeTextElement(QLatin1String("bool"), elementBool()); + writer.writeTextElement(QStringLiteral("bool"), elementBool()); break; } case Color: { DomColor* v = elementColor(); if (v != 0) { - v->write(writer, QLatin1String("color")); + v->write(writer, QStringLiteral("color")); } break; } case Cstring: { - writer.writeTextElement(QLatin1String("cstring"), elementCstring()); + writer.writeTextElement(QStringLiteral("cstring"), elementCstring()); break; } case Cursor: { - writer.writeTextElement(QLatin1String("cursor"), QString::number(elementCursor())); + writer.writeTextElement(QStringLiteral("cursor"), QString::number(elementCursor())); break; } case CursorShape: { - writer.writeTextElement(QLatin1String("cursorShape"), elementCursorShape()); + writer.writeTextElement(QStringLiteral("cursorShape"), elementCursorShape()); break; } case Enum: { - writer.writeTextElement(QLatin1String("enum"), elementEnum()); + writer.writeTextElement(QStringLiteral("enum"), elementEnum()); break; } case Font: { DomFont* v = elementFont(); if (v != 0) { - v->write(writer, QLatin1String("font")); + v->write(writer, QStringLiteral("font")); } break; } case IconSet: { DomResourceIcon* v = elementIconSet(); if (v != 0) { - v->write(writer, QLatin1String("iconset")); + v->write(writer, QStringLiteral("iconset")); } break; } case Pixmap: { DomResourcePixmap* v = elementPixmap(); if (v != 0) { - v->write(writer, QLatin1String("pixmap")); + v->write(writer, QStringLiteral("pixmap")); } break; } case Palette: { DomPalette* v = elementPalette(); if (v != 0) { - v->write(writer, QLatin1String("palette")); + v->write(writer, QStringLiteral("palette")); } break; } case Point: { DomPoint* v = elementPoint(); if (v != 0) { - v->write(writer, QLatin1String("point")); + v->write(writer, QStringLiteral("point")); } break; } case Rect: { DomRect* v = elementRect(); if (v != 0) { - v->write(writer, QLatin1String("rect")); + v->write(writer, QStringLiteral("rect")); } break; } case Set: { - writer.writeTextElement(QLatin1String("set"), elementSet()); + writer.writeTextElement(QStringLiteral("set"), elementSet()); break; } case Locale: { DomLocale* v = elementLocale(); if (v != 0) { - v->write(writer, QLatin1String("locale")); + v->write(writer, QStringLiteral("locale")); } break; } case SizePolicy: { DomSizePolicy* v = elementSizePolicy(); if (v != 0) { - v->write(writer, QLatin1String("sizepolicy")); + v->write(writer, QStringLiteral("sizepolicy")); } break; } case Size: { DomSize* v = elementSize(); if (v != 0) { - v->write(writer, QLatin1String("size")); + v->write(writer, QStringLiteral("size")); } break; } case String: { DomString* v = elementString(); if (v != 0) { - v->write(writer, QLatin1String("string")); + v->write(writer, QStringLiteral("string")); } break; } case StringList: { DomStringList* v = elementStringList(); if (v != 0) { - v->write(writer, QLatin1String("stringlist")); + v->write(writer, QStringLiteral("stringlist")); } break; } case Number: { - writer.writeTextElement(QLatin1String("number"), QString::number(elementNumber())); + writer.writeTextElement(QStringLiteral("number"), QString::number(elementNumber())); break; } case Float: { - writer.writeTextElement(QLatin1String("float"), QString::number(elementFloat(), 'f', 8)); + writer.writeTextElement(QStringLiteral("float"), QString::number(elementFloat(), 'f', 8)); break; } case Double: { - writer.writeTextElement(QLatin1String("double"), QString::number(elementDouble(), 'f', 15)); + writer.writeTextElement(QStringLiteral("double"), QString::number(elementDouble(), 'f', 15)); break; } case Date: { DomDate* v = elementDate(); if (v != 0) { - v->write(writer, QLatin1String("date")); + v->write(writer, QStringLiteral("date")); } break; } case Time: { DomTime* v = elementTime(); if (v != 0) { - v->write(writer, QLatin1String("time")); + v->write(writer, QStringLiteral("time")); } break; } case DateTime: { DomDateTime* v = elementDateTime(); if (v != 0) { - v->write(writer, QLatin1String("datetime")); + v->write(writer, QStringLiteral("datetime")); } break; } case PointF: { DomPointF* v = elementPointF(); if (v != 0) { - v->write(writer, QLatin1String("pointf")); + v->write(writer, QStringLiteral("pointf")); } break; } case RectF: { DomRectF* v = elementRectF(); if (v != 0) { - v->write(writer, QLatin1String("rectf")); + v->write(writer, QStringLiteral("rectf")); } break; } case SizeF: { DomSizeF* v = elementSizeF(); if (v != 0) { - v->write(writer, QLatin1String("sizef")); + v->write(writer, QStringLiteral("sizef")); } break; } case LongLong: { - writer.writeTextElement(QLatin1String("longLong"), QString::number(elementLongLong())); + writer.writeTextElement(QStringLiteral("longLong"), QString::number(elementLongLong())); break; } case Char: { DomChar* v = elementChar(); if (v != 0) { - v->write(writer, QLatin1String("char")); + v->write(writer, QStringLiteral("char")); } break; } case Url: { DomUrl* v = elementUrl(); if (v != 0) { - v->write(writer, QLatin1String("url")); + v->write(writer, QStringLiteral("url")); } break; } case UInt: { - writer.writeTextElement(QLatin1String("UInt"), QString::number(elementUInt())); + writer.writeTextElement(QStringLiteral("UInt"), QString::number(elementUInt())); break; } case ULongLong: { - writer.writeTextElement(QLatin1String("uLongLong"), QString::number(elementULongLong())); + writer.writeTextElement(QStringLiteral("uLongLong"), QString::number(elementULongLong())); break; } case Brush: { DomBrush* v = elementBrush(); if (v != 0) { - v->write(writer, QLatin1String("brush")); + v->write(writer, QStringLiteral("brush")); } break; } @@ -10052,13 +8058,13 @@ void DomConnections::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("connection")) { + if (tag == QStringLiteral("connection")) { DomConnection *v = new DomConnection(); v->read(reader); m_connection.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10074,36 +8080,13 @@ void DomConnections::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnections::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("connection")) { - DomConnection *v = new DomConnection(); - v->read(e); - m_connection.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connections") : tagName.toLower()); for (int i = 0; i < m_connection.size(); ++i) { DomConnection* v = m_connection[i]; - v->write(writer, QLatin1String("connection")); + v->write(writer, QStringLiteral("connection")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10147,29 +8130,29 @@ void DomConnection::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("sender")) { + if (tag == QStringLiteral("sender")) { setElementSender(reader.readElementText()); continue; } - if (tag == QLatin1String("signal")) { + if (tag == QStringLiteral("signal")) { setElementSignal(reader.readElementText()); continue; } - if (tag == QLatin1String("receiver")) { + if (tag == QStringLiteral("receiver")) { setElementReceiver(reader.readElementText()); continue; } - if (tag == QLatin1String("slot")) { + if (tag == QStringLiteral("slot")) { setElementSlot(reader.readElementText()); continue; } - if (tag == QLatin1String("hints")) { + if (tag == QStringLiteral("hints")) { DomConnectionHints *v = new DomConnectionHints(); v->read(reader); setElementHints(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10185,67 +8168,28 @@ void DomConnection::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnection::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("sender")) { - setElementSender(e.text()); - continue; - } - if (tag == QLatin1String("signal")) { - setElementSignal(e.text()); - continue; - } - if (tag == QLatin1String("receiver")) { - setElementReceiver(e.text()); - continue; - } - if (tag == QLatin1String("slot")) { - setElementSlot(e.text()); - continue; - } - if (tag == QLatin1String("hints")) { - DomConnectionHints *v = new DomConnectionHints(); - v->read(e); - setElementHints(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connection") : tagName.toLower()); if (m_children & Sender) { - writer.writeTextElement(QLatin1String("sender"), m_sender); + writer.writeTextElement(QStringLiteral("sender"), m_sender); } if (m_children & Signal) { - writer.writeTextElement(QLatin1String("signal"), m_signal); + writer.writeTextElement(QStringLiteral("signal"), m_signal); } if (m_children & Receiver) { - writer.writeTextElement(QLatin1String("receiver"), m_receiver); + writer.writeTextElement(QStringLiteral("receiver"), m_receiver); } if (m_children & Slot) { - writer.writeTextElement(QLatin1String("slot"), m_slot); + writer.writeTextElement(QStringLiteral("slot"), m_slot); } if (m_children & Hints) { - m_hints->write(writer, QLatin1String("hints")); + m_hints->write(writer, QStringLiteral("hints")); } if (!m_text.isEmpty()) @@ -10350,13 +8294,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("hint")) { + if (tag == QStringLiteral("hint")) { DomConnectionHint *v = new DomConnectionHint(); v->read(reader); m_hint.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10372,36 +8316,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnectionHints::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("hint")) { - DomConnectionHint *v = new DomConnectionHint(); - v->read(e); - m_hint.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhints") : tagName.toLower()); for (int i = 0; i < m_hint.size(); ++i) { DomConnectionHint* v = m_hint[i]; - v->write(writer, QLatin1String("hint")); + v->write(writer, QStringLiteral("hint")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10445,11 +8366,11 @@ void DomConnectionHint::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { @@ -10464,7 +8385,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader) setElementY(reader.readElementText().toInt()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10480,40 +8401,12 @@ void DomConnectionHint::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomConnectionHint::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QString(QLatin1Char('x'))) { - setElementX(e.text().toInt()); - continue; - } - if (tag == QString(QLatin1Char('y'))) { - setElementY(e.text().toInt()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhint") : tagName.toLower()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (m_children & X) { writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x)); @@ -10579,22 +8472,22 @@ void DomScript::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("source")) { + if (name == QStringLiteral("source")) { setAttributeSource(attribute.value().toString()); continue; } - if (name == QLatin1String("language")) { + if (name == QStringLiteral("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10610,37 +8503,15 @@ void DomScript::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomScript::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("source"))) - setAttributeSource(node.attribute(QLatin1String("source"))); - if (node.hasAttribute(QLatin1String("language"))) - setAttributeLanguage(node.attribute(QLatin1String("language"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("script") : tagName.toLower()); if (hasAttributeSource()) - writer.writeAttribute(QLatin1String("source"), attributeSource()); + writer.writeAttribute(QStringLiteral("source"), attributeSource()); if (hasAttributeLanguage()) - writer.writeAttribute(QLatin1String("language"), attributeLanguage()); + writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10678,13 +8549,13 @@ void DomWidgetData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10700,36 +8571,13 @@ void DomWidgetData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomWidgetData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widgetdata") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10773,13 +8621,13 @@ void DomDesignerData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("property")) { + if (tag == QStringLiteral("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10795,36 +8643,13 @@ void DomDesignerData::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomDesignerData::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("property")) { - DomProperty *v = new DomProperty(); - v->read(e); - m_property.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("designerdata") : tagName.toLower()); for (int i = 0; i < m_property.size(); ++i) { DomProperty* v = m_property[i]; - v->write(writer, QLatin1String("property")); + v->write(writer, QStringLiteral("property")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10868,15 +8693,15 @@ void DomSlots::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("signal")) { + if (tag == QStringLiteral("signal")) { m_signal.append(reader.readElementText()); continue; } - if (tag == QLatin1String("slot")) { + if (tag == QStringLiteral("slot")) { m_slot.append(reader.readElementText()); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10892,42 +8717,17 @@ void DomSlots::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomSlots::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("signal")) { - m_signal.append(e.text()); - continue; - } - if (tag == QLatin1String("slot")) { - m_slot.append(e.text()); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("slots") : tagName.toLower()); for (int i = 0; i < m_signal.size(); ++i) { QString v = m_signal[i]; - writer.writeTextElement(QLatin1String("signal"), v); + writer.writeTextElement(QStringLiteral("signal"), v); } for (int i = 0; i < m_slot.size(); ++i) { QString v = m_slot[i]; - writer.writeTextElement(QLatin1String("slot"), v); + writer.writeTextElement(QStringLiteral("slot"), v); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -10977,13 +8777,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QLatin1String("stringpropertyspecification")) { + if (tag == QStringLiteral("stringpropertyspecification")) { DomStringPropertySpecification *v = new DomStringPropertySpecification(); v->read(reader); m_stringpropertyspecification.append(v); continue; } - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -10999,36 +8799,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomPropertySpecifications::read(const QDomElement &node) -{ - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - if (tag == QLatin1String("stringpropertyspecification")) { - DomStringPropertySpecification *v = new DomStringPropertySpecification(); - v->read(e); - m_stringpropertyspecification.append(v); - continue; - } - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower()); for (int i = 0; i < m_stringpropertyspecification.size(); ++i) { DomStringPropertySpecification* v = m_stringpropertyspecification[i]; - v->write(writer, QLatin1String("stringpropertyspecification")); + v->write(writer, QStringLiteral("stringpropertyspecification")); } if (!m_text.isEmpty()) writer.writeCharacters(m_text); @@ -11072,26 +8849,26 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { + if (name == QStringLiteral("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QLatin1String("type")) { + if (name == QStringLiteral("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QLatin1String("notr")) { + if (name == QStringLiteral("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); + reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); } for (bool finished = false; !finished && !reader.hasError();) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); + reader.raiseError(QStringLiteral("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : @@ -11107,42 +8884,18 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) } } -#ifdef QUILOADER_QDOM_READ -void DomStringPropertySpecification::read(const QDomElement &node) -{ - if (node.hasAttribute(QLatin1String("name"))) - setAttributeName(node.attribute(QLatin1String("name"))); - if (node.hasAttribute(QLatin1String("type"))) - setAttributeType(node.attribute(QLatin1String("type"))); - if (node.hasAttribute(QLatin1String("notr"))) - setAttributeNotr(node.attribute(QLatin1String("notr"))); - - for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { - if (!n.isElement()) - continue; - QDomElement e = n.toElement(); - QString tag = e.tagName().toLower(); - } - m_text.clear(); - for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { - if (child.isText()) - m_text.append(child.nodeValue()); - } -} -#endif - void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower()); if (hasAttributeName()) - writer.writeAttribute(QLatin1String("name"), attributeName()); + writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeType()) - writer.writeAttribute(QLatin1String("type"), attributeType()); + writer.writeAttribute(QStringLiteral("type"), attributeType()); if (hasAttributeNotr()) - writer.writeAttribute(QLatin1String("notr"), attributeNotr()); + writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); diff --git a/tools/uilib/ui4_p.h b/tools/uilib/ui4_p.h index 8d7f108065..6a56c9eadc 100644 --- a/tools/uilib/ui4_p.h +++ b/tools/uilib/ui4_p.h @@ -62,17 +62,8 @@ #include #include -#if defined(QT_UIC3) - #define QUILOADER_QDOM_READ -#endif - QT_BEGIN_NAMESPACE -#ifdef QUILOADER_QDOM_READ - class QDomElement; -#endif - - #define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT #define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT @@ -174,9 +165,6 @@ public: ~DomUI(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -374,9 +362,6 @@ public: ~DomIncludes(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -408,9 +393,6 @@ public: ~DomInclude(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -451,9 +433,6 @@ public: ~DomResources(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -493,9 +472,6 @@ public: ~DomResource(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -528,9 +504,6 @@ public: ~DomActionGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -585,9 +558,6 @@ public: ~DomAction(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -640,9 +610,6 @@ public: ~DomActionRef(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -675,9 +642,6 @@ public: ~DomButtonGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -722,9 +686,6 @@ public: ~DomButtonGroups(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -756,9 +717,6 @@ public: ~DomImages(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -790,9 +748,6 @@ public: ~DomImage(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -835,9 +790,6 @@ public: ~DomImageData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -878,9 +830,6 @@ public: ~DomCustomWidgets(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -912,9 +861,6 @@ public: ~DomHeader(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -947,9 +893,6 @@ public: ~DomCustomWidget(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1067,9 +1010,6 @@ public: ~DomProperties(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1101,9 +1041,6 @@ public: ~DomPropertyData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1136,9 +1073,6 @@ public: ~DomSizePolicyData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1179,9 +1113,6 @@ public: ~DomLayoutDefault(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1222,9 +1153,6 @@ public: ~DomLayoutFunction(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1265,9 +1193,6 @@ public: ~DomTabStops(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1299,9 +1224,6 @@ public: ~DomLayout(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1399,9 +1321,6 @@ public: ~DomLayoutItem(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1484,9 +1403,6 @@ public: ~DomRow(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1518,9 +1434,6 @@ public: ~DomColumn(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1552,9 +1465,6 @@ public: ~DomItem(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1607,9 +1517,6 @@ public: ~DomWidget(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1730,9 +1637,6 @@ public: ~DomSpacer(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1772,9 +1676,6 @@ public: ~DomColor(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1830,9 +1731,6 @@ public: ~DomGradientStop(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -1875,9 +1773,6 @@ public: ~DomGradient(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2013,9 +1908,6 @@ public: ~DomBrush(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2066,9 +1958,6 @@ public: ~DomColorRole(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2111,9 +2000,6 @@ public: ~DomColorGroup(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2150,9 +2036,6 @@ public: ~DomPalette(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2203,9 +2086,6 @@ public: ~DomFont(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2302,9 +2182,6 @@ public: ~DomPoint(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2345,9 +2222,6 @@ public: ~DomRect(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2402,9 +2276,6 @@ public: ~DomLocale(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2445,9 +2316,6 @@ public: ~DomSizePolicy(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2518,9 +2386,6 @@ public: ~DomSize(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2561,9 +2426,6 @@ public: ~DomDate(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2611,9 +2473,6 @@ public: ~DomTime(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2661,9 +2520,6 @@ public: ~DomDateTime(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2732,9 +2588,6 @@ public: ~DomStringList(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2766,9 +2619,6 @@ public: ~DomResourcePixmap(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2809,9 +2659,6 @@ public: ~DomResourceIcon(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2918,9 +2765,6 @@ public: ~DomString(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2969,9 +2813,6 @@ public: ~DomPointF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3012,9 +2853,6 @@ public: ~DomRectF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3069,9 +2907,6 @@ public: ~DomSizeF(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3112,9 +2947,6 @@ public: ~DomChar(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3148,9 +2980,6 @@ public: ~DomUrl(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3185,9 +3014,6 @@ public: ~DomProperty(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3384,9 +3210,6 @@ public: ~DomConnections(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3418,9 +3241,6 @@ public: ~DomConnection(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3483,9 +3303,6 @@ public: ~DomConnectionHints(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3517,9 +3334,6 @@ public: ~DomConnectionHint(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3568,9 +3382,6 @@ public: ~DomScript(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3611,9 +3422,6 @@ public: ~DomWidgetData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3645,9 +3453,6 @@ public: ~DomDesignerData(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3679,9 +3484,6 @@ public: ~DomSlots(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3718,9 +3520,6 @@ public: ~DomPropertySpecifications(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -3752,9 +3551,6 @@ public: ~DomStringPropertySpecification(); void read(QXmlStreamReader &reader); -#ifdef QUILOADER_QDOM_READ - void read(const QDomElement &node); -#endif void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } -- cgit v1.2.3 From bf7ca774bd81b7a0fe65f99e62cf32690da9a77d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 15:18:08 +1000 Subject: test: fixed crash in tst_qmenubar::accel in qpa Always verify that the application has an active window before attempting to generate a key click. This problem potentially affected all platforms, but is rare on non-qpa Linux since QTest::qWaitForWindowShown would usually avoid the problem on that platform. Change-Id: I0c30be6228361faffa121c9c2d7a667f8351ebd6 Reviewed-on: http://codereview.qt.nokia.com/2896 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qmenubar/tst_qmenubar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 51bb43716e..e1b7f1ff9b 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -344,6 +344,9 @@ void tst_QMenuBar::accel() // create a popup menu with menu items set the accelerators later... initSimpleMenubar(); + + // shortcuts won't work unless the window is active + QTRY_VERIFY( QApplication::activeWindow() ); // QTest::keyClick( 0, Qt::Key_A, AltKey ); QTest::keyClick( 0, Qt::Key_A, Qt::ControlModifier ); QTest::qWait(300); -- cgit v1.2.3 From 81b559631a4f3ece66196965d034684d506af70d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 11 Aug 2011 16:59:06 +1000 Subject: Don't leak MouseEvents Based off merge request 1312 Reviewed-by: Michael Brasser (cherry picked from commit 206c9ba930095efb6d569f6e61a9809f16361dd5) Change-Id: Iaaaabadbadbadaaaaaaaaaffaaaeaaaaaaaacaaa Reviewed-on: http://codereview.qt.nokia.com/2843 Reviewed-by: Qt Sanity Bot Reviewed-by: Alan Alpert --- src/gui/widgets/qlinecontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 59374466d6..92c84d72e0 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1449,9 +1449,9 @@ bool QLineControl::processEvent(QEvent* ev) case QEvent::GraphicsSceneMouseRelease: case QEvent::GraphicsSceneMousePress:{ QGraphicsSceneMouseEvent *gvEv = static_cast(ev); - QMouseEvent* mouse = new QMouseEvent(ev->type(), + QMouseEvent mouse(ev->type(), gvEv->pos().toPoint(), gvEv->button(), gvEv->buttons(), gvEv->modifiers()); - processMouseEvent(mouse); break; + processMouseEvent(&mouse); break; } #endif case QEvent::MouseButtonPress: -- cgit v1.2.3 From 7b49a23888c2463d9ac23e4f0006e547ad16ae07 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 9 Aug 2011 14:23:50 +1000 Subject: Don't endless loop Task-number: QTBUG-20699 Reviewed-by: Michael Brasser (cherry picked from commit ce36e8afa47e3625737208b5a912f9f191a59678) Change-Id: Iaaaabadbabaaaeaaaaaaaaffaaaeaaaaaaaacaaa Reviewed-on: http://codereview.qt.nokia.com/2757 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Brasser --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index ef539634d9..2ac2bdf6ee 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3297,7 +3297,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim } if (climb) { - while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) + while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible() && f->d_ptr->focusScopeItem != f) f = f->d_ptr->focusScopeItem; } -- cgit v1.2.3 From c74aa533837bda15bf049d4135bd18f952c5229f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 15 Aug 2011 13:44:44 +1000 Subject: FocusScope's focusItem must always be a descendent Task-number: QTBUG-20699 Reviewed-by: Michael Brasser Change-Id: Iaaaabaabaabaabaabaaaaaffaaaeaaaaaaaacaaa (cherry picked from commit 0ee51351894296df7328f206e444ece262692f3f) Reviewed-on: http://codereview.qt.nokia.com/2931 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Brasser --- src/gui/graphicsview/qgraphicsitem.cpp | 34 ++++++++++++++------------ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 32 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2ac2bdf6ee..0c218fc9f4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q // Update focus scope item ptr in new scope. QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; if (newFocusScopeItem && newParent) { - if (subFocusItem) { - // Find the subFocusItem's topmost focus scope. - QGraphicsItem *ancestorScope = 0; - QGraphicsItem *p = subFocusItem->d_ptr->parent; - while (p) { - if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) - ancestorScope = p; - if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel) - break; - p = p->d_ptr->parent; - } - if (ancestorScope) - newFocusScopeItem = ancestorScope; - } - QGraphicsItem *p = newParent; while (p) { if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { + if (subFocusItem && subFocusItem != q_ptr) { + // Find the subFocusItem's topmost focus scope within the new parent's focusscope + QGraphicsItem *ancestorScope = 0; + QGraphicsItem *p2 = subFocusItem->d_ptr->parent; + while (p2 && p2 != p) { + if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) + ancestorScope = p2; + if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel) + break; + if (p2 == q_ptr) + break; + p2 = p2->d_ptr->parent; + } + if (ancestorScope) + newFocusScopeItem = ancestorScope; + } + p->d_ptr->focusScopeItem = newFocusScopeItem; newFocusScopeItem->d_ptr->focusScopeItemChange(true); // Ensure the new item is no longer the subFocusItem. The @@ -3297,7 +3299,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim } if (climb) { - while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible() && f->d_ptr->focusScopeItem != f) + while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) f = f->d_ptr->focusScopeItem; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index cd66e10b79..a8cc3b0e62 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -475,6 +475,7 @@ private slots: void QTBUG_12112_focusItem(); void QTBUG_13473_sceneposchange(); void QTBUG_16374_crashInDestructor(); + void QTBUG_20699_focusScopeCrash(); private: QList paintedItems; @@ -11257,5 +11258,36 @@ void tst_QGraphicsItem::QTBUG_16374_crashInDestructor() QTest::qWaitForWindowShown(&view); } +void tst_QGraphicsItem::QTBUG_20699_focusScopeCrash() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsPixmapItem fs; + fs.setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable); + scene.addItem(&fs); + QGraphicsPixmapItem* fs2 = new QGraphicsPixmapItem(&fs); + fs2->setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable); + QGraphicsPixmapItem* fi2 = new QGraphicsPixmapItem(&fs); + fi2->setFlags(QGraphicsItem::ItemIsFocusable); + QGraphicsPixmapItem* fi = new QGraphicsPixmapItem(fs2); + fi->setFlags(QGraphicsItem::ItemIsFocusable); + fs.setFocus(); + fi->setFocus(); + + view.show(); + QTest::qWaitForWindowShown(&view); + + fi->setParentItem(fi2); + fi->setFocus(); + fs.setFocus(); + fi->setParentItem(fs2); + fi->setFocus(); + fs2->setFocus(); + fs.setFocus(); + fi->setParentItem(fi2); + fi->setFocus(); + fs.setFocus(); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v1.2.3 From 3a1568c30c80c3681edaeaa472fe9c684ab48454 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 15 Aug 2011 13:24:23 +0200 Subject: Add flag for non-recursive lookup of child qobject(s) Merge-request: 40 Reviewed-by: olivier Reviewed-by: Frederik Gladhorn Change-Id: I1194ba0d8bba92ece3132171e230cece341ec127 Reviewed-on: http://codereview.qt.nokia.com/2957 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- .../snippets/code/src_corelib_kernel_qobject.cpp | 15 ++++ src/corelib/global/qnamespace.h | 6 +- src/corelib/global/qnamespace.qdoc | 7 ++ src/corelib/kernel/qobject.cpp | 50 ++++++++---- src/corelib/kernel/qobject.h | 16 ++-- tests/auto/qobject/tst_qobject.cpp | 95 ++++++++++++++++++++++ 6 files changed, 165 insertions(+), 24 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index afb9460983..086c62893d 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -434,6 +434,21 @@ hostNameLabel->setText(tr("Name:")); QString example = tr("Example"); //! [40] +//! [41] +QPushButton *button = parentWidget->findChild("button1", Qt::FindDirectChildOnly); +//! [41] + + +//! [42] +QListWidget *list = parentWidget->findChild(QString(), Qt::FindDirectChildOnly); +//! [42] + + +//! [43] +QList childButtons = parentWidget.findChildren(QString(), Qt::FindDirectChildOnly); +//! [43] + + //! [meta data] //: This is a comment for the translator. //= qtn_foo_bar diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 4f638e10ae..9253b19e60 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1293,7 +1293,11 @@ public: AnchorBottom }; - + enum FindChildOption { + FindDirectChildrenOnly = 0x0, + FindChildrenRecursively = 0x1 + }; + Q_DECLARE_FLAGS(FindChildOptions, FindChildOption) enum DropAction { CopyAction = 0x1, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9dd7cda24f..08df79af28 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2110,6 +2110,13 @@ \sa QWidget::windowFlags, {Window Flags Example} */ +/*! + \enum Qt::FindChildOption + + \value FindDirectChildrenOnly Looks only at the direct children of the object. + \value FindChildrenRecursively Looks at all children of the object (recursive search). +*/ + /*! \enum Qt::DropAction diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 076744ee00..dce78393d0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1028,8 +1028,8 @@ QObjectPrivate::Connection::~Connection() \brief the name of this object - You can find an object by name (and type) using findChild(). You can - find a set of objects with findChildren(). + You can find an object by name (and type) using findChild(). + You can find a set of objects with findChildren(). \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 5 @@ -1545,12 +1545,13 @@ void QObject::killTimer(int id) /*! - \fn T *QObject::findChild(const QString &name) const + \fn T *QObject::findChild(const QString &name, Qt::FindChildOptions options) const Returns the child of this object that can be cast into type T and that is called \a name, or 0 if there is no such object. Omitting the \a name argument causes all object names to be matched. - The search is performed recursively. + The search is performed recursively, unless \a options specifies the + option FindDirectChildrenOnly. If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct @@ -1558,7 +1559,8 @@ void QObject::killTimer(int id) case, findChildren() should be used. This example returns a child \l{QPushButton} of \c{parentWidget} - named \c{"button1"}: + named \c{"button1"}, even if the button isn't a direct child of + the parent: \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 10 @@ -1566,16 +1568,27 @@ void QObject::killTimer(int id) \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 11 + This example returns a child \l{QPushButton} of \c{parentWidget} + (its direct parent) named \c{"button1"}: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 41 + + This example returns a \l{QListWidget} child of \c{parentWidget}, + its direct parent: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 42 + \sa findChildren() */ /*! - \fn QList QObject::findChildren(const QString &name) const + \fn QList QObject::findChildren(const QString &name, Qt::FindChildOptions options) const Returns all children of this object with the given \a name that can be cast to type T, or an empty list if there are no such objects. Omitting the \a name argument causes all object names to be matched. - The search is performed recursively. + The search is performed recursively, unless \a options specifies the + option FindDirectChildrenOnly. The following example shows how to find a list of child \l{QWidget}s of the specified \c{parentWidget} named \c{widgetname}: @@ -1586,11 +1599,15 @@ void QObject::killTimer(int id) \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 13 + This example returns all \c{QPushButton}s that are immediate children of \c{parentWidget}: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 43 + \sa findChild() */ /*! - \fn QList QObject::findChildren(const QRegExp ®Exp) const + \fn QList QObject::findChildren(const QRegExp ®Exp, Qt::FindChildOptions options) const \overload findChildren() Returns the children of this object that can be cast to type T @@ -1650,7 +1667,7 @@ void QObject::killTimer(int id) \internal */ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, - const QMetaObject &mo, QList *list) + const QMetaObject &mo, QList *list, Qt::FindChildOptions options) { if (!parent || !list) return; @@ -1667,13 +1684,14 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const Q list->append(obj); } } - qt_qFindChildren_helper(obj, name, re, mo, list); + if (options & Qt::FindChildrenRecursively) + qt_qFindChildren_helper(obj, name, re, mo, list, options); } } /*! \internal */ -QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo) +QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options) { if (!parent) return 0; @@ -1685,10 +1703,12 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const if (mo.cast(obj) && (name.isNull() || obj->objectName() == name)) return obj; } - for (i = 0; i < children.size(); ++i) { - obj = qt_qFindChild_helper(children.at(i), name, mo); - if (obj) - return obj; + if (options & Qt::FindChildrenRecursively) { + for (i = 0; i < children.size(); ++i) { + obj = qt_qFindChild_helper(children.at(i), name, mo, options); + if (obj) + return obj; + } } return 0; } diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 0e28fa7e26..59ff988ba9 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -78,8 +78,8 @@ class QObjectUserData; typedef QList QObjectList; Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, - const QMetaObject &mo, QList *list); -Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); + const QMetaObject &mo, QList *list, Qt::FindChildOptions options); +Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options); class #if defined(__INTEL_COMPILER) && defined(Q_OS_WIN) @@ -155,11 +155,11 @@ public: void killTimer(int id); template - inline T findChild(const QString &aName = QString()) const - { return static_cast(qt_qFindChild_helper(this, aName, reinterpret_cast(0)->staticMetaObject)); } + inline T findChild(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { return static_cast(qt_qFindChild_helper(this, aName, reinterpret_cast(0)->staticMetaObject, options)); } template - inline QList findChildren(const QString &aName = QString()) const + inline QList findChildren(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { QList list; union { @@ -167,13 +167,13 @@ public: QList *voidList; } u; u.typedList = &list; - qt_qFindChildren_helper(this, aName, 0, reinterpret_cast(0)->staticMetaObject, u.voidList); + qt_qFindChildren_helper(this, aName, 0, reinterpret_cast(0)->staticMetaObject, u.voidList, options); return list; } #ifndef QT_NO_REGEXP template - inline QList findChildren(const QRegExp &re) const + inline QList findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { QList list; union { @@ -181,7 +181,7 @@ public: QList *voidList; } u; u.typedList = &list; - qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast(0)->staticMetaObject, u.voidList); + qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast(0)->staticMetaObject, u.voidList, options); return list; } #endif diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 99942d54be..3cd4376d80 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -689,6 +689,101 @@ void tst_QObject::findChildren() tl = o.findChildren("t1"); QCOMPARE(tl.size(), 1); QCOMPARE(tl.at(0), &t1); + + // Find direct child/children + + op = o.findChild("o1", Qt::FindDirectChildrenOnly); + QCOMPARE(op, &o1); + op = o.findChild("o2", Qt::FindDirectChildrenOnly); + QCOMPARE(op, &o2); + op = o.findChild("o11", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("o12", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("o111", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("t1", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(&t1)); + op = o.findChild("t121", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("t1", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(&t1)); + op = o.findChild("t121", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("o12", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("o", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("harry", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + op = o.findChild("o1", Qt::FindDirectChildrenOnly); + QCOMPARE(op, &o1); + + l = o.findChildren("o1", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 1); + QCOMPARE(l.at(0), &o1); + l = o.findChildren("o2", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 1); + QCOMPARE(l.at(0), &o2); + l = o.findChildren("o11", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + l = o.findChildren("o12", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + l = o.findChildren("o111", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + l = o.findChildren("t1", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 1); + QCOMPARE(l.at(0), static_cast(&t1)); + l = o.findChildren("t121", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + tl = o.findChildren("t1", Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 1); + QCOMPARE(tl.at(0), &t1); + tl = o.findChildren("t121", Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 0); + l = o.findChildren("o", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + l = o.findChildren("harry", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + tl = o.findChildren("o12", Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 0); + l = o.findChildren("o1", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 1); + QCOMPARE(l.at(0), &o1); + + l = o.findChildren(QRegExp("o.*"), Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 2); + QVERIFY(l.contains(&o1)); + QVERIFY(l.contains(&o2)); + l = o.findChildren(QRegExp("t.*"), Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 1); + QVERIFY(l.contains(&t1)); + tl = o.findChildren(QRegExp(".*"), Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 2); + QVERIFY(tl.contains(&t1)); + tl = o.findChildren(QRegExp("o.*"), Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 0); + l = o.findChildren(QRegExp("harry"), Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + + // empty and null string check + op = o.findChild(QString(), Qt::FindDirectChildrenOnly); + QCOMPARE(op, &o1); + op = o.findChild("", Qt::FindDirectChildrenOnly); + QCOMPARE(op, &unnamed); + op = o.findChild("unnamed", Qt::FindDirectChildrenOnly); + QCOMPARE(op, static_cast(0)); + + l = o.findChildren(QString(), Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 5); + l = o.findChildren("", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 2); + l = o.findChildren("unnamed", Qt::FindDirectChildrenOnly); + QCOMPARE(l.size(), 0); + + tl = o.findChildren("t1", Qt::FindDirectChildrenOnly); + QCOMPARE(tl.size(), 1); + QCOMPARE(tl.at(0), &t1); } -- cgit v1.2.3 From 168fe50106b20b250cdc5499e17f48907bd00f53 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 15 Aug 2011 13:43:45 +0200 Subject: Make QThread::sleep/msleep/usleep public. Merge-request: 43 Reviewed-by: olivier Reviewed-by: Frederik Gladhorn Change-Id: Ic5e3ce8f49daf83665865f89fa9fd3488cc5b349 Reviewed-on: http://codereview.qt.nokia.com/2959 Reviewed-by: Frederik Gladhorn Reviewed-by: Qt Sanity Bot --- src/corelib/thread/qthread.h | 8 +++--- tests/auto/qglthreads/tst_qglthreads.cpp | 37 +++++---------------------- tests/manual/qgraphicslayout/flicker/window.h | 15 +---------- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index bc529fd53b..89a3ad8b1f 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -101,6 +101,10 @@ public: // default argument causes thread to block indefinately bool wait(unsigned long time = ULONG_MAX); + static void sleep(unsigned long); + static void msleep(unsigned long); + static void usleep(unsigned long); + Q_SIGNALS: void started(); void finished(); @@ -112,10 +116,6 @@ protected: static void setTerminationEnabled(bool enabled = true); - static void sleep(unsigned long); - static void msleep(unsigned long); - static void usleep(unsigned long); - protected: QThread(QThreadPrivate &dd, QObject *parent = 0); diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp index 859f47f000..472379ab7a 100644 --- a/tests/auto/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/qglthreads/tst_qglthreads.cpp @@ -46,7 +46,6 @@ #include "tst_qglthreads.h" #ifdef Q_OS_SYMBIAN -#include // for usleep #define RUNNING_TIME 2000 // save GPU mem by running shorter time. #else #define RUNNING_TIME 5000 @@ -467,11 +466,7 @@ void tst_QGLThreads::renderInThread() qApp->processEvents(); value = -value; -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!thread.failure); @@ -574,11 +569,7 @@ public slots: p.drawText(rect.center(), "This is a piece of text"); p.end(); rotAngle += 2; -#ifdef Q_WS_WIN - Sleep(20); -#else - usleep(20 * 1000); -#endif + QThread::msleep(20); } fail = beginFailed; @@ -670,11 +661,7 @@ void tst_QGLThreads::painterOnGLWidgetInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -693,11 +680,7 @@ void tst_QGLThreads::painterOnPixmapInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -726,11 +709,7 @@ void tst_QGLThreads::painterOnPboInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -760,11 +739,7 @@ void tst_QGLThreads::painterOnFboInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } diff --git a/tests/manual/qgraphicslayout/flicker/window.h b/tests/manual/qgraphicslayout/flicker/window.h index 5d5a9c1fd3..26a8f2ab5e 100644 --- a/tests/manual/qgraphicslayout/flicker/window.h +++ b/tests/manual/qgraphicslayout/flicker/window.h @@ -45,19 +45,6 @@ #include -static void qSleep(int msec) -{ - - struct Thread : public QThread - { - static void wait(int msec) - { - QThread::msleep(msec); - } - }; - Thread::wait(msec); -} - struct Statistics { Statistics() : output(0), setGeometryCount(0), currentBenchmarkIteration(0), relayoutClicked(false), sleepMsecs(0) @@ -70,7 +57,7 @@ struct Statistics { QLabel *output; void sleep() { - qSleep(sleepMsecs); + QThread::msleep(sleepMsecs); } int currentBenchmarkIteration; bool relayoutClicked; -- cgit v1.2.3 From 0536ec05c3a5ceedc7b928c5f96b7ff36398af04 Mon Sep 17 00:00:00 2001 From: Robert Hogan Date: Mon, 15 Aug 2011 10:43:43 +0200 Subject: HTTP internals: send password even if no username is set Setting only a password (no username) for HTTP requests does not result in the password being sent. Only cancel authentication if neither a username nor a password is set. Requiring a username was preventing user-less logins. Merge-request: 1250 Reviewed-by: Peter Hartmann Task-number: QTBUG-15566 (cherry picked from commit 6057909d2b73c2c3aa01a0e9216714ef07fb652f) Change-Id: I23a52362e3e8cf114219accca2b548ceb9dccff7 Reviewed-on: http://codereview.qt.nokia.com/2940 Reviewed-by: Qt Sanity Bot Reviewed-by: Peter Hartmann --- src/network/kernel/qauthenticator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 4f7f4ed80d..0423e2224d 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -395,7 +395,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QListoptions[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); - if (user.isEmpty()) + if (user.isEmpty() && password.isEmpty()) phase = Done; break; case Ntlm: @@ -406,7 +406,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QListoptions[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); if (options.value("stale").toLower() == "true") phase = Start; - if (user.isEmpty()) + if (user.isEmpty() && password.isEmpty()) phase = Done; break; } -- cgit v1.2.3 From d6d3a32a688da08fd0eab74c9b142e34a7676d17 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 15 Aug 2011 15:36:08 +0200 Subject: Configure: Set separate_debug_info for all modules separate_debug_info was previously stored in .qmake.cache, and therefore only affected qtbase. Store it as a QT_CONFIG setting instead, and add it to CONFIG for all Qt plugins and modules. Change-Id: I940c8cb30f1c42c85f4d0342e6a482f20677ff04 Reviewed-on: http://codereview.qt.nokia.com/2975 Reviewed-by: Qt Sanity Bot Reviewed-by: Oswald Buddenhagen Reviewed-by: Marius Storm-Olsen --- configure | 4 ++-- mkspecs/features/qt_module_config.prf | 2 ++ mkspecs/features/qt_plugin.prf | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f4691e12c2..0a18aafd8c 100755 --- a/configure +++ b/configure @@ -7113,10 +7113,10 @@ fi if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then QMakeVar add QMAKE_CFLAGS -g QMakeVar add QMAKE_CXXFLAGS -g - QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info" + QT_CONFIG="$QT_CONFIG separate_debug_info" fi if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then - QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy" + QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy" fi [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx" [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow" diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf index 7b5b5ad304..e110de0c5b 100644 --- a/mkspecs/features/qt_module_config.prf +++ b/mkspecs/features/qt_module_config.prf @@ -59,6 +59,8 @@ linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions contains(QT_CONFIG, largefile):CONFIG += largefile +contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info +contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy #mac frameworks mac:!static:contains(QT_CONFIG, qt_framework) { diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index c4eaab8147..824729ba52 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -9,6 +9,8 @@ CONFIG += qt plugin win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release TARGET = $$qtLibraryTarget($$TARGET) contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols +contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info +contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy load(qt_targets) -- cgit v1.2.3 From 5622e32ac9703c9e2c1ce3fb1d0ad77cdbc595f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Mon, 6 Jun 2011 15:03:09 +0200 Subject: Changing cursor position in all boundaries Merge-request: 1242 Reviewed-by: Harald Fernengel (cherry picked from commit 97c59df43d821e8e1784749e72f8ee7f90d46da2) Change-Id: Iccb872281a443e57ff3e492911490a8d7495bbdc Reviewed-on: http://codereview.qt.nokia.com/3004 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 2 +- tests/auto/qaccessibility/tst_qaccessibility.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 34f5be912f..ea5880c846 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1435,9 +1435,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType, if (offset >= characterCount()) return QString(); + cursor.setPosition(offset); switch (boundaryType) { case CharBoundary: - cursor.setPosition(offset); *startOffset = cursor.position(); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); *endOffset = cursor.position(); diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 1ab630d020..9043c4f771 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -1679,6 +1679,8 @@ void tst_QAccessibility::textEditTest() { { QTextEdit edit; + int startOffset; + int endOffset; QString text = "hello world\nhow are you today?\n"; edit.setText(text); edit.show(); @@ -1688,6 +1690,12 @@ void tst_QAccessibility::textEditTest() QCOMPARE(iface->childCount(), 6); QCOMPARE(iface->text(QAccessible::Value, 4), QString("hello world")); QCOMPARE(iface->text(QAccessible::Value, 5), QString("how are you today?")); + QCOMPARE(iface->textInterface()->textAtOffset(8, QAccessible2::WordBoundary, &startOffset, &endOffset), QString("world")); + QCOMPARE(startOffset, 6); + QCOMPARE(endOffset, 11); + QCOMPARE(iface->textInterface()->textAtOffset(14, QAccessible2::LineBoundary, &startOffset, &endOffset), QString("how are you today?")); + QCOMPARE(startOffset, 12); + QCOMPARE(endOffset, 30); QCOMPARE(iface->text(QAccessible::Value, 6), QString()); QCOMPARE(iface->textInterface()->characterCount(), 31); QFontMetrics fm(edit.font()); -- cgit v1.2.3 From ddb0b4a838092a7cdd64b9860a0751cf6d8155c3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 May 2011 18:50:35 +0200 Subject: Remove stray semicolon. Reviewed-by: TrustMe (cherry picked from commit f045367df74fbb5befeef81afa9102d0a6e59d54) Change-Id: Idcdb0115606447d74a49f2dd1101ad0ad7745db0 Reviewed-on: http://codereview.qt.nokia.com/3017 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 70a182f2df..b768904915 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -176,7 +176,7 @@ QString QAccessibleButton::text(Text t, int child) const break; } if (str.isEmpty()) - str = QAccessibleWidgetEx::text(t, child);; + str = QAccessibleWidgetEx::text(t, child); return qt_accStripAmp(str); } -- cgit v1.2.3 From fe59af2c002731ef994604b85f382891afd68b59 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 May 2011 18:51:59 +0200 Subject: QAccessibleToolButton::text should return accessibleName if set. This was most likely a copy and paste error. Reviewed-by: Denis Dzyubenko (cherry picked from commit e29ef45e404dbe888c0848eb28317a10b2aff768) Change-Id: I55dec5b9d101f9015f97cf453dc804d3cc22db8d Reviewed-on: http://codereview.qt.nokia.com/3018 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index b768904915..1b10a7b734 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -396,7 +396,7 @@ QString QAccessibleToolButton::text(Text t, int child) const QString str; switch (t) { case Name: - str = toolButton()->text(); + str = toolButton()->accessibleName(); if (str.isEmpty()) str = toolButton()->text(); break; -- cgit v1.2.3 From 7465b55d9c1c8586da7384fbf97604ed020a4fd3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 18 May 2011 21:46:26 +0200 Subject: Remove more inconsistencies with invisible. Visible status should not influence child count and other properties. Reviewed-by: Jan-Arve (cherry picked from commit b6a6953d21a95c402e8a5010c1ea5131509eeea3) Change-Id: I854349bfe48ab3d81bb9eee284965461b1e66aef Reviewed-on: http://codereview.qt.nokia.com/3019 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/rangecontrols.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp index fb53b10567..8868d53dc7 100644 --- a/src/plugins/accessible/widgets/rangecontrols.cpp +++ b/src/plugins/accessible/widgets/rangecontrols.cpp @@ -83,8 +83,6 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const /*! \reimp */ int QAccessibleAbstractSpinBox::childCount() const { - if (!abstractSpinBox()->isVisible()) - return 0; return ValueDown; } @@ -344,8 +342,6 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const /*! \reimp */ int QAccessibleDoubleSpinBox::childCount() const { - if (!doubleSpinBox()->isVisible()) - return 0; return ValueDown; } @@ -410,8 +406,6 @@ QVariant QAccessibleDoubleSpinBox::invokeMethodEx(QAccessible::Method, int, cons /*! \reimp */ QString QAccessibleDoubleSpinBox::text(Text textType, int child) const { - if (!doubleSpinBox()->isVisible()) - return QString(); switch (textType) { case Name: if (child == ValueUp) @@ -540,16 +534,12 @@ QRect QAccessibleScrollBar::rect(int child) const /*! \reimp */ int QAccessibleScrollBar::childCount() const { - if (!scrollBar()->isVisible()) - return 0; return LineDown; } /*! \reimp */ QString QAccessibleScrollBar::text(Text t, int child) const { - if (!scrollBar()->isVisible()) - return QString(); switch (t) { case Value: if (!child || child == Position) @@ -698,16 +688,12 @@ QRect QAccessibleSlider::rect(int child) const /*! \reimp */ int QAccessibleSlider::childCount() const { - if (!slider()->isVisible()) - return 0; return PageRight; } /*! \reimp */ QString QAccessibleSlider::text(Text t, int child) const { - if (!slider()->isVisible()) - return QString(); switch (t) { case Value: if (!child || child == 2) @@ -932,15 +918,11 @@ QRect QAccessibleDial::rect(int child) const int QAccessibleDial::childCount() const { - if (!dial()->isVisible()) - return 0; return SliderHandle; } QString QAccessibleDial::text(Text textType, int child) const { - if (!dial()->isVisible()) - return QString(); if (textType == Value && child >= Self && child <= SliderHandle) return QString::number(dial()->value()); if (textType == Name) { -- cgit v1.2.3 From 94b6f1ad52e967961c034b6954df25ab86bb962b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 14:00:38 +1000 Subject: test: skip tst_QMenu::pushButtonPopulateOnAboutToShow() for picky WM We are trying to test the case of having a widget right next to the edge of the screen, but the window manager is likely to forbid this geometry in many cases. When this happens, we can't continue the test. Change-Id: I6bce2263bdf444221c5303e83d70a254bbb9194c Reviewed-on: http://codereview.qt.nokia.com/2892 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qmenu/tst_qmenu.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 331f0e9a2d..73a74c6d75 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -883,12 +883,27 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow() b.show(); const QRect screen = QApplication::desktop()->screenGeometry(scrNumber); - b.move(10, screen.bottom()-b.height()-5); + QRect desiredGeometry = b.geometry(); + desiredGeometry.moveTopLeft(QPoint(10, screen.bottom()-b.height()-5)); + + b.setGeometry(desiredGeometry); QTest::qWaitForWindowShown(&b); + + if (b.geometry() != desiredGeometry) { + // We are trying to put the button very close to the edge of the screen, + // explicitly to test behavior when the popup menu goes off the screen. + // However a modern window manager is quite likely to reject this requested geometry + // (kwin in kde4 does, for example, since the button would probably appear behind + // or partially behind the taskbar). + // Your best bet is to run this test _without_ a WM. + QSKIP("Your window manager won't allow a window against the bottom of the screen", SkipAll); + } + QTimer::singleShot(300,lastMenu, SLOT(hide())); QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center()); QVERIFY(!lastMenu->geometry().intersects(b.geometry())); + // note: we're assuming that, if we previously got the desired geometry, we'll get it here too b.move(10, screen.bottom()-lastMenu->height()-5); QTimer::singleShot(300,lastMenu, SLOT(hide())); QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center()); -- cgit v1.2.3 From 29a8761cd810b246374f2647ed85cdbcdba57c3b Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Tue, 9 Aug 2011 15:44:41 +1000 Subject: Report an error when the version header can't be written If sync.profile points to a location that does not exist in the %modules section, the version header cannot be written. Report the error clearly so this problem can be identified. Change-Id: Ib681087f46362487ffb621221d33cf9b7e54df2f Reviewed-on: http://codereview.qt.nokia.com/2761 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Goddard --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index e5f93bd1c4..4eab929b30 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -900,7 +900,7 @@ foreach my $lib (@modules_to_sync) { # FIXME: this creates a file in the source location for shadow-builds my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h"; my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version)); - open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader"; + open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader" or die "Can't open $moduleversionheader for writing"; print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n"; print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n"; print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n"; -- cgit v1.2.3 From a3ce0eb6f19578bbc5b95602ebd731fbb80fec26 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 18 May 2011 18:20:38 +0200 Subject: When asking for relations, don't crash on children that don't return an interface. Reviewed-by: Jan-Arve (cherry picked from commit a816cb0d26ebcef54e9e61c72455509edf6c44b9) Change-Id: I8fed57eb0dfd5b67dee440b19c0ad5b9d7b3ae2d Reviewed-on: http://codereview.qt.nokia.com/3020 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessiblewidget.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 60ed48f76b..6a7d7e97cc 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -704,13 +704,16 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry, int sibCount = pIface->childCount(); QAccessibleInterface *candidate = 0; for (int i = 0; i < sibCount && entry; ++i) { - pIface->navigate(Child, i+1, &candidate); - Q_ASSERT(candidate); - if (candidate->relationTo(0, this, 0) & Label) + const int childId = pIface->navigate(Child, i+1, &candidate); + Q_ASSERT(childId >= 0); + if (childId > 0) + candidate = pIface; + if (candidate->relationTo(childId, this, 0) & Label) --entry; if (!entry) break; - delete candidate; + if (candidate != pIface) + delete candidate; candidate = 0; } if (!candidate) { -- cgit v1.2.3 From 7a16085a0f04a632cc4e6b6f08d674bcf25d6e60 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 17 Aug 2011 16:12:56 +1000 Subject: test: mark qlistview as insignificant for qpa, xcb The test fails on some qpa, xcb configurations, but not others. The difference between the passing and failing configurations is unknown. Task-number: QTBUG-20956 Change-Id: I0dc7c3e598ce1116ef5f2280d9285dda82f14f10 Reviewed-on: http://codereview.qt.nokia.com/3064 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qlistview/qlistview.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qlistview/qlistview.pro b/tests/auto/qlistview/qlistview.pro index e62ade63c1..21dfe57606 100644 --- a/tests/auto/qlistview/qlistview.pro +++ b/tests/auto/qlistview/qlistview.pro @@ -2,4 +2,4 @@ load(qttest_p4) SOURCES += tst_qlistview.cpp win32:!wince*: LIBS += -luser32 - +qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test -- cgit v1.2.3 From 8455b13feeb1441bc1b9d615ca8c67d8831c2d8c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 17 Aug 2011 15:43:36 +1000 Subject: test: fixed failure of tst_qgridlayout on small screens for non-QWS This test will fail if the window manager doesn't give the widget the geometry it requested. The test was verifying this precondition, but only on QWS. It doesn't make sense to limit this check to QWS, as other platforms can have small screens too. Change-Id: I3fec905c28ac2f85ebfd621f84f2269a673e318e Reviewed-on: http://codereview.qt.nokia.com/3061 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qgridlayout/tst_qgridlayout.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 6753f49fed..921168da8e 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -721,10 +721,8 @@ void tst_QGridLayout::spacingsAndMargins() QSize topsize = toplevel.size(); QSize minimumsize = vbox.totalMinimumSize(); -#if defined(Q_WS_QWS) if (topsize.width() < minimumsize.width() || topsize.height() < minimumsize.height()) QSKIP("The screen is too small to run this test case", SkipSingle); -#endif // We are relying on the order here... for (int pi = 0; pi < sizehinters.count(); ++pi) { -- cgit v1.2.3 From 4482dcda21bb765ad817384ab44180e9f0dcef3a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 11:30:32 +1000 Subject: test: mark tst_qwindowsurface as expected failure on qpa This test fails on qpa because QPixmap::grabWindow is not implemented for that platform. Task-number: QTBUG-20863 Change-Id: I19afdac231922113c1b491dee27c2ea91e121b85 Reviewed-on: http://codereview.qt.nokia.com/3123 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 11f7240ae7..5810ec3580 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -119,6 +119,9 @@ static void VERIFY_COLOR(const QRegion ®ion, const QColor &color) const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), rect.left(), rect.top(), rect.width(), rect.height()); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20863 QPixmap::grabWindow unimplemented for qpa", Abort); +#endif QCOMPARE(pixmap.size(), rect.size()); QPixmap expectedPixmap(pixmap); /* ensure equal formats */ expectedPixmap.fill(color); -- cgit v1.2.3 From 508433df15a6c56db914b5c3b49667552867b7a6 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 17 Aug 2011 15:40:46 +1000 Subject: Stabilize autotests using QTest::qWaitForWindowShown on non-X11. X11 is currently the only platform with a "real" implementation of QTest::qWaitForWindowShown. All others merely process events for some fixed interval, and assume that this is sufficient for the window to be placed. In practice, the current interval is too short for slower machines. Change-Id: I956cd747d0b30577f5072a9a08da88dabc76906c Reviewed-on: http://codereview.qt.nokia.com/3060 Reviewed-by: Qt Sanity Bot Reviewed-by: Sergio Ahumada Reviewed-by: Jason McDonald --- src/testlib/qtestsystem.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 6805bb7b6a..de20abeeee 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -76,12 +76,9 @@ namespace QTest #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(window); QCoreApplication::processEvents(); -#elif defined(Q_WS_QWS) - Q_UNUSED(window); - qWait(100); #else Q_UNUSED(window); - qWait(50); + qWait(200); #endif return true; } -- cgit v1.2.3 From f94410f104ad90de69bb1594e316d0e035871f71 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 13:26:41 +1000 Subject: test: marked tst_qsocketnotifier failures as expected Task-number: QTBUG-20982 Change-Id: Ie53ea9733dc357176ec829d3df971760c49afdbd Reviewed-on: http://codereview.qt.nokia.com/3126 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index c416ec7ccb..77836b4671 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -294,6 +294,7 @@ void tst_QSocketNotifier::posixSockets() QTestEventLoop::instance().enterLoop(3); QCOMPARE(readSpy.count(), 1); + QEXPECT_FAIL("", "QTBUG-20982 fails", Abort); QCOMPARE(writeSpy.count(), 0); QCOMPARE(errorSpy.count(), 0); @@ -321,11 +322,13 @@ void tst_QSocketNotifier::bogusFds() QSocketNotifier max(std::numeric_limits::max(), QSocketNotifier::Read); QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Invalid socket specified"); #ifndef Q_OS_WIN - QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); + // FIXME QTBUG-20982: this fails, and ignoreMessage can't be skipped or QEXPECT_FAILed + // QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); #endif QSocketNotifier min(std::numeric_limits::min(), QSocketNotifier::Write); #ifndef Q_OS_WIN - QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); + // FIXME QTBUG-20982: this fails, and ignoreMessage can't be skipped or QEXPECT_FAILed + // QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); #endif //bogus magic number is the first pseudo socket descriptor from symbian socket engine. QSocketNotifier bogus(0x40000000, QSocketNotifier::Exception); -- cgit v1.2.3 From becba0e71fafeb1582123ca5ae0876b4b6097a06 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 13:07:12 +1000 Subject: test: marked tst_qhttpnetworkconnection as insignificant This test crashes sometimes (but not always), making its result insignificant for the purpose of detecting regressions. Task-number: QTBUG-20981 Change-Id: I65e9c449ef342fad17be2364964774f229970aaa Reviewed-on: http://codereview.qt.nokia.com/3125 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro index 98511ac86e..1ce5d8a092 100644 --- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -9,3 +9,5 @@ symbian: TARGET.CAPABILITY = NetworkServices symbian: { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE } + +CONFIG+=insignificant_test # QTBUG-20981, crashes sometimes -- cgit v1.2.3 From c475870cb664f41fbadd5b13b2d4d63ec2891b94 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 13:47:38 +1000 Subject: tests: mark expected failures in qsslsocket_onDemandCertificates Task-number: QTBUG-20983 Change-Id: I5db2a92352037721802c127f2b47b52a514e0bfc Reviewed-on: http://codereview.qt.nokia.com/3127 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- .../tst_qsslsocket_onDemandCertificates_member.cpp | 1 + .../tst_qsslsocket_onDemandCertificates_static.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 7e1516218a..c884e78391 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -209,6 +209,7 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe QSslSocketPtr socket = newSocket(); this->socket = socket; socket->connectToHostEncrypted(host, 443); + QEXPECT_FAIL("", "QTBUG-20983 fails", Abort); QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); // not using any root certs again -> should not work diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp index 0338a2f34c..ec5dd8c2d6 100644 --- a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp +++ b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp @@ -210,6 +210,7 @@ void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMe QSslSocketPtr socket2 = newSocket(); this->socket = socket2; socket2->connectToHostEncrypted(host, 443); + QEXPECT_FAIL("", "QTBUG-20983 fails", Abort); QVERIFY2(socket2->waitForEncrypted(), qPrintable(socket2->errorString())); // not using any root certs again -> should not work -- cgit v1.2.3 From f61c496757c73f3b723a4fc4de26003251d5af8d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 13:51:55 +1000 Subject: test: mark tst_qcombobox as expected failure for qpa This test fails on qpa because it uses QCursor::setPos, which is unimplemented. Task-number: QTBUG-20753 Change-Id: I8b77261e9ddfa8f57cebdbd83c93a367a8cf8bea Reviewed-on: http://codereview.qt.nokia.com/3128 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qcombobox/tst_qcombobox.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 86c3445d5b..137438b3ef 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2487,6 +2487,10 @@ void tst_QComboBox::keyBoardNavigationWithMouse() int selection; GET_SELECTION(selection); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20753 QCursor::setPos doesn't work for qpa", Abort); +#endif + //since we moved the mouse is in the middle it should even be around 5; QVERIFY(selection > 3); -- cgit v1.2.3 From 6e7ad733a48dbf2a7f9e04482993d68f00d8edca Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 14:03:19 +1000 Subject: test: marked tst_macgui as insignificant This autotest sometimes passes and sometimes fails, making its result insignificant for the purpose of detecting regressions. Task-number: QTBUG-20984 Change-Id: I1454649384b60501be0bec238dfb18cfc85d5f54 Reviewed-on: http://codereview.qt.nokia.com/3129 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/macgui/macgui.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/macgui/macgui.pro b/tests/auto/macgui/macgui.pro index 7e40d81808..8a57a8c54b 100644 --- a/tests/auto/macgui/macgui.pro +++ b/tests/auto/macgui/macgui.pro @@ -11,3 +11,4 @@ QT = core-private gui-private requires(mac) +CONFIG+=insignificant_test # QTBUG-20984, fails unstably -- cgit v1.2.3 From 0f1aee99634d2f14f6137d39ecbfea1b17fb6c60 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 12:53:08 +1000 Subject: test: fixed failure of tst_qhostinfo Doing an async exit of the test event loop is unsafe - it means that a call to exitLoop may be left pending from one testfunction, causing future testfunctions to fail. This in fact was happening for the multipleDifferentLookups testfunction, which was running the event loop for two milliseconds at a time until a certain amount of lookups was done. It was common for the loop to timeout after the lookup had completed but before the async exitLoop had been processed. Make it simple, do a synchronous exitLoop. Change-Id: I2ffe6989bddc091ddd42b218a75f7a8ff160cf53 Reviewed-on: http://codereview.qt.nokia.com/3124 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qhostinfo/tst_qhostinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index 35c8d8d95c..1c7df1bdae 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -611,7 +611,7 @@ void tst_QHostInfo::resultsReady(const QHostInfo &hi) lookupDone = true; lookupResults = hi; lookupsDoneCounter++; - QMetaObject::invokeMethod(&QTestEventLoop::instance(), "exitLoop", Qt::QueuedConnection); + QTestEventLoop::instance().exitLoop(); } void tst_QHostInfo::abortHostLookup() -- cgit v1.2.3 From ee934d6c4c013e45c9f5c9cd188df0e341d19b6d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 11:16:54 +1000 Subject: tests: disabled failing qsharedmemory, qsystemsemaphore tests The `lackey' helper app was disabled by ccd5228a9380fbfa308a57365e4075f90010da00, but the tests which depend on it weren't disabled - so, of course, they fail. None of these tests will work until the circular dependency is fixed (the tests are in qtbase and they depend on qtscript which depends on qtbase). Change-Id: I8e41b4182f5ea57a71ec810a30a21ba1c7217db3 Reviewed-on: http://codereview.qt.nokia.com/3122 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qtipc/qtipc.pro | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/auto/qtipc/qtipc.pro b/tests/auto/qtipc/qtipc.pro index e7d2a55cd8..ac647e097b 100644 --- a/tests/auto/qtipc/qtipc.pro +++ b/tests/auto/qtipc/qtipc.pro @@ -1,5 +1,6 @@ TEMPLATE=subdirs -SUBDIRS=\ - qsharedmemory \ - qsystemsemaphore \ -# lackey \ should be moved to QtScript +# lackey depends on qtscript and the tests depend on lackey :( +#SUBDIRS=\ +# qsharedmemory \ +# qsystemsemaphore \ +# lackey -- cgit v1.2.3 From 7789b872da10fb43d418b40dbb80ad9da811c88c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 11:07:42 +1000 Subject: test: mark tst_qtextlayout as insignificant for qpa, xcb This autotest segfaults in this configuration. Task-number: QTBUG-20979 Change-Id: I7f038416d9333b690695f48e4ad01d52767f45cd Reviewed-on: http://codereview.qt.nokia.com/3120 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qtextlayout/qtextlayout.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/qtextlayout/qtextlayout.pro index 222e69b804..6bf0065e4f 100644 --- a/tests/auto/qtextlayout/qtextlayout.pro +++ b/tests/auto/qtextlayout/qtextlayout.pro @@ -9,3 +9,4 @@ symbian { TARGET.EPOCHEAPSIZE = 100000 20000000 } +qpa:contains(QT_CONFIG,qpa):CONFIG+=insignificant_test # QTBUG-20979 -- cgit v1.2.3 From 1ed19b09ce9b250f100f528ef07bf515225958c7 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 10:53:22 +1000 Subject: test: mark tst_qsystemtrayicon as expected failure for qpa QSystemTrayIcon is unimplemented for qpa. Task-number: QTBUG-20978 Change-Id: I63703b96e3d4572bae722120774de1565d475414 Reviewed-on: http://codereview.qt.nokia.com/3119 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp index 41115fdb34..a4a5ed7ad9 100644 --- a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -122,6 +122,10 @@ void tst_QSystemTrayIcon::getSetCheck() void tst_QSystemTrayIcon::supportsMessages() { +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20978 QSystemTrayIcon is unimplemented for qpa", Abort); +#endif + #if !defined(Q_WS_QWS) QCOMPARE(QSystemTrayIcon::supportsMessages(), true ); #else -- cgit v1.2.3 From 3817a82ebdb777e54e7594f205f3cd69a12cc874 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 09:40:55 +1000 Subject: test: fixed XPASS from tst_qstatictext on qpa These tests were written to compare two different methods of drawing text, to ensure the result was the same. However, if _both_ methods turned out to be complete no-ops, the test would unexpectedly pass, as it never verified that anything was painted. Add additional verification steps and QEXPECT_FAIL them on qpa for now. Task-number: QTBUG-20977 Change-Id: I1ce1b7c2bcd683fc9eeaeb8d1483268e56f5cf08 Reviewed-on: http://codereview.qt.nokia.com/3117 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qstatictext/tst_qstatictext.cpp | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 704f19b72d..5d5ed3c737 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -60,6 +60,8 @@ private: bool supportsTransformations() const; private slots: + void initTestCase(); + void init(); void cleanup(); @@ -99,8 +101,20 @@ private slots: void underlinedColor_qtbug20159(); void textDocumentColor(); + +private: + QImage const m_whiteSquare; }; +void tst_QStaticText::initTestCase() +{ + // a "blank" square; we compare against in our testfunctions to verify + // that we have actually painted something + QPixmap pm(1000, 1000); + pm.fill(Qt::white); + const_cast(m_whiteSquare) = pm.toImage(); +} + void tst_QStaticText::init() { } @@ -169,6 +183,7 @@ void tst_QStaticText::drawToPoint() p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -208,6 +223,7 @@ void tst_QStaticText::drawToRect() imageDrawStaticText.save("drawToRect_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -236,6 +252,17 @@ void tst_QStaticText::prepareToCorrectData() p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } +#if defined(DEBUG_SAVE_IMAGE) + imageDrawText.save("prepareToCorrectData_imageDrawText.png"); + imageDrawStaticText.save("prepareToCorrectData_imageDrawStaticText.png"); +#endif + +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20977 fails on qpa", Abort); +#endif + + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -264,6 +291,7 @@ void tst_QStaticText::prepareToWrongData() p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -304,6 +332,7 @@ void tst_QStaticText::setFont() imageDrawStaticText.save("setFont_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -326,6 +355,7 @@ void tst_QStaticText::setTextWidth() p.drawStaticText(QPointF(11, 12), text); } + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -352,6 +382,7 @@ void tst_QStaticText::translatedPainter() p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -399,6 +430,8 @@ void tst_QStaticText::rotatedPainter() imageDrawStaticText.save("rotatedPainter_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -427,6 +460,8 @@ void tst_QStaticText::scaledPainter() p.drawStaticText(QPointF(11, 12 - QFontMetricsF(p.font()).ascent()), text); } + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -508,6 +543,8 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter() imageDrawStaticText.save("rotatedScaledAndPainter_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -550,6 +587,8 @@ void tst_QStaticText::transformationChanged() imageDrawStaticText.save("transformationChanged_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); + if (!supportsTransformations()) QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); @@ -586,6 +625,7 @@ void tst_QStaticText::plainTextVsRichText() imageRichText.save("plainTextVsRichText_imageRichText.png"); #endif + QVERIFY(imagePlainText.toImage() != m_whiteSquare); QCOMPARE(imagePlainText, imageRichText); } @@ -706,6 +746,7 @@ void tst_QStaticText::drawStruckOutText() imageDrawStaticText.save("drawStruckOutText_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawText, imageDrawStaticText); } @@ -740,6 +781,7 @@ void tst_QStaticText::drawOverlinedText() imageDrawStaticText.save("drawOverlinedText_imageDrawStaticText.png"); #endif + QVERIFY(imageDrawText.toImage() != m_whiteSquare); QCOMPARE(imageDrawText, imageDrawStaticText); } -- cgit v1.2.3 From 0c9bd2829866b1071effcd53003c8356a3170094 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 09:24:09 +1000 Subject: test: mark tst_qrawfont as expected failure on qpa The necessary font handling code for qrawfont currently seems to be unimplemented for all qpa backends. Task-number: QTBUG-20976 Change-Id: I2b5c511936892e2754c0ee809b7a558f44d1d132 Reviewed-on: http://codereview.qt.nokia.com/3116 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qrawfont/tst_qrawfont.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp index eb78057b5e..1c18f2f1e8 100644 --- a/tests/auto/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/qrawfont/tst_qrawfont.cpp @@ -49,6 +49,8 @@ class tst_QRawFont: public QObject Q_OBJECT #if !defined(QT_NO_RAWFONT) private slots: + void init(); + void invalidRawFont(); void explicitRawFontNotLoadedInDatabase_data(); @@ -107,6 +109,20 @@ Q_DECLARE_METATYPE(QFont::Style) Q_DECLARE_METATYPE(QFont::Weight) Q_DECLARE_METATYPE(QFontDatabase::WritingSystem) +void tst_QRawFont::init() +{ +#ifdef Q_WS_QPA + // Loading fonts from a QByteArray seems unimplemented for all qpa plugins at time of writing; + // almost all testfunctions fail on qpa due to this, except these few: + const QByteArray func = QTest::currentTestFunction(); + if (func != "invalidRawFont" + && func != "explicitRawFontNotAvailableInSystem" + && func != "fromFont" + && func != "textLayout") + QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort); +#endif +} + void tst_QRawFont::invalidRawFont() { QRawFont font; @@ -292,6 +308,9 @@ void tst_QRawFont::textLayout() QString familyName = QString::fromLatin1("QtBidiTestFont"); QFont font(familyName); font.setPixelSize(18.0); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort); +#endif QCOMPARE(QFontInfo(font).family(), familyName); QTextLayout layout(QLatin1String("Foobar")); @@ -608,6 +627,11 @@ void tst_QRawFont::fromFont() QRawFont rawFont = QRawFont::fromFont(font, writingSystem); QVERIFY(rawFont.isValid()); + +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort); +#endif + QCOMPARE(rawFont.familyName(), familyName); QCOMPARE(rawFont.pixelSize(), 26.0); -- cgit v1.2.3 From 66fbd24849cf89782b4679e6376fd5429370d05a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 14:14:41 +1000 Subject: test: skipped unstable portion of tst_qcssparser on qpa This test unstably fails because font lookup is somewhat broken for qpa. Task-number: QTBUG-20986 Change-Id: Id4ebd35e979d8837d32b58e5ed9c1df3ac15827a Reviewed-on: http://codereview.qt.nokia.com/3130 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qcssparser/tst_qcssparser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index 23cb9e73f2..1e82431a48 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -1590,6 +1590,14 @@ void tst_QCssParser::extractFontFamily() QFont fnt; extractor.extractFont(&fnt, &adjustment); QFontInfo info(fnt); + +#ifdef Q_WS_QPA + // Note, we have to QSKIP rather than QEXPECT_FAIL because font lookup is broken + // such that it may work or not work depending on the order in which fonts were + // loaded from disk + QSKIP("QTBUG-20986 may fail on qpa", SkipSingle); +#endif + QTEST(info.family(), "expectedFamily"); } -- cgit v1.2.3 From 06657ea84bdee3293fa9110653100121fedf7e5f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 2 Aug 2011 12:05:21 +1000 Subject: test: fixed tst_qeventloop and removed CONFIG+=insignificant_test Throwing C++ exceptions through the event loop doesn't work if the Glib event loop is used, so conditionally skip that part of the test. Change-Id: Ic27ebf4eb75bd1cf7c7e35f371f29bcfc0e1844a Reviewed-on: http://codereview.qt.nokia.com/2471 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen Reviewed-by: Sergio Ahumada --- tests/auto/qeventloop/qeventloop.pro | 2 -- tests/auto/qeventloop/tst_qeventloop.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/auto/qeventloop/qeventloop.pro b/tests/auto/qeventloop/qeventloop.pro index 153cdbafe7..e3c170a33b 100644 --- a/tests/auto/qeventloop/qeventloop.pro +++ b/tests/auto/qeventloop/qeventloop.pro @@ -6,5 +6,3 @@ QT += network win32:!wince*:LIBS += -luser32 symbian:TARGET.CAPABILITY += NetworkServices - -CONFIG+=insignificant_test diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index 828366ba49..a702908549 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -203,6 +203,7 @@ private slots: void symbianNestedActiveSchedulerLoop(); void processEvents(); void exec(); + void throwInExec(); void reexec(); void exit(); void execAfterExit(); @@ -445,14 +446,35 @@ void tst_QEventLoop::exec() QCOMPARE(returnCode, 0); QCOMPARE(executor.returnCode, -1); } +} -#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN) && !defined(NO_EVENTLOOP_EXCEPTIONS) +void tst_QEventLoop::throwInExec() +{ +#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS) + QSKIP("Exceptions are disabled", SkipAll); +#elif defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) // Windows Mobile cannot handle cross library exceptions // qobject.cpp will try to rethrow the exception after handling // which causes gwes.exe to crash // Symbian doesn't propagate exceptions from eventloop, but converts them to // CActiveScheduler errors instead -> this test will hang. + QSKIP("This platform doesn't support propagating exceptions through the event loop", SkipAll); +#elif defined(Q_OS_LINUX) + // C++ exceptions can't be passed through glib callbacks. Skip the test if + // we're using the glib event loop. + QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className(); + if (dispatcher.contains("Glib")) { + QSKIP( + qPrintable(QString( + "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n" + "Try running with QT_NO_GLIB=1 in environment." + ).arg(QString::fromLatin1(dispatcher))), + SkipAll + ); + } +#endif + { // QEventLoop::exec() is exception safe QEventLoop eventLoop; @@ -474,7 +496,6 @@ void tst_QEventLoop::exec() } QCOMPARE(caughtExceptions, 2); } -#endif } void tst_QEventLoop::reexec() -- cgit v1.2.3 From 06bfd1feda1786d2df8a29aaad14f49d4e32cfea Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 10:33:57 +1000 Subject: test: fixed failure of tst_qstylesheetstyle on qpa Wait for window shown on _all_ platforms, not just X11. QEXPECT_FAIL a test which relies on QCursor::setPos, which is currently unimplemented for qpa (QTBUG-20753). Change-Id: I72412476afc7e52ccb6cab4306ff791b7e7d8d93 Reviewed-on: http://codereview.qt.nokia.com/3118 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 11d297cdac..a8dfea99d0 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -792,9 +792,7 @@ void tst_QStyleSheetStyle::focusColors() frame.setLayout(layout); frame.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&frame); -#endif + QTest::qWaitForWindowShown(&frame); QApplication::setActiveWindow(&frame); widget->setFocus(); QApplication::processEvents(); @@ -856,15 +854,17 @@ void tst_QStyleSheetStyle::hoverColors() QCursor::setPos(QPoint(0,0)); #endif -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&frame); -#endif + QTest::qWaitForWindowShown(&frame); QApplication::setActiveWindow(&frame); QTest::qWait(60); //move the mouse inside the widget, it should be colored QTest::mouseMove ( widget, QPoint(5,5)); QTest::qWait(60); +#ifdef Q_WS_QPA + QEXPECT_FAIL("", "QCursor::setPos / QTest::mouseMove is not implemented on qpa", Abort); +#endif + QVERIFY(widget->testAttribute(Qt::WA_UnderMouse)); QImage image(frame.width(), frame.height(), QImage::Format_ARGB32); @@ -960,9 +960,7 @@ void tst_QStyleSheetStyle::background() QWidget* widget = widgets[c]; widget->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(widget); -#endif + QTest::qWaitForWindowShown(widget); QImage image(widget->width(), widget->height(), QImage::Format_ARGB32); widget->render(&image); @@ -1303,9 +1301,7 @@ void tst_QStyleSheetStyle::emptyStyleSheet() layout.addWidget(new QGroupBox("some text", &w)); w.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&w); -#endif + QTest::qWaitForWindowShown(&w); //workaround the fact that the label sizehint is one pixel different the first time. label.setIndent(0); //force to recompute the sizeHint: w.setFocus(); -- cgit v1.2.3 From 8d16fcb912778c7d881ab735f2180dcb7081bb91 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 18 Aug 2011 14:21:32 +1000 Subject: test: marked tst_qfocusevent as insignificant on all platforms This was known to be unstable on mac, but appears to be unstable on Linux also. Task-number: QTBUG-20987 Change-Id: I760533c32cf13d24f8428f120813eb590b202182 Reviewed-on: http://codereview.qt.nokia.com/3131 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qfocusevent/qfocusevent.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qfocusevent/qfocusevent.pro b/tests/auto/qfocusevent/qfocusevent.pro index 1ebbf9b104..851d616173 100644 --- a/tests/auto/qfocusevent/qfocusevent.pro +++ b/tests/auto/qfocusevent/qfocusevent.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qfocusevent.cpp -mac*:CONFIG+=insignificant_test +CONFIG+=insignificant_test -- cgit v1.2.3 From 5af6a09b6faf55bf70237913f49dcf4ba2358f52 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 5 Jun 2011 04:16:13 -0700 Subject: Avoid bogus accessibility focus events from menus. Do not send accessibility focus events when menus are involved. There are focus events to preserve the old focus when showing a new popup window. Reviewed-by: Jan-Arve (cherry picked from commit 32079bb0b348ef5f7126e69be9bcfb249c1a6412) Change-Id: Id4838a3aede1d60a1850385e97660d085f055d64 Reviewed-on: http://codereview.qt.nokia.com/3021 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/kernel/qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 60f20644c7..231fc261d7 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6443,6 +6443,10 @@ void QWidget::setFocus(Qt::FocusReason reason) // The negation of the condition in setFocus_sys if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows +# endif +# ifdef Q_OS_UNIX + // menus update the focus manually and this would create bogus events + if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) # endif QAccessible::updateAccessibility(f, 0, QAccessible::Focus); #endif -- cgit v1.2.3 From 910e1bf4156575d23f3fd11bedf760987e278af1 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 20 Jun 2011 14:29:16 +0200 Subject: Fix typo in comment. (cherry picked from commit f067c2b3016182862e82805b13c7944ebe8671a9) Change-Id: Iac3673db666e53f5e1a20f95a59df15a6ad9c137 Reviewed-on: http://codereview.qt.nokia.com/3022 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index 432b536577..a250730493 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -2427,7 +2427,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason) } // There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored - // and isItIntersting which will mark the HIObject accociated with the element as ignored if the + // and isItInteresting which will mark the HIObject accociated with the element as ignored if the // QAccessible::Invisible state bit is set. QAInterface interface = accessibleHierarchyManager()->lookup(element); if (interface.isValid()) { -- cgit v1.2.3 From 90fd142c93ad5de5c642ae023222bd3a7b573aec Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 28 Jun 2011 14:37:10 +0200 Subject: Fix a11y crash: dock doesn't always have a widget. Also return dock widget title. Reviewed-by: Gabriel de Dietrich (cherry picked from commit 276d16583b80da2838f9af47e15fe3a83cdb0485) Change-Id: I8d66bec4212cc2b1df8c9b041375d7455c6a76a3 Reviewed-on: http://codereview.qt.nokia.com/3023 Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index ea5880c846..45322e53d8 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -73,6 +73,9 @@ QT_BEGIN_NAMESPACE using namespace QAccessible2; +QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); +QString Q_GUI_EXPORT qt_accHotKey(const QString &text); + QList childWidgets(const QWidget *widget, bool includeTopLevel) { if (widget == 0) @@ -1139,8 +1142,8 @@ int QAccessibleTitleBar::childCount() const QString QAccessibleTitleBar::text(Text t, int child) const { if (!child) { - if (t == Value) { - return dockWidget()->windowTitle(); + if (t == Name || t == Value) { + return qt_accStripAmp(dockWidget()->windowTitle()); } } return QString(); @@ -1171,17 +1174,19 @@ QAccessible::State QAccessibleTitleBar::state(int child) const return state; } -QRect QAccessibleTitleBar::rect (int child ) const +QRect QAccessibleTitleBar::rect(int child) const { bool mapToGlobal = true; QRect rect; if (child == 0) { if (dockWidget()->isFloating()) { rect = dockWidget()->frameGeometry(); - QPoint globalPos = dockWidget()->mapToGlobal( dockWidget()->widget()->rect().topLeft() ); - globalPos.ry()--; - rect.setBottom(globalPos.y()); - mapToGlobal = false; + if (dockWidget()->widget()) { + QPoint globalPos = dockWidget()->mapToGlobal(dockWidget()->widget()->rect().topLeft()); + globalPos.ry()--; + rect.setBottom(globalPos.y()); + mapToGlobal = false; + } } else { QDockWidgetLayout *layout = qobject_cast(dockWidget()->layout()); rect = layout->titleArea(); -- cgit v1.2.3 From a34771074c4a2475b4c6702b6aef147eb4908cfe Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 16 Aug 2011 14:53:33 +0200 Subject: Update changelog with Accessibility fixes. (cherry picked from commit b955efd392d2c1ec82a043df7b364af71e464078) Change-Id: I4a2c4f0abf5c9bef10fe0ce0f071473d9b3a3397 Reviewed-on: http://codereview.qt.nokia.com/3024 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- dist/changes-4.8.0 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index 1dcb56cd4e..7bd61556ef 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -72,6 +72,17 @@ QtGui like UltraLight. [QTBUG-19366] - Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls, which can be used as an optional mode for bi-directional text editing. [QTBUG-13859] + - Accessibility: Fix potential crash in QDockWidget. + - Accessibility: Fix crash when asking for relations of child accessibles. + - Accessibility: More consistency in reporting names (especially when widget is invisible). + - Accessibility: Make focus handling more consistent. + - Accessibility: Send updates when text changes. + - Accessibility: Add IAccessible2 events. + - Accessibility: Fix crash when accessing ItemViews during initialization. + - Accessibility: Make QTabWidget child hierarchy consistent. + - Accessibility: Report correct window title and application name. + - Accessibility: Return text attributes for QTextEdit. + QtNetwork --------- -- cgit v1.2.3 From 3cea6b22a6b1628cedd59a3286dcaa8088491660 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 22 May 2011 21:36:10 +0200 Subject: Add DBus VirtualObject to handle multiple paths. When a virtual object is registered with the SubPath option it will handle all dbus calls to itself and all child paths. It needs to reimplement handleMessage for that purpose. Introspection needs to be implemented manually in the introspect function. Reviewed-by: Thiago Macieira (cherry picked from commit b07919b3de8cff3e44b7271062372b14bcda5b83) (cherry picked from commit 997c2dfed7a04da2fac577f1c29b89bda4939e2d) (cherry picked from commit c676b7095d826dc2d006f52a4b234546af5e2137) Change-Id: I003007604b286af8000959756ce9d25c17306f5b Reviewed-on: http://codereview.qt.nokia.com/3051 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/dbus/dbus.pro | 6 +- src/dbus/qdbusconnection.cpp | 52 +++++- src/dbus/qdbusconnection.h | 16 +- src/dbus/qdbusconnection_p.h | 13 +- src/dbus/qdbusintegrator.cpp | 18 +- src/dbus/qdbusinternalfilters.cpp | 8 +- src/dbus/qdbusvirtualobject.cpp | 97 ++++++++++ src/dbus/qdbusvirtualobject.h | 81 +++++++++ tests/auto/qdbusconnection/tst_qdbusconnection.cpp | 202 ++++++++++++++++++++- tests/auto/qdbusinterface/tst_qdbusinterface.cpp | 71 +++++++- 10 files changed, 553 insertions(+), 11 deletions(-) create mode 100644 src/dbus/qdbusvirtualobject.cpp create mode 100644 src/dbus/qdbusvirtualobject.h diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index c91c2f6ad7..8669bb003a 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -52,7 +52,8 @@ PUB_HEADERS = qdbusargument.h \ qdbusmetatype.h \ qdbuspendingcall.h \ qdbuspendingreply.h \ - qdbuscontext.h + qdbuscontext.h \ + qdbusvirtualobject.h HEADERS += $$PUB_HEADERS \ qdbusconnection_p.h \ qdbusmessage_p.h \ @@ -95,4 +96,5 @@ SOURCES += qdbusconnection.cpp \ qdbuspendingreply.cpp \ qdbus_symbols.cpp \ qdbusservicewatcher.cpp \ - qdbusunixfiledescriptor.cpp + qdbusunixfiledescriptor.cpp \ + qdbusvirtualobject.cpp diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 9656903846..a55ff14fcf 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -221,6 +221,18 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP \sa registerObject(), QDBusAbstractAdaptor, {usingadaptors.html}{Using adaptors} */ +/*! + \internal + \since 4.8 + \enum QDBusConnection::VirtualObjectRegisterOption + Specifies the options for registering virtual objects with the connection. The possible values are: + + \value SingleNode register a virtual object to handle one path only + \value SubPath register a virtual object so that it handles all sub paths + + \sa registerVirtualObject(), QDBusVirtualObject +*/ + /*! \enum QDBusConnection::UnregisterMode The mode for unregistering an object path: @@ -801,9 +813,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis // this node exists // consider it free if there's no object here and the user is not trying to // replace the object sub-tree - if ((options & ExportChildObjects && !node->children.isEmpty()) || node->obj) + if (node->obj) return false; + if (options & QDBusConnectionPrivate::VirtualObject) { + // technically the check for children needs to go even deeper + if (options & SubPath) { + foreach (const QDBusConnectionPrivate::ObjectTreeNode &child, node->children) { + if (child.obj) + return false; + } + } + } else { + if ((options & ExportChildObjects && !node->children.isEmpty())) + return false; + } // we can add the object here node->obj = object; node->flags = options; @@ -813,6 +837,13 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis return true; } + // if a virtual object occupies this path, return false + if (node->obj && (node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) { + qDebug("Cannot register object at %s because QDBusVirtualObject handles all sub-paths.", + qPrintable(path)); + return false; + } + // find the position where we'd insert the node QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i)); @@ -840,6 +871,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis return false; } +/*! + \internal + \since 4.8 + Registers a QDBusTreeNode for a path. It can handle a path including all child paths, thus + handling multiple DBus nodes. + + To unregister a QDBusTreeNode use the unregisterObject() function with its path. +*/ +bool QDBusConnection::registerVirtualObject(const QString &path, QDBusVirtualObject *treeNode, + VirtualObjectRegisterOption options) +{ + int opts = options | QDBusConnectionPrivate::VirtualObject; + return registerObject(path, (QObject*) treeNode, (RegisterOptions) opts); +} + /*! Unregisters an object that was registered with the registerObject() at the object path given by \a path and, if \a mode is QDBusConnection::UnregisterTree, all of its sub-objects too. @@ -905,6 +951,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const while (node) { if (pathComponents.count() == i) return node->obj; + if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) + return node->obj; QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i)); @@ -917,6 +965,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const return 0; } + + /*! Returns a QDBusConnectionInterface object that represents the D-Bus server interface on this connection. diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index 4bdd055f52..8b126af77e 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -69,6 +69,7 @@ class QDBusError; class QDBusMessage; class QDBusPendingCall; class QDBusConnectionInterface; +class QDBusVirtualObject; class QObject; class QDBusConnectionPrivate; @@ -104,8 +105,8 @@ public: // Qt 4.2 had a misspelling here ExportAllSignal = ExportAllSignals, #endif - ExportChildObjects = 0x1000 + // Reserved = 0xff000000 }; enum UnregisterMode { UnregisterNode, @@ -113,6 +114,15 @@ public: }; Q_DECLARE_FLAGS(RegisterOptions, RegisterOption) + enum VirtualObjectRegisterOption { + SingleNode = 0x0, + SubPath = 0x1 + // Reserved = 0xff000000 + }; +#ifndef Q_QDOC + Q_DECLARE_FLAGS(VirtualObjectRegisterOptions, VirtualObjectRegisterOption) +#endif + enum ConnectionCapability { UnixFileDescriptorPassing = 0x0001 }; @@ -163,6 +173,9 @@ public: void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode); QObject *objectRegisteredAt(const QString &path) const; + bool registerVirtualObject(const QString &path, QDBusVirtualObject *object, + VirtualObjectRegisterOption options = SingleNode); + bool registerService(const QString &serviceName); bool unregisterService(const QString &serviceName); @@ -192,6 +205,7 @@ private: }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::VirtualObjectRegisterOptions) QT_END_NAMESPACE diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 12bcb21d9f..d481cf16ba 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -129,6 +129,11 @@ public: QByteArray matchRule; }; + enum TreeNodeType { + Object = 0x0, + VirtualObject = 0x01000000 + }; + struct ObjectTreeNode { typedef QVector DataList; @@ -143,8 +148,12 @@ public: { return QStringRef(&name) < other; } QString name; - QObject* obj; + union { + QObject *obj; + QDBusVirtualObject *treeNode; + }; int flags; + DataList children; }; @@ -333,7 +342,7 @@ extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name); extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo); // in qdbusinternalfilters.cpp -extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node); +extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path); extern QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg); extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index f3f3d0b8b2..2cde07ea47 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -57,6 +57,7 @@ #include "qdbusabstractadaptor.h" #include "qdbusabstractadaptor_p.h" #include "qdbusutil_p.h" +#include "qdbusvirtualobject.h" #include "qdbusmessage_p.h" #include "qdbuscontext_p.h" #include "qdbuspendingcall_p.h" @@ -442,7 +443,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, // walk the object tree const QDBusConnectionPrivate::ObjectTreeNode *node = root; - while (start < length && node && !(node->flags & QDBusConnection::ExportChildObjects)) { + while (start < length && node) { + if (node->flags & QDBusConnection::ExportChildObjects) + break; + if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) + break; int end = fullpath.indexOf(QLatin1Char('/'), start); end = (end == -1 ? length : end); QStringRef pathComponent(&fullpath, start, end - start); @@ -1328,7 +1333,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node, if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) { if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) { //qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg; - QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node)); + QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path())); send(reply); return true; } @@ -1375,6 +1380,15 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes // object may be null + if (node.flags & QDBusConnectionPrivate::VirtualObject) { + if (node.treeNode->handleMessage(msg, q(this))) { + return; + } else { + if (activateInternalFilters(node, msg)) + return; + } + } + if (pathStartPos != msg.path().length()) { node.flags &= ~QDBusConnection::ExportAllSignals; node.obj = findChildObject(&node, msg.path(), pathStartPos); diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index 2b142a72b8..b874a64644 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -56,6 +56,7 @@ #include "qdbusmetatype_p.h" #include "qdbusmessage_p.h" #include "qdbusutil_p.h" +#include "qdbusvirtualobject.h" #ifndef QT_NO_DBUS @@ -108,7 +109,7 @@ static QString generateSubObjectXml(QObject *object) // declared as extern in qdbusconnection_p.h -QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node) +QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path) { // object may be null @@ -155,6 +156,11 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node } } + // is it a virtual node that handles introspection itself? + if (node.flags & QDBusConnectionPrivate::VirtualObject) { + xml_data += node.treeNode->introspect(path); + } + xml_data += QLatin1String( propertiesInterfaceXml ); } diff --git a/src/dbus/qdbusvirtualobject.cpp b/src/dbus/qdbusvirtualobject.cpp new file mode 100644 index 0000000000..992ccbf229 --- /dev/null +++ b/src/dbus/qdbusvirtualobject.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdbusvirtualobject.h" + +#ifndef QT_NO_DBUS + +QT_BEGIN_NAMESPACE + +QDBusVirtualObject::QDBusVirtualObject(QObject *parent) : + QObject(parent) +{ +} + +QDBusVirtualObject::~QDBusVirtualObject() +{ +} + +QT_END_NAMESPACE + + +/*! + \internal + \class QDBusVirtualObject + \inmodule QtDBus + \since 4.8 + + \brief The QDBusVirtualObject class is used to handle several DBus paths with one class. +*/ + +/*! + \internal + \fn bool QDBusVirtualObject::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0 + + This function needs to handle all messages to the path of the + virtual object, when the SubPath option is specified. + The service, path, interface and methos are all part of the message. + Must return true when the message is handled, otherwise false (will generate dbus error message). +*/ + + +/*! + \internal + \fn QString QDBusVirtualObject::introspect(const QString &path) const + + This function needs to handle the introspection of the + virtual object. It must return xml of the form: + + \code + + + + \endcode + + If you pass the SubPath option, this introspection has to include all child nodes. + Otherwise QDBus handles the introspection of the child nodes. +*/ + +#endif // QT_NO_DBUS diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h new file mode 100644 index 0000000000..be323de720 --- /dev/null +++ b/src/dbus/qdbusvirtualobject.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSTREENODE_H +#define QDBUSTREENODE_H + +#include +#include +#include + +#ifndef QT_NO_DBUS + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusMessage; +class QDBusConnection; + +class QDBusVirtualObjectPrivate; +class Q_DBUS_EXPORT QDBusVirtualObject : public QObject +{ + Q_OBJECT +public: + explicit QDBusVirtualObject(QObject *parent = 0); + virtual ~QDBusVirtualObject(); + + virtual QString introspect(const QString &path) const = 0; + virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0; + +private: + Q_DECLARE_PRIVATE(QDBusVirtualObject) + Q_DISABLE_COPY(QDBusVirtualObject) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_DBUS +#endif diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp index e06e3a8b26..6490bfe973 100644 --- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp @@ -113,6 +113,10 @@ private slots: void serviceRegistrationRaceCondition(); + void registerVirtualObject(); + void callVirtualObject(); + void callVirtualObjectLocal(); + public: QString serviceName() const { return "com.trolltech.Qt.Autotests.QDBusConnection"; } bool callMethod(const QDBusConnection &conn, const QString &path); @@ -823,7 +827,6 @@ bool tst_QDBusConnection::callMethod(const QDBusConnection &conn, const QString { QDBusMessage msg = QDBusMessage::createMethodCall(conn.baseService(), path, "", "method"); QDBusMessage reply = conn.call(msg, QDBus::Block/*WithGui*/); - if (reply.type() != QDBusMessage::ReplyMessage) return false; if (MyObject::path == path) { @@ -1098,6 +1101,203 @@ void tst_QDBusConnection::serviceRegistrationRaceCondition() QCOMPARE(recv.count, 1); } +class VirtualObject: public QDBusVirtualObject +{ + Q_OBJECT +public: + VirtualObject() :success(true) {} + + QString introspect(const QString &path) const + { + return QString(); + } + + bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) { + ++callCount; + lastMessage = message; + + if (success) { + QDBusMessage reply = message.createReply(replyArguments); + connection.send(reply); + } + emit messageReceived(message); + return success; + } +signals: + void messageReceived(const QDBusMessage &message) const; + +public: + mutable QDBusMessage lastMessage; + QVariantList replyArguments; + mutable int callCount; + bool success; +}; + + +void tst_QDBusConnection::registerVirtualObject() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QString path = "/tree/node"; + QString childPath = "/tree/node/child"; + QString childChildPath = "/tree/node/child/another"; + + { + // Register VirtualObject that handles child paths. Unregister by going out of scope. + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + QCOMPARE(con.objectRegisteredAt(path), static_cast(&obj)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(&obj)); + QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast(&obj)); + } + QCOMPARE(con.objectRegisteredAt(path), static_cast(0)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(0)); + + { + // Register VirtualObject that handles child paths. Unregister by calling unregister. + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + QCOMPARE(con.objectRegisteredAt(path), static_cast(&obj)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(&obj)); + QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast(&obj)); + con.unregisterObject(path); + QCOMPARE(con.objectRegisteredAt(path), static_cast(0)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(0)); + } + + { + // Single node has no sub path handling. + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SingleNode)); + QCOMPARE(con.objectRegisteredAt(path), static_cast(&obj)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(0)); + } + + { + // Register VirtualObject that handles child paths. Try to register an object on a child path of that. + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + QCOMPARE(con.objectRegisteredAt(path), static_cast(&obj)); + + QObject objectAtSubPath; + QVERIFY(!con.registerObject(path, &objectAtSubPath)); + QVERIFY(!con.registerObject(childPath, &objectAtSubPath)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(&obj)); + } + + { + // Register object, make sure no SubPath handling object can be registered on a parent path. + QObject objectAtSubPath; + QVERIFY(con.registerObject(childPath, &objectAtSubPath)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(&objectAtSubPath)); + + VirtualObject obj; + QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + QCOMPARE(con.objectRegisteredAt(path), static_cast(0)); + } + QCOMPARE(con.objectRegisteredAt(path), static_cast(0)); + QCOMPARE(con.objectRegisteredAt(childPath), static_cast(0)); + QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast(0)); +} + +void tst_QDBusConnection::callVirtualObject() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusConnection con2 = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "con2"); + + QString path = "/tree/node"; + QString childPath = "/tree/node/child"; + + // register one object at root: + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + obj.callCount = 0; + obj.replyArguments << 42 << 47u; + + QObject::connect(&obj, SIGNAL(messageReceived(QDBusMessage)), &QTestEventLoop::instance(), SLOT(exitLoop())); + + QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello"); + QDBusPendingCall reply = con2.asyncCall(message); + + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(obj.callCount, 1); + QCOMPARE(obj.lastMessage.service(), con2.baseService()); + QCOMPARE(obj.lastMessage.interface(), QString()); + QCOMPARE(obj.lastMessage.path(), path); + reply.waitForFinished(); + QVERIFY(reply.isValid()); + QCOMPARE(reply.reply().arguments(), obj.replyArguments); + + // call sub path + QDBusMessage childMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "helloChild"); + obj.replyArguments.clear(); + obj.replyArguments << 99; + QDBusPendingCall childReply = con2.asyncCall(childMessage); + + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(obj.callCount, 2); + QCOMPARE(obj.lastMessage.service(), con2.baseService()); + QCOMPARE(obj.lastMessage.interface(), QString()); + QCOMPARE(obj.lastMessage.path(), childPath); + + childReply.waitForFinished(); + QVERIFY(childReply.isValid()); + QCOMPARE(childReply.reply().arguments(), obj.replyArguments); + + // let the call fail by having the virtual object return false + obj.success = false; + QDBusMessage errorMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "someFunc"); + QDBusPendingCall errorReply = con2.asyncCall(errorMessage); + + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTest::qWait(100); + QVERIFY(errorReply.isError()); + qDebug() << errorReply.reply().arguments(); + QCOMPARE(errorReply.reply().errorName(), QString("org.freedesktop.DBus.Error.UnknownObject")); + + QDBusConnection::disconnectFromBus("con2"); +} + +void tst_QDBusConnection::callVirtualObjectLocal() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QString path = "/tree/node"; + QString childPath = "/tree/node/child"; + + // register one object at root: + VirtualObject obj; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + obj.callCount = 0; + obj.replyArguments << 42 << 47u; + + QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello"); + QDBusMessage reply = con.call(message, QDBus::Block, 5000); + QCOMPARE(obj.callCount, 1); + QCOMPARE(obj.lastMessage.service(), con.baseService()); + QCOMPARE(obj.lastMessage.interface(), QString()); + QCOMPARE(obj.lastMessage.path(), path); + QCOMPARE(obj.replyArguments, reply.arguments()); + + obj.replyArguments << QString("alien abduction"); + QDBusMessage subPathMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "hello"); + QDBusMessage subPathReply = con.call(subPathMessage , QDBus::Block, 5000); + QCOMPARE(obj.callCount, 2); + QCOMPARE(obj.lastMessage.service(), con.baseService()); + QCOMPARE(obj.lastMessage.interface(), QString()); + QCOMPARE(obj.lastMessage.path(), childPath); + QCOMPARE(obj.replyArguments, subPathReply.arguments()); +} + QString MyObject::path; QTEST_MAIN(tst_QDBusConnection) diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index 96ab3113f3..9156818158 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -200,6 +200,7 @@ private slots: void invalidAfterServiceOwnerChanged(); void introspect(); void introspectUnknownTypes(); + void introspectVirtualObject(); void callMethod(); void invokeMethod(); void invokeMethodWithReturn(); @@ -361,7 +362,6 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() void tst_QDBusInterface::introspect() { - QDBusConnection con = QDBusConnection::sessionBus(); QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), TEST_INTERFACE_NAME); @@ -394,6 +394,75 @@ void tst_QDBusInterface::introspectUnknownTypes() QVERIFY(mo->indexOfProperty("prop1") != -1); int pidx = mo->indexOfProperty("prop1"); QCOMPARE(mo->property(pidx).typeName(), "QDBusRawType<0x7e>*"); + + + + QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), "/unknownTypes", "org.freedesktop.DBus.Introspectable", "Introspect"); + QDBusMessage reply = con.call(message, QDBus::Block, 5000); + qDebug() << "REPL: " << reply.arguments(); + +} + + +class VirtualObject: public QDBusVirtualObject +{ + Q_OBJECT +public: + VirtualObject() :success(true) {} + + QString introspect(const QString &path) const { + if (path == "/some/path/superNode") + return "zitroneneis"; + if (path == "/some/path/superNode/foo") + return " \n" + " \n" + " \n" ; + return QString(); + } + + bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) { + ++callCount; + lastMessage = message; + + if (success) { + QDBusMessage reply = message.createReply(replyArguments); + connection.send(reply); + } + emit messageReceived(message); + return success; + } +signals: + void messageReceived(const QDBusMessage &message) const; + +public: + mutable QDBusMessage lastMessage; + QVariantList replyArguments; + mutable int callCount; + bool success; +}; + +void tst_QDBusInterface::introspectVirtualObject() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + VirtualObject obj; + + obj.success = false; + + QString path = "/some/path/superNode"; + QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + + QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, "org.freedesktop.DBus.Introspectable", "Introspect"); + QDBusMessage reply = con.call(message, QDBus::Block, 5000); + QVERIFY(reply.arguments().at(0).toString().contains( + QRegExp(".*zitroneneis.*.*" + ".*\n" + ".*.*::testAndSetRelaxed(T *expectedValu asm volatile("0:\n" "ldrex %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" + "itt eq\n" "strexeq %[result], %[newValue], [%[_q_value]]\n" "teqeq %[result], #1\n" "beq 0b\n" -- cgit v1.2.3 From b5dbd1373beddb9eb4d761230c4b8d8d5ff4f6dc Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 5 Jul 2011 17:05:11 +0200 Subject: Implement text interface for QLineEdit. Add boundary helper functions to the QAccessibleTextInterface. Move LineEdit over to use QTextBoundaryFinder. Reviewed-by: Jan-Arve (cherry picked from commit c1ec1a95806cda54d5b4e9f8ed159a611bd75964) Change-Id: Ib93599c49110aab50debe1e3fb0073dd34071c87 Reviewed-on: http://codereview.qt.nokia.com/3025 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible2.cpp | 112 +++++++++++++++++++++++ src/plugins/accessible/widgets/simplewidgets.cpp | 40 +++++--- tests/auto/qaccessibility/tst_qaccessibility.cpp | 55 ++++++++++- 3 files changed, 194 insertions(+), 13 deletions(-) diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index 35b24f6e24..b62a7a4235 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -42,6 +42,7 @@ #include "qaccessible2.h" #include "qapplication.h" #include "qclipboard.h" +#include "qtextboundaryfinder.h" #ifndef QT_NO_ACCESSIBILITY @@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink */ + +/*! + \internal +*/ +QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + if (!boundary.isAtBoundary()) { + boundary.toPreviousBoundary(); + } + boundary.toPreviousBoundary(); + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + +/*! + \internal +*/ +QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + boundary.toNextBoundary(); + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + +/*! + \internal +*/ +QString Q_GUI_EXPORT textAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text) +{ + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = text.length(); + return text; + } + + QTextBoundaryFinder boundary(type, text); + boundary.setPosition(offset); + + if (!boundary.isAtBoundary()) { + boundary.toPreviousBoundary(); + } + *startOffset = boundary.position(); + boundary.toNextBoundary(); + *endOffset = boundary.position(); + + return text.mid(*startOffset, *endOffset - *startOffset); +} + QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface( QAccessibleInterface *accessibleInterface) : iface(accessibleInterface) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 1b10a7b734..179ec76299 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -68,6 +68,13 @@ extern QList childWidgets(const QWidget *widget, bool includeTopLevel QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); QString Q_GUI_EXPORT qt_accHotKey(const QString &text); +QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text); +QString Q_GUI_EXPORT textAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text); +QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset, const QString& text); + /*! \class QAccessibleButton \brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets. @@ -804,25 +811,34 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset) return lineEdit()->text().mid(startOffset, endOffset - startOffset); } -QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/, - int * /*startOffset*/, int * /*endOffset*/) +QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType, + int *startOffset, int *endOffset) { - // TODO - return QString(); + if (lineEdit()->echoMode() != QLineEdit::Normal) { + *startOffset = *endOffset = -1; + return QString(); + } + return textBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } -QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/, - int * /*startOffset*/, int * /*endOffset*/) +QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType, + int *startOffset, int *endOffset) { - // TODO - return QString(); + if (lineEdit()->echoMode() != QLineEdit::Normal) { + *startOffset = *endOffset = -1; + return QString(); + } + return textAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } -QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/, - int * /*startOffset*/, int * /*endOffset*/) +QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType, + int *startOffset, int *endOffset) { - // TODO - return QString(); + if (lineEdit()->echoMode() != QLineEdit::Normal) { + *startOffset = *endOffset = -1; + return QString(); + } + return textAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } void QAccessibleLineEdit::removeSelection(int selectionIndex) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 9043c4f771..dc84e8e074 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2031,8 +2031,61 @@ void tst_QAccessibility::lineEditTest() delete iface; delete le; delete le2; - delete toplevel; QTestAccessibility::clearEvents(); + + // IA2 + QString cite = "I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself. --Oscar Wilde"; + QLineEdit *le3 = new QLineEdit(cite, toplevel); + iface = QAccessible::queryAccessibleInterface(le3); + QAccessibleTextInterface* textIface = iface->textInterface(); + le3->deselect(); + le3->setCursorPosition(3); + QCOMPARE(textIface->cursorPosition(), 3); + QCOMPARE(textIface->selectionCount(), 0); + int start, end; + + QCOMPARE(textIface->text(0, 8), QString::fromLatin1("I always")); + QCOMPARE(textIface->textAtOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("I")); + QCOMPARE(start, 0); + QCOMPARE(end, 1); + QCOMPARE(textIface->textBeforeOffset(0, QAccessible2::CharBoundary,&start,&end), QString()); + QCOMPARE(textIface->textAfterOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1(" ")); + QCOMPARE(start, 1); + QCOMPARE(end, 2); + + QCOMPARE(textIface->textAtOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("a")); + QCOMPARE(start, 5); + QCOMPARE(end, 6); + QCOMPARE(textIface->textBeforeOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("w")); + QCOMPARE(textIface->textAfterOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("y")); + + QCOMPARE(textIface->textAtOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always")); + QCOMPARE(start, 2); + QCOMPARE(end, 8); + + QCOMPARE(textIface->textAtOffset(2, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always")); + QCOMPARE(textIface->textAtOffset(7, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always")); + QCOMPARE(textIface->textAtOffset(8, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); + QCOMPARE(textIface->textAtOffset(25, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("advice")); + QCOMPARE(textIface->textAtOffset(92, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("oneself")); + + QCOMPARE(textIface->textBeforeOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); + QCOMPARE(textIface->textAfterOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); + QCOMPARE(textIface->textAtOffset(5, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("I always pass on good advice. ")); + QCOMPARE(start, 0); + QCOMPARE(end, 30); + + QCOMPARE(textIface->textBeforeOffset(40, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("I always pass on good advice. ")); + QCOMPARE(textIface->textAfterOffset(5, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("It is the only thing to do with it. ")); + + QCOMPARE(textIface->textAtOffset(5, QAccessible2::ParagraphBoundary,&start,&end), cite); + QCOMPARE(start, 0); + QCOMPARE(end, cite.length()); + QCOMPARE(textIface->textAtOffset(5, QAccessible2::LineBoundary,&start,&end), cite); + QCOMPARE(textIface->textAtOffset(5, QAccessible2::NoBoundary,&start,&end), cite); + + delete iface; + delete toplevel; } void tst_QAccessibility::workspaceTest() -- cgit v1.2.3 From 2c91710679556f1abc00a728d71137a33e0c6c52 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 8 Jul 2011 01:22:39 -0700 Subject: Rename textBeforeOffsetFromString to start with q. Exported functions should start with q. Reviewed-by: TrustMe (cherry picked from commit 4fcb7c233c3c8d748d66bf698df059ad7546ae88) Change-Id: Idc53d3ec49f73227a9fd12b6b88aade35c7cdf25 Reviewed-on: http://codereview.qt.nokia.com/3026 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible2.cpp | 6 +++--- src/plugins/accessible/widgets/simplewidgets.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index b62a7a4235..078ff13e2c 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -137,7 +137,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; @@ -175,7 +175,7 @@ QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::Bounda /*! \internal */ -QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; @@ -210,7 +210,7 @@ QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::Boundar /*! \internal */ -QString Q_GUI_EXPORT textAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 179ec76299..5730b4d896 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -68,11 +68,11 @@ extern QList childWidgets(const QWidget *widget, bool includeTopLevel QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); QString Q_GUI_EXPORT qt_accHotKey(const QString &text); -QString Q_GUI_EXPORT textBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text); -QString Q_GUI_EXPORT textAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text); -QString Q_GUI_EXPORT textAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text); /*! @@ -818,7 +818,7 @@ QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryT *startOffset = *endOffset = -1; return QString(); } - return textBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType, @@ -828,7 +828,7 @@ QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryTy *startOffset = *endOffset = -1; return QString(); } - return textAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType, @@ -838,7 +838,7 @@ QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType, *startOffset = *endOffset = -1; return QString(); } - return textAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); } void QAccessibleLineEdit::removeSelection(int selectionIndex) -- cgit v1.2.3 From b0c1c98f76e2006a67da0b8455b44205753be30b Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 30 Jun 2011 17:31:36 +0200 Subject: Use name for combobox on Unix. This is more conforming to the AT-SPI specs. Also we have working relations for the label when a buddy is set. Reviewed-by: Gabi (cherry picked from commit 8be3168aa2f300f9a93a53b417704f3f10b1dc8b) Change-Id: I1831d5063b003df2d209aba99d54558b6493a3e9 Reviewed-on: http://codereview.qt.nokia.com/3027 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/gui/widgets/qcombobox.cpp | 18 ++++++++++++++++++ src/plugins/accessible/widgets/complexwidgets.cpp | 12 +++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index bf6730e9e3..650227214a 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -80,6 +80,9 @@ #if defined(Q_WS_S60) #include "private/qt_s60_p.h" #endif +#ifndef QT_NO_ACCESSIBILITY +#include "qaccessible.h" +#endif QT_BEGIN_NAMESPACE @@ -1018,6 +1021,9 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn } q->update(); } +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged); +#endif } void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end) @@ -1271,6 +1277,9 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) Q_Q(QComboBox); emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(itemText(index)); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged); +#endif } QString QComboBoxPrivate::itemText(const QModelIndex &index) const @@ -2635,6 +2644,9 @@ void QComboBox::clear() { Q_D(QComboBox); d->model->removeRows(0, d->model->rowCount(d->root), d->root); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged); +#endif } /*! @@ -2651,6 +2663,9 @@ void QComboBox::clearEditText() Q_D(QComboBox); if (d->lineEdit) d->lineEdit->clear(); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged); +#endif } /*! @@ -2661,6 +2676,9 @@ void QComboBox::setEditText(const QString &text) Q_D(QComboBox); if (d->lineEdit) d->lineEdit->setText(text); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged); +#endif } /*! diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp index 8843d3edcb..563d3b9472 100644 --- a/src/plugins/accessible/widgets/complexwidgets.cpp +++ b/src/plugins/accessible/widgets/complexwidgets.cpp @@ -1776,16 +1776,12 @@ QString QAccessibleComboBox::text(Text t, int child) const switch (t) { case Name: +#ifndef Q_WS_X11 // on Linux we use relations for this, name is text (fall through to Value) if (child == OpenList) str = QComboBox::tr("Open"); else str = QAccessibleWidgetEx::text(t, 0); break; -#ifndef QT_NO_SHORTCUT - case Accelerator: - if (child == OpenList) - str = (QString)QKeySequence(Qt::Key_Down); - // missing break? #endif case Value: if (comboBox()->isEditable()) @@ -1793,6 +1789,12 @@ QString QAccessibleComboBox::text(Text t, int child) const else str = comboBox()->currentText(); break; +#ifndef QT_NO_SHORTCUT + case Accelerator: + if (child == OpenList) + str = (QString)QKeySequence(Qt::Key_Down); + break; +#endif default: break; } -- cgit v1.2.3 From 1e0d1c5f2996da33db1e3e4c1f7c6ef3e1f29416 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 17 Aug 2011 14:47:42 +1000 Subject: Fixed broken lookup of fallback fonts on qpa Loading of fallback fonts from the font cache was broken. While iterating through fallback fonts, we would incorrectly skip any fonts which were already in the cache. This would cause unstable lookup results for some fonts, depending on the order in which fonts were loaded during the current process. Change-Id: I56a6a07e93196ed14f33f4cc181e41c5b8f19498 Reviewed-on: http://codereview.qt.nokia.com/3059 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang Reviewed-by: Rohan McGovern --- src/gui/text/qfontdatabase_qpa.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index 6b6f4f1a54..032a42b9b1 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -292,7 +292,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!engine) { if (!request.family.isEmpty()) { QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script)); - for (int i = 0; i < fallbacks.size(); i++) { + for (int i = 0; !engine && i < fallbacks.size(); i++) { QFontDef def = request; def.family = fallbacks.at(i); QFontCache::Key key(def,script); @@ -306,7 +306,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size); if (engine) { initFontDef(desc, def, &engine->fontDef); - break; } } } -- cgit v1.2.3 From b9224af92c128f7cc66bef11849db046f10dc81f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 1 Jun 2011 15:33:38 +0200 Subject: Enablers for using QGlyphRun in SceneGraph Several required fixes and changes to fix problems that arose when porting SceneGraph's QSGTextInput and QSGTextEdit to use QSGTextNode, especially related to having selections on the text. Also fixes crashes with the threaded renderer on Mac OS X when using the TextEdit or TextInput elements. Task-number: QTBUG-18019, QTBUG-20017 Change-Id: I67f24465352daa1d2cb12b6d2f378feb676c9804 Reviewed-on: http://codereview.qt.nokia.com/2864 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta Reviewed-by: Jiang Jiang --- src/gui/text/qglyphrun.cpp | 45 +++++++++++++++++++++++++++- src/gui/text/qglyphrun.h | 3 ++ src/gui/text/qglyphrun_p.h | 2 ++ src/gui/text/qtextcontrol.cpp | 24 ++++++++++++--- src/gui/text/qtextcontrol_p.h | 3 ++ src/gui/text/qtextlayout.cpp | 63 +++++++++++++++++++++++++++++++++------- src/gui/text/qtextobject.cpp | 17 ++++++----- src/gui/text/qtextobject.h | 2 +- src/gui/widgets/qlinecontrol.cpp | 43 +++++++++++++++++++-------- src/gui/widgets/qlinecontrol_p.h | 33 +++++++++++++++++++-- 10 files changed, 196 insertions(+), 39 deletions(-) diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index cc825525c4..be9c058693 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -45,6 +45,7 @@ #include "qglyphrun.h" #include "qglyphrun_p.h" +#include QT_BEGIN_NAMESPACE @@ -343,12 +344,44 @@ void QGlyphRun::setStrikeOut(bool strikeOut) } /*! - Returns the smallest rectangle that contains all glyphs in this QGlyphRun. + Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle + will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the + glyphs in the glyph run will be returned instead. + + \note Unless you are implementing text shaping, you should not have to use this function. + It is used specifically when the QGlyphRun should represent an area which is smaller than the + area of the glyphs it contains. This could happen e.g. if the glyph run is retrieved by calling + QTextLayout::glyphRuns() and the specified range only includes part of a ligature (where two or + more characters are combined to a single glyph.) When this is the case, the bounding rect should + only include the appropriate part of the ligature glyph, based on a calculation of the average + width of the characters in the ligature. + + In order to support such a case (an example is selections which should be drawn with a different + color than the main text color), it is necessary to clip the painting mechanism to the rectangle + returned from boundingRect() to avoid drawing the entire ligature glyph. + + \sa boundingRect() + + \since 5.0 +*/ +void QGlyphRun::setBoundingRect(const QRectF &boundingRect) +{ + detach(); + d->boundingRect = boundingRect; +} + +/*! + Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect + has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect + will be calculated based on the font metrics of the glyphs in the glyph run. \since 5.0 */ QRectF QGlyphRun::boundingRect() const { + if (!d->boundingRect.isEmpty()) + return d->boundingRect; + qreal minX, minY, maxX, maxY; for (int i=0; iglyphPositions.size(), d->glyphIndexes.size()); ++i) { @@ -371,6 +404,16 @@ QRectF QGlyphRun::boundingRect() const return QRectF(QPointF(minX, minY), QPointF(maxX, maxY)); } +/*! + Returns true if the QGlyphRun does not contain any glyphs. + + \since 5.0 +*/ +bool QGlyphRun::isEmpty() const +{ + return d->glyphIndexes.isEmpty(); +} + QT_END_NAMESPACE #endif // QT_NO_RAWFONT diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index b4f02f0d87..da88bc72f9 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -91,8 +91,11 @@ public: void setStrikeOut(bool strikeOut); bool strikeOut() const; + void setBoundingRect(const QRectF &boundingRect); QRectF boundingRect() const; + bool isEmpty() const; + private: friend class QGlyphRunPrivate; friend class QTextLine; diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index a7745e68ce..b632678971 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -83,6 +83,7 @@ public: , glyphIndexes(other.glyphIndexes) , glyphPositions(other.glyphPositions) , rawFont(other.rawFont) + , boundingRect(other.boundingRect) , overline(other.overline) , underline(other.underline) , strikeOut(other.strikeOut) @@ -96,6 +97,7 @@ public: QVector glyphIndexes; QVector glyphPositions; QRawFont rawFont; + QRectF boundingRect; uint overline : 1; uint underline : 1; diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 424d1979b2..c29379ed28 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -409,6 +409,8 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); q->setCursorWidth(-1); + + QObject::connect(q, SIGNAL(updateCursorRequest(QRectF)), q, SIGNAL(updateRequest(QRectF))); } void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document) @@ -547,7 +549,7 @@ void QTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode) void QTextControlPrivate::repaintCursor() { Q_Q(QTextControl); - emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor)); + emit q->updateCursorRequest(cursorRectPlusUnicodeDirectionMarkers(cursor)); } void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection) @@ -565,9 +567,16 @@ void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelect differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor); emit q->updateRequest(q->selectionRect(differenceSelection)); } else { - if (!oldSelection.isNull()) - emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection)); - emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor)); + if (!oldSelection.hasSelection() && !cursor.hasSelection()) { + if (!oldSelection.isNull()) + emit q->updateCursorRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection)); + emit q->updateCursorRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor)); + + } else { + if (!oldSelection.isNull()) + emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection)); + emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor)); + } } } @@ -2959,6 +2968,12 @@ void QTextControl::setPalette(const QPalette &pal) d->palette = pal; } +bool QTextControl::cursorOn() const +{ + Q_D(const QTextControl); + return d->cursorOn; +} + QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext(QWidget *widget) const { Q_D(const QTextControl); @@ -3146,6 +3161,7 @@ void QTextEditMimeData::setup() const fragment = QTextDocumentFragment(); } + QT_END_NAMESPACE #include "moc_qtextcontrol_p.cpp" diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index cbf26d2122..c5ed0ee1e0 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -226,6 +226,7 @@ Q_SIGNALS: void cursorPositionChanged(); // control signals + void updateCursorRequest(const QRectF &rect = QRectF()); void updateRequest(const QRectF &rect = QRectF()); void documentSizeChanged(const QSizeF &); void blockCountChanged(int newBlockCount); @@ -258,6 +259,8 @@ public: bool setFocusToNextOrPreviousAnchor(bool next); bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor); + bool cursorOn() const; + protected: virtual void timerEvent(QTimerEvent *e); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 2535faddc3..8c5e63da54 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -42,6 +42,7 @@ #include "qtextlayout.h" #include "qtextengine_p.h" +#include #include #include #include @@ -2108,8 +2109,10 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q } +#if !defined(QT_NO_RAWFONT) static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &glyphLayout, - const QPointF &pos, const QTextItem::RenderFlags &flags) + const QPointF &pos, const QTextItem::RenderFlags &flags, + const QFixed &selectionX, const QFixed &selectionWidth) { QGlyphRun glyphRun; @@ -2117,6 +2120,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g QRawFont font; QRawFontPrivate *fontD = QRawFontPrivate::get(font); fontD->fontEngine = fontEngine; + fontD->thread = QThread::currentThread(); fontD->fontEngine->ref.ref(); #if defined(Q_WS_WIN) @@ -2151,13 +2155,27 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g positionsArray); Q_ASSERT(glyphsArray.size() == positionsArray.size()); + qreal fontHeight = font.ascent() + font.descent(); + qreal minY; + qreal maxY; QVector glyphs; QVector positions; for (int i=0; i QTextLine::glyphRuns(int from, int length) const { const QScriptLine &line = eng->lines[i]; @@ -2196,7 +2215,14 @@ QList QTextLine::glyphRuns(int from, int length) const if (length < 0) length = textLength(); - QTextLineItemIterator iterator(eng, i); + if (length == 0) + return QList(); + + QTextLayout::FormatRange selection; + selection.start = from; + selection.length = length; + + QTextLineItemIterator iterator(eng, i, QPointF(), &selection); qreal y = line.y.toReal() + line.base().toReal(); QList glyphRuns; while (!iterator.atEnd()) { @@ -2206,7 +2232,10 @@ QList QTextLine::glyphRuns(int from, int length) const QPointF pos(iterator.x.toReal(), y); if (from >= 0 && length >= 0 && - (from >= si.position + eng->length(&si) || from + length <= si.position)) { + (from >= si.position + eng->length(&si) + || from + length <= si.position + || from + length <= iterator.itemStart + || from >= iterator.itemEnd)) { continue; } @@ -2235,19 +2264,22 @@ QList QTextLine::glyphRuns(int from, int length) const ? si.num_glyphs - 1 : logClusters[relativeTo]; + int itemGlyphsStart = logClusters[iterator.itemStart - si.position]; + int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position]; + QGlyphLayout glyphLayout = eng->shapedGlyphs(&si); // Calculate new x position of glyph layout for a subset. This becomes somewhat complex // when we're breaking a RTL script item, since the expected position passed into // getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run. if (relativeFrom != (iterator.itemStart - si.position) && !rtl) { - for (int i=0; iglyphsEnd; --i) { + for (int i=itemGlyphsEnd; i>glyphsEnd; --i) { QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), glyphLayout.advances_y[i].toReal()); @@ -2256,6 +2288,10 @@ QList QTextLine::glyphRuns(int from, int length) const glyphLayout = glyphLayout.mid(glyphsStart, glyphsEnd - glyphsStart + 1); + QFixed x; + QFixed width; + iterator.getSelectionBounds(&x, &width); + if (glyphLayout.numGlyphs > 0) { QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script); if (mainFontEngine->type() == QFontEngine::Multi) { @@ -2270,7 +2306,7 @@ QList QTextLine::glyphRuns(int from, int length) const QGlyphLayout subLayout = glyphLayout.mid(start, end - start); glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which), - subLayout, pos, flags)); + subLayout, pos, flags, x, width)); for (int i = 0; i < subLayout.numGlyphs; i++) { pos += QPointF(subLayout.advances_x[i].toReal(), subLayout.advances_y[i].toReal()); @@ -2281,10 +2317,15 @@ QList QTextLine::glyphRuns(int from, int length) const } QGlyphLayout subLayout = glyphLayout.mid(start, end - start); - glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which), - subLayout, pos, flags)); + QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which), + subLayout, pos, flags, x, width); + if (!glyphRun.isEmpty()) + glyphRuns.append(glyphRun); } else { - glyphRuns.append(glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags)); + QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags, x, + width); + if (!glyphRun.isEmpty()) + glyphRuns.append(glyphRun); } } } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index cea5eac465..d641266367 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1667,21 +1667,24 @@ QTextBlock::iterator &QTextBlock::iterator::operator--() \sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun() */ #if !defined(QT_NO_RAWFONT) -QList QTextFragment::glyphRuns() const +QList QTextFragment::glyphRuns(int pos, int len) const { if (!p || !n) return QList(); - int pos = position(); - int len = length(); - if (len == 0) - return QList(); - - int blockNode = p->blockMap().findNode(pos); + int blockNode = p->blockMap().findNode(position()); const QTextBlockData *blockData = p->blockMap().fragment(blockNode); QTextLayout *layout = blockData->layout; + int blockPosition = p->blockMap().position(blockNode); + if (pos < 0) + pos = position() - blockPosition; + if (len < 0) + len = length(); + if (len == 0) + return QList(); + QList ret; for (int i=0; ilineCount(); ++i) { QTextLine textLine = layout->lineAt(i); diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 9c5cc13539..c2b46e4d12 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -317,7 +317,7 @@ public: QString text() const; #if !defined(QT_NO_RAWFONT) - QList glyphRuns() const; + QList glyphRuns(int from = -1, int length = -1) const; #endif private: diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 92c84d72e0..9b7d9b83ad 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -75,6 +75,28 @@ static int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; password characters. */ +/*! + \internal + + Updates the internal text layout. Returns the ascent of the + created QTextLine. +*/ +int QLineControl::redoTextLayout() const +{ + m_textLayout.clearLayout(); + + m_textLayout.beginLayout(); + QTextLine l = m_textLayout.createLine(); + m_textLayout.endLayout(); + +#if defined(Q_WS_MAC) + if (m_threadChecks) + m_textLayoutThread = QThread::currentThread(); +#endif + + return qRound(l.ascent()); +} + /*! \internal @@ -124,15 +146,12 @@ void QLineControl::updateDisplayText(bool forceUpdate) m_textLayout.setText(str); - QTextOption option; + QTextOption option = m_textLayout.textOption(); option.setTextDirection(m_layoutDirection); option.setFlags(QTextOption::IncludeTrailingSpaces); m_textLayout.setTextOption(option); - m_textLayout.beginLayout(); - QTextLine l = m_textLayout.createLine(); - m_textLayout.endLayout(); - m_ascent = qRound(l.ascent()); + m_ascent = redoTextLayout(); if (str != orig || forceUpdate) emit displayTextChanged(str); @@ -228,7 +247,7 @@ void QLineControl::del() if (hasSelectedText()) { removeSelectedText(); } else { - int n = m_textLayout.nextCursorPosition(m_cursor) - m_cursor; + int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; while (n--) internalDelete(); } @@ -357,7 +376,7 @@ void QLineControl::updatePasswordEchoEditing(bool editing) */ int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const { - return m_textLayout.lineAt(0).xToCursor(x, betweenOrOn); + return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); } /*! @@ -368,7 +387,7 @@ int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const */ QRect QLineControl::cursorRect() const { - QTextLine l = m_textLayout.lineAt(0); + QTextLine l = textLayout()->lineAt(0); int c = m_cursor; if (m_preeditCursor != -1) c += m_preeditCursor; @@ -578,14 +597,14 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl } if (flags & DrawText) - m_textLayout.draw(painter, offset, selections, clip); + textLayout()->draw(painter, offset, selections, clip); if (flags & DrawCursor){ int cursor = m_cursor; if (m_preeditCursor != -1) cursor += m_preeditCursor; if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) - m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); + textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); } } @@ -601,10 +620,10 @@ void QLineControl::selectWordAtPos(int cursor) int next = cursor + 1; if(next > end()) --next; - int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords); + int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); // ## text layout should support end of words. - int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords); + int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords); while (end > cursor && m_text[end-1].isSpace()) --end; moveCursor(end, true); diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 44bd7214be..d4c4154b3d 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -65,6 +65,7 @@ #include "QtCore/qpoint.h" #include "QtGui/qcompleter.h" #include "QtGui/qaccessible.h" +#include "QtCore/qthread.h" #include "qplatformdefs.h" @@ -90,6 +91,10 @@ public: #ifdef QT_GUI_PASSWORD_ECHO_DELAY , m_passwordEchoTimer(0) #endif +#if defined(Q_WS_MAC) + , m_threadChecks(false) + , m_textLayoutThread(0) + #endif { init(txt); } @@ -332,11 +337,27 @@ public: bool processEvent(QEvent *ev); - QTextLayout *textLayout() + QTextLayout *textLayout() const { +#if defined(Q_WS_MAC) + if (m_threadChecks && QThread::currentThread() != m_textLayoutThread) + redoTextLayout(); +#endif return &m_textLayout; } +#if defined(Q_WS_MAC) + void setThreadChecks(bool threadChecks) + { + m_threadChecks = threadChecks; + } + + bool threadChecks() const + { + return m_threadChecks; + } +#endif + private: void init(const QString &txt); void removeSelectedText(); @@ -433,8 +454,8 @@ private: QString stripString(const QString &str) const; int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const; - // complex text layout - QTextLayout m_textLayout; + // complex text layout (must be mutable so it can be reshaped at will) + mutable QTextLayout m_textLayout; bool m_passwordEchoEditing; QChar m_passwordCharacter; @@ -451,6 +472,12 @@ private: #endif } + int redoTextLayout() const; +#if defined(Q_WS_MAC) + bool m_threadChecks; + mutable QThread *m_textLayoutThread; +#endif + Q_SIGNALS: void cursorPositionChanged(int, int); void selectionChanged(); -- cgit v1.2.3 From f98525e9a44bb148b49280525123d8953d2398aa Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 13 Aug 2011 00:18:18 +0200 Subject: test: Fix `tst_qfiledialog' in a namespaced build Reviewed-by: Pierre Rossi (cherry picked from commit 3be7f871f07041477b5bca0182623b36afd2b3e6) Change-Id: Ib24d837ef8f47435cc0a505233e77f1104537cae Reviewed-on: http://codereview.qt.nokia.com/3263 Reviewed-by: Sergio Ahumada Reviewed-by: Qt Sanity Bot --- tests/auto/qfiledialog/tst_qfiledialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 08d2e88f3c..81da8a3f62 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -80,7 +80,9 @@ # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" #elif defined(Q_OS_UNIX) #ifdef QT_BUILD_INTERNAL +QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); +QT_END_NAMESPACE #endif #endif -- cgit v1.2.3 From 15575fb280e1489157d0be44d00ab57aecc19320 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 22 Aug 2011 11:44:47 +1000 Subject: test: marked tst_qtcpsocket autotest as unstable Task-number: QTBUG-21043 Change-Id: Idefb79bf64eb746e82ebf2980c628f2e37dcf6c3 Reviewed-on: http://codereview.qt.nokia.com/3279 Reviewed-by: Qt Sanity Bot Reviewed-by: Keith Isdale --- tests/auto/qtcpsocket/qtcpsocket.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 5dfff5bb88..48ac1fa0c5 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -6,3 +6,5 @@ wince*|symbian|vxworks* : SUBDIRS = test requires(contains(QT_CONFIG,private_tests)) + +CONFIG+=insignificant_test # unstable, QTBUG-21043 -- cgit v1.2.3 From 1b7b3377971832f56414c65063c7307202e09d7c Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 27 Jun 2011 16:28:50 +0200 Subject: Add IAccessible2 table2 implementation. Implement the IAccessible table2 interface for itemviews. This is simpler than what we have in complexwidgets. For now it is only used on Linux. The new table2 interface is ifdef'ed to only be used on X11. Improve handling of accessible events and clean up. There are two xfails for the Table and Tree where sibling navigation is not implemented yet. Reviewed-by: Gabi (cherry picked from commit e797ba558dddd45522b5a317316e497e9efc44a8) (cherry picked from commit eff5ecc5d8f65fa25d6cfd6ed96a9d2a00d0c663) (cherry picked from commit d29876008fad400bca8d6b37e5d5f61dd1bcb39d) (cherry picked from commit 2a326fdc8f8bf2bd2c5764394616100906d9db2d) (cherry picked from commit 9b72e79e20d0d3560e0b064b8b0d75e35feb720e) (cherry picked from commit 075b0f744363842ed4179c644d933d461389544f) Change-Id: I654f74991830ae1fc7df7cc91d930390fb88b2a4 Reviewed-on: http://codereview.qt.nokia.com/3274 Reviewed-by: Frederik Gladhorn Reviewed-by: Qt Sanity Bot --- src/gui/accessible/qaccessible.cpp | 5 + src/gui/accessible/qaccessible.h | 10 +- src/gui/accessible/qaccessible2.h | 112 +++ src/gui/accessible/qaccessible_unix.cpp | 11 + src/gui/itemviews/qabstractitemview.cpp | 95 +- src/gui/itemviews/qabstractitemview.h | 1 + src/gui/itemviews/qabstractitemview_p.h | 1 + src/gui/itemviews/qlistview.cpp | 12 + src/gui/itemviews/qtableview.cpp | 17 + src/gui/itemviews/qtableview_p.h | 5 + src/gui/itemviews/qtreeview.cpp | 52 +- src/gui/itemviews/qtreeview.h | 3 + src/gui/itemviews/qtreeview_p.h | 6 +- src/plugins/accessible/widgets/itemviews.cpp | 1029 ++++++++++++++++++++++ src/plugins/accessible/widgets/itemviews.h | 319 +++++++ src/plugins/accessible/widgets/main.cpp | 22 +- src/plugins/accessible/widgets/widgets.pro | 22 +- tests/auto/qaccessibility/tst_qaccessibility.cpp | 370 +++++++- 18 files changed, 2055 insertions(+), 37 deletions(-) create mode 100644 src/plugins/accessible/widgets/itemviews.cpp create mode 100644 src/plugins/accessible/widgets/itemviews.h diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 337bb9992d..10e5785cd5 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1047,6 +1047,11 @@ const QAccessibleInterface *other, int otherChild) const \internal */ +/*! + \fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface() + \internal +*/ + /*! \fn QAccessibleActionInterface *QAccessibleInterface::actionInterface() \internal diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index fc03e1cec7..16869bb926 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -151,6 +151,7 @@ public: ReadOnly = 0x00000040, HotTracked = 0x00000080, DefaultButton = 0x00000100, + // #### Qt5 Expandable Expanded = 0x00000200, Collapsed = 0x00000400, Busy = 0x00000800, @@ -178,6 +179,8 @@ public: HasPopup = 0x40000000, Modal = 0x80000000, + // #### Qt5 ManagesDescendants + // #### Qt5 remove HasInvokeExtension HasInvokeExtension = 0x10000000 // internal }; Q_DECLARE_FLAGS(State, StateFlag) @@ -348,7 +351,8 @@ namespace QAccessible2 ValueInterface, TableInterface, ActionInterface, - ImageInterface + ImageInterface, + Table2Interface }; } @@ -359,6 +363,7 @@ class QAccessibleValueInterface; class QAccessibleTableInterface; class QAccessibleActionInterface; class QAccessibleImageInterface; +class QAccessibleTable2Interface; class Q_GUI_EXPORT QAccessibleInterface : public QAccessible { @@ -422,6 +427,9 @@ public: inline QAccessibleImageInterface *imageInterface() { return reinterpret_cast(cast_helper(QAccessible2::ImageInterface)); } + inline QAccessibleTable2Interface *table2Interface() + { return reinterpret_cast(cast_helper(QAccessible2::Table2Interface)); } + private: QAccessible2Interface *cast_helper(QAccessible2::InterfaceType); }; diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h index 5cb03239ef..106b69efcf 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/gui/accessible/qaccessible2.h @@ -52,6 +52,8 @@ QT_MODULE(Gui) #ifndef QT_NO_ACCESSIBILITY +class QModelIndex; + namespace QAccessible2 { enum CoordinateType @@ -68,6 +70,24 @@ namespace QAccessible2 LineBoundary, NoBoundary }; + + enum TableModelChangeType { + TableModelChangeInsert, + TableModelChangeDelete, + TableModelChangeUpdate + }; + + struct TableModelChange { + int firstColumn; + int firstRow; + int lastColumn; + int lastRow; + TableModelChangeType type; + + TableModelChange() + : firstColumn(0), firstRow(0), lastColumn(0), lastRow(0), type(TableModelChangeUpdate) + {} + }; } class Q_GUI_EXPORT QAccessible2Interface @@ -83,6 +103,7 @@ inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleTable2CastHelper() { return 0; } #define Q_ACCESSIBLE_OBJECT \ public: \ @@ -101,6 +122,8 @@ inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; } return qAccessibleActionCastHelper(); \ case QAccessible2::ImageInterface: \ return qAccessibleImageCastHelper(); \ + case QAccessible2::Table2Interface: \ + return qAccessibleTable2CastHelper(); \ } \ return 0; \ } \ @@ -214,6 +237,95 @@ public: int *columnSpan, bool *isSelected) = 0; }; +class Q_GUI_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface +{ +public: + // Returns the number of columns occupied by this cell accessible. + virtual int columnExtent() const = 0; + + // Returns the column headers as an array of cell accessibles. + virtual QList columnHeaderCells() const = 0; + + // Translates this cell accessible into the corresponding column index. + virtual int columnIndex() const = 0; + // Returns the number of rows occupied by this cell accessible. + virtual int rowExtent() const = 0; + // Returns the row headers as an array of cell accessibles. + virtual QList rowHeaderCells() const = 0; + // Translates this cell accessible into the corresponding row index. + virtual int rowIndex() const = 0; + // Returns a boolean value indicating whether this cell is selected. + virtual bool isSelected() const = 0; + + // Gets the row and column indexes and extents of this cell accessible and whether or not it is selected. + virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0; + // Returns a reference to the accessbile of the containing table. + virtual QAccessibleTable2Interface* table() const = 0; + + // #### Qt5 this should not be here but part of the state + virtual bool isExpandable() const = 0; +}; + +class Q_GUI_EXPORT QAccessibleTable2Interface: public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleTable2CastHelper() { return this; } + + // Returns the cell at the specified row and column in the table. + virtual QAccessibleTable2CellInterface *cellAt (int row, int column) const = 0; + // Returns the caption for the table. + virtual QAccessibleInterface *caption() const = 0; + // Returns the description text of the specified column in the table. + virtual QString columnDescription(int column) const = 0; + // Returns the total number of columns in table. + virtual int columnCount() const = 0; + // Returns the total number of rows in table. + virtual int rowCount() const = 0; + // Returns the total number of selected cells. + virtual int selectedCellCount() const = 0; + // Returns the total number of selected columns. + virtual int selectedColumnCount() const = 0; + // Returns the total number of selected rows. + virtual int selectedRowCount() const = 0; + // Returns the description text of the specified row in the table. + virtual QString rowDescription(int row) const = 0; + // Returns a list of accessibles currently selected. + virtual QList selectedCells() const = 0; + // Returns a list of column indexes currently selected (0 based). + virtual QList selectedColumns() const = 0; + // Returns a list of row indexes currently selected (0 based). + virtual QList selectedRows() const = 0; + // Returns the summary description of the table. + virtual QAccessibleInterface *summary() const = 0; + // Returns a boolean value indicating whether the specified column is completely selected. + virtual bool isColumnSelected(int column) const = 0; + // Returns a boolean value indicating whether the specified row is completely selected. + virtual bool isRowSelected(int row) const = 0; + // Selects a row and unselects all previously selected rows. + virtual bool selectRow(int row) = 0; + // Selects a column and unselects all previously selected columns. + virtual bool selectColumn(int column) = 0; + // Unselects one row, leaving other selected rows selected (if any). + virtual bool unselectRow(int row) = 0; + // Unselects one column, leaving other selected columns selected (if any). + virtual bool unselectColumn(int column) = 0; + // Returns the type and extents describing how a table changed. + virtual QAccessible2::TableModelChange modelChange() const = 0; + +protected: + // These functions are called when the model changes. + virtual void modelReset() = 0; + virtual void rowsInserted(const QModelIndex &parent, int first, int last) = 0; + virtual void rowsRemoved(const QModelIndex &parent, int first, int last) = 0; + virtual void columnsInserted(const QModelIndex &parent, int first, int last) = 0; + virtual void columnsRemoved(const QModelIndex &parent, int first, int last) = 0; + virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) = 0; + virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) = 0; + +friend class QAbstractItemView; +friend class QAbstractItemViewPrivate; +}; + class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface { public: diff --git a/src/gui/accessible/qaccessible_unix.cpp b/src/gui/accessible/qaccessible_unix.cpp index a6b7ec3345..19fbe78301 100644 --- a/src/gui/accessible/qaccessible_unix.cpp +++ b/src/gui/accessible/qaccessible_unix.cpp @@ -103,6 +103,17 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) if (!iface) return; + // updates for List/Table/Tree should send child + if (who) { + QAccessibleInterface *child; + iface->navigate(QAccessible::Child, who, &child); + if (child) { + delete iface; + iface = child; + who = 0; + } + } + for (int i = 0; i < bridges()->count(); ++i) bridges()->at(i)->notifyAccessibilityUpdate(reason, iface, who); delete iface; diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 6aed17c049..d3875c8961 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -60,6 +60,7 @@ #include #ifndef QT_NO_ACCESSIBILITY #include +#include #endif #include #ifndef QT_NO_GESTURE @@ -682,6 +683,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model) this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(_q_rowsRemoved(QModelIndex,int,int))); + disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_rowsInserted(QModelIndex,int,int))); disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int))); disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)), @@ -712,6 +715,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model) this, SLOT(_q_headerDataChanged())); connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); + connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_rowsInserted(QModelIndex,int,int))); connect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), @@ -1095,6 +1100,14 @@ void QAbstractItemView::reset() setRootIndex(QModelIndex()); if (d->selectionModel) d->selectionModel->reset(); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); + QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged); + } +#endif +#endif } /*! @@ -2849,7 +2862,7 @@ void QAbstractItemView::editorDestroyed(QObject *editor) */ void QAbstractItemView::setHorizontalStepsPerItem(int steps) { - Q_UNUSED(steps); + Q_UNUSED(steps) // do nothing } @@ -2878,7 +2891,7 @@ int QAbstractItemView::horizontalStepsPerItem() const */ void QAbstractItemView::setVerticalStepsPerItem(int steps) { - Q_UNUSED(steps); + Q_UNUSED(steps) // do nothing } @@ -3311,12 +3324,24 @@ void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int star rows are those under the given \a parent from \a start to \a end inclusive. */ -void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &, int, int) +void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end) { + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) + Q_Q(QAbstractItemView); if (q->isVisible()) q->updateEditorGeometries(); q->setState(QAbstractItemView::NoState); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end); + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } /*! @@ -3379,27 +3404,72 @@ void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &par rows are those under the given \a parent from \a start to \a end inclusive. */ -void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &, int, int) +void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end) { + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) + Q_Q(QAbstractItemView); if (q->isVisible()) q->updateEditorGeometries(); q->setState(QAbstractItemView::NoState); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end); + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } + /*! \internal This slot is called when rows have been inserted. */ -void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int) +void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end) { + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) + Q_Q(QAbstractItemView); - if (q->isVisible()) - q->updateEditorGeometries(); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end); + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } +/*! + \internal + This slot is called when columns have been inserted. +*/ +void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end) +{ + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) + + Q_Q(QAbstractItemView); + if (q->isVisible()) + q->updateEditorGeometries(); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end); + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif +} /*! \internal @@ -3417,7 +3487,16 @@ void QAbstractItemViewPrivate::_q_modelDestroyed() */ void QAbstractItemViewPrivate::_q_layoutChanged() { + Q_Q(QAbstractItemView); doDelayedItemsLayout(); +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset(); + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } /*! @@ -3742,7 +3821,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand( const QModelIndex &index, const QEvent *event) const { - Q_UNUSED(index); + Q_UNUSED(index) if (event) { switch (event->type()) { diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index e4766afbd6..e49ce0b6d0 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -355,6 +355,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 5b4b1790d6..c1b4ca3e12 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -108,6 +108,7 @@ public: void init(); virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end); + virtual void _q_rowsInserted(const QModelIndex &parent, int start, int end); virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end); virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end); diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index a234fdee85..a0955d256e 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -3168,7 +3168,11 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive()) { if (current.isValid()) { int entry = visualIndex(current) + 1; +#ifdef Q_WS_X11 + QAccessible::updateAccessibility(this, entry, QAccessible::Focus); +#else QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); +#endif } } #endif @@ -3187,12 +3191,20 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel) + 1; +#ifdef Q_WS_X11 + QAccessible::updateAccessibility(this, entry, QAccessible::Selection); +#else QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); +#endif } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = visualIndex(desel) + 1; +#ifdef Q_WS_X11 + QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove); +#else QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); +#endif } } #endif diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 617409ff3f..6f532eb7c7 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -3164,10 +3164,16 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { if (current.isValid()) { +#ifdef Q_WS_X11 + Q_D(QTableView); + int entry = d->accessibleTable2Index(current); + QAccessible::updateAccessibility(this, entry, QAccessible::Focus); +#else int entry = visualIndex(current) + 1; if (horizontalHeader()) ++entry; QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); +#endif } } #endif @@ -3180,22 +3186,33 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p void QTableView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { + Q_D(QTableView); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { // ### does not work properly for selection ranges. QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { +#ifdef Q_WS_X11 + int entry = d->accessibleTable2Index(sel); + QAccessible::updateAccessibility(this, entry, QAccessible::Selection); +#else int entry = visualIndex(sel); if (horizontalHeader()) ++entry; QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); +#endif } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { +#ifdef Q_WS_X11 + int entry = d->accessibleTable2Index(sel); + QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove); +#else int entry = visualIndex(sel); if (horizontalHeader()) ++entry; QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); +#endif } } #endif diff --git a/src/gui/itemviews/qtableview_p.h b/src/gui/itemviews/qtableview_p.h index f973acf3ce..dce0ed06ac 100644 --- a/src/gui/itemviews/qtableview_p.h +++ b/src/gui/itemviews/qtableview_p.h @@ -167,6 +167,11 @@ public: return horizontalHeader->logicalIndex(visualCol); } + inline int accessibleTable2Index(const QModelIndex &index) const { + return (index.row() + (horizontalHeader ? 1 : 0)) * (index.model()->columnCount() + (verticalHeader ? 1 : 0)) + + index.column() + (verticalHeader ? 1 : 0) + 1; + } + int sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const; int sectionSpanSize(const QHeaderView *header, int logical, int span) const; bool spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 6a992dbab6..9228ac82a2 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -54,6 +54,7 @@ #include #ifndef QT_NO_ACCESSIBILITY #include +#include #endif #include @@ -2883,20 +2884,36 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem) { + Q_Q(QTreeView); viewItems.insert(pos, count, viewItem); QTreeViewItem *items = viewItems.data(); for (int i = pos + count; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem += count; +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } void QTreeViewPrivate::removeViewItems(int pos, int count) { + Q_Q(QTreeView); viewItems.remove(pos, count); QTreeViewItem *items = viewItems.data(); for (int i = pos; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem -= count; +#ifndef QT_NO_ACCESSIBILITY +#ifdef Q_WS_X11 + if (QAccessible::isActive()) { + QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged); + } +#endif +#endif } #if 0 @@ -3687,14 +3704,6 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order) */ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { -#ifndef QT_NO_ACCESSIBILITY - if (QAccessible::isActive()) { - int entry = visualIndex(current) + 1; - if (header()) - ++entry; - QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); - } -#endif QAbstractItemView::currentChanged(current, previous); if (allColumnsShowFocus()) { @@ -3711,6 +3720,19 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr viewport()->update(currentRect); } } +#ifndef QT_NO_ACCESSIBILITY + if (QAccessible::isActive() && current.isValid()) { +#ifdef Q_WS_X11 + int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1; + QAccessible::updateAccessibility(this, entry, QAccessible::Focus); +#else + int entry = visualIndex(current) + 1; + if (header()) + ++entry; + QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); +#endif + } +#endif } /*! @@ -3719,26 +3741,38 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr void QTreeView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { + QAbstractItemView::selectionChanged(selected, deselected); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { // ### does not work properly for selection ranges. QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { +#ifdef Q_WS_X11 + int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1; + Q_ASSERT(entry > 0); + QAccessible::updateAccessibility(this, entry, QAccessible::Selection); +#else int entry = visualIndex(sel) + 1; if (header()) ++entry; QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); +#endif } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { +#ifdef Q_WS_X11 + int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1; + Q_ASSERT(entry > 0); + QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove); +#else int entry = visualIndex(desel) + 1; if (header()) ++entry; QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); +#endif } } #endif - QAbstractItemView::selectionChanged(selected, deselected); } int QTreeView::visualIndex(const QModelIndex &index) const diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 26c73153e9..b77da4e89a 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -219,6 +219,9 @@ protected: private: friend class QAccessibleItemView; + friend class QAccessibleTable2; + friend class QAccessibleTree; + friend class QAccessibleTable2Cell; int visualIndex(const QModelIndex &index) const; Q_DECLARE_PRIVATE(QTreeView) diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index b6d84586ee..a9dc452398 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -78,7 +78,7 @@ struct QTreeViewItem Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE); -class QTreeViewPrivate : public QAbstractItemViewPrivate +class Q_GUI_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate { Q_DECLARE_PUBLIC(QTreeView) public: @@ -223,6 +223,10 @@ public: inline void invalidateHeightCache(int item) const { viewItems[item].height = 0; } + inline int accessibleTable2Index(const QModelIndex &index) const { + return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column() + 1; + } + // used for spanning rows QVector spanningIndexes; diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp new file mode 100644 index 0000000000..4618f873d3 --- /dev/null +++ b/src/plugins/accessible/widgets/itemviews.cpp @@ -0,0 +1,1029 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "itemviews.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifndef QT_NO_ACCESSIBILITY + +QT_BEGIN_NAMESPACE + +QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); + +#ifndef QT_NO_ITEMVIEWS +/* +Implementation of the IAccessible2 table2 interface. Much simpler than +the other table interfaces since there is only the main table and cells: + +TABLE/LIST/TREE + |- HEADER CELL + |- CELL + |- CELL + ... +*/ + +int QAccessibleTable2::logicalIndex(const QModelIndex &index) const +{ + if (!index.isValid()) + return -1; + int vHeader = verticalHeader() ? 1 : 0; + int hHeader = horizontalHeader() ? 1 : 0; + // row * number columns + column + 1 for one based counting + return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader) + 1; +} + +QAccessibleInterface *QAccessibleTable2::childFromLogical(int logicalIndex) const +{ + logicalIndex--; // one based counting ftw + int vHeader = verticalHeader() ? 1 : 0; + int hHeader = horizontalHeader() ? 1 : 0; + + int columns = view->model()->columnCount() + vHeader; + + int row = logicalIndex / columns; + int column = logicalIndex % columns; + + if (vHeader) { + if (column == 0) { + if (row == 0) { + return new QAccessibleTable2CornerButton(view); + } + return new QAccessibleTable2HeaderCell(view, row-1, Qt::Vertical); + } + --column; + } + if (hHeader) { + if (row == 0) { + return new QAccessibleTable2HeaderCell(view, column, Qt::Horizontal); + } + --row; + } + return new QAccessibleTable2Cell(view, view->model()->index(row, column), cellRole()); +} + +QAccessibleTable2::QAccessibleTable2(QWidget *w) + : QAccessibleObjectEx(w) +{ + view = qobject_cast(w); + Q_ASSERT(view); + + if (qobject_cast(view)) { + m_role = QAccessible::Table; + } else if (qobject_cast(view)) { + m_role = QAccessible::Tree; + } else if (qobject_cast(view)) { + m_role = QAccessible::List; + } else { + // is this our best guess? + m_role = QAccessible::Table; + } +} + +QAccessibleTable2::~QAccessibleTable2() +{ +} + +QHeaderView *QAccessibleTable2::horizontalHeader() const +{ + QHeaderView *header = 0; + if (false) { +#ifndef QT_NO_TABLEVIEW + } else if (const QTableView *tv = qobject_cast(view)) { + header = tv->horizontalHeader(); +#endif +#ifndef QT_NO_TREEVIEW + } else if (const QTreeView *tv = qobject_cast(view)) { + header = tv->header(); +#endif + } + return header; +} + +QHeaderView *QAccessibleTable2::verticalHeader() const +{ + QHeaderView *header = 0; + if (false) { +#ifndef QT_NO_TABLEVIEW + } else if (const QTableView *tv = qobject_cast(view)) { + header = tv->verticalHeader(); +#endif + } + return header; +} + +void QAccessibleTable2::modelReset() +{} + +void QAccessibleTable2::rowsInserted(const QModelIndex &, int first, int last) +{ + lastChange.firstRow = first; + lastChange.lastRow = last; + lastChange.firstColumn = 0; + lastChange.lastColumn = 0; + lastChange.type = QAccessible2::TableModelChangeInsert; +} + +void QAccessibleTable2::rowsRemoved(const QModelIndex &, int first, int last) +{ + lastChange.firstRow = first; + lastChange.lastRow = last; + lastChange.firstColumn = 0; + lastChange.lastColumn = 0; + lastChange.type = QAccessible2::TableModelChangeDelete; +} + +void QAccessibleTable2::columnsInserted(const QModelIndex &, int first, int last) +{ + lastChange.firstRow = 0; + lastChange.lastRow = 0; + lastChange.firstColumn = first; + lastChange.lastColumn = last; + lastChange.type = QAccessible2::TableModelChangeInsert; +} + +void QAccessibleTable2::columnsRemoved(const QModelIndex &, int first, int last) +{ + lastChange.firstRow = 0; + lastChange.lastRow = 0; + lastChange.firstColumn = first; + lastChange.lastColumn = last; + lastChange.type = QAccessible2::TableModelChangeDelete; +} + +void QAccessibleTable2::rowsMoved( const QModelIndex &, int, int, const QModelIndex &, int) +{ + lastChange.firstRow = 0; + lastChange.lastRow = 0; + lastChange.firstColumn = 0; + lastChange.lastColumn = 0; + lastChange.type = QAccessible2::TableModelChangeUpdate; +} + +void QAccessibleTable2::columnsMoved( const QModelIndex &, int, int, const QModelIndex &, int) +{ + lastChange.firstRow = 0; + lastChange.lastRow = 0; + lastChange.firstColumn = 0; + lastChange.lastColumn = 0; + lastChange.type = QAccessible2::TableModelChangeUpdate; +} + +QAccessibleTable2Cell *QAccessibleTable2::cell(const QModelIndex &index) const +{ + if (index.isValid()) + return new QAccessibleTable2Cell(view, index, cellRole()); + return 0; +} + +QAccessibleTable2CellInterface *QAccessibleTable2::cellAt(int row, int column) const +{ + Q_ASSERT(role(0) != QAccessible::Tree); + QModelIndex index = view->model()->index(row, column); + //Q_ASSERT(index.isValid()); + if (!index.isValid()) { + qWarning() << "QAccessibleTable2::cellAt: invalid index: " << index << " for " << view; + return 0; + } + return cell(index); +} + +QAccessibleInterface *QAccessibleTable2::caption() const +{ + return 0; +} + +QString QAccessibleTable2::columnDescription(int column) const +{ + return view->model()->headerData(column, Qt::Horizontal).toString(); +} + +int QAccessibleTable2::columnCount() const +{ + return view->model()->columnCount(); +} + +int QAccessibleTable2::rowCount() const +{ + return view->model()->rowCount(); +} + +int QAccessibleTable2::selectedCellCount() const +{ + return view->selectionModel()->selectedIndexes().count(); +} + +int QAccessibleTable2::selectedColumnCount() const +{ + return view->selectionModel()->selectedColumns().count(); +} + +int QAccessibleTable2::selectedRowCount() const +{ + return view->selectionModel()->selectedRows().count(); +} + +QString QAccessibleTable2::rowDescription(int row) const +{ + return view->model()->headerData(row, Qt::Vertical).toString(); +} + +QList QAccessibleTable2::selectedCells() const +{ + QList cells; + Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedIndexes()) { + cells.append(cell(index)); + } + return cells; +} + +QList QAccessibleTable2::selectedColumns() const +{ + QList columns; + Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedColumns()) { + columns.append(index.column()); + } + return columns; +} + +QList QAccessibleTable2::selectedRows() const +{ + QList rows; + Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedRows()) { + rows.append(index.row()); + } + return rows; +} + +QAccessibleInterface *QAccessibleTable2::summary() const +{ + return 0; +} + +bool QAccessibleTable2::isColumnSelected(int column) const +{ + return view->selectionModel()->isColumnSelected(column, QModelIndex()); +} + +bool QAccessibleTable2::isRowSelected(int row) const +{ + return view->selectionModel()->isRowSelected(row, QModelIndex()); +} + +bool QAccessibleTable2::selectRow(int row) +{ + QModelIndex index = view->model()->index(row, 0); + if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection) + return false; + view->selectionModel()->select(index, QItemSelectionModel::Select); + return true; +} + +bool QAccessibleTable2::selectColumn(int column) +{ + QModelIndex index = view->model()->index(0, column); + if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection) + return false; + view->selectionModel()->select(index, QItemSelectionModel::Select); + return true; +} + +bool QAccessibleTable2::unselectRow(int row) +{ + QModelIndex index = view->model()->index(row, 0); + if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection) + return false; + view->selectionModel()->select(index, QItemSelectionModel::Deselect); + return true; +} + +bool QAccessibleTable2::unselectColumn(int column) +{ + QModelIndex index = view->model()->index(0, column); + if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection) + return false; + view->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect); + return true; +} + +QAccessible2::TableModelChange QAccessibleTable2::modelChange() const +{ + QAccessible2::TableModelChange change; + // FIXME + return change; +} + +QAccessible::Role QAccessibleTable2::role(int child) const +{ + Q_ASSERT(child >= 0); + if (child > 0) + return QAccessible::Cell; + return m_role; +} + +QAccessible::State QAccessibleTable2::state(int child) const +{ + Q_ASSERT(child == 0); + return QAccessible::Normal | HasInvokeExtension; +} + +int QAccessibleTable2::childAt(int x, int y) const +{ + QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0)); + QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset); + // FIXME: if indexPosition < 0 in one coordinate, return header + + QModelIndex index = view->indexAt(indexPosition); + if (index.isValid()) { + return logicalIndex(index); + } + return -1; +} + +int QAccessibleTable2::childCount() const +{ + int vHeader = verticalHeader() ? 1 : 0; + int hHeader = horizontalHeader() ? 1 : 0; + return (view->model()->rowCount()+hHeader) * (view->model()->columnCount()+vHeader); +} + +int QAccessibleTable2::indexOfChild(const QAccessibleInterface *iface) const +{ + Q_ASSERT(iface->role(0) != QAccessible::TreeItem); // should be handled by tree class + if (iface->role(0) == QAccessible::Cell || iface->role(0) == QAccessible::ListItem) { + const QAccessibleTable2Cell* cell = static_cast(iface); + return logicalIndex(cell->m_index); + } else if (iface->role(0) == QAccessible::ColumnHeader){ + const QAccessibleTable2HeaderCell* cell = static_cast(iface); + return cell->index + (verticalHeader() ? 1 : 0) + 1; + } else if (iface->role(0) == QAccessible::RowHeader){ + const QAccessibleTable2HeaderCell* cell = static_cast(iface); + return (cell->index+1) * (view->model()->rowCount()+1) + 1; + } else if (iface->role(0) == QAccessible::Pane) { + return 1; // corner button + } else { + qWarning() << "WARNING QAccessibleTable2::indexOfChild Fix my children..." + << iface->role(0) << iface->text(QAccessible::Name, 0); + } + // FIXME: we are in denial of our children. this should stop. + return -1; +} + +QString QAccessibleTable2::text(Text t, int child) const +{ + Q_ASSERT(child == 0); + if (t == QAccessible::Description) + return view->accessibleDescription(); + return view->accessibleName(); +} + +QRect QAccessibleTable2::rect(int child) const +{ + Q_ASSERT(!child); + if (!view->isVisible()) + return QRect(); + QPoint pos = view->mapToGlobal(QPoint(0, 0)); + return QRect(pos.x(), pos.y(), view->width(), view->height()); +} + +int QAccessibleTable2::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const +{ + *iface = 0; + switch (relation) { + case Ancestor: { + if (index == 1 && view->parent()) { + *iface = QAccessible::queryAccessibleInterface(view->parent()); + if (*iface) + return 0; + } + break; + } + case QAccessible::Child: { + Q_ASSERT(index > 0); + *iface = childFromLogical(index); + if (*iface) { + return 0; + } + break; + } + default: + break; + } + return -1; +} + +QAccessible::Relation QAccessibleTable2::relationTo(int, const QAccessibleInterface *, int) const +{ + return QAccessible::Unrelated; +} + +#ifndef QT_NO_ACTION +int QAccessibleTable2::userActionCount(int) const +{ + return 0; +} +QString QAccessibleTable2::actionText(int, Text, int) const +{ + return QString(); +} +bool QAccessibleTable2::doAction(int, int, const QVariantList &) +{ + return false; +} +#endif + + +// TREE VIEW + +QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const +{ + const QTreeView *treeView = qobject_cast(view); + QModelIndex modelIndex = treeView->d_func()->viewItems.at(row).index; + + if (modelIndex.isValid() && column > 0) { + modelIndex = view->model()->index(modelIndex.row(), column, modelIndex.parent()); + } + return modelIndex; +} + +int QAccessibleTree::childAt(int x, int y) const +{ + QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0)); + QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset); + + QModelIndex index = view->indexAt(indexPosition); + if (!index.isValid()) + return -1; + + const QTreeView *treeView = qobject_cast(view); + int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0); + int column = index.column(); + + int i = row * view->model()->columnCount() + column + 1; + Q_ASSERT(i > view->model()->columnCount()); + return i; +} + +int QAccessibleTree::childCount() const +{ + const QTreeView *treeView = qobject_cast(view); + Q_ASSERT(treeView); + if (!view->model()) + return 0; + + int hHeader = horizontalHeader() ? 1 : 0; + return (treeView->d_func()->viewItems.count() + hHeader)* view->model()->columnCount(); +} + +int QAccessibleTree::rowCount() const +{ + const QTreeView *treeView = qobject_cast(view); + Q_ASSERT(treeView); + return treeView->d_func()->viewItems.count(); +} + +int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const +{ + if (iface->role(0) == QAccessible::TreeItem) { + const QAccessibleTable2Cell* cell = static_cast(iface); + const QTreeView *treeView = qobject_cast(view); + Q_ASSERT(treeView); + int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0); + int column = cell->m_index.column(); + + int index = row * view->model()->columnCount() + column + 1; + //qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index; + Q_ASSERT(index > treeView->model()->columnCount()); + return index; + } else if (iface->role(0) == QAccessible::ColumnHeader){ + const QAccessibleTable2HeaderCell* cell = static_cast(iface); + //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1; + return cell->index + 1; + } else { + qWarning() << "WARNING QAccessibleTable2::indexOfChild invalid child" + << iface->role(0) << iface->text(QAccessible::Name, 0); + } + // FIXME: add scrollbars and don't just ignore them + return -1; +} + +int QAccessibleTree::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const +{ + switch (relation) { + case QAccessible::Child: { + Q_ASSERT(index > 0); + --index; + int hHeader = horizontalHeader() ? 1 : 0; + + if (hHeader) { + if (index < view->model()->columnCount()) { + *iface = new QAccessibleTable2HeaderCell(view, index, Qt::Horizontal); + return 0; + } else { + index -= view->model()->columnCount(); + } + } + + int row = index / view->model()->columnCount(); + int column = index % view->model()->columnCount(); + QModelIndex modelIndex = indexFromLogical(row, column); + if (modelIndex.isValid()) { + *iface = cell(modelIndex); + return 0; + } + return -1; + } + default: + break; + } + return QAccessibleTable2::navigate(relation, index, iface); +} + +QAccessible::Relation QAccessibleTree::relationTo(int, const QAccessibleInterface *, int) const +{ + return QAccessible::Unrelated; +} + +QAccessibleTable2CellInterface *QAccessibleTree::cellAt(int row, int column) const +{ + QModelIndex index = indexFromLogical(row, column); + if (!index.isValid()) { + qWarning() << "Requested invalid tree cell: " << row << column; + return 0; + } + return new QAccessibleTable2Cell(view, index, cellRole()); +} + +QString QAccessibleTree::rowDescription(int) const +{ + return QString(); // no headers for rows in trees +} + +bool QAccessibleTree::isRowSelected(int row) const +{ + QModelIndex index = indexFromLogical(row); + return view->selectionModel()->isRowSelected(index.row(), index.parent()); +} + +bool QAccessibleTree::selectRow(int row) +{ + QModelIndex index = indexFromLogical(row); + if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection) + return false; + view->selectionModel()->select(index, QItemSelectionModel::Select); + return true; +} + +// TABLE CELL + +QAccessibleTable2Cell::QAccessibleTable2Cell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_) + : /* QAccessibleSimpleEditableTextInterface(this), */ view(view_), m_index(index_), m_role(role_) +{ + Q_ASSERT(index_.isValid()); +} + +int QAccessibleTable2Cell::columnExtent() const { return 1; } +int QAccessibleTable2Cell::rowExtent() const { return 1; } + +QList QAccessibleTable2Cell::rowHeaderCells() const +{ + QList headerCell; + if (verticalHeader()) { + headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.row(), Qt::Vertical)); + } + return headerCell; +} + +QList QAccessibleTable2Cell::columnHeaderCells() const +{ + QList headerCell; + if (horizontalHeader()) { + headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.column(), Qt::Horizontal)); + } + return headerCell; +} + +QHeaderView *QAccessibleTable2Cell::horizontalHeader() const +{ + QHeaderView *header = 0; + + if (false) { +#ifndef QT_NO_TABLEVIEW + } else if (const QTableView *tv = qobject_cast(view)) { + header = tv->horizontalHeader(); +#endif +#ifndef QT_NO_TREEVIEW + } else if (const QTreeView *tv = qobject_cast(view)) { + header = tv->header(); +#endif + } + + return header; +} + +QHeaderView *QAccessibleTable2Cell::verticalHeader() const +{ + QHeaderView *header = 0; +#ifndef QT_NO_TABLEVIEW + if (const QTableView *tv = qobject_cast(view)) + header = tv->verticalHeader(); +#endif + return header; +} + +int QAccessibleTable2Cell::columnIndex() const +{ + return m_index.column(); +} + +int QAccessibleTable2Cell::rowIndex() const +{ + if (role(0) == QAccessible::TreeItem) { + const QTreeView *treeView = qobject_cast(view); + Q_ASSERT(treeView); + int row = treeView->d_func()->viewIndex(m_index); + return row; + } + return m_index.row(); +} + +bool QAccessibleTable2Cell::isSelected() const +{ + return view->selectionModel()->isSelected(m_index); +} + +void QAccessibleTable2Cell::rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const +{ + *row = m_index.row(); + *column = m_index.column(); + *rowExtents = 1; + *columnExtents = 1; + *selected = isSelected(); +} + +QAccessibleTable2Interface* QAccessibleTable2Cell::table() const +{ + return QAccessible::queryAccessibleInterface(view)->table2Interface(); +} + +QAccessible::Role QAccessibleTable2Cell::role(int child) const +{ + Q_ASSERT(child == 0); + return m_role; +} + +QAccessible::State QAccessibleTable2Cell::state(int child) const +{ + Q_ASSERT(child == 0); + State st = Normal; + + QRect globalRect = view->rect(); + globalRect.translate(view->mapToGlobal(QPoint(0,0))); + if (!globalRect.intersects(rect(0))) + st |= Invisible; + + if (view->selectionModel()->isSelected(m_index)) + st |= Selected; + if (view->selectionModel()->currentIndex() == m_index) + st |= Focused; + if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked) + st |= Checked; + + Qt::ItemFlags flags = m_index.flags(); + if (flags & Qt::ItemIsSelectable) { + st |= Selectable; + st |= Focusable; + if (view->selectionMode() == QAbstractItemView::MultiSelection) + st |= MultiSelectable; + if (view->selectionMode() == QAbstractItemView::ExtendedSelection) + st |= ExtSelectable; + } + if (m_role == QAccessible::TreeItem) { + const QTreeView *treeView = qobject_cast(view); + if (treeView->isExpanded(m_index)) + st |= Expanded; + } + return st; +} + +bool QAccessibleTable2Cell::isExpandable() const +{ + return view->model()->hasChildren(m_index); +} + +QRect QAccessibleTable2Cell::rect(int child) const +{ + Q_ASSERT(child == 0); + + QRect r; + r = view->visualRect(m_index); + + if (!r.isNull()) + r.translate(view->viewport()->mapTo(view, QPoint(0,0))); + r.translate(view->mapToGlobal(QPoint(0, 0))); + return r; +} + +QString QAccessibleTable2Cell::text(Text t, int child) const +{ + Q_ASSERT(child == 0); + QAbstractItemModel *model = view->model(); + QString value; + switch (t) { + case QAccessible::Value: + case QAccessible::Name: + value = model->data(m_index, Qt::AccessibleTextRole).toString(); + if (value.isEmpty()) + value = model->data(m_index, Qt::DisplayRole).toString(); + break; + case QAccessible::Description: + value = model->data(m_index, Qt::AccessibleDescriptionRole).toString(); + break; + default: + break; + } + return value; +} + +void QAccessibleTable2Cell::setText(Text /*t*/, int child, const QString &text) +{ + Q_ASSERT(child == 0); + if (!m_index.flags() & Qt::ItemIsEditable) + return; + view->model()->setData(m_index, text); +} + +bool QAccessibleTable2Cell::isValid() const +{ + if (!m_index.isValid()) { + qDebug() << "Interface is not valid"; + } + + return m_index.isValid(); +} + +int QAccessibleTable2Cell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const +{ + if (relation == Ancestor && index == 1) { + if (m_role == QAccessible::TreeItem) { + *iface = new QAccessibleTree(view); + } else { + *iface = new QAccessibleTable2(view); + } + return 0; + } + + *iface = 0; + if (!view) + return -1; + + switch (relation) { + + case Child: { + return -1; + } + case Sibling: + if (index > 0) { + QAccessibleInterface *parent = queryAccessibleInterface(view); + int ret = parent->navigate(QAccessible::Child, index, iface); + delete parent; + if (*iface) + return ret; + } + return -1; + +// From table1 implementation: +// case Up: +// case Down: +// case Left: +// case Right: { +// // This is in the "not so nice" category. In order to find out which item +// // is geometrically around, we have to set the current index, navigate +// // and restore the index as well as the old selection +// view->setUpdatesEnabled(false); +// const QModelIndex oldIdx = view->currentIndex(); +// QList kids = children(); +// const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row); +// const QItemSelection oldSelection = view->selectionModel()->selection(); +// view->setCurrentIndex(currentIndex); +// const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier); +// view->setCurrentIndex(oldIdx); +// view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect); +// view->setUpdatesEnabled(true); +// if (!idx.isValid()) +// return -1; + +// if (idx.parent() != row.parent() || idx.row() != row.row()) +// *iface = cell(idx); +// return index ? kids.indexOf(idx) + 1 : 0; } + default: + break; + } + + return -1; +} + +QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const +{ + Q_ASSERT(child == 0); + Q_ASSERT(otherChild == 0); + // we only check for parent-child relationships in trees + if (m_role == QAccessible::TreeItem && other->role(0) == QAccessible::TreeItem) { + QModelIndex otherIndex = static_cast(other)->m_index; + // is the other our parent? + if (otherIndex.parent() == m_index) + return QAccessible::Ancestor; + // are we the other's child? + if (m_index.parent() == otherIndex) + return QAccessible::Child; + } + return QAccessible::Unrelated; +} + +#ifndef QT_NO_ACTION +int QAccessibleTable2Cell::userActionCount(int) const +{ + return 0; +} + +QString QAccessibleTable2Cell::actionText(int, Text, int) const +{ + return QString(); +} + +bool QAccessibleTable2Cell::doAction(int, int, const QVariantList &) +{ + return false; +} + +QAccessibleTable2HeaderCell::QAccessibleTable2HeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_) + : view(view_), index(index_), orientation(orientation_) +{ + Q_ASSERT(index_ >= 0); +} + +QAccessible::Role QAccessibleTable2HeaderCell::role(int child) const +{ + Q_ASSERT(child == 0); + if (orientation == Qt::Horizontal) + return QAccessible::ColumnHeader; + return QAccessible::RowHeader; +} + +QAccessible::State QAccessibleTable2HeaderCell::state(int child) const +{ + Q_ASSERT(child == 0); + return QAccessible::Normal; +} + +QRect QAccessibleTable2HeaderCell::rect(int child) const +{ + Q_ASSERT(child == 0); + + QHeaderView *header = 0; + if (false) { +#ifndef QT_NO_TABLEVIEW + } else if (const QTableView *tv = qobject_cast(view)) { + if (orientation == Qt::Horizontal) { + header = tv->horizontalHeader(); + } else { + header = tv->verticalHeader(); + } +#endif +#ifndef QT_NO_TREEVIEW + } else if (const QTreeView *tv = qobject_cast(view)) { + header = tv->header(); +#endif + } + QPoint zero = header->mapToGlobal(QPoint(0, 0)); + int sectionSize = header->sectionSize(index); + int sectionPos = header->sectionPosition(index); + return orientation == Qt::Horizontal + ? QRect(zero.x() + sectionPos, zero.y(), sectionSize, header->height()) + : QRect(zero.x(), zero.y() + sectionPos, header->width(), sectionSize); +} + +QString QAccessibleTable2HeaderCell::text(Text t, int child) const +{ + Q_ASSERT(child == 0); + QAbstractItemModel *model = view->model(); + QString value; + switch (t) { + case QAccessible::Value: + case QAccessible::Name: + value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString(); + if (value.isEmpty()) + value = model->headerData(index, orientation, Qt::DisplayRole).toString(); + break; + case QAccessible::Description: + value = model->headerData(index, orientation, Qt::AccessibleDescriptionRole).toString(); + break; + default: + break; + } + return value; +} + +void QAccessibleTable2HeaderCell::setText(Text, int, const QString &) +{ + return; +} + +bool QAccessibleTable2HeaderCell::isValid() const +{ + return true; +} + +int QAccessibleTable2HeaderCell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const +{ + if (relation == QAccessible::Ancestor && index == 1) { + if (false) { +#ifndef QT_NO_TREEVIEW + } else if (qobject_cast(view)) { + *iface = new QAccessibleTree(view); + return 0; +#endif + } else { + *iface = new QAccessibleTable2(view); + return 0; + } + } + *iface = 0; + return -1; +} + +QAccessible::Relation QAccessibleTable2HeaderCell::relationTo(int, const QAccessibleInterface *, int) const +{ + return QAccessible::Unrelated; +} + +#ifndef QT_NO_ACTION +int QAccessibleTable2HeaderCell::userActionCount(int) const +{ + return 0; +} + +QString QAccessibleTable2HeaderCell::actionText(int, Text, int) const +{ + return QString(); +} + +bool QAccessibleTable2HeaderCell::doAction(int, int, const QVariantList &) +{ + return false; +} +#endif + + + +#endif + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +#endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h new file mode 100644 index 0000000000..c8492e3c89 --- /dev/null +++ b/src/plugins/accessible/widgets/itemviews.h @@ -0,0 +1,319 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ACCESSIBLE_ITEMVIEWS_H +#define ACCESSIBLE_ITEMVIEWS_H + +#include +#include +#include +#include +#include + + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_ACCESSIBILITY + +#ifndef QT_NO_ITEMVIEWS + +class QAccessibleTable2Cell; +class QAccessibleTable2HeaderCell; + +class QAccessibleTable2: public QAccessibleTable2Interface, public QAccessibleObjectEx +{ + Q_ACCESSIBLE_OBJECT +public: + explicit QAccessibleTable2(QWidget *w); + + virtual ~QAccessibleTable2(); + + QObject *object() const { return view; } + Role role(int child) const; + State state(int child) const; + QString text(Text t, int child) const; + QRect rect(int child) const; + + int childAt(int x, int y) const; + int childCount() const; + int indexOfChild(const QAccessibleInterface *) const; + + int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + +#ifndef QT_NO_ACTION + int userActionCount(int child) const; + QString actionText(int action, Text t, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); +#endif + QVariant invokeMethodEx(Method, int, const QVariantList &) { return QVariant(); } + + // table2 interface + virtual QAccessibleTable2CellInterface *cellAt(int row, int column) const; + virtual QAccessibleInterface *caption() const; + virtual QAccessibleInterface *summary() const; + virtual QString columnDescription(int column) const; + virtual QString rowDescription(int row) const; + virtual int columnCount() const; + virtual int rowCount() const; + virtual QAccessible2::TableModelChange modelChange() const; + + // selection + virtual int selectedCellCount() const; + virtual int selectedColumnCount() const; + virtual int selectedRowCount() const; + virtual QList selectedCells() const; + virtual QList selectedColumns() const; + virtual QList selectedRows() const; + virtual bool isColumnSelected(int column) const; + virtual bool isRowSelected(int row) const; + virtual bool selectRow(int row); + virtual bool selectColumn(int column); + virtual bool unselectRow(int row); + virtual bool unselectColumn(int column); + +protected: + virtual void modelReset(); + virtual void rowsInserted(const QModelIndex &parent, int first, int last); + virtual void rowsRemoved(const QModelIndex &parent, int first, int last); + virtual void columnsInserted(const QModelIndex &parent, int first, int last); + virtual void columnsRemoved(const QModelIndex &parent, int first, int last); + virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row); + virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column); + +protected: + QAbstractItemView* view; + QAccessible2::TableModelChange lastChange; + inline QAccessibleTable2Cell *cell(const QModelIndex &index) const; + inline QAccessible::Role cellRole() const { + switch (m_role) { + case QAccessible::List: + return QAccessible::ListItem; + case QAccessible::Table: + return QAccessible::Cell; + case QAccessible::Tree: + return QAccessible::TreeItem; + default: + Q_ASSERT(0); + } + return QAccessible::NoRole; + } + + QHeaderView *horizontalHeader() const; + QHeaderView *verticalHeader() const; +private: + // the child index for a model index + inline int logicalIndex(const QModelIndex &index) const; + // the model index from the child index + QAccessibleInterface *childFromLogical(int logicalIndex) const; + QAccessible::Role m_role; +}; + +class QAccessibleTree :public QAccessibleTable2 +{ +public: + explicit QAccessibleTree(QWidget *w) + : QAccessibleTable2(w) + {} + + virtual ~QAccessibleTree() {} + + int childAt(int x, int y) const; + int childCount() const; + int indexOfChild(const QAccessibleInterface *) const; + + int rowCount() const; + + int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + + // table2 interface + QAccessibleTable2CellInterface *cellAt(int row, int column) const; + QString rowDescription(int row) const; + bool isRowSelected(int row) const; + bool selectRow(int row); + +private: + QModelIndex indexFromLogical(int row, int column = 0) const; +}; + +class QAccessibleTable2Cell: public QAccessibleTable2CellInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/ +{ +public: + QAccessibleTable2Cell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role); + + QObject *object() const { return 0; } + Role role(int child) const; + State state(int child) const; + QRect rect(int child) const; + bool isValid() const; + + int childAt(int, int) const { return 0; } + int childCount() const { return 0; } + int indexOfChild(const QAccessibleInterface *) const { return -1; } + + QString text(Text t, int child) const; + void setText(Text t, int child, const QString &text); + + int navigate(RelationFlag relation, int m_index, QAccessibleInterface **iface) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + + bool isExpandable() const; + +#ifndef QT_NO_ACTION + int userActionCount(int child) const; + QString actionText(int action, Text t, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); +#endif + + // cell interface + virtual int columnExtent() const; + virtual QList columnHeaderCells() const; + virtual int columnIndex() const; + virtual int rowExtent() const; + virtual QList rowHeaderCells() const; + virtual int rowIndex() const; + virtual bool isSelected() const; + virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const; + virtual QAccessibleTable2Interface* table() const; + +private: + QHeaderView *verticalHeader() const; + QHeaderView *horizontalHeader() const; + QAbstractItemView *view; + QModelIndex m_index; + QAccessible::Role m_role; + +friend class QAccessibleTable2; +friend class QAccessibleTree; +}; + + +class QAccessibleTable2HeaderCell: public QAccessibleInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/ +{ +public: + // For header cells, pass the header view in addition + QAccessibleTable2HeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation); + + QObject *object() const { return 0; } + Role role(int child) const; + State state(int child) const; + QRect rect(int child) const; + bool isValid() const; + + int childAt(int, int) const { return 0; } + int childCount() const { return 0; } + int indexOfChild(const QAccessibleInterface *) const { return -1; } + + QString text(Text t, int child) const; + void setText(Text t, int child, const QString &text); + + int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + +#ifndef QT_NO_ACTION + int userActionCount(int child) const; + QString actionText(int action, Text t, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); +#endif + +private: + QAbstractItemView *view; + int index; + Qt::Orientation orientation; + +friend class QAccessibleTable2; +friend class QAccessibleTree; +}; + +// This is the corner button on the top left of a table. +// It can be used to select all cells or it is not active at all. +// For now it is ignored. +class QAccessibleTable2CornerButton: public QAccessibleInterface +{ +public: + QAccessibleTable2CornerButton(QAbstractItemView *view_) + :view(view_) + {} + + QObject *object() const { return 0; } + Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; } + State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; } + QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); } + bool isValid() const { return true; } + + int childAt(int, int) const { return 0; } + int childCount() const { return 0; } + int indexOfChild(const QAccessibleInterface *) const { return -1; } + + QString text(Text, int) const { return QString(); } + void setText(Text, int, const QString &) {} + + int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const + { + if (relation == QAccessible::Ancestor && index == 1) { + *iface = QAccessible::queryAccessibleInterface(view); + return 0; + } + return -1; + } + Relation relationTo(int, const QAccessibleInterface *, int) const + { + return QAccessible::Unrelated; + } + +#ifndef QT_NO_ACTION + int userActionCount(int) const { return 0; } + QString actionText(int, Text, int) const { return QString(); } + bool doAction(int, int, const QVariantList &) { return false; } +#endif +private: + QAbstractItemView *view; +}; + + +#endif + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +#endif // ACCESSIBLE_ITEMVIEWS_H diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp index aa5459c066..cd17a6e80b 100644 --- a/src/plugins/accessible/widgets/main.cpp +++ b/src/plugins/accessible/widgets/main.cpp @@ -44,11 +44,13 @@ #include "simplewidgets.h" #include "rangecontrols.h" #include "complexwidgets.h" +#include "itemviews.h" #include #include #include #include +#include #include #include @@ -56,6 +58,7 @@ QT_BEGIN_NAMESPACE + class AccessibleFactory : public QAccessiblePlugin { public: @@ -251,6 +254,22 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec iface = new QAccessibleMenu(widget); #endif #ifndef QT_NO_ITEMVIEWS +#ifdef Q_WS_X11 + } else if (classname == QLatin1String("QAbstractItemView")) { + if (qobject_cast(widget)) { + iface = new QAccessibleTree(widget); + } else { + iface = new QAccessibleTable2(widget); + } + } else if (classname == QLatin1String("QWidget") + && widget->objectName() == QLatin1String("qt_scrollarea_viewport") + && qobject_cast(widget->parentWidget())) { + if (qobject_cast(widget->parentWidget())) { + iface = new QAccessibleTree(widget->parentWidget()); + } else { + iface = new QAccessibleTable2(widget->parentWidget()); + } +#else } else if (classname == QLatin1String("QHeaderView")) { iface = new QAccessibleHeader(widget); } else if (classname == QLatin1String("QAbstractItemView")) { @@ -259,7 +278,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec && widget->objectName() == QLatin1String("qt_scrollarea_viewport") && qobject_cast(widget->parentWidget())) { iface = new QAccessibleItemView(widget); -#endif +#endif // Q_WS_X11 +#endif // QT_NO_ITEMVIEWS #ifndef QT_NO_TABBAR } else if (classname == QLatin1String("QTabBar")) { iface = new QAccessibleTabBar(widget); diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro index 00d99f94e7..d1a121ec94 100644 --- a/src/plugins/accessible/widgets/widgets.pro +++ b/src/plugins/accessible/widgets/widgets.pro @@ -8,14 +8,18 @@ DESTDIR = $$QT.gui.plugins/accessible QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" SOURCES += main.cpp \ - simplewidgets.cpp \ - rangecontrols.cpp \ - complexwidgets.cpp \ - qaccessiblewidgets.cpp \ - qaccessiblemenu.cpp + simplewidgets.cpp \ + rangecontrols.cpp \ + complexwidgets.cpp \ + qaccessiblewidgets.cpp \ + qaccessiblemenu.cpp \ + itemviews.cpp HEADERS += qaccessiblewidgets.h \ - simplewidgets.h \ - rangecontrols.h \ - complexwidgets.h \ - qaccessiblemenu.h + simplewidgets.h \ + rangecontrols.h \ + complexwidgets.h \ + qaccessiblemenu.h \ + itemviews.h + + diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index dc84e8e074..8390de0de5 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -187,7 +187,8 @@ static int verifyHierarchy(QAccessibleInterface *iface) if (middleChild) { entry = if2->navigate(QAccessible::Sibling, middle, &if3); EXPECT(entry == 0 && if3->object() == middleChild->object()); - delete if3; + if (entry == 0) + delete if3; EXPECT(iface->indexOfChild(middleChild) == middle); } @@ -258,6 +259,9 @@ private slots: void scrollAreaTest(); void tableWidgetTest(); void tableViewTest(); + void table2ListTest(); + void table2TreeTest(); + void table2TableTest(); void calendarWidgetTest(); void dockWidgetTest(); void comboBoxTest(); @@ -288,6 +292,10 @@ QString eventName(const int ev) case 0x0012: return "ScrollingStart"; case 0x0013: return "ScrollingEnd"; case 0x0018: return "MenuCommand"; + + case 0x0116: return "TableModelChanged"; + case 0x011B: return "TextCaretMoved"; + case 0x8000: return "ObjectCreated"; case 0x8001: return "ObjectDestroyed"; case 0x8002: return "ObjectShow"; @@ -957,18 +965,21 @@ void tst_QAccessibility::applicationTest() void tst_QAccessibility::mainWindowTest() { - QMainWindow mw; - mw.resize(300, 200); - mw.show(); // triggers layout + QMainWindow *mw = new QMainWindow; + mw->resize(300, 200); + mw->show(); // triggers layout QLatin1String name = QLatin1String("I am the main window"); - mw.setWindowTitle(name); - QTest::qWaitForWindowShown(&mw); + mw->setWindowTitle(name); + QTest::qWaitForWindowShown(mw); + QVERIFY_EVENT(mw, 0, QAccessible::ObjectShow); - QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw); + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(mw); QCOMPARE(interface->text(QAccessible::Name, 0), name); QCOMPARE(interface->role(0), QAccessible::Window); delete interface; + delete mw; + QTestAccessibility::clearEvents(); } class CounterButton : public QPushButton { @@ -1728,6 +1739,9 @@ void tst_QAccessibility::textBrowserTest() void tst_QAccessibility::listViewTest() { +#if defined(Q_WS_X11) + QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll); +#else { QListView listView; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView); @@ -1793,6 +1807,7 @@ void tst_QAccessibility::listViewTest() } QTestAccessibility::clearEvents(); +#endif } @@ -2041,9 +2056,11 @@ void tst_QAccessibility::lineEditTest() le3->deselect(); le3->setCursorPosition(3); QCOMPARE(textIface->cursorPosition(), 3); + QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, 0, QAccessible::TextCaretMoved))); QCOMPARE(textIface->selectionCount(), 0); - int start, end; + QTestAccessibility::clearEvents(); + int start, end; QCOMPARE(textIface->text(0, 8), QString::fromLatin1("I always")); QCOMPARE(textIface->textAtOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("I")); QCOMPARE(start, 0); @@ -2086,6 +2103,7 @@ void tst_QAccessibility::lineEditTest() delete iface; delete toplevel; + QTestAccessibility::clearEvents(); } void tst_QAccessibility::workspaceTest() @@ -2496,6 +2514,9 @@ void tst_QAccessibility::scrollAreaTest() void tst_QAccessibility::tableWidgetTest() { +#if defined(Q_WS_X11) + QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll); +#else { QWidget *topLevel = new QWidget; QTableWidget *w = new QTableWidget(8,4,topLevel); @@ -2535,6 +2556,7 @@ void tst_QAccessibility::tableWidgetTest() delete topLevel; } QTestAccessibility::clearEvents(); +#endif } class QtTestTableModel: public QAbstractTableModel @@ -2617,6 +2639,9 @@ public: void tst_QAccessibility::tableViewTest() { +#if defined(Q_WS_X11) + QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll); +#else { QtTestTableModel *model = new QtTestTableModel(3, 4); QTableView *w = new QTableView(); @@ -2696,6 +2721,331 @@ void tst_QAccessibility::tableViewTest() delete model; } QTestAccessibility::clearEvents(); +#endif +} + +void tst_QAccessibility::table2ListTest() +{ +#if !defined(Q_WS_X11) + QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll); +#else + QListWidget *listView = new QListWidget; + listView->addItem("Oslo"); + listView->addItem("Berlin"); + listView->addItem("Brisbane"); + listView->resize(400,400); + listView->show(); + QTest::qWait(1); // Need this for indexOfchild to work. +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(listView); + QTest::qWait(100); +#endif + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(listView); + QCOMPARE(verifyHierarchy(iface), 0); + + QCOMPARE((int)iface->role(0), (int)QAccessible::List); + QCOMPARE(iface->childCount(), 3); + + QAccessibleInterface *child1 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 1, &child1), 0); + QVERIFY(child1); + QCOMPARE(iface->indexOfChild(child1), 1); + QCOMPARE(child1->text(QAccessible::Name, 0), QString("Oslo")); + QCOMPARE(child1->role(0), QAccessible::ListItem); + delete child1; + + QAccessibleInterface *child2 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 2, &child2), 0); + QVERIFY(child2); + QCOMPARE(iface->indexOfChild(child2), 2); + QCOMPARE(child2->text(QAccessible::Name, 0), QString("Berlin")); + delete child2; + + QAccessibleInterface *child3 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 3, &child3), 0); + QVERIFY(child3); + QCOMPARE(iface->indexOfChild(child3), 3); + QCOMPARE(child3->text(QAccessible::Name, 0), QString("Brisbane")); + delete child3; + QTestAccessibility::clearEvents(); + + // Check for events + QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center()); + QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Selection))); + QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Focus))); + QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center()); + QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Selection))); + QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Focus))); + + listView->addItem("Munich"); + QCOMPARE(iface->childCount(), 4); + + // table 2 + QAccessibleTable2Interface *table2 = iface->table2Interface(); + QVERIFY(table2); + QCOMPARE(table2->columnCount(), 1); + QCOMPARE(table2->rowCount(), 4); + QAccessibleTable2CellInterface *cell1; + QVERIFY(cell1 = table2->cellAt(0,0)); + QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Oslo")); + QAccessibleTable2CellInterface *cell4; + QVERIFY(cell4 = table2->cellAt(3,0)); + QCOMPARE(cell4->text(QAccessible::Name, 0), QString("Munich")); + QCOMPARE(cell4->role(0), QAccessible::ListItem); + QCOMPARE(cell4->rowIndex(), 3); + QCOMPARE(cell4->columnIndex(), 0); + QVERIFY(!cell4->isExpandable()); + + delete cell4; + delete cell1; + delete iface; + delete listView; + QTestAccessibility::clearEvents(); +#endif +} + +void tst_QAccessibility::table2TreeTest() +{ +#if !defined(Q_WS_X11) + QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll); +#else + QTreeWidget *treeView = new QTreeWidget; + treeView->setColumnCount(2); + QTreeWidgetItem *header = new QTreeWidgetItem; + header->setText(0, "Artist"); + header->setText(1, "Work"); + treeView->setHeaderItem(header); + + QTreeWidgetItem *root1 = new QTreeWidgetItem; + root1->setText(0, "Spain"); + treeView->addTopLevelItem(root1); + + QTreeWidgetItem *item1 = new QTreeWidgetItem; + item1->setText(0, "Picasso"); + item1->setText(1, "Guernica"); + root1->addChild(item1); + + QTreeWidgetItem *item2 = new QTreeWidgetItem; + item2->setText(0, "Tapies"); + item2->setText(1, "Ambrosia"); + root1->addChild(item2); + + QTreeWidgetItem *root2 = new QTreeWidgetItem; + root2->setText(0, "Austria"); + treeView->addTopLevelItem(root2); + + QTreeWidgetItem *item3 = new QTreeWidgetItem; + item3->setText(0, "Klimt"); + item3->setText(1, "The Kiss"); + root2->addChild(item3); + + treeView->resize(400,400); + treeView->show(); + QTest::qWait(1); // Need this for indexOfchild to work. +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(treeView); + QTest::qWait(100); +#endif + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView); + QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue); + QCOMPARE(verifyHierarchy(iface), 0); + + QCOMPARE((int)iface->role(0), (int)QAccessible::Tree); + // header and 2 rows (the others are not expanded, thus not visible) + QCOMPARE(iface->childCount(), 6); + + QAccessibleInterface *header1 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 1, &header1), 0); + QVERIFY(header1); + QCOMPARE(iface->indexOfChild(header1), 1); + QCOMPARE(header1->text(QAccessible::Name, 0), QString("Artist")); + QCOMPARE(header1->role(0), QAccessible::ColumnHeader); + delete header1; + + QAccessibleInterface *child1 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0); + QVERIFY(child1); + QCOMPARE(iface->indexOfChild(child1), 3); + QCOMPARE(child1->text(QAccessible::Name, 0), QString("Spain")); + QCOMPARE(child1->role(0), QAccessible::TreeItem); + QVERIFY(!(child1->state(0) & QAccessible::Expanded)); + delete child1; + + QAccessibleInterface *child2 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 5, &child2), 0); + QVERIFY(child2); + QCOMPARE(iface->indexOfChild(child2), 5); + QCOMPARE(child2->text(QAccessible::Name, 0), QString("Austria")); + delete child2; + + QTestAccessibility::clearEvents(); + + // table 2 + QAccessibleTable2Interface *table2 = iface->table2Interface(); + QVERIFY(table2); + QCOMPARE(table2->columnCount(), 2); + QCOMPARE(table2->rowCount(), 2); + QAccessibleTable2CellInterface *cell1; + QVERIFY(cell1 = table2->cellAt(0,0)); + QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Spain")); + QAccessibleTable2CellInterface *cell2; + QVERIFY(cell2 = table2->cellAt(1,0)); + QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Austria")); + QCOMPARE(cell2->role(0), QAccessible::TreeItem); + QCOMPARE(cell2->rowIndex(), 1); + QCOMPARE(cell2->columnIndex(), 0); + QVERIFY(cell2->isExpandable()); + QCOMPARE(iface->indexOfChild(cell2), 5); + QVERIFY(!(cell2->state(0) & QAccessible::Expanded)); + QCOMPARE(table2->columnDescription(1), QString("Work")); + delete cell2; + delete cell1; + + treeView->expandAll(); + + QTest::qWait(1); // Need this for indexOfchild to work. +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(treeView); + QTest::qWait(100); +#endif + + QCOMPARE(table2->columnCount(), 2); + QCOMPARE(table2->rowCount(), 5); + cell1 = table2->cellAt(1,0); + QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Picasso")); + QCOMPARE(iface->indexOfChild(cell1), 5); // 1 based + 2 header + 2 for root item + + cell2 = table2->cellAt(4,0); + QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Klimt")); + QCOMPARE(cell2->role(0), QAccessible::TreeItem); + QCOMPARE(cell2->rowIndex(), 4); + QCOMPARE(cell2->columnIndex(), 0); + QVERIFY(!cell2->isExpandable()); + QCOMPARE(iface->indexOfChild(cell2), 11); + + QCOMPARE(table2->columnDescription(0), QString("Artist")); + QCOMPARE(table2->columnDescription(1), QString("Work")); + + delete iface; + QTestAccessibility::clearEvents(); +#endif +} + + +void tst_QAccessibility::table2TableTest() +{ +#if !defined(Q_WS_X11) + QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll); +#else + QTableWidget *tableView = new QTableWidget(3, 3); + tableView->setColumnCount(3); + QStringList hHeader; + hHeader << "h1" << "h2" << "h3"; + tableView->setHorizontalHeaderLabels(hHeader); + + QStringList vHeader; + vHeader << "v1" << "v2" << "v3"; + tableView->setVerticalHeaderLabels(vHeader); + + for (int i = 0; i<9; ++i) { + QTableWidgetItem *item = new QTableWidgetItem; + item->setText(QString::number(i/3) + QString(".") + QString::number(i%3)); + tableView->setItem(i/3, i%3, item); + } + + tableView->resize(600,600); + tableView->show(); + QTest::qWait(1); // Need this for indexOfchild to work. +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(tableView); + QTest::qWait(100); +#endif + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView); + QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue); + QCOMPARE(verifyHierarchy(iface), 0); + + QCOMPARE((int)iface->role(0), (int)QAccessible::Table); + // header and 2 rows (the others are not expanded, thus not visible) + QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button + + QAccessibleInterface *cornerButton = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 1, &cornerButton), 0); + QVERIFY(cornerButton); + QCOMPARE(iface->indexOfChild(cornerButton), 1); + QCOMPARE(cornerButton->role(0), QAccessible::Pane); + delete cornerButton; + + QAccessibleInterface *child1 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0); + QVERIFY(child1); + QCOMPARE(iface->indexOfChild(child1), 3); + QCOMPARE(child1->text(QAccessible::Name, 0), QString("h2")); + QCOMPARE(child1->role(0), QAccessible::ColumnHeader); + QVERIFY(!(child1->state(0) & QAccessible::Expanded)); + delete child1; + + QAccessibleInterface *child2 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 11, &child2), 0); + QVERIFY(child2); + QCOMPARE(iface->indexOfChild(child2), 11); + QCOMPARE(child2->text(QAccessible::Name, 0), QString("1.1")); + QAccessibleTable2CellInterface *cell2Iface = static_cast(child2); + QCOMPARE(cell2Iface->rowIndex(), 1); + QCOMPARE(cell2Iface->columnIndex(), 1); + delete child2; + + QAccessibleInterface *child3 = 0; + QCOMPARE(iface->navigate(QAccessible::Child, 12, &child3), 0); + QCOMPARE(iface->indexOfChild(child3), 12); + QCOMPARE(child3->text(QAccessible::Name, 0), QString("1.2")); + delete child3; + + QTestAccessibility::clearEvents(); + + // table 2 + QAccessibleTable2Interface *table2 = iface->table2Interface(); + QVERIFY(table2); + QCOMPARE(table2->columnCount(), 3); + QCOMPARE(table2->rowCount(), 3); + QAccessibleTable2CellInterface *cell1; + QVERIFY(cell1 = table2->cellAt(0,0)); + QCOMPARE(cell1->text(QAccessible::Name, 0), QString("0.0")); + QCOMPARE(iface->indexOfChild(cell1), 6); + + QAccessibleTable2CellInterface *cell2; + QVERIFY(cell2 = table2->cellAt(0,1)); + QCOMPARE(cell2->text(QAccessible::Name, 0), QString("0.1")); + QCOMPARE(cell2->role(0), QAccessible::Cell); + QCOMPARE(cell2->rowIndex(), 0); + QCOMPARE(cell2->columnIndex(), 1); + QCOMPARE(iface->indexOfChild(cell2), 7); + delete cell2; + + QAccessibleTable2CellInterface *cell3; + QVERIFY(cell3 = table2->cellAt(1,2)); + QCOMPARE(cell3->text(QAccessible::Name, 0), QString("1.2")); + QCOMPARE(cell3->role(0), QAccessible::Cell); + QCOMPARE(cell3->rowIndex(), 1); + QCOMPARE(cell3->columnIndex(), 2); + QCOMPARE(iface->indexOfChild(cell3), 12); + delete cell3; + + QCOMPARE(table2->columnDescription(0), QString("h1")); + QCOMPARE(table2->columnDescription(1), QString("h2")); + QCOMPARE(table2->columnDescription(2), QString("h3")); + QCOMPARE(table2->rowDescription(0), QString("v1")); + QCOMPARE(table2->rowDescription(1), QString("v2")); + QCOMPARE(table2->rowDescription(2), QString("v3")); + + delete iface; + + delete tableView; + + QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::calendarWidgetTest() @@ -2912,6 +3262,9 @@ void tst_QAccessibility::comboBoxTest() void tst_QAccessibility::treeWidgetTest() { +#if defined(Q_WS_X11) + QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll); +#else QWidget *w = new QWidget; QTreeWidget *tree = new QTreeWidget(w); QHBoxLayout *l = new QHBoxLayout(w); @@ -2969,6 +3322,7 @@ void tst_QAccessibility::treeWidgetTest() delete w; QTestAccessibility::clearEvents(); +#endif } void tst_QAccessibility::labelTest() -- cgit v1.2.3 From a2cbaf9137b6e3a1c66b0bfb82345b1409ce5f1f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 23 Aug 2011 09:18:12 +1000 Subject: test: really marked tst_qtcpsocket autotest as unstable 15575fb280e1489157d0be44d00ab57aecc19320 edited the wrong .pro file :( Task-number: QTBUG-21043 Change-Id: I7b52fb7ea8669856b359523b278142c763bfb978 Reviewed-on: http://codereview.qt.nokia.com/3341 Reviewed-by: Qt Sanity Bot Reviewed-by: Keith Isdale --- tests/auto/qtcpsocket/qtcpsocket.pro | 2 -- tests/auto/qtcpsocket/test/test.pro | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 48ac1fa0c5..5dfff5bb88 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -6,5 +6,3 @@ wince*|symbian|vxworks* : SUBDIRS = test requires(contains(QT_CONFIG,private_tests)) - -CONFIG+=insignificant_test # unstable, QTBUG-21043 diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro index e282de1a2e..6ac2da653c 100644 --- a/tests/auto/qtcpsocket/test/test.pro +++ b/tests/auto/qtcpsocket/test/test.pro @@ -29,4 +29,4 @@ win32 { DESTDIR = ../ } - +CONFIG+=insignificant_test # unstable, QTBUG-21043 -- cgit v1.2.3 From b8cd3fe7b66130200af65eadaf17671136015441 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 16 Aug 2011 15:19:09 +0200 Subject: Implemented QAccessibleTextEdit::attributes() Handling font properties and colors Created test: tst_QAccessibility::textAttributes Merge-request: 2626 Reviewed-by: Harald Fernengel (cherry picked from commit f1a6766432f66220275aa7902e4c2414a3069cd1) Change-Id: I388bc660af20149934110d7894840eccecf81f2a Reviewed-on: http://codereview.qt.nokia.com/3036 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- .../accessible/widgets/qaccessiblewidgets.cpp | 111 ++++++++++++++++++++- tests/auto/qaccessibility/tst_qaccessibility.cpp | 55 ++++++++++ 2 files changed, 161 insertions(+), 5 deletions(-) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 45322e53d8..a0dde37ed6 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1321,11 +1321,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset) QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset) { - // TODO - wait for a definition of attributes - Q_UNUSED(offset); - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - return QString(); + /* The list of attributes can be found at: + http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes + */ + + if (offset >= characterCount()) { + *startOffset = -1; + *endOffset = -1; + return QString(); + } + + QMap attrs; + + QTextCursor cursor = textEdit()->textCursor(); + + //cursor.charFormat returns the format of the previous character + cursor.setPosition(offset + 1); + QTextCharFormat charFormat = cursor.charFormat(); + + cursor.setPosition(offset); + QTextBlockFormat blockFormat = cursor.blockFormat(); + + QTextCharFormat charFormatComp; + QTextBlockFormat blockFormatComp; + + *startOffset = offset; + cursor.setPosition(*startOffset); + while (*startOffset > 0) { + charFormatComp = cursor.charFormat(); + cursor.setPosition(*startOffset - 1); + blockFormatComp = cursor.blockFormat(); + if ((charFormat == charFormatComp) && (blockFormat == blockFormatComp)) + (*startOffset)--; + else + break; + } + + int limit = characterCount() + 1; + *endOffset = offset + 1; + cursor.setPosition(*endOffset); + while (*endOffset < limit) { + blockFormatComp = cursor.blockFormat(); + cursor.setPosition(*endOffset + 1); + charFormatComp = cursor.charFormat(); + if ((charFormat == charFormatComp) && (cursor.blockFormat() == blockFormatComp)) + (*endOffset)++; + else + break; + } + + QString family = charFormat.fontFamily(); + if (!family.isEmpty()) { + family = family.replace('\\',"\\\\"); + family = family.replace(':',"\\:"); + family = family.replace(',',"\\,"); + family = family.replace('=',"\\="); + family = family.replace(';',"\\;"); + family = family.replace('\"',"\\\""); + attrs["font-family"] = '"'+family+'"'; + } + + int fontSize = int(charFormat.fontPointSize()); + if (fontSize) + attrs["font-size"] = QString::number(fontSize).append("pt"); + + //Different weight values are not handled + attrs["font-weight"] = (charFormat.fontWeight() > QFont::Normal) ? "bold" : "normal"; + + QFont::Style style = charFormat.font().style(); + attrs["font-style"] = (style == QFont::StyleItalic) ? "italic" : ((style == QFont::StyleOblique) ? "oblique": "normal"); + + attrs["text-underline-style"] = charFormat.font().underline() ? "solid" : "none"; + + QTextCharFormat::VerticalAlignment alignment = charFormat.verticalAlignment(); + attrs["text-position"] = (alignment == QTextCharFormat::AlignSubScript) ? "sub" : ((alignment == QTextCharFormat::AlignSuperScript) ? "super" : "baseline" ); + + QBrush background = charFormat.background(); + if (background.style() == Qt::SolidPattern) { + attrs["background-color"] = QString("rgb(%1,%2,%3)").arg(background.color().red()).arg(background.color().green()).arg(background.color().blue()); + } + + QBrush foreground = charFormat.foreground(); + if (foreground.style() == Qt::SolidPattern) { + attrs["color"] = QString("rgb(%1,%2,%3)").arg(foreground.color().red()).arg(foreground.color().green()).arg(foreground.color().blue()); + } + + switch (blockFormat.alignment() & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter | Qt::AlignJustify)) { + case Qt::AlignLeft: + attrs["text-align"] = "left"; + break; + case Qt::AlignRight: + attrs["text-align"] = "right"; + break; + case Qt::AlignHCenter: + attrs["text-align"] = "center"; + break; + case Qt::AlignJustify: + attrs["text-align"] = "left"; + break; + } + + QString result; + foreach (const QString &attributeName, attrs.keys()) { + result.append(attributeName).append(':').append(attrs[attributeName]).append(';'); + } + + return result; } int QAccessibleTextEdit::cursorPosition() diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 8390de0de5..1d99cc1dc5 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -230,6 +230,7 @@ private slots: void navigateHierarchy(); void navigateSlider(); void navigateCovered(); + void textAttributes(); void hideShowTest(); void userActionCount(); @@ -862,6 +863,60 @@ void tst_QAccessibility::accessibleName() QTestAccessibility::clearEvents(); } +void tst_QAccessibility::textAttributes() +{ + QTextEdit textEdit; + int startOffset; + int endOffset; + QString attributes; + QString text("" + "Hello, this is an example text." + "Multiple fonts are used." + "Multiple text sizes are used." + "Let's give some color to Qt." + ""); + + textEdit.setText(text); + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&textEdit); + + QAccessibleTextInterface *textInterface=interface->textInterface(); + + QVERIFY(textInterface); + QCOMPARE(textInterface->characterCount(), 112); + + attributes = textInterface->attributes(10, &startOffset, &endOffset); + QCOMPARE(startOffset, 7); + QCOMPARE(endOffset, 11); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;"))); + + attributes = textInterface->attributes(18, &startOffset, &endOffset); + QCOMPARE(startOffset, 18); + QCOMPARE(endOffset, 25); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;"))); + QVERIFY(attributes.contains(QLatin1String(";font-style:italic;"))); + + attributes = textInterface->attributes(34, &startOffset, &endOffset); + QCOMPARE(startOffset, 31); + QCOMPARE(endOffset, 55); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-family:\"monospace\";"))); + + attributes = textInterface->attributes(65, &startOffset, &endOffset); + QCOMPARE(startOffset, 64); + QCOMPARE(endOffset, 74); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";font-size:8pt;"))); + + attributes = textInterface->attributes(110, &startOffset, &endOffset); + QCOMPARE(startOffset, 109); + QCOMPARE(endOffset, 111); + attributes.prepend(';'); + QVERIFY(attributes.contains(QLatin1String(";background-color:rgb(20,240,30);"))); + QVERIFY(attributes.contains(QLatin1String(";color:rgb(240,241,242);"))); +} + void tst_QAccessibility::hideShowTest() { QWidget * const window = new QWidget(); -- cgit v1.2.3 From 983941da65adda5e674ac2c2d90de55c93fda50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Fri, 3 Jun 2011 20:44:37 +0200 Subject: Check validator when changing text using accessibility functions. Reviewed-by: Frederik Gladhorn (cherry picked from commit 731d843b52b0a0bc387c50c2af37a71f87804f4d) Change-Id: Ieef71cea5b44f288f2f95a0765ec0b3f6d47c042 Reviewed-on: http://codereview.qt.nokia.com/3037 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 9 ++++++++- tests/auto/qaccessibility/tst_qaccessibility.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 5730b4d896..47a41b67bf 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -710,7 +710,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text) QAccessibleWidgetEx::setText(t, control, text); return; } - lineEdit()->setText(text); + + QString newText = text; + if (lineEdit()->validator()) { + int pos = 0; + if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable) + return; + } + lineEdit()->setText(newText); } /*! \reimp */ diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 1d99cc1dc5..d8aa382548 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2098,6 +2098,12 @@ void tst_QAccessibility::lineEditTest() QTestAccessibility::clearEvents(); le2->setFocus(Qt::TabFocusReason); QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, 0, QAccessible::Focus))); + + le->setText(QLatin1String("500")); + le->setValidator(new QIntValidator()); + iface->setText(QAccessible::Value, 0, QLatin1String("This text is not a number")); + QCOMPARE(le->text(), QLatin1String("500")); + delete iface; delete le; delete le2; -- cgit v1.2.3 From 4ef4f8f3e177e7e371232c49e614e6ebbf57e8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Sat, 4 Jun 2011 18:06:47 +0200 Subject: Do not expose text when echo mode is not Normal. Reviewed-by: Frederik Gladhorn (cherry picked from commit 636b7088eb3740800f54a7c1634d3e041e688270) Change-Id: I82b2e02af74dc43268d2b6613fe31e2875fd132f Reviewed-on: http://codereview.qt.nokia.com/3038 Reviewed-by: Qt Sanity Bot Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 47a41b67bf..36e786ff6b 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -815,6 +815,10 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset) { if (startOffset > endOffset) return QString(); + + if (lineEdit()->echoMode() != QLineEdit::Normal) + return QString(); + return lineEdit()->text().mid(startOffset, endOffset - startOffset); } -- cgit v1.2.3 From 41e5be37737b959c476275c6aa245b635b6e2a16 Mon Sep 17 00:00:00 2001 From: Antonis Tsiapaliokas Date: Tue, 16 Aug 2011 01:26:21 +0300 Subject: Add operator== and operator!= to qsqlerror class Merge-request: 44 Task-number: QTBUG-20543 Change-Id: I7b88985fe095ffd2e48ac05c82dc3f3a92dbb091 Reviewed-on: http://codereview.qt.nokia.com/3425 Reviewed-by: Charles Yin Reviewed-by: Qt Sanity Bot --- src/sql/kernel/qsqlerror.cpp | 20 ++++++++++++++++++++ src/sql/kernel/qsqlerror.h | 2 ++ tests/auto/qsqlerror/tst_qsqlerror.cpp | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp index a8ffdffa8a..fd731e4974 100644 --- a/src/sql/kernel/qsqlerror.cpp +++ b/src/sql/kernel/qsqlerror.cpp @@ -123,6 +123,26 @@ QSqlError& QSqlError::operator=(const QSqlError& other) return *this; } +/*! + Compare the \a other error's values to this error and returns true, if it equal. +*/ + +bool QSqlError::operator==(const QSqlError& other) +{ + return (errorType == other.errorType); +} + + +/*! + Compare the \a other error's values to this error and returns true if it is not equal. +*/ + +bool QSqlError::operator!=(const QSqlError& other) +{ + return (errorType != other.errorType); +} + + /*! Destroys the object and frees any allocated resources. */ diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h index fea3ca8526..c1df370a86 100644 --- a/src/sql/kernel/qsqlerror.h +++ b/src/sql/kernel/qsqlerror.h @@ -66,6 +66,8 @@ public: int number = -1); QSqlError(const QSqlError& other); QSqlError& operator=(const QSqlError& other); + bool operator==(const QSqlError& other); + bool operator!=(const QSqlError& other); ~QSqlError(); QString driverText() const; diff --git a/tests/auto/qsqlerror/tst_qsqlerror.cpp b/tests/auto/qsqlerror/tst_qsqlerror.cpp index ad3ef05cda..d02b373c73 100644 --- a/tests/auto/qsqlerror/tst_qsqlerror.cpp +++ b/tests/auto/qsqlerror/tst_qsqlerror.cpp @@ -61,6 +61,7 @@ public: private slots: void getSetCheck(); void construction(); + void operators(); }; tst_QSqlError::tst_QSqlError() @@ -125,5 +126,20 @@ void tst_QSqlError::construction() QVERIFY(!obj4.isValid()); } +void tst_QSqlError::operators() +{ + QSqlError error1; + QSqlError error2; + QSqlError error3; + + error1.setType(QSqlError::NoError); + error2.setType(QSqlError::NoError); + error3.setType(QSqlError::UnknownError); + + QVERIFY(error1 == error2); + QVERIFY(error1 != error3); +} + + QTEST_MAIN(tst_QSqlError) #include "tst_qsqlerror.moc" -- cgit v1.2.3 From bdc417b3828737334723eae23097c85f70c23a33 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Tue, 23 Aug 2011 11:36:24 +1000 Subject: update .gitignore 1. generated module def files 2. generated version headers 3. unit test executables Change-Id: Ibce72e89882e646ff0a450d68031e8e3a5cea085 Reviewed-on: http://codereview.qt.nokia.com/3346 Reviewed-by: Qt Sanity Bot Reviewed-by: Ling Hu --- .gitignore | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.gitignore b/.gitignore index 0db34fab52..47bd28227d 100644 --- a/.gitignore +++ b/.gitignore @@ -269,3 +269,47 @@ src/xml/lib/ *.dep *.map work + + +#generated module def and version header files +mkspecs/modules/qt_*.pri +mkspecs/qmodule.pri +src/uitools/qtuitoolsversion.h +tools/uilib/qtdesignerversion.h + + +#unit tests executables +selftests/assert/assert +selftests/badxml/badxml +selftests/benchlibcallgrind/benchlibcallgrind +selftests/benchlibeventcounter/benchlibeventcounter +selftests/benchliboptions/benchliboptions +selftests/benchlibtickcounter/benchlibtickcounter +selftests/benchlibwalltime/benchlibwalltime +selftests/cmptest/cmptest +selftests/commandlinedata/commandlinedata +selftests/crashes/crashes +selftests/datatable/datatable +selftests/datetime/datetime +selftests/differentexec/differentexec +selftests/exceptionthrow/exceptionthrow +selftests/expectfail/expectfail +selftests/failinit/failinit +selftests/failinitdata/failinitdata +selftests/fetchbogus/fetchbogus +selftests/globaldata/globaldata +selftests/longstring/longstring +selftests/maxwarnings/maxwarnings +selftests/multiexec/multiexec +selftests/qexecstringlist/qexecstringlist +selftests/singleskip/singleskip +selftests/skip/skip +selftests/skipglobal/skipglobal +selftests/skipinit/skipinit +selftests/skipinitdata/skipinitdata +selftests/sleep/sleep +selftests/strcmp/strcmp +selftests/subtest/subtest +selftests/waitwithoutgui/waitwithoutgui +selftests/warnings/warnings +selftests/xunit/xunit -- cgit v1.2.3