From eae8afa5711d892b482aaf06758ca7f4eb474b9c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 20 Dec 2016 15:07:56 +0100 Subject: [PATCH 01/71] Add AVX2 optimized bilinear texture transform Implement AVX2 versions of the three optimized paths of bilinear texture transform. Change-Id: Ie7199ef7dcce1e3457535fee35822d76afc0e8ba Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 11 + src/gui/painting/qdrawhelper_avx2.cpp | 414 ++++++++++++++++++++++++++ 2 files changed, 425 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 9233bff68c..6b7c57673b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6495,6 +6495,17 @@ static void qInitDrawhelperFunctions() qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_avx2; qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_avx2; qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2; + + extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int /*fdy*/); + extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_downscale_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int /*fdy*/); + extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int fdy); + + bilinearFastTransformHelperARGB32PM[0][SimpleUpscaleTransform] = fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2; + bilinearFastTransformHelperARGB32PM[0][DownscaleTransform] = fetchTransformedBilinearARGB32PM_downscale_helper_avx2; + bilinearFastTransformHelperARGB32PM[0][FastRotateTransform] = fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2; } #endif diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp index 5e17e8abec..a7e03a7bb3 100644 --- a/src/gui/painting/qdrawhelper_avx2.cpp +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -44,6 +44,13 @@ QT_BEGIN_NAMESPACE +static Q_CONSTEXPR int BufferSize = 2048; + +enum { + FixedScale = 1 << 16, + HalfPoint = 1 << 15 +}; + // Vectorized blend functions: // See BYTE_MUL_SSE2 for details. @@ -343,6 +350,413 @@ void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, u } } +#define interpolate_4_pixels_16_avx2(tlr1, tlr2, blr1, blr2, distx, disty, colorMask, v_256, b) \ +{ \ + /* Correct for later unpack */ \ + const __m256i vdistx = _mm256_permute4x64_epi64(distx, _MM_SHUFFLE(3, 1, 2, 0)); \ + const __m256i vdisty = _mm256_permute4x64_epi64(disty, _MM_SHUFFLE(3, 1, 2, 0)); \ + \ + __m256i dxdy = _mm256_mullo_epi16 (vdistx, vdisty); \ + const __m256i distx_ = _mm256_slli_epi16(vdistx, 4); \ + const __m256i disty_ = _mm256_slli_epi16(vdisty, 4); \ + __m256i idxidy = _mm256_add_epi16(dxdy, _mm256_sub_epi16(v_256, _mm256_add_epi16(distx_, disty_))); \ + __m256i dxidy = _mm256_sub_epi16(distx_, dxdy); \ + __m256i idxdy = _mm256_sub_epi16(disty_, dxdy); \ + \ + __m256i tlr1AG = _mm256_srli_epi16(tlr1, 8); \ + __m256i tlr1RB = _mm256_and_si256(tlr1, colorMask); \ + __m256i tlr2AG = _mm256_srli_epi16(tlr2, 8); \ + __m256i tlr2RB = _mm256_and_si256(tlr2, colorMask); \ + __m256i blr1AG = _mm256_srli_epi16(blr1, 8); \ + __m256i blr1RB = _mm256_and_si256(blr1, colorMask); \ + __m256i blr2AG = _mm256_srli_epi16(blr2, 8); \ + __m256i blr2RB = _mm256_and_si256(blr2, colorMask); \ + \ + __m256i odxidy1 = _mm256_unpacklo_epi32(idxidy, dxidy); \ + __m256i odxidy2 = _mm256_unpackhi_epi32(idxidy, dxidy); \ + tlr1AG = _mm256_mullo_epi16(tlr1AG, odxidy1); \ + tlr1RB = _mm256_mullo_epi16(tlr1RB, odxidy1); \ + tlr2AG = _mm256_mullo_epi16(tlr2AG, odxidy2); \ + tlr2RB = _mm256_mullo_epi16(tlr2RB, odxidy2); \ + __m256i odxdy1 = _mm256_unpacklo_epi32(idxdy, dxdy); \ + __m256i odxdy2 = _mm256_unpackhi_epi32(idxdy, dxdy); \ + blr1AG = _mm256_mullo_epi16(blr1AG, odxdy1); \ + blr1RB = _mm256_mullo_epi16(blr1RB, odxdy1); \ + blr2AG = _mm256_mullo_epi16(blr2AG, odxdy2); \ + blr2RB = _mm256_mullo_epi16(blr2RB, odxdy2); \ + \ + /* Add the values, and shift to only keep 8 significant bits per colors */ \ + __m256i topAG = _mm256_hadd_epi32(tlr1AG, tlr2AG); \ + __m256i topRB = _mm256_hadd_epi32(tlr1RB, tlr2RB); \ + __m256i botAG = _mm256_hadd_epi32(blr1AG, blr2AG); \ + __m256i botRB = _mm256_hadd_epi32(blr1RB, blr2RB); \ + __m256i rAG = _mm256_add_epi16(topAG, botAG); \ + __m256i rRB = _mm256_add_epi16(topRB, botRB); \ + rRB = _mm256_srli_epi16(rRB, 8); \ + /* Correct for hadd */ \ + rAG = _mm256_permute4x64_epi64(rAG, _MM_SHUFFLE(3, 1, 2, 0)); \ + rRB = _mm256_permute4x64_epi64(rRB, _MM_SHUFFLE(3, 1, 2, 0)); \ + _mm256_storeu_si256((__m256i*)(b), _mm256_blendv_epi8(rAG, rRB, colorMask)); \ +} + +inline void fetchTransformedBilinear_pixelBounds(int, int l1, int l2, int &v1, int &v2) +{ + if (v1 < l1) + v2 = v1 = l1; + else if (v1 >= l2) + v2 = v1 = l2; + else + v2 = v1 + 1; + Q_ASSERT(v1 >= l1 && v1 <= l2); + Q_ASSERT(v2 >= l1 && v2 <= l2); +} + +void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int /*fdy*/) +{ + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2); + const uint *s1 = (const uint *)image.scanLine(y1); + const uint *s2 = (const uint *)image.scanLine(y2); + + int disty = (fy & 0x0000ffff) >> 8; + int idisty = 256 - disty; + int x = fx >> 16; + int length = end - b; + + // The idea is first to do the interpolation between the row s1 and the row s2 + // into an intermediate buffer, then we interpolate between two pixel of this buffer. + + // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB + // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG + // +1 for the last pixel to interpolate with, and +1 for rounding errors. + quint32 intermediate_buffer[2][BufferSize + 2]; + // count is the size used in the intermediate_buffer. + int count = (qint64(length) * fdx + FixedScale - 1) / FixedScale + 2; + Q_ASSERT(count <= BufferSize + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case + int f = 0; + int lim = qMin(count, image.x2 - x); + if (x < image.x1) { + Q_ASSERT(x < image.x2); + uint t = s1[image.x1]; + uint b = s2[image.x1]; + quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + do { + intermediate_buffer[0][f] = rb; + intermediate_buffer[1][f] = ag; + f++; + x++; + } while (x < image.x1 && f < lim); + } + + const __m256i disty_ = _mm256_set1_epi16(disty); + const __m256i idisty_ = _mm256_set1_epi16(idisty); + const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff); + + lim -= 7; + for (; f < lim; x += 8, f += 8) { + // Load 8 pixels from s1, and split the alpha-green and red-blue component + __m256i top = _mm256_loadu_si256((const __m256i*)((const uint *)(s1)+x)); + __m256i topAG = _mm256_srli_epi16(top, 8); + __m256i topRB = _mm256_and_si256(top, colorMask); + // Multiplies each color component by idisty + topAG = _mm256_mullo_epi16 (topAG, idisty_); + topRB = _mm256_mullo_epi16 (topRB, idisty_); + + // Same for the s2 vector + __m256i bottom = _mm256_loadu_si256((const __m256i*)((const uint *)(s2)+x)); + __m256i bottomAG = _mm256_srli_epi16(bottom, 8); + __m256i bottomRB = _mm256_and_si256(bottom, colorMask); + bottomAG = _mm256_mullo_epi16 (bottomAG, disty_); + bottomRB = _mm256_mullo_epi16 (bottomRB, disty_); + + // Add the values, and shift to only keep 8 significant bits per colors + __m256i rAG =_mm256_add_epi16(topAG, bottomAG); + rAG = _mm256_srli_epi16(rAG, 8); + _mm256_storeu_si256((__m256i*)(&intermediate_buffer[1][f]), rAG); + __m256i rRB =_mm256_add_epi16(topRB, bottomRB); + rRB = _mm256_srli_epi16(rRB, 8); + _mm256_storeu_si256((__m256i*)(&intermediate_buffer[0][f]), rRB); + } + + for (; f < count; f++) { // Same as above but without simd + x = qMin(x, image.x2 - 1); + + uint t = s1[x]; + uint b = s2[x]; + + intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + x++; + } + // Now interpolate the values from the intermediate_buffer to get the final result. + fx &= FixedScale - 1; + Q_ASSERT((fx >> 16) == 0); + + const __m128i v_fdx = _mm_set1_epi32(fdx * 4); + const __m128i v_blend = _mm_set1_epi32(0x00800080); + __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); + + while (b < end - 3) { + const __m128i offset = _mm_srli_epi32(v_fx, 16); + __m256i vrb = _mm256_i32gather_epi64((const long long *)intermediate_buffer[0], offset, 4); + __m256i vag = _mm256_i32gather_epi64((const long long *)intermediate_buffer[1], offset, 4); + + __m128i vdx = _mm_and_si128(v_fx, _mm_set1_epi32(0x0000ffff)); + vdx = _mm_srli_epi16(vdx, 8); + __m128i vidx = _mm_sub_epi32(_mm_set1_epi32(256), vdx); + __m256i vmulx = _mm256_castsi128_si256(_mm_unpacklo_epi32(vidx, vdx)); + vmulx = _mm256_inserti128_si256(vmulx, _mm_unpackhi_epi32(vidx, vdx), 1); + + vrb = _mm256_mullo_epi32(vrb, vmulx); + vag = _mm256_mullo_epi32(vag, vmulx); + + __m256i vrbag = _mm256_hadd_epi32(vrb, vag); + vrbag = _mm256_permute4x64_epi64(vrbag, _MM_SHUFFLE(3, 1, 2, 0)); + + __m128i rb = _mm256_castsi256_si128(vrbag); + __m128i ag = _mm256_extracti128_si256(vrbag, 1); + rb = _mm_srli_epi16(rb, 8); + + _mm_storeu_si128((__m128i*)b, _mm_blendv_epi8(ag, rb, v_blend)); + + b += 4; + fx += 4 * fdx; + v_fx = _mm_add_epi32(v_fx, v_fdx); + } + while (b < end) { + int x = (fx >> 16); + + uint distx = (fx & 0x0000ffff) >> 8; + uint idistx = 256 - distx; + + uint rb = ((intermediate_buffer[0][x] * idistx + intermediate_buffer[0][x + 1] * distx) >> 8) & 0xff00ff; + uint ag = (intermediate_buffer[1][x] * idistx + intermediate_buffer[1][x + 1] * distx) & 0xff00ff00; + *b = rb | ag; + b++; + fx += fdx; + } +} + +void QT_FASTCALL fetchTransformedBilinearARGB32PM_downscale_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int /*fdy*/) +{ + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2); + const uint *s1 = (const uint *)image.scanLine(y1); + const uint *s2 = (const uint *)image.scanLine(y2); + const int disty8 = (fy & 0x0000ffff) >> 8; + const int disty4 = (disty8 + 0x08) >> 4; + + const qint64 min_fx = qint64(image.x1) * FixedScale; + const qint64 max_fx = qint64(image.x2 - 1) * FixedScale; + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2); + if (x1 != x2) + break; + uint top = s1[x1]; + uint bot = s2[x1]; + *b = INTERPOLATE_PIXEL_256(top, 256 - disty8, bot, disty8); + fx += fdx; + ++b; + } + uint *boundedEnd = end; + if (fdx > 0) + boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); + else if (fdx < 0) + boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); + + // A fast middle part without boundary checks + const __m256i vdistShuffle = + _mm256_setr_epi8(0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80), + 0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80)); + const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff); + const __m256i v_256 = _mm256_set1_epi16(256); + const __m256i v_disty = _mm256_set1_epi16(disty4); + const __m256i v_fdx = _mm256_set1_epi32(fdx * 8); + const __m256i v_fx_r = _mm256_set1_epi32(0x08); + const __m256i v_index = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7); + __m256i v_fx = _mm256_set1_epi32(fx); + v_fx = _mm256_add_epi32(v_fx, _mm256_mullo_epi32(_mm256_set1_epi32(fdx), v_index)); + + while (b < boundedEnd - 7) { + const __m256i offset = _mm256_srli_epi32(v_fx, 16); + const __m128i offsetLo = _mm256_castsi256_si128(offset); + const __m128i offsetHi = _mm256_extracti128_si256(offset, 1); + const __m256i toplo = _mm256_i32gather_epi64((const long long *)s1, offsetLo, 4); + const __m256i tophi = _mm256_i32gather_epi64((const long long *)s1, offsetHi, 4); + const __m256i botlo = _mm256_i32gather_epi64((const long long *)s2, offsetLo, 4); + const __m256i bothi = _mm256_i32gather_epi64((const long long *)s2, offsetHi, 4); + + __m256i v_distx = _mm256_srli_epi16(v_fx, 8); + v_distx = _mm256_srli_epi16(_mm256_add_epi32(v_distx, v_fx_r), 4); + v_distx = _mm256_shuffle_epi8(v_distx, vdistShuffle); + + interpolate_4_pixels_16_avx2(toplo, tophi, botlo, bothi, v_distx, v_disty, colorMask, v_256, b); + b += 8; + v_fx = _mm256_add_epi32(v_fx, v_fdx); + } + fx = _mm_extract_epi32(_mm256_castsi256_si128(v_fx) , 0); + + while (b < boundedEnd) { + int x = (fx >> 16); + int distx8 = (fx & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(s1 + x, s2 + x, distx8, disty8); + fx += fdx; + ++b; + } + + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2); + uint tl = s1[x1]; + uint tr = s1[x2]; + uint bl = s2[x1]; + uint br = s2[x2]; + int distx8 = (fx & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(tl, tr, bl, br, distx8, disty8); + fx += fdx; + ++b; + } +} + +void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint *b, uint *end, const QTextureData &image, + int &fx, int &fy, int fdx, int fdy) +{ + const qint64 min_fx = qint64(image.x1) * FixedScale; + const qint64 max_fx = qint64(image.x2 - 1) * FixedScale; + const qint64 min_fy = qint64(image.y1) * FixedScale; + const qint64 max_fy = qint64(image.y2 - 1) * FixedScale; + // first handle the possibly bounded part in the beginning + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2); + fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2); + if (x1 != x2 && y1 != y2) + break; + const uint *s1 = (const uint *)image.scanLine(y1); + const uint *s2 = (const uint *)image.scanLine(y2); + uint tl = s1[x1]; + uint tr = s1[x2]; + uint bl = s2[x1]; + uint br = s2[x2]; + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); + fx += fdx; + fy += fdy; + ++b; + } + uint *boundedEnd = end; + if (fdx > 0) + boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); + else if (fdx < 0) + boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); + if (fdy > 0) + boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); + else if (fdy < 0) + boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); + + // until boundedEnd we can now have a fast middle part without boundary checks + const __m256i vdistShuffle = + _mm256_setr_epi8(0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80), + 0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80)); + const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff); + const __m256i v_256 = _mm256_set1_epi16(256); + const __m256i v_fdx = _mm256_set1_epi32(fdx * 8); + const __m256i v_fdy = _mm256_set1_epi32(fdy * 8); + const __m256i v_fxy_r = _mm256_set1_epi32(0x08); + const __m256i v_index = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7); + __m256i v_fx = _mm256_set1_epi32(fx); + __m256i v_fy = _mm256_set1_epi32(fy); + v_fx = _mm256_add_epi32(v_fx, _mm256_mullo_epi32(_mm256_set1_epi32(fdx), v_index)); + v_fy = _mm256_add_epi32(v_fy, _mm256_mullo_epi32(_mm256_set1_epi32(fdy), v_index)); + + const uchar *textureData = image.imageData; + const int bytesPerLine = image.bytesPerLine; + const __m256i vbpl = _mm256_set1_epi16(bytesPerLine/4); + + while (b < boundedEnd - 7) { + const __m256i vy = _mm256_packs_epi32(_mm256_srli_epi32(v_fy, 16), _mm256_setzero_si256()); + // 8x16bit * 8x16bit -> 8x32bit + __m256i offset = _mm256_unpacklo_epi16(_mm256_mullo_epi16(vy, vbpl), _mm256_mulhi_epi16(vy, vbpl)); + offset = _mm256_add_epi32(offset, _mm256_srli_epi32(v_fx, 16)); + const __m128i offsetLo = _mm256_castsi256_si128(offset); + const __m128i offsetHi = _mm256_extracti128_si256(offset, 1); + const uint *topData = (const uint *)(textureData); + const uint *botData = (const uint *)(textureData + bytesPerLine); + const __m256i toplo = _mm256_i32gather_epi64((const long long *)topData, offsetLo, 4); + const __m256i tophi = _mm256_i32gather_epi64((const long long *)topData, offsetHi, 4); + const __m256i botlo = _mm256_i32gather_epi64((const long long *)botData, offsetLo, 4); + const __m256i bothi = _mm256_i32gather_epi64((const long long *)botData, offsetHi, 4); + + __m256i v_distx = _mm256_srli_epi16(v_fx, 8); + __m256i v_disty = _mm256_srli_epi16(v_fy, 8); + v_distx = _mm256_srli_epi16(_mm256_add_epi32(v_distx, v_fxy_r), 4); + v_disty = _mm256_srli_epi16(_mm256_add_epi32(v_disty, v_fxy_r), 4); + v_distx = _mm256_shuffle_epi8(v_distx, vdistShuffle); + v_disty = _mm256_shuffle_epi8(v_disty, vdistShuffle); + + interpolate_4_pixels_16_avx2(toplo, tophi, botlo, bothi, v_distx, v_disty, colorMask, v_256, b); + b += 8; + v_fx = _mm256_add_epi32(v_fx, v_fdx); + v_fy = _mm256_add_epi32(v_fy, v_fdy); + } + fx = _mm_extract_epi32(_mm256_castsi256_si128(v_fx) , 0); + fy = _mm_extract_epi32(_mm256_castsi256_si128(v_fy) , 0); + + while (b < boundedEnd) { + int x = (fx >> 16); + int y = (fy >> 16); + + const uint *s1 = (const uint *)image.scanLine(y); + const uint *s2 = (const uint *)image.scanLine(y + 1); + + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(s1 + x, s2 + x, distx, disty); + + fx += fdx; + fy += fdy; + ++b; + } + + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; + + fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2); + fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2); + + const uint *s1 = (const uint *)image.scanLine(y1); + const uint *s2 = (const uint *)image.scanLine(y2); + + uint tl = s1[x1]; + uint tr = s1[x2]; + uint bl = s2[x1]; + uint br = s2[x2]; + + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); + + fx += fdx; + fy += fdy; + ++b; + } +} + QT_END_NAMESPACE #endif From 5a3029fbf11c8e802f8b811e98d16ed29983548d Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 28 Feb 2017 14:33:09 +0100 Subject: [PATCH 02/71] File dialog does not require features.tooltip Also rewrite condition as block Change-Id: Ife0086def80f1806c38dad822265fddf7ca0690b Reviewed-by: Lars Knoll --- src/widgets/configure.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 7bc2e06a32..ee296ccbe0 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -408,7 +408,16 @@ "label": "QFileDialog", "purpose": "Provides a dialog widget for selecting files or directories.", "section": "Dialogs", - "condition": "features.dirmodel && features.treeview && features.combobox && features.toolbutton && features.buttongroup && features.tooltip && features.splitter && features.stackedwidget && features.proxymodel", + "condition": [ + "features.buttongroup", + "features.combobox", + "features.dirmodel", + "features.proxymodel", + "features.splitter", + "features.stackedwidget", + "features.treeview", + "features.toolbutton" + ], "output": [ "publicFeature", "feature" ] }, "fontdialog": { From 104408f3daf7e62dc33f6573282af9ccc2d1c440 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 27 Feb 2017 15:06:12 +0100 Subject: [PATCH 03/71] Add feature.commandlinkbutton Change-Id: I057ed507552c74a787e5bcdaa28a18c667eecd43 Reviewed-by: Oswald Buddenhagen --- src/widgets/configure.json | 6 ++++++ src/widgets/widgets/qcommandlinkbutton.h | 2 ++ src/widgets/widgets/widgets.pri | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index ee296ccbe0..f27a23fd04 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -117,6 +117,12 @@ "condition": "features.tableview", "output": [ "publicFeature", "feature" ] }, + "commandlinkbutton": { + "label": "QCommandLinkButton", + "purpose": "Provides a Vista style command link button.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "datetimeedit": { "label": "QDateTimeEdit", "purpose": "Supports editing dates and times.", diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h index 4f81651ce4..d8215a256e 100644 --- a/src/widgets/widgets/qcommandlinkbutton.h +++ b/src/widgets/widgets/qcommandlinkbutton.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(commandlinkbutton); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index abba3e0472..fc002c126a 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -13,7 +13,6 @@ HEADERS += \ widgets/qcheckbox.h \ widgets/qcombobox.h \ widgets/qcombobox_p.h \ - widgets/qcommandlinkbutton.h \ widgets/qdatetimeedit.h \ widgets/qdatetimeedit_p.h \ widgets/qdial.h \ @@ -92,7 +91,6 @@ SOURCES += \ widgets/qcalendarwidget.cpp \ widgets/qcheckbox.cpp \ widgets/qcombobox.cpp \ - widgets/qcommandlinkbutton.cpp \ widgets/qdatetimeedit.cpp \ widgets/qdial.cpp \ widgets/qdialogbuttonbox.cpp \ @@ -145,6 +143,14 @@ SOURCES += \ widgets/qtoolbararealayout.cpp \ widgets/qplaintextedit.cpp +qtConfig(commandlinkbutton) { + HEADERS += \ + widgets/qcommandlinkbutton.h + + SOURCES += \ + widgets/qcommandlinkbutton.cpp +} + macx { HEADERS += \ widgets/qmacnativewidget_mac.h \ From d83a20af1d05b5958d3559482b715777a57dea7a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 23 Feb 2017 14:53:27 +0100 Subject: [PATCH 04/71] Improve time stamp precision of qmake's touch function On POSIX compliant platforms, the default precision we apply to preserving time stamps is seconds. However we can do better and use utimensat() - if available - to increase the precision to nanoseconds. The values are provided by statbuf's st_mtim. This is guarded for compatibility with older systems, similar to commit 494ced13292fa9d7b572f5310090f6b8fab36e26. Change-Id: I6928660230d84f8511bf0f58e268906d2e575e04 Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakebuiltins.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index b30373b596..808bf53da4 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1818,10 +1819,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( evalError(fL1S("Cannot stat() reference file %1: %2.").arg(rfn, fL1S(strerror(errno)))); return ReturnFalse; } +#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L + const struct timespec times[2] = { { 0, UTIME_NOW }, st.st_mtim }; + const bool utimeError = utimensat(AT_FDCWD, tfn.toLocal8Bit().constData(), times, 0) < 0; +#else struct utimbuf utb; utb.actime = time(0); utb.modtime = st.st_mtime; - if (utime(tfn.toLocal8Bit().constData(), &utb)) { + const bool utimeError = utime(tfn.toLocal8Bit().constData(), &utb) < 0; +#endif + if (utimeError) { evalError(fL1S("Cannot touch %1: %2.").arg(tfn, fL1S(strerror(errno)))); return ReturnFalse; } From a58dafd2e8b2ad6ee89dc447e9a98d31f574ec9f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 20 Feb 2017 10:09:39 +0100 Subject: [PATCH 05/71] Build fix for -no-feature-imageformat_xpm Change-Id: I081fdfb622f21fc63a72e153d4d6c7120107ba67 Reviewed-by: Lars Knoll --- src/widgets/styles/qcommonstyle.cpp | 2 ++ src/widgets/styles/qfusionstyle.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 18a0c4fb64..24070f18a6 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5239,6 +5239,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget return ret; } +#if QT_CONFIG(imageformat_xpm) static QPixmap cachedPixmapFromXPM(const char * const *xpm) { QPixmap result; @@ -5251,6 +5252,7 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) } static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); } +#endif // QT_CONFIG(imageformat_xpm) #ifndef QT_NO_IMAGEFORMAT_PNG static inline QString clearText16IconPath() diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 75c50bb146..bf72983138 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -86,7 +86,7 @@ static const int windowsRightBorder = 15; // right border on windows static const int groupBoxBottomMargin = 0; // space below the groupbox static const int groupBoxTopMargin = 3; - +#if QT_CONFIG(imageformat_xpm) /* XPM */ static const char * const dock_widget_close_xpm[] = { "11 13 7 1", @@ -173,7 +173,7 @@ static const char * const qt_titlebar_context_help[] = { " ", " ## ", " ## "}; - +#endif // QT_CONFIG(imageformat_xpm) static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) { @@ -2368,6 +2368,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken); qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); +#if QT_CONFIG(imageformat_xpm) QImage image(qt_titlebar_context_help); QColor alpha = textColor; alpha.setAlpha(128); @@ -2375,6 +2376,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption image.setColor(2, alpha.rgba()); painter->setRenderHint(QPainter::SmoothPixmapTransform); painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); +#endif } } From 410d9cabb76f56358944f61a810457b80bcbf65f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Feb 2017 14:11:01 +0100 Subject: [PATCH 06/71] Build fix for -no-feature-validator Change-Id: I884381964d692eb5d3eb9088c87779c03057981d Reviewed-by: Lars Knoll --- src/widgets/itemviews/qabstractitemdelegate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 8cd2a957be..f63e258e8e 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -537,11 +537,13 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor) #ifndef QT_NO_LINEEDIT if (QLineEdit *e = qobject_cast(editor)) { if (!e->hasAcceptableInput()) { +#if QT_CONFIG(validator) if (const QValidator *validator = e->validator()) { QString text = e->text(); validator->fixup(text); e->setText(text); } +#endif return e->hasAcceptableInput(); } } From a16b6e29e0913f71c282adbc2b9f4ad83626c094 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Feb 2017 12:40:56 +0100 Subject: [PATCH 07/71] Fix build with -no-feature-draganddrop Change-Id: If537cb6b7d41b2d6511c369451dde2e9289f724d Reviewed-by: Lars Knoll --- src/widgets/graphicsview/qgraphicsview.cpp | 19 ++----------------- src/widgets/graphicsview/qgraphicsview.h | 2 ++ src/widgets/itemviews/qlistview.cpp | 2 ++ src/widgets/itemviews/qlistwidget.h | 3 ++- src/widgets/itemviews/qtablewidget.h | 3 ++- src/widgets/itemviews/qtreewidget.h | 3 ++- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 41f5eddd99..9d7412340f 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2996,12 +2996,12 @@ void QGraphicsView::contextMenuEvent(QContextMenuEvent *event) } #endif // QT_NO_CONTEXTMENU +#if QT_CONFIG(draganddrop) /*! \reimp */ void QGraphicsView::dropEvent(QDropEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3020,10 +3020,6 @@ void QGraphicsView::dropEvent(QDropEvent *event) delete d->lastDragDropEvent; d->lastDragDropEvent = 0; - -#else - Q_UNUSED(event) -#endif } /*! @@ -3031,7 +3027,6 @@ void QGraphicsView::dropEvent(QDropEvent *event) */ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3054,9 +3049,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) event->setAccepted(true); event->setDropAction(sceneEvent.dropAction()); } -#else - Q_UNUSED(event) -#endif } /*! @@ -3064,7 +3056,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) */ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3094,9 +3085,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) // Accept the originating event if the scene accepted the scene event. if (sceneEvent.isAccepted()) event->setAccepted(true); -#else - Q_UNUSED(event) -#endif } /*! @@ -3104,7 +3092,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) */ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3123,10 +3110,8 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) event->setAccepted(sceneEvent.isAccepted()); if (sceneEvent.isAccepted()) event->setDropAction(sceneEvent.dropAction()); -#else - Q_UNUSED(event) -#endif } +#endif // QT_CONFIG(draganddrop) /*! \reimp diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 327a75c374..64d5f5b430 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -244,10 +244,12 @@ protected: #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; #endif +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE; void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; +#endif void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE; bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 45c547d313..1414823e82 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -2020,7 +2020,9 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView: QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) { +#if QT_CONFIG(draganddrop) dd->defaultDropAction = Qt::CopyAction; +#endif } #ifndef QT_NO_DRAGANDDROP diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index c70e0522b7..85ca639e50 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -252,8 +252,9 @@ public: bool isItemHidden(const QListWidgetItem *item) const; void setItemHidden(const QListWidgetItem *item, bool hide); +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif public Q_SLOTS: void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible); void clear(); diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 5dde93f628..b91bcf7ce4 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -331,8 +331,9 @@ protected: QModelIndex indexFromItem(QTableWidgetItem *item) const; QTableWidgetItem *itemFromIndex(const QModelIndex &index) const; +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif private: void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 36ba9985bd..fc0bccf2fe 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -360,8 +360,9 @@ protected: QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const; QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const; +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif private: void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; From 40837c42a5418b99aadf9e4bf25a99d1f4d41ab7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 15:33:27 +0100 Subject: [PATCH 08/71] Build fix for -no-feature-validator Change-Id: I385ce6e37611b7ba32503ef5d041628dd764fe23 Reviewed-by: Lars Knoll --- src/widgets/accessible/simplewidgets.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index a2805a2458..f22f9cb2ed 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -664,11 +664,13 @@ void QAccessibleLineEdit::setText(QAccessible::Text t, const QString &text) } QString newText = text; +#if QT_CONFIG(validator) if (lineEdit()->validator()) { int pos = 0; if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable) return; } +#endif lineEdit()->setText(newText); } From 782e1caa9f562ad7ea00241e91ce94ad464323b8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 15:31:20 +0100 Subject: [PATCH 09/71] Fix build with -no-feature-tabletevent Change-Id: I5f16db38a3a54acaa76f764b9d4d7167640587c9 Reviewed-by: Lars Knoll --- src/plugins/generic/generic.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro index 996e57d015..e323f32d2c 100644 --- a/src/plugins/generic/generic.pro +++ b/src/plugins/generic/generic.pro @@ -2,7 +2,9 @@ TEMPLATE = subdirs QT_FOR_CONFIG += gui-private network-private qtConfig(evdev) { - SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet + SUBDIRS += evdevmouse evdevtouch evdevkeyboard + qtConfig(tabletevent): \ + SUBDIRS += evdevtablet } qtConfig(tslib) { From e97d6fd52cacc1aa0903512d6571c1aa7b30ae92 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 15:17:15 +0100 Subject: [PATCH 10/71] Build fix for -no-feature-action Change-Id: I62291af347dca7c1bb4a53d2cb698e4f1a38743d Reviewed-by: Lars Knoll --- src/widgets/widgets/qlineedit.cpp | 11 ++++++++++- src/widgets/widgets/qlineedit.h | 2 ++ src/widgets/widgets/qlineedit_p.cpp | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index fb0ffd6083..0a35bae200 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -437,6 +437,7 @@ bool QLineEdit::hasFrame() const \since 5.2 */ +#if QT_CONFIG(action) /*! \overload @@ -466,7 +467,7 @@ QAction *QLineEdit::addAction(const QIcon &icon, ActionPosition position) addAction(result, position); return result; } - +#endif // QT_CONFIG(action) /*! \property QLineEdit::clearButtonEnabled \brief Whether the line edit displays a clear button when it is not empty. @@ -483,6 +484,7 @@ static const char clearButtonActionNameC[] = "_q_qlineeditclearaction"; void QLineEdit::setClearButtonEnabled(bool enable) { +#if QT_CONFIG(action) Q_D(QLineEdit); if (enable == isClearButtonEnabled()) return; @@ -497,11 +499,16 @@ void QLineEdit::setClearButtonEnabled(bool enable) d->removeAction(clearAction); delete clearAction; } +#endif // QT_CONFIG(action) } bool QLineEdit::isClearButtonEnabled() const { +#if QT_CONFIG(action) return findChild(QLatin1String(clearButtonActionNameC)); +#else + return false; +#endif } void QLineEdit::setFrame(bool enable) @@ -1432,8 +1439,10 @@ bool QLineEdit::event(QEvent * e) || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) d->setCursorVisible(true); } +#if QT_CONFIG(action) } else if (e->type() == QEvent::ActionRemoved) { d->removeAction(static_cast(e)->action()); +#endif } else if (e->type() == QEvent::Resize) { d->positionSideWidgets(); } diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index 96dd64164f..4d32b11f06 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -174,9 +174,11 @@ public: void getTextMargins(int *left, int *top, int *right, int *bottom) const; QMargins textMargins() const; +#if QT_CONFIG(action) using QWidget::addAction; void addAction(QAction *action, ActionPosition position); QAction *addAction(const QIcon &icon, ActionPosition position); +#endif public Q_SLOTS: void setText(const QString &); diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 13f18f66d2..791fba49aa 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -448,12 +448,14 @@ QIcon QLineEditPrivate::clearButtonIcon() const void QLineEditPrivate::setClearButtonEnabled(bool enabled) { +#if QT_CONFIG(action) for (const SideWidgetEntry &e : trailingSideWidgets) { if (e.flags & SideWidgetClearButton) { e.action->setEnabled(enabled); break; } } +#endif } void QLineEditPrivate::positionSideWidgets() @@ -467,14 +469,18 @@ void QLineEditPrivate::positionSideWidgets() QSize(p.widgetWidth, p.widgetHeight)); for (const SideWidgetEntry &e : leftSideWidgetList()) { e.widget->setGeometry(widgetGeometry); +#if QT_CONFIG(action) if (e.action->isVisible()) widgetGeometry.moveLeft(widgetGeometry.left() + delta); +#endif } widgetGeometry.moveLeft(contentRect.width() - p.widgetWidth - p.margin); for (const SideWidgetEntry &e : rightSideWidgetList()) { e.widget->setGeometry(widgetGeometry); +#if QT_CONFIG(action) if (e.action->isVisible()) widgetGeometry.moveLeft(widgetGeometry.left() - delta); +#endif } } } @@ -508,10 +514,12 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE QWidget *w = 0; // Store flags about QWidgetAction here since removeAction() may be called from ~QAction, // in which a qobject_cast<> no longer works. +#if QT_CONFIG(action) if (QWidgetAction *widgetAction = qobject_cast(newAction)) { if ((w = widgetAction->requestWidget(q))) flags |= SideWidgetCreatedByWidgetAction; } +#endif if (!w) { #if QT_CONFIG(toolbutton) QLineEditIconButton *toolButton = new QLineEditIconButton(q); @@ -538,6 +546,7 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE void QLineEditPrivate::removeAction(QAction *action) { +#if QT_CONFIG(action) Q_Q(QLineEdit); const PositionIndexPair positionIndex = findSideWidget(action); if (positionIndex.second == -1) @@ -553,6 +562,7 @@ void QLineEditPrivate::removeAction(QAction *action) if (!hasSideWidgets()) // Last widget, remove connection QObject::disconnect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString))); q->update(); +#endif // QT_CONFIG(action) } static bool isSideWidgetVisible(const QLineEditPrivate::SideWidgetEntry &e) From 0684f28984e748c80300f5b66b15a3a1f2462ce7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 14:35:40 +0100 Subject: [PATCH 11/71] Build fix for xmlstreamreader/writer features Change-Id: Icb3a998716c8816e244634e21911a7384078978e Reviewed-by: Lars Knoll --- src/tools/uic/uic.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro index 9afb2d847f..02469cdd1b 100644 --- a/src/tools/uic/uic.pro +++ b/src/tools/uic/uic.pro @@ -1,5 +1,5 @@ option(host_build) -!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)): \ +!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)|!qtConfig(xmlstreamreader)|!qtConfig(xmlstreamwriter)): \ CONFIG += force_bootstrap DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH From 1399cacb6be044550bbd330b5ec77c1c1609b3ff Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 14:58:13 +0100 Subject: [PATCH 12/71] Fix build with -no-feature-cursor Change-Id: I971dbe7827adf0cf06337348a0d011632c364725 Reviewed-by: Lars Knoll --- src/plugins/platforms/vnc/qvnc.cpp | 8 ++------ src/plugins/platforms/vnc/qvnc_p.h | 3 ++- src/plugins/platforms/vnc/qvncclient.cpp | 4 ++-- src/plugins/platforms/vnc/qvncscreen.cpp | 11 +++++++++++ src/plugins/platforms/vnc/qvncscreen.h | 2 ++ 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp index a45bb1c19c..fa65e8c9a4 100644 --- a/src/plugins/platforms/vnc/qvnc.cpp +++ b/src/plugins/platforms/vnc/qvnc.cpp @@ -531,13 +531,12 @@ void QRfbRawEncoder::write() socket->flush(); } +#if QT_CONFIG(cursor) QVncClientCursor::QVncClientCursor() { -#ifndef QT_NO_CURSOR QWindow *w = QGuiApplication::focusWindow(); QCursor c = w ? w->cursor() : QCursor(Qt::ArrowCursor); changeCursor(&c, 0); -#endif } QVncClientCursor::~QVncClientCursor() @@ -587,7 +586,6 @@ void QVncClientCursor::write(QVncClient *client) const void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window) { Q_UNUSED(window); -#ifndef QT_NO_CURSOR const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor; if (shape == Qt::BitmapCursor) { @@ -601,9 +599,6 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window) cursor = *platformImage.image(); hotspot = platformImage.hotspot(); } -#else // !QT_NO_CURSOR - Q_UNUSED(widgetCursor); -#endif for (auto client : clients) client->setDirtyCursor(); } @@ -619,6 +614,7 @@ uint QVncClientCursor::removeClient(QVncClient *client) clients.removeOne(client); return clients.count(); } +#endif // QT_CONFIG(cursor) QVncServer::QVncServer(QVncScreen *screen, quint16 port) : qvnc_screen(screen) diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h index e58b6ae056..338fae9f87 100644 --- a/src/plugins/platforms/vnc/qvnc_p.h +++ b/src/plugins/platforms/vnc/qvnc_p.h @@ -364,6 +364,7 @@ private: friend class QRfbMultiColorHextile; }; +#if QT_CONFIG(cursor) class QVncClientCursor : public QPlatformCursor { public: @@ -381,7 +382,7 @@ public: QPoint hotspot; QVector clients; }; - +#endif // QT_CONFIG(cursor) class QVncServer : public QObject { diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp index 58dcfc9b51..9dfe873927 100644 --- a/src/plugins/platforms/vnc/qvncclient.cpp +++ b/src/plugins/platforms/vnc/qvncclient.cpp @@ -425,14 +425,14 @@ void QVncClient::checkUpdate() { if (!m_wantUpdate) return; - +#if QT_CONFIG(cursor) if (m_dirtyCursor) { m_server->screen()->clientCursor->write(this); m_dirtyCursor = false; m_wantUpdate = false; return; } - +#endif if (!m_dirtyRegion.isEmpty()) { if (m_encoder) m_encoder->write(); diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 75c8bedff7..cd43ce4e69 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -58,8 +58,10 @@ QVncScreen::QVncScreen(const QStringList &args) QVncScreen::~QVncScreen() { +#if QT_CONFIG(cursor) if (clientCursor) delete clientCursor; +#endif } bool QVncScreen::initialize() @@ -120,17 +122,21 @@ QRegion QVncScreen::doRedraw() return touched; } + void QVncScreen::enableClientCursor(QVncClient *client) { +#if QT_CONFIG(cursor) delete mCursor; mCursor = nullptr; if (!clientCursor) clientCursor = new QVncClientCursor(); clientCursor->addClient(client); +#endif } void QVncScreen::disableClientCursor(QVncClient *client) { +#if QT_CONFIG(cursor) uint clientCount = clientCursor->removeClient(client); if (clientCount == 0) { delete clientCursor; @@ -138,11 +144,16 @@ void QVncScreen::disableClientCursor(QVncClient *client) } mCursor = new QFbCursor(this); +#endif } QPlatformCursor *QVncScreen::cursor() const { +#if QT_CONFIG(cursor) return mCursor ? static_cast(mCursor) : static_cast(clientCursor); +#else + return nullptr; +#endif } // grabWindow() grabs "from the screen" not from the backingstores. diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h index b2dd89a2ed..e69aa90d41 100644 --- a/src/plugins/platforms/vnc/qvncscreen.h +++ b/src/plugins/platforms/vnc/qvncscreen.h @@ -86,7 +86,9 @@ public: QRegion dirtyRegion; int refreshRate = 30; QVncServer *vncServer = 0; +#if QT_CONFIG(cursor) QVncClientCursor *clientCursor = 0; +#endif }; QT_END_NAMESPACE From 432fd5a5afe6f165cc11b7e039dadbec9ed80eb5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 13:56:13 +0100 Subject: [PATCH 13/71] Make VNC a proper feature Change-Id: Iffae3f4d77f46bbf7ac38e7c9bc916f060606dd9 Reviewed-by: Lars Knoll --- src/gui/configure.json | 8 +++++++- src/plugins/platforms/platforms.pro | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index e627d6286f..a3e97e09ca 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -537,6 +537,12 @@ "condition": "tests.linuxfb", "output": [ "privateFeature" ] }, + "vnc": { + "label": "VNC", + "section": "Platform plugins", + "condition": "config.unix && !config.android && !config.darwin && features.regularexpression", + "output": [ "privateFeature" ] + }, "mirclient": { "label": "Mir client", "section": "Platform plugins", @@ -1114,7 +1120,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11" ] }, - "linuxfb", "mirclient", + "linuxfb", "vnc", "mirclient", { "type": "feature", "message": "INTEGRITY framebuffer", diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 2a6e059243..9ccc2b54b9 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -36,7 +36,7 @@ qtConfig(directfb) { qtConfig(linuxfb): SUBDIRS += linuxfb -unix:!android:!darwin: SUBDIRS += vnc +qtConfig(vnc): SUBDIRS += vnc freebsd { SUBDIRS += bsdfb From 369876ee0639fdb6a4d3d8ed1c98810e7347a78b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 13:55:45 +0100 Subject: [PATCH 14/71] Build fix for -no-feature-regularexpression Change-Id: I34f23c0cdc269d8a3acf1e09553ba2604e142736 Reviewed-by: Lars Knoll --- src/gui/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index a3e97e09ca..41c665962e 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -534,7 +534,7 @@ "linuxfb": { "label": "LinuxFB", "section": "Platform plugins", - "condition": "tests.linuxfb", + "condition": "tests.linuxfb && features.regularexpression", "output": [ "privateFeature" ] }, "vnc": { From 06a3ac26717794c053c23dc5c04914c0b1769e22 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 13 Feb 2017 16:53:53 +0100 Subject: [PATCH 15/71] Fix build with -no-feature-tabbar Change-Id: I7b692f5308efa92da8c2101e07e9a803c6c69d99 Reviewed-by: Lars Knoll --- src/widgets/widgets/qdockarealayout.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 8d9280ebb5..37ea7dadbc 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2605,12 +2605,16 @@ bool QDockAreaLayout::insertGap(const QList &path, QLayoutItem *dockWidgetI QLayoutItem *QDockAreaLayout::plug(const QList &path) { +#if QT_CONFIG(tabbar) Q_ASSERT(!path.isEmpty()); const int index = path.first(); Q_ASSERT(index >= 0 && index < QInternal::DockCount); QLayoutItem *item = docks[index].plug(path.mid(1)); docks[index].reparentWidgets(mainWindow); return item; +#else + return nullptr; +#endif } QLayoutItem *QDockAreaLayout::unplug(const QList &path) From 07d4376e0d9a147afe18c03d130bd5bc6c04ad49 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 16 Feb 2017 09:53:57 +0100 Subject: [PATCH 16/71] Build fix for -no-feature-datestring Change-Id: If3b744e9f7e7761d02664b1a117e0540fabe8915 Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 2 +- src/sql/configure.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index dfef0bcd6c..45e768708e 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -28,7 +28,7 @@ "label": "CUPS", "purpose": "Provides support for the Common Unix Printing System.", "section": "Painting", - "condition": "libs.cups && features.printer", + "condition": "libs.cups && features.printer && features.datestring", "output": [ "privateFeature", "feature" ] }, "cupsjobwidget": { diff --git a/src/sql/configure.json b/src/sql/configure.json index ff2409415b..e8d1fb6ce3 100644 --- a/src/sql/configure.json +++ b/src/sql/configure.json @@ -153,7 +153,7 @@ }, "sql-odbc": { "label": "ODBC", - "condition": "libs.odbc && features.textdate", + "condition": "libs.odbc && features.datestring", "output": [ "publicFeature" ] }, "sql-psql": { @@ -168,7 +168,7 @@ }, "sql-sqlite": { "label": "SQLite", - "condition": "features.textdate", + "condition": "features.datestring", "output": [ "publicFeature" ] }, "system-sqlite": { @@ -179,7 +179,7 @@ }, "sql-tds": { "label": "TDS (Sybase)", - "condition": "libs.tds && features.textdate", + "condition": "libs.tds && features.datestring", "output": [ "publicFeature" ] } }, From a43670a889274431066d9390825c852fbbe14240 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 28 Feb 2017 15:50:02 +0100 Subject: [PATCH 17/71] Fix malformed GL extension name for immutable storage Change-Id: Ice2821d9d9523fa8cd446c009677378d52f61ad5 Task-number: QTBUG-59189 Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 3696378bd1..0831bfe706 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -3685,7 +3685,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) const char *renderer = reinterpret_cast(ctx->functions()->glGetString(GL_RENDERER)); switch (feature) { case ImmutableStorage: - supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("EXT_texture_storage"))) + supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage"))) && !(renderer && strstr(renderer, "Mali")); // do not use on Mali: QTBUG-45106 break; From b41492d53e733e12351338e03ad471d39d81c0b1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 1 Mar 2017 15:50:44 +0100 Subject: [PATCH 18/71] Doc: Remove references to pre-C++11 recommendations Compiler support for lambda functions and variadic templates is required since Qt 5.7, so no need to mention in the documentation what happens if the compiler doesn't support it. Change-Id: I5caeaa0bd7f0edce81e22e22964e0b7dd042c719 Reviewed-by: Marc Mutz --- .../doc/src/objectmodel/signalsandslots.qdoc | 3 --- src/corelib/kernel/qobject.cpp | 15 ++------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index 6366350cde..ed61511c62 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -364,9 +364,6 @@ connect(sender, &QObject::destroyed, [=](){ this->m_objects.remove(sender); }); \endcode - Note that if your compiler does not support C++11 variadic templates, - this syntax only works if the signal and slot have 6 arguments or less. - The other way to connect a signal to a slot is to use QObject::connect() and the \c{SIGNAL} and \c{SLOT} macros. The rule about whether to diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8e906b278d..2f4f76856f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4655,12 +4655,8 @@ void qDeleteInEventHandler(QObject *o) make sure to declare the argument type with Q_DECLARE_METATYPE Overloaded functions can be resolved with help of \l qOverload. - - \note The number of arguments in the signal or slot are limited to 6 if - the compiler does not support C++11 variadic templates. */ - /*! \fn QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, Functor functor) @@ -4683,7 +4679,7 @@ void qDeleteInEventHandler(QObject *o) \snippet code/src_corelib_kernel_qobject.cpp 45 - If your compiler support C++11 lambda expressions, you can use them: + Lambda expressions can also be used: \snippet code/src_corelib_kernel_qobject.cpp 46 @@ -4693,9 +4689,6 @@ void qDeleteInEventHandler(QObject *o) Overloaded functions can be resolved with help of \l qOverload. - \note If the compiler does not support C++11 variadic templates, the number - of arguments in the signal or slot are limited to 6, and the functor object - must not have an overloaded or templated operator(). */ /*! @@ -4726,7 +4719,7 @@ void qDeleteInEventHandler(QObject *o) \snippet code/src_corelib_kernel_qobject.cpp 50 - If your compiler support C++11 lambda expressions, you can use them: + Lambda expressions can also be used: \snippet code/src_corelib_kernel_qobject.cpp 51 @@ -4736,10 +4729,6 @@ void qDeleteInEventHandler(QObject *o) are still alive when the signal is emitted. Overloaded functions can be resolved with help of \l qOverload. - - \note If the compiler does not support C++11 variadic templates, the number - of arguments in the signal or slot are limited to 6, and the functor object - must not have an overloaded or templated operator(). */ /*! From e1b9ddc10552b061ef8b4d56a2e3fa7a5daa61bb Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 28 Feb 2017 20:24:27 +0100 Subject: [PATCH 19/71] Add feature.scroller Change-Id: I5313e1f5091d5764994525dae138e288e5125c59 Reviewed-by: Lars Knoll --- src/widgets/configure.json | 6 ++++++ src/widgets/itemviews/qabstractitemview.cpp | 6 +++--- src/widgets/itemviews/qabstractitemview.h | 2 +- src/widgets/styles/qpixmapstyle.cpp | 6 ++++-- src/widgets/util/qscroller.h | 2 ++ src/widgets/util/qscrollerproperties.h | 2 ++ src/widgets/util/util.pri | 22 +++++++++++++-------- 7 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index f27a23fd04..151935927a 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -324,6 +324,12 @@ "condition": "features.scrollbar", "output": [ "publicFeature", "feature" ] }, + "scroller": { + "label": "QScroller", + "purpose": "Enables kinetic scrolling for any scrolling widget or graphics item.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "graphicsview": { "label": "QGraphicsView", "purpose": "Provides a canvas/sprite framework.", diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 6ecf5a664f..939e2a3d79 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -64,7 +64,7 @@ #ifndef QT_NO_ACCESSIBILITY #include #endif -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) # include #endif @@ -196,7 +196,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index } } -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) // stores and restores the selection and current item when flicking void QAbstractItemViewPrivate::_q_scrollerStateChanged() @@ -1736,7 +1736,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) break; case QEvent::ScrollPrepare: executeDelayedItemsLayout(); -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) connect(QScroller::scroller(d->viewport), SIGNAL(stateChanged(QScroller::State)), this, SLOT(_q_scrollerStateChanged()), Qt::UniqueConnection); #endif break; diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 309b8c4d59..f315ea6e4c 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -367,7 +367,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) Q_PRIVATE_SLOT(d_func(), void _q_headerDataChanged()) -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged()) #endif diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index a947f5d079..3aec3cf991 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -60,7 +60,9 @@ #include #include +#if QT_CONFIG(scroller) #include +#endif QT_BEGIN_NAMESPACE @@ -194,7 +196,7 @@ void QPixmapStyle::polish(QWidget *widget) view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); } #endif -#if QT_CONFIG(gestures) +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture); #endif } @@ -235,7 +237,7 @@ void QPixmapStyle::unpolish(QWidget *widget) if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) widget->removeEventFilter(this); -#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) +#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) && QT_CONFIG(scroller) if (QAbstractScrollArea *scrollArea = qobject_cast(widget)) QScroller::ungrabGesture(scrollArea->viewport()); #endif diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h index 561dcfaefc..ca8d059f50 100644 --- a/src/widgets/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -45,6 +45,8 @@ #include #include +QT_REQUIRE_CONFIG(scroller); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h index 4fdc9bd32f..2fc1a5dc18 100644 --- a/src/widgets/util/qscrollerproperties.h +++ b/src/widgets/util/qscrollerproperties.h @@ -45,6 +45,8 @@ #include #include +QT_REQUIRE_CONFIG(scroller); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index cb19c1fc95..b9b62d9bb0 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -6,11 +6,6 @@ HEADERS += \ util/qcompleter.h \ util/qcompleter_p.h \ util/qsystemtrayicon_p.h \ - util/qscroller.h \ - util/qscroller_p.h \ - util/qscrollerproperties.h \ - util/qscrollerproperties_p.h \ - util/qflickgesture_p.h \ util/qundogroup.h \ util/qundostack.h \ util/qundostack_p.h \ @@ -20,13 +15,24 @@ SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ util/qcompleter.cpp \ - util/qscroller.cpp \ - util/qscrollerproperties.cpp \ - util/qflickgesture.cpp \ util/qundogroup.cpp \ util/qundostack.cpp \ util/qundoview.cpp +qtConfig(scroller) { + HEADERS += \ + util/qscroller.h \ + util/qscroller_p.h \ + util/qscrollerproperties.h \ + util/qscrollerproperties_p.h \ + util/qflickgesture_p.h + + SOURCES += \ + util/qscroller.cpp \ + util/qscrollerproperties.cpp \ + util/qflickgesture.cpp \ +} + win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp } else: qtConfig(xcb) { From 593a707ba35c22c0a1061dce745deceed8837f80 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 27 Feb 2017 15:07:42 +0100 Subject: [PATCH 20/71] Remove unused QDBusConnectionPrivate::checkReplyForDelivery() It's referenced nowhere, and wasn't even implemented. Change-Id: I3c43c4733f82f98f2af451460270b519474be6ed Reviewed-by: Thiago Macieira --- src/dbus/qdbusconnection_p.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 875bcd1421..d323088779 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -348,9 +348,6 @@ public: QObject *receiver, const char *signal, int minMIdx, bool buildSignature); static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); - static bool checkReplyForDelivery(QDBusConnectionPrivate *target, QObject *object, - int idx, const QList &metaTypes, - const QDBusMessage &msg); static QDBusCallDeliveryEvent *prepareReply(QDBusConnectionPrivate *target, QObject *object, int idx, const QVector &metaTypes, const QDBusMessage &msg); From c4c8886a864d1058c3441a96556aa8b124b4f17f Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 23 Feb 2017 09:39:07 +0100 Subject: [PATCH 21/71] ppm/pgm image formats: fix reading 16bit and limited range The color values of ppm and pgm images can be either 8 or 16 bits. They can also be scaled to a smaller max value, and they can be expressed either binary or ascii. For some of these permutations, Qt's image handler lacked implementation or would decode the wrong color value. This commit fixes that. Task-number: QTBUG-18262 Task-number: QTBUG-35990 Change-Id: I7cf11c2366244f3a9b31c1a565a81e2658bc6a51 Reviewed-by: Lars Knoll --- src/gui/image/qppmhandler.cpp | 59 ++++++++++---- .../image/qimagereader/tst_qimagereader.cpp | 76 +++++++++++++++++++ 2 files changed, 121 insertions(+), 14 deletions(-) diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index 42d3684aea..e9f5a905f0 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -45,6 +45,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -120,6 +121,11 @@ static bool read_pbm_header(QIODevice *device, char& type, int& w, int& h, int& return true; } +static inline QRgb scale_pbm_color(quint16 mx, quint16 rv, quint16 gv, quint16 bv) +{ + return QRgba64::fromRgba64((rv * 0xffff) / mx, (gv * 0xffff) / mx, (bv * 0xffff) / mx, 0xffff).toArgb32(); +} + static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, QImage *outImage) { int nbits, y; @@ -148,9 +154,6 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q } raw = type >= '4'; - int maxc = mcc; - if (maxc > 255) - maxc = 255; if (outImage->size() != QSize(w, h) || outImage->format() != format) { *outImage = QImage(w, h, format); if (outImage->isNull()) @@ -175,22 +178,50 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q b = buf24; while (p < end) { if (mcc < 256) { - *p++ = qRgb(b[0],b[1],b[2]); + if (mcc == 255) + *p++ = qRgb(b[0],b[1],b[2]); + else + *p++ = scale_pbm_color(mcc, b[0], b[1], b[2]); b += 3; } else { - *p++ = qRgb(((int(b[0]) * 256 + int(b[1]) + 1) * 256) / (mcc + 1) - 1, - ((int(b[2]) * 256 + int(b[3]) + 1) * 256) / (mcc + 1) - 1, - ((int(b[4]) * 256 + int(b[5]) + 1) * 256) / (mcc + 1) - 1); + quint16 rv = b[0] << 8 | b[1]; + quint16 gv = b[2] << 8 | b[3]; + quint16 bv = b[4] << 8 | b[5]; + if (mcc == 0xffff) + *p++ = QRgba64::fromRgba64(rv, gv, bv, 0xffff).toArgb32(); + else + *p++ = scale_pbm_color(mcc, rv, gv, bv); b += 6; } } } delete[] buf24; + } else if (nbits == 8 && mcc > 255) { // type 5 16bit + pbm_bpl = 2*w; + uchar *buf16 = new uchar[pbm_bpl]; + for (y=0; yread((char *)buf16, pbm_bpl) != pbm_bpl) { + delete[] buf16; + return false; + } + uchar *p = outImage->scanLine(y); + uchar *end = p + w; + uchar *b = buf16; + while (p < end) { + *p++ = (b[0] << 8 | b[1]) * 255 / mcc; + b += 2; + } + } + delete[] buf16; } else { // type 4,5 for (y=0; yread((char *)outImage->scanLine(y), pbm_bpl) - != pbm_bpl) + uchar *p = outImage->scanLine(y); + if (device->read((char *)p, pbm_bpl) != pbm_bpl) return false; + if (nbits == 8 && mcc < 255) { + for (int i = 0; i < pbm_bpl; i++) + p[i] = (p[i] * 255) / mcc; + } } } } else { // read ascii data @@ -227,7 +258,7 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q } else { // 32 bits n /= 4; int r, g, b; - if (mcc == maxc) { + if (mcc == 255) { while (n--) { r = read_pbm_int(device); g = read_pbm_int(device); @@ -237,10 +268,10 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q } } else { while (n--) { - r = read_pbm_int(device) * maxc / mcc; - g = read_pbm_int(device) * maxc / mcc; - b = read_pbm_int(device) * maxc / mcc; - *((QRgb*)p) = qRgb(r, g, b); + r = read_pbm_int(device); + g = read_pbm_int(device); + b = read_pbm_int(device); + *((QRgb*)p) = scale_pbm_color(mcc, r, g, b); p += 4; } } diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index bd02dc6255..18649b3de5 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -133,6 +133,9 @@ private slots: void gifImageCount(); void gifLoopCount(); + void ppmMaxval_data(); + void ppmMaxval(); + void readCorruptImage_data(); void readCorruptImage(); void readCorruptBmp(); @@ -956,6 +959,79 @@ void tst_QImageReader::gifLoopCount() } } +void tst_QImageReader::ppmMaxval_data() +{ + QTest::addColumn("hasColor"); + QTest::addColumn("bytes"); + + QTest::newRow("PGM plain 8bit full") << false << QByteArray("P2 3 1 255 255 0 127\n"); + QTest::newRow("PGM plain 8bit lim.") << false << QByteArray("P2 3 1 50 50 0 25\n"); + QTest::newRow("PGM plain 16bit full") << false << QByteArray("P2 3 1 65535 65535 0 32767\n"); + QTest::newRow("PGM plain 16bit lim.") << false << QByteArray("P2 3 1 5000 5000 0 2500\n"); + QTest::newRow("PGM raw 8bit full") << false << QByteArray("P5 3 1 255 \xff\x00\x7f", 13 + 3); + QTest::newRow("PGM raw 8bit lim.") << false << QByteArray("P5 3 1 50 \x32\x00\x19", 13 + 3); + QTest::newRow("PGM raw 16bit full") << false << QByteArray("P5 3 1 65535 \xff\xff\x00\x00\x7f\xff", 13 + 3 * 2); + QTest::newRow("PGM raw 16bit lim.") << false << QByteArray("P5 3 1 5000 \x13\x88\x00\x00\x09\xc4", 13 + 3 * 2); + + QTest::newRow("PPM plain 8bit full") << true << QByteArray("P3 3 2 255 " + "255 255 255 0 0 0 127 127 127 " + "255 0 0 0 255 0 0 0 255\n"); + + QTest::newRow("PPM plain 8bit lim.") << true << QByteArray("P3 3 2 50 " + " 50 50 50 0 0 0 25 25 25 " + " 50 0 0 0 50 0 0 0 50\n"); + + QTest::newRow("PPM plain 16bit full") << true << QByteArray("P3 3 2 65535 " + "65535 65535 65535 0 0 0 32767 32767 32767 " + "65535 0 0 0 65535 0 0 0 65535\n"); + + QTest::newRow("PPM plain 16bit lim.") << true << QByteArray("P3 3 2 5000 " + " 5000 5000 5000 0 0 0 2500 2500 2500 " + " 5000 0 0 0 5000 0 0 0 5000\n"); + + QTest::newRow("PPM raw 8bit full") << true << QByteArray("P6 3 2 255 " + "\xff\xff\xff\x00\x00\x00\x7f\x7f\x7f" + "\xff\x00\x00\x00\xff\x00\x00\x00\xff", 13 + 6 * 3); + + QTest::newRow("PPM raw 8bit lim.") << true << QByteArray("P6 3 2 50 " + "\x32\x32\x32\x00\x00\x00\x19\x19\x19" + "\x32\x00\x00\x00\x32\x00\x00\x00\x32", 13 + 6 * 3); + + QTest::newRow("PPM raw 16bit full") << true << QByteArray("P6 3 2 65535 " + "\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x7f\xff\x7f\xff\x7f\xff" + "\xff\xff\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\xff\xff", 13 + 6 * 3 * 2); + + QTest::newRow("PPM raw 16bit lim.") << true << QByteArray("P6 3 2 5000 " + "\x13\x88\x13\x88\x13\x88\x00\x00\x00\x00\x00\x00\x09\xc4\x09\xc4\x09\xc4" + "\x13\x88\x00\x00\x00\x00\x00\x00\x13\x88\x00\x00\x00\x00\x00\x00\x13\x88", 13 + 6 * 3 * 2); +} + +void tst_QImageReader::ppmMaxval() +{ + SKIP_IF_UNSUPPORTED("ppm"); + + QFETCH(bool, hasColor); + QFETCH(QByteArray, bytes); + + QImage img; + img.loadFromData(bytes); + QVERIFY(!img.isNull()); + QCOMPARE(img.width(), 3); + QCOMPARE(img.height(), hasColor ? 2 : 1); + + QCOMPARE(img.pixel(0,0), qRgb(0xff, 0xff, 0xff)); + QCOMPARE(img.pixel(1,0), qRgb(0, 0, 0)); + QRgb gray = img.pixel(2,0); + QVERIFY(qIsGray(gray)); + QVERIFY(qRed(gray) > 0x70 && qRed(gray) < 0x90 ); + + if (hasColor) { + QCOMPARE(img.pixel(0,1), qRgb(0xff, 0, 0)); + QCOMPARE(img.pixel(1,1), qRgb(0, 0xff, 0)); + QCOMPARE(img.pixel(2,1), qRgb(0, 0, 0xff)); + } +} + class Server : public QObject { Q_OBJECT From 87f8777b45dd0643e1a9e17e3e93f95371d3246d Mon Sep 17 00:00:00 2001 From: Gerry Boland Date: Tue, 31 Jan 2017 13:58:12 +0000 Subject: [PATCH 22/71] Mirclient: only enable if desired. Depend on content-hub>=0.2.0 Change-Id: I65050e7924b6f7564664e8f4c7270ddad5717336 Reviewed-by: Eirik Aavitsland --- src/gui/configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 41c665962e..b1329cc213 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -170,7 +170,7 @@ "label": "Mir client libraries", "test": "qpa/mirclient", "sources": [ - { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api libcontent-hub" } + { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api libcontent-hub >= 0.2.0" } ] }, "mtdev": { @@ -546,6 +546,7 @@ "mirclient": { "label": "Mir client", "section": "Platform plugins", + "autoDetect": false, "condition": "libs.mirclient", "output": [ "privateFeature" ] }, From fef6819f5bfe77f8ea8185c67021abf970a681a2 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 1 Mar 2017 19:15:29 +0100 Subject: [PATCH 23/71] Fix grammar in QIcon docs Change-Id: I170662de5dde32a913acc5b681c2d2cefcb51a70 Reviewed-by: Jake Petroules --- src/gui/image/qicon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 7d6cd50bac..07dcf8b726 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -700,7 +700,7 @@ QIcon::QIcon(const QIcon &other) the relevant file must be found relative to the runtime working directory. - The file name can be either refer to an actual file on disk or to + The file name can refer to an actual file on disk or to one of the application's embedded resources. See the \l{resources.html}{Resource System} overview for details on how to embed images and other resource files in the application's @@ -1049,7 +1049,7 @@ static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString the relevant file must be found relative to the runtime working directory. - The file name can be either refer to an actual file on disk or to + The file name can refer to an actual file on disk or to one of the application's embedded resources. See the \l{resources.html}{Resource System} overview for details on how to embed images and other resource files in the application's From 8cd99d24a8639ad8afef1330a518b37779db62cc Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 1 Mar 2017 13:25:44 +0000 Subject: [PATCH 24/71] QRegularExpression: build fix Latest PCRE2 versions require a macro to be defined before including pcre2.h, so do it. Task-number: QTBUG-59226 Change-Id: I472ff557e29d1212fdcd99454778551323be4d4b Reviewed-by: Thiago Macieira --- src/corelib/tools/qregularexpression.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 791a4970f0..8366e01ee8 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -54,6 +54,8 @@ #include #include +#define PCRE2_CODE_UNIT_WIDTH 16 + #include QT_BEGIN_NAMESPACE From 1d9270ee42c257e6df104053177653cffa76336e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Feb 2017 12:26:39 +0100 Subject: [PATCH 25/71] Fix DPI of QWidget with parent on a different screen If a floating QWidget has a parent on a different screen, its DPI was still inherited from the parent instead of taken from the screen. The only reason we did was in case there is a customDpi set. (customDpi is a private thing that is only used in designer to change the appearance of the previewed widget) So instead of recursing into QWidget::metric for each ancestor, just use a for loop to find if one parent has a customDpi. If no customDpi is found, then return the DPI of the right screen. Task-number: QTBUG-58959 Task-number: QTBUG-48242 Change-Id: Ie6e9e48cdd10234994c0919ba3aea9b0cdb52494 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/widgets/kernel/qwidget.cpp | 18 ++++++++---------- .../widgets/kernel/qwidget/tst_qwidget.cpp | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 70bc407587..17f87ef87c 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12770,8 +12770,6 @@ void QWidget::activateWindow() */ int QWidget::metric(PaintDeviceMetric m) const { - Q_D(const QWidget); - QWindow *topLevelWindow = 0; QScreen *screen = 0; if (QWidget *topLevel = window()) { @@ -12799,16 +12797,16 @@ int QWidget::metric(PaintDeviceMetric m) const } else if (m == PdmDepth) { return screen->depth(); } else if (m == PdmDpiX) { - if (d->extra && d->extra->customDpiX) - return d->extra->customDpiX; - else if (d->parent) - return static_cast(d->parent)->metric(m); + for (const QWidget *p = this; p; p = p->parentWidget()) { + if (p->d_func()->extra && p->d_func()->extra->customDpiX) + return p->d_func()->extra->customDpiX; + } return qRound(screen->logicalDotsPerInchX()); } else if (m == PdmDpiY) { - if (d->extra && d->extra->customDpiY) - return d->extra->customDpiY; - else if (d->parent) - return static_cast(d->parent)->metric(m); + for (const QWidget *p = this; p; p = p->parentWidget()) { + if (p->d_func()->extra && p->d_func()->extra->customDpiY) + return p->d_func()->extra->customDpiY; + } return qRound(screen->logicalDotsPerInchY()); } else if (m == PdmPhysicalDpiX) { return qRound(screen->physicalDotsPerInchX()); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 7afa7ca42b..5715505fd6 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8181,7 +8181,7 @@ void tst_QWidget::customDpi() custom->logicalDpiX(); QCOMPARE(custom->metricCallCount, 1); child->logicalDpiX(); - QCOMPARE(custom->metricCallCount, 2); + QCOMPARE(custom->metricCallCount, 1); } void tst_QWidget::customDpiProperty() From 374e0223c2a948e5d3b71e8edeae471ab79cef50 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 2 Mar 2017 11:53:37 +0100 Subject: [PATCH 26/71] winrt: Fix compiler warning The drag event handler classes should have virtual destructors. Change-Id: Ia011856eec37ed303649a1eda036c52f5fa9f8e5 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/winrt/qwinrtdrag.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp index 89ebf7d26f..cf52816b65 100644 --- a/src/plugins/platforms/winrt/qwinrtdrag.cpp +++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp @@ -504,6 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA class QtDragEventHandler##name : public IDragEventHandler \ { \ public: \ + virtual ~QtDragEventHandler##name() {\ + }\ STDMETHODIMP Invoke(IInspectable *sender, \ ABI::Windows::UI::Xaml::IDragEventArgs *e) \ { \ From 66e1d20537b728c449e01dd992917e58f0b5e923 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 2 Mar 2017 12:35:37 +0100 Subject: [PATCH 27/71] winrt: Fix potential warning fix warning about non-portable-includepath due to case insensitivity on windows file system. Change-Id: Ib92db836910c2b9d06a18c841e7c6f0c2e9abab4 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index d9a9d3b20f..150fc8a25e 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include From 4460b9c84373710d54a37052713e96b1a7962525 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 28 Feb 2017 16:43:35 +0100 Subject: [PATCH 28/71] Replace outdated BSD license text For examples and documentation, use new BSD license text that includes the commercial licenses. Change-Id: I1cd74bd8e9c8f2746d8702df00780ee100cbebac Reviewed-by: Jani Heikkinen --- .../corelib/mimetypes/mimetypebrowser/main.cpp | 14 ++++++++++++-- .../mimetypes/mimetypebrowser/mainwindow.cpp | 14 ++++++++++++-- .../corelib/mimetypes/mimetypebrowser/mainwindow.h | 14 ++++++++++++-- .../mimetypes/mimetypebrowser/mimetypemodel.cpp | 14 ++++++++++++-- .../mimetypes/mimetypebrowser/mimetypemodel.h | 14 ++++++++++++-- examples/opengl/computegles31/glwindow.cpp | 14 ++++++++++++-- examples/opengl/computegles31/glwindow.h | 14 ++++++++++++-- examples/opengl/computegles31/main.cpp | 14 ++++++++++++-- ...src_corelib_kernel_qabstractnativeeventfilter.h | 12 +++++++++++- ...rc_corelib_kernel_qabstractnativeeventfilter.mm | 12 +++++++++++- .../code/src_network_socket_qsctpsocket.cpp | 12 +++++++++++- 11 files changed, 129 insertions(+), 19 deletions(-) diff --git a/examples/corelib/mimetypes/mimetypebrowser/main.cpp b/examples/corelib/mimetypes/mimetypebrowser/main.cpp index daa92a2344..f4462df411 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/main.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp index edd48021f3..1d36b7e5ef 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h index 11b1f004a0..978cdec4f4 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h +++ b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp index 46e603621a..ee83de092d 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h index 0656e64e8f..6c537f4001 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h +++ b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/glwindow.cpp b/examples/opengl/computegles31/glwindow.cpp index d2cea169a1..178ad9f1e7 100644 --- a/examples/opengl/computegles31/glwindow.cpp +++ b/examples/opengl/computegles31/glwindow.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h index 15ece01780..a1a429d7c7 100644 --- a/examples/opengl/computegles31/glwindow.h +++ b/examples/opengl/computegles31/glwindow.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/main.cpp b/examples/opengl/computegles31/main.cpp index ff2a1e622d..e4dde8b3bd 100644 --- a/examples/opengl/computegles31/main.cpp +++ b/examples/opengl/computegles31/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h index 8818e23ffa..bb44782ac5 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h @@ -6,7 +6,17 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm index 2c94178e13..7c40330de0 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm @@ -6,7 +6,17 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp index 378022d655..ac181f950c 100644 --- a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp +++ b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp @@ -6,7 +6,17 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are From 3ffb0b50a46810e0f5334483dfdcf53a44cd3fc1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:33:32 +0100 Subject: [PATCH 29/71] GTK3 plugin: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: I6e925378ef4e82bdc739d23186d2dd6f23370d7a Reviewed-by: Jani Heikkinen --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 36 +++++++++++-------- src/plugins/platformthemes/gtk3/qgtk3menu.h | 34 ++++++++++-------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 52757587b4..38c2d251b4 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the plugins of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.h b/src/plugins/platformthemes/gtk3/qgtk3menu.h index 21e6178ec4..b43f363fa4 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.h +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 00696c32bc155341200238da3c9f4f7889f19406 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:32:43 +0100 Subject: [PATCH 30/71] BSD plugins: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: I27cee9135228dabcf1ece5dcf15db18a2aa536f9 Reviewed-by: Jani Heikkinen --- src/plugins/generic/bsdkeyboard/main.cpp | 32 ++++++++++------- .../generic/bsdkeyboard/qbsdkeyboard.cpp | 32 ++++++++++------- .../generic/bsdkeyboard/qbsdkeyboard.h | 32 ++++++++++------- .../bsdkeyboard/qbsdkeyboard_defaultmap.h | 36 +++++++++++-------- src/plugins/generic/bsdmouse/main.cpp | 34 ++++++++++-------- src/plugins/generic/bsdmouse/qbsdmouse.cpp | 34 ++++++++++-------- src/plugins/generic/bsdmouse/qbsdmouse.h | 34 ++++++++++-------- 7 files changed, 138 insertions(+), 96 deletions(-) diff --git a/src/plugins/generic/bsdkeyboard/main.cpp b/src/plugins/generic/bsdkeyboard/main.cpp index f48af0ae28..b65d500230 100644 --- a/src/plugins/generic/bsdkeyboard/main.cpp +++ b/src/plugins/generic/bsdkeyboard/main.cpp @@ -3,29 +3,35 @@ ** Copyright (C) 2015-2016 Oleksandr Tymoshenko ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp index 6f34d066c6..784ec54542 100644 --- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp +++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp @@ -3,29 +3,35 @@ ** Copyright (C) 2015-2016 Oleksandr Tymoshenko ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h index 1a7cbc1f9a..46d8988d3a 100644 --- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h +++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h @@ -3,29 +3,35 @@ ** Copyright (C) 2015-2016 Oleksandr Tymoshenko ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h index 45cf5944bc..69c03b3daf 100644 --- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h +++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2015-2016 Oleksandr Tymoshenko -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdmouse/main.cpp b/src/plugins/generic/bsdmouse/main.cpp index 4abc7609c1..d676d5a1bb 100644 --- a/src/plugins/generic/bsdmouse/main.cpp +++ b/src/plugins/generic/bsdmouse/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015-2016 Oleksandr Tymoshenko -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.cpp b/src/plugins/generic/bsdmouse/qbsdmouse.cpp index 4875fd96bd..55905199b8 100644 --- a/src/plugins/generic/bsdmouse/qbsdmouse.cpp +++ b/src/plugins/generic/bsdmouse/qbsdmouse.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015-2016 Oleksandr Tymoshenko -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.h b/src/plugins/generic/bsdmouse/qbsdmouse.h index 9a4cb8dd82..724b9c8484 100644 --- a/src/plugins/generic/bsdmouse/qbsdmouse.h +++ b/src/plugins/generic/bsdmouse/qbsdmouse.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015-2016 Oleksandr Tymoshenko -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From fb2732c43def81f3a80905f4a618332ee1e58378 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:25:24 +0100 Subject: [PATCH 31/71] Testlib: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: I7ffe7a8afa28fe8b66e00bc5e51595edeac042a9 Reviewed-by: Jani Heikkinen --- src/testlib/qtestutil_macos.mm | 34 +++++++++++++++++++-------------- src/testlib/qtestutil_macos_p.h | 34 +++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/testlib/qtestutil_macos.mm b/src/testlib/qtestutil_macos.mm index 852c9f75f2..70a7fb9f85 100644 --- a/src/testlib/qtestutil_macos.mm +++ b/src/testlib/qtestutil_macos.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/testlib/qtestutil_macos_p.h b/src/testlib/qtestutil_macos_p.h index 85f9ace82f..d7cc5bc251 100644 --- a/src/testlib/qtestutil_macos_p.h +++ b/src/testlib/qtestutil_macos_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 63fa8aa1cebbe054b31901c9bbd05e094b7a0354 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:19:10 +0100 Subject: [PATCH 32/71] Gui: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: Ic0bf112998707844eb0c2853d7516b76f4d5afa8 Reviewed-by: Jani Heikkinen --- src/gui/image/qimage_darwin.mm | 34 ++++++++++++++++++------------ src/gui/painting/qcoregraphics.mm | 34 ++++++++++++++++++------------ src/gui/painting/qcoregraphics_p.h | 34 ++++++++++++++++++------------ 3 files changed, 60 insertions(+), 42 deletions(-) diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm index 2d38468cc5..3764bef06b 100644 --- a/src/gui/image/qimage_darwin.mm +++ b/src/gui/image/qimage_darwin.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index 768d3e7148..98fdd7f35e 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h index 065910222d..54de3f332e 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 032d402485d10cc3246b749c3062076c75e10529 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:37:53 +0100 Subject: [PATCH 33/71] mkspecs: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: I04c403f81bb8a8d6d6222573030d1e6d09ec4c3d Reviewed-by: Jani Heikkinen --- mkspecs/android-clang/qplatformdefs.h | 34 +++++++++++-------- mkspecs/common/bsd/qplatformdefs.h | 34 +++++++++++-------- mkspecs/common/integrity/qplatformdefs.h | 32 ++++++++++------- .../linux-rasp-pi3-g++/qplatformdefs.h | 34 +++++++++++-------- .../linux-rasp-pi3-vc4-g++/qplatformdefs.h | 34 +++++++++++-------- mkspecs/features/data/mac/objc_namespace.sh | 34 +++++++++++-------- mkspecs/features/uikit/devices.pl | 34 +++++++++++-------- mkspecs/integrity-armv7-imx6/qplatformdefs.h | 32 ++++++++++------- mkspecs/integrity-armv7/qplatformdefs.h | 32 ++++++++++------- mkspecs/integrity-x86/qplatformdefs.h | 32 ++++++++++------- mkspecs/macx-tvos-clang/qplatformdefs.h | 34 +++++++++++-------- mkspecs/macx-watchos-clang/qplatformdefs.h | 34 +++++++++++-------- mkspecs/qnx-aarch64le-qcc/qplatformdefs.h | 32 ++++++++++------- mkspecs/qnx-x86-64-qcc/qplatformdefs.h | 32 ++++++++++------- 14 files changed, 274 insertions(+), 190 deletions(-) diff --git a/mkspecs/android-clang/qplatformdefs.h b/mkspecs/android-clang/qplatformdefs.h index 9a8d176285..017233658e 100644 --- a/mkspecs/android-clang/qplatformdefs.h +++ b/mkspecs/android-clang/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/common/bsd/qplatformdefs.h b/mkspecs/common/bsd/qplatformdefs.h index 123155816f..6c3a00b194 100644 --- a/mkspecs/common/bsd/qplatformdefs.h +++ b/mkspecs/common/bsd/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/common/integrity/qplatformdefs.h b/mkspecs/common/integrity/qplatformdefs.h index 91ec1cde12..7039318f25 100644 --- a/mkspecs/common/integrity/qplatformdefs.h +++ b/mkspecs/common/integrity/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/devices/linux-rasp-pi3-g++/qplatformdefs.h b/mkspecs/devices/linux-rasp-pi3-g++/qplatformdefs.h index 5ae49b35dd..4435fb2557 100644 --- a/mkspecs/devices/linux-rasp-pi3-g++/qplatformdefs.h +++ b/mkspecs/devices/linux-rasp-pi3-g++/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/devices/linux-rasp-pi3-vc4-g++/qplatformdefs.h b/mkspecs/devices/linux-rasp-pi3-vc4-g++/qplatformdefs.h index 6fe3b52454..4435fb2557 100644 --- a/mkspecs/devices/linux-rasp-pi3-vc4-g++/qplatformdefs.h +++ b/mkspecs/devices/linux-rasp-pi3-vc4-g++/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/features/data/mac/objc_namespace.sh b/mkspecs/features/data/mac/objc_namespace.sh index 0c7faf18bf..6ac004fe2d 100755 --- a/mkspecs/features/data/mac/objc_namespace.sh +++ b/mkspecs/features/data/mac/objc_namespace.sh @@ -2,32 +2,38 @@ ############################################################################# ## -## Copyright (C) 2015 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ ## ## This file is the build configuration utility of the Qt Toolkit. ## -## $QT_BEGIN_LICENSE:LGPL21$ +## $QT_BEGIN_LICENSE:LGPL$ ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in ## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. ## ## GNU Lesser General Public License Usage ## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## diff --git a/mkspecs/features/uikit/devices.pl b/mkspecs/features/uikit/devices.pl index eb45d1dab9..8d69a97273 100755 --- a/mkspecs/features/uikit/devices.pl +++ b/mkspecs/features/uikit/devices.pl @@ -2,32 +2,38 @@ ############################################################################# ## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ ## ## This file is the build configuration utility of the Qt Toolkit. ## -## $QT_BEGIN_LICENSE:LGPL21$ +## $QT_BEGIN_LICENSE:LGPL$ ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in ## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. ## ## GNU Lesser General Public License Usage ## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## diff --git a/mkspecs/integrity-armv7-imx6/qplatformdefs.h b/mkspecs/integrity-armv7-imx6/qplatformdefs.h index 55afd0c3c7..1942139851 100644 --- a/mkspecs/integrity-armv7-imx6/qplatformdefs.h +++ b/mkspecs/integrity-armv7-imx6/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/integrity-armv7/qplatformdefs.h b/mkspecs/integrity-armv7/qplatformdefs.h index 55afd0c3c7..1942139851 100644 --- a/mkspecs/integrity-armv7/qplatformdefs.h +++ b/mkspecs/integrity-armv7/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/integrity-x86/qplatformdefs.h b/mkspecs/integrity-x86/qplatformdefs.h index 55afd0c3c7..1942139851 100644 --- a/mkspecs/integrity-x86/qplatformdefs.h +++ b/mkspecs/integrity-x86/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/macx-tvos-clang/qplatformdefs.h b/mkspecs/macx-tvos-clang/qplatformdefs.h index 68020de6d5..f49d2d493c 100644 --- a/mkspecs/macx-tvos-clang/qplatformdefs.h +++ b/mkspecs/macx-tvos-clang/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/macx-watchos-clang/qplatformdefs.h b/mkspecs/macx-watchos-clang/qplatformdefs.h index 965eb5e97b..f49d2d493c 100644 --- a/mkspecs/macx-watchos-clang/qplatformdefs.h +++ b/mkspecs/macx-watchos-clang/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/qnx-aarch64le-qcc/qplatformdefs.h b/mkspecs/qnx-aarch64le-qcc/qplatformdefs.h index 029ee7e062..46d9fd2fae 100644 --- a/mkspecs/qnx-aarch64le-qcc/qplatformdefs.h +++ b/mkspecs/qnx-aarch64le-qcc/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2016 QNX Software Systems. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/mkspecs/qnx-x86-64-qcc/qplatformdefs.h b/mkspecs/qnx-x86-64-qcc/qplatformdefs.h index a8c97172d0..991b196218 100644 --- a/mkspecs/qnx-x86-64-qcc/qplatformdefs.h +++ b/mkspecs/qnx-x86-64-qcc/qplatformdefs.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2016 QNX Software Systems. All rights reserved. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 585bb526c4b9d810979c498e03fd2ecec54e1432 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:36:04 +0100 Subject: [PATCH 34/71] config.tests: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: Ia1f814ce822d247f3af14c1ea46e07cfad0fda09 Reviewed-by: Jani Heikkinen --- config.tests/common/atomicfptr/atomicfptr.cpp | 32 ++++++++++------- config.tests/unix/dlopen/dlopen.cpp | 34 +++++++++++-------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/config.tests/common/atomicfptr/atomicfptr.cpp b/config.tests/common/atomicfptr/atomicfptr.cpp index ce0193dbe4..a993357127 100644 --- a/config.tests/common/atomicfptr/atomicfptr.cpp +++ b/config.tests/common/atomicfptr/atomicfptr.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the FOO module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/config.tests/unix/dlopen/dlopen.cpp b/config.tests/unix/dlopen/dlopen.cpp index 28a82330f2..454ca3bf72 100644 --- a/config.tests/unix/dlopen/dlopen.cpp +++ b/config.tests/unix/dlopen/dlopen.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From 6cff40c1959a57b52bf0be6b427b0f807e0e82b4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Feb 2017 12:50:24 +0100 Subject: [PATCH 35/71] Build fix for -no-feature-shortcut Change-Id: I99144b114b3c2eacb56b522b3059aa53a6bbd969 Reviewed-by: Lars Knoll --- src/widgets/dialogs/qcolordialog.cpp | 5 ++++- src/widgets/dialogs/qfiledialog.cpp | 6 ++++-- src/widgets/dialogs/qmessagebox.cpp | 4 ++-- src/widgets/dialogs/qwizard.cpp | 2 ++ src/widgets/kernel/qwhatsthis.cpp | 6 ++++-- src/widgets/util/qcompleter.cpp | 3 ++- src/widgets/widgets/qcalendarwidget.cpp | 4 ++++ src/widgets/widgets/qcombobox.cpp | 2 ++ src/widgets/widgets/qdatetimeedit.cpp | 2 ++ src/widgets/widgets/qdialogbuttonbox.cpp | 4 ++-- 10 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index ab3099dfe8..dbcd2d7fe2 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -2246,10 +2246,13 @@ bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e) bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e) { Q_Q(QColorDialog); +#if QT_CONFIG(shortcut) if (e->matches(QKeySequence::Cancel)) { releaseColorPicking(); q->setCurrentColor(beforeScreenColorPicking); - } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { + } else +#endif + if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { q->setCurrentColor(grabScreenColor(QCursor::pos())); releaseColorPicking(); } diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index a552746385..78e304950a 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3813,12 +3813,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory) bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { Q_Q(QFileDialog); - +#if QT_CONFIG(shortcut) if (event->matches(QKeySequence::Cancel)) { q->reject(); return true; } - +#endif switch (event->key()) { case Qt::Key_Backspace: _q_navigateToParent(); @@ -4020,7 +4020,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) int key = e->key(); QLineEdit::keyPressEvent(e); +#if QT_CONFIG(shortcut) if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back) +#endif e->accept(); } diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 98d070e493..3b0a71518d 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1405,7 +1405,7 @@ void QMessageBox::changeEvent(QEvent *ev) void QMessageBox::keyPressEvent(QKeyEvent *e) { Q_D(QMessageBox); - +#if QT_CONFIG(shortcut) if (e->matches(QKeySequence::Cancel)) { if (d->detectedEscapeButton) { #ifdef Q_OS_MAC @@ -1416,7 +1416,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) } return; } - +#endif // QT_CONFIG(shortcut) #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 532ee4700f..5e598ba990 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1465,8 +1465,10 @@ void QWizardPrivate::updateButtonTexts() // Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right // even in RTL mode, so do the same, even if it might be counter-intuitive. // The shortcut for 'back' is set in class QVistaBackButton. +#if QT_CONFIG(shortcut) if (btns[QWizard::NextButton]) btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence()); +#endif } void QWizardPrivate::updateButtonLayout() diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 6061af5f38..4286019717 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -462,11 +462,13 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e) case QEvent::KeyPress: { QKeyEvent* kev = (QKeyEvent*)e; - +#if QT_CONFIG(shortcut) if (kev->matches(QKeySequence::Cancel)) { QWhatsThis::leaveWhatsThisMode(); return true; - } else if (customWhatsThis) { + } else +#endif + if (customWhatsThis) { return false; } else if (kev->key() == Qt::Key_Menu || (kev->key() == Qt::Key_F10 && diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 3006f0c9ce..e8f23f08bc 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1347,11 +1347,12 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) } // default implementation for keys not handled by the widget when popup is open +#if QT_CONFIG(shortcut) if (ke->matches(QKeySequence::Cancel)) { d->popup->hide(); return true; } - +#endif switch (key) { #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Select: diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index da4850a816..f81377a85c 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -770,8 +770,10 @@ bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e) applyDate(); emit editingFinished(); removeDateLabel(); +#if QT_CONFIG(shortcut) } else if (ke->matches(QKeySequence::Cancel)) { removeDateLabel(); +#endif } else if (e->type() == QEvent::KeyPress) { createDateLabel(); m_dateValidator->handleKeyEvent(ke); @@ -3107,12 +3109,14 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event) */ void QCalendarWidget::keyPressEvent(QKeyEvent * event) { +#if QT_CONFIG(shortcut) Q_D(QCalendarWidget); if (d->yearEdit->isVisible()&& event->matches(QKeySequence::Cancel)) { d->yearEdit->setValue(yearShown()); d->_q_yearEditingFinished(); return; } +#endif QWidget::keyPressEvent(event); } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index f4e08dc670..b18066c174 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -682,10 +682,12 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) combo->hidePopup(); return true; default: +#if QT_CONFIG(shortcut) if (keyEvent->matches(QKeySequence::Cancel)) { combo->hidePopup(); return true; } +#endif break; } break; diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index c5eab55a53..cebfb9316a 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2662,11 +2662,13 @@ void QCalendarPopup::mouseReleaseEvent(QMouseEvent*) bool QCalendarPopup::event(QEvent *event) { +#if QT_CONFIG(shortcut) if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast(event); if (keyEvent->matches(QKeySequence::Cancel)) dateChanged = false; } +#endif return QWidget::event(event); } diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 61ef8e8c93..5a789c2d66 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -410,9 +410,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added"); else addButton(button, static_cast(role), doLayout); - +#if QT_CONFIG(shortcut) button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton)); - +#endif return button; } From 259adc5e77a40bc8f0b7e4c17f7a38bfc4ad511b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 20 Feb 2017 13:15:40 +0100 Subject: [PATCH 36/71] Fix build with -no-opengl Change-Id: I6fb61944ef88e328a94ea6b7ab42db271828a602 Reviewed-by: Lars Knoll Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/api/qeglfscursor_p.h | 6 +++++- .../eglfs/deviceintegration/deviceintegration.pro | 2 +- .../eglfs_kms/qeglfskmsgbmintegration.cpp | 7 ++++--- .../eglfs_kms_egldevice/qeglfskmsegldevice.cpp | 4 ++-- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 6 +++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index 942fb09aac..aaeb83cb99 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -79,7 +79,10 @@ private: QEglFSCursor *m_cursor; }; -class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor, protected QOpenGLFunctions +#if QT_CONFIG(opengl) + +class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor + , protected QOpenGLFunctions { Q_OBJECT public: @@ -153,6 +156,7 @@ private: }; QHash m_gfx; }; +#endif // QT_CONFIG(opengl) QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro index aca0078bfb..6d759938b5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro @@ -9,7 +9,7 @@ qtConfig(eglfs_mali): SUBDIRS += eglfs_mali qtConfig(eglfs_viv): SUBDIRS += eglfs_viv qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl -SUBDIRS += eglfs_emu +qtConfig(opengl): SUBDIRS += eglfs_emu eglfs_kms_egldevice.depends = eglfs_kms_support eglfs_kms.depends = eglfs_kms_support diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp index 16767114ab..b6cdcf92b6 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp @@ -105,12 +105,13 @@ void QEglFSKmsGbmIntegration::destroyNativeWindow(EGLNativeWindowType window) QPlatformCursor *QEglFSKmsGbmIntegration::createCursor(QPlatformScreen *screen) const { - if (screenConfig()->hwCursor()) { - return nullptr; - } else { +#if QT_CONFIG(opengl) + if (!screenConfig()->hwCursor()) { qCDebug(qLcEglfsKmsDebug, "Using plain OpenGL mouse cursor"); return new QEglFSCursor(screen); } +#endif + return nullptr; } void QEglFSKmsGbmIntegration::presentBuffer(QPlatformSurface *surface) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index f0bf59466e..0a66a897a1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -85,12 +85,12 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const QPlatformScreen *QEglFSKmsEglDevice::createScreen(const QKmsOutput &output) { QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output); - +#if QT_CONFIG(opengl) if (!m_globalCursor && !screenConfig()->separateScreens()) { qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); m_globalCursor = new QEglFSCursor(screen); } - +#endif return screen; } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 3e333fc25a..43bdb77a18 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -280,7 +280,11 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device() QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const { - return screenConfig()->separateScreens() ? new QEglFSCursor(screen) : nullptr; +#if QT_CONFIG(opengl) + if (screenConfig()->separateScreens()) + return new QEglFSCursor(screen); +#endif + return nullptr; } QT_END_NAMESPACE From 0cd15fd94de4c688f67049b1fef17b6ca698bf67 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 15 Feb 2017 10:47:01 +0100 Subject: [PATCH 37/71] Make "finger touch" not be a tablet Otherwise QTouchDevices::devices() doesn't return the touchscreen on my Thinkpad Yoga 460 Change-Id: Ibb829df95f92152a77c512e4325522825901074e Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 7c842ae1ba..73a7e97716 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -208,6 +208,8 @@ void QXcbConnection::xi2SetupDevices() isTablet = true; tabletData.pointerType = QTabletEvent::Cursor; dbgType = QLatin1String("cursor"); + } else if (name.contains("wacom") && name.contains("finger touch")) { + isTablet = false; } else if ((name.contains("pen") || name.contains("stylus")) && isTablet) { tabletData.pointerType = QTabletEvent::Pen; dbgType = QLatin1String("pen"); From 863debd720e25d27fde845c248806df3025133fb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 2 Mar 2017 08:14:54 +0100 Subject: [PATCH 38/71] Revert "Add expandingListItems property to QListView" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a4c25c020554527aa9ff9b533afabffef46be131. The API is too limited in scope, and a good name is hard to find, as evidenced in the API review discussion preceding Qt 5.9 beta. This API will hopefully return as something like setItemAlignment(). [ChangeLog][QtWidgets][QListView] EDIT: REMOVE: Added expandingListItems property. Conflicts: tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: I397acd8a7a6c716e2d3c96eee45a276eb6d4f9dd Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Friedemann Kleint Reviewed-by: Alexander Volkov --- src/widgets/itemviews/qlistview.cpp | 44 ++----------------- src/widgets/itemviews/qlistview.h | 4 -- src/widgets/itemviews/qlistview_p.h | 2 - .../itemviews/qlistview/tst_qlistview.cpp | 24 ---------- 4 files changed, 4 insertions(+), 70 deletions(-) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 1414823e82..653b03ef0d 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1624,33 +1624,6 @@ bool QListView::isSelectionRectVisible() const return d->isSelectionRectVisible(); } -/*! - \property QListView::expandingListItems - \brief if items occupy the entire width of the column - \since 5.9 - - If this property is \c true then all items in the column - will have the width of the column; otherwise the width of - each item will be determined by it's size hint. - - By default, this property is \c true. -*/ -void QListView::setExpandingListItems(bool enable) -{ - Q_D(QListView); - if (d->expandingListItems == enable) - return; - d->expandingListItems = enable; - if (viewMode() == ListMode && flow() == QListView::TopToBottom && isWrapping()) - d->doDelayedItemsLayout(); -} - -bool QListView::isExpandingListItems() const -{ - Q_D(const QListView); - return d->expandingListItems; -} - /*! \reimp */ @@ -1677,8 +1650,7 @@ QListViewPrivate::QListViewPrivate() column(0), uniformItemSizes(false), batchSize(100), - showElasticBand(false), - expandingListItems(true) + showElasticBand(false) { } @@ -2395,8 +2367,7 @@ QListViewItem QListModeViewBase::indexToListViewItem(const QModelIndex &index) c int right = (segment + 1 >= segmentPositions.count() ? contentsSize.width() : segmentPositions.at(segment + 1)); - size.setWidth(dd->expandingListItems ? right - pos.x() - : qMin(size.width(), right - pos.x())); + size.setWidth(right - pos.x()); } else { // make the items as wide as the viewport size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing())); } @@ -2580,15 +2551,8 @@ QVector QListModeViewBase::intersectingSet(const QRect &area) const if (isHidden(row)) continue; QModelIndex index = modelIndex(row); - if (index.isValid()) { - if (flow() == QListView::LeftToRight || dd->expandingListItems) { - ret += index; - } else { - const int iw = indexToListViewItem(index).width(); // item width - if (iw > 0 && segStartPosition - segmentPositions.at(seg) < iw) - ret += index; - } - } + if (index.isValid()) + ret += index; #if 0 // for debugging else qWarning("intersectingSet: row %d was invalid", row); diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index 4cf53f9bab..e918e66d38 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -66,7 +66,6 @@ class Q_WIDGETS_EXPORT QListView : public QAbstractItemView Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize) Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) Q_PROPERTY(bool selectionRectVisible READ isSelectionRectVisible WRITE setSelectionRectVisible) - Q_PROPERTY(bool expandingListItems READ isExpandingListItems WRITE setExpandingListItems) public: enum Movement { Static, Free, Snap }; @@ -127,9 +126,6 @@ public: void setSelectionRectVisible(bool show); bool isSelectionRectVisible() const; - void setExpandingListItems(bool enable); - bool isExpandingListItems() const; - QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE; void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE; QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index a66e007195..47effcdfd9 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -431,8 +431,6 @@ public: QRect elasticBand; bool showElasticBand; - - bool expandingListItems; }; // inline implementations diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 29e4bbfe29..a89f8f3c8a 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -150,7 +150,6 @@ private slots: void horizontalScrollingByVerticalWheelEvents(); void taskQTBUG_7232_AllowUserToControlSingleStep(); void taskQTBUG_51086_skippingIndexesInSelectedIndexes(); - void expandingListItems(); void taskQTBUG_47694_indexOutOfBoundBatchLayout(); }; @@ -2488,29 +2487,6 @@ void tst_QListView::taskQTBUG_51086_skippingIndexesInSelectedIndexes() QVERIFY(!indexes.contains(data.index(8, 0))); } -void tst_QListView::expandingListItems() -{ - auto item1 = new QStandardItem("111"); - auto item2 = new QStandardItem("111111"); - QStandardItemModel model; - model.appendRow(item1); - model.appendRow(item2); - - QListView w; - w.setModel(&model); - w.setWrapping(true); - w.show(); - QVERIFY(QTest::qWaitForWindowExposed(&w)); - - QVERIFY(w.visualRect(item1->index()).width() > 0); - QVERIFY(w.visualRect(item1->index()).width() == w.visualRect(item2->index()).width()); - - w.setExpandingListItems(false); - QApplication::processEvents(); - - QVERIFY(w.visualRect(item1->index()).width() < w.visualRect(item2->index()).width()); -} - void tst_QListView::taskQTBUG_47694_indexOutOfBoundBatchLayout() { QListView view; From fd08361ad32d935931eefcbe55cea1330949feea Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 1 Mar 2017 20:27:40 +0100 Subject: [PATCH 39/71] Add feature.radiobutton Change-Id: Ie11f178ce22e2fafdfdf1760288e90563569e0cb Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 11 ++++++++++- src/widgets/accessible/simplewidgets.cpp | 7 ++++++- src/widgets/configure.json | 6 ++++++ src/widgets/styles/qstylesheetstyle.cpp | 1 - src/widgets/widgets/qgroupbox.cpp | 4 ++++ src/widgets/widgets/qradiobutton.h | 2 ++ src/widgets/widgets/widgets.pri | 10 ++++++++-- 7 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 45e768708e..d9da67527a 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -55,7 +55,16 @@ "label": "QPrintDialog", "purpose": "Provides a dialog widget for specifying printer configuration.", "section": "Dialogs", - "condition": "features.printer && features.combobox && features.buttongroup && features.spinbox && features.treeview && features.tabwidget && features.datetimeedit", + "condition": [ + "features.buttongroup", + "features.combobox", + "features.datetimeedit", + "features.printer", + "features.radiobutton", + "features.spinbox", + "features.tabwidget", + "features.treeview" + ], "output": [ "publicFeature", "feature" ] }, "printpreviewdialog": { diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index f22f9cb2ed..184b934c34 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -44,7 +44,9 @@ #include #include #include +#if QT_CONFIG(radiobutton) #include +#endif #include #include #include @@ -169,12 +171,15 @@ QRect QAccessibleButton::rect() const QStyleOptionButton opt; cb->initStyleOption(&opt); return cb->style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, cb).translated(wpos); - } else if (QRadioButton *rb = qobject_cast(ab)) { + } +#if QT_CONFIG(radiobutton) + else if (QRadioButton *rb = qobject_cast(ab)) { QPoint wpos = rb->mapToGlobal(QPoint(0, 0)); QStyleOptionButton opt; rb->initStyleOption(&opt); return rb->style()->subElementRect(QStyle::SE_RadioButtonClickRect, &opt, rb).translated(wpos); } +#endif return QAccessibleWidget::rect(); } diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 151935927a..399850a932 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -175,6 +175,12 @@ "section": "Widgets", "output": [ "publicFeature", "feature" ] }, + "radiobutton": { + "label": "QRadioButton", + "purpose": "Provides a radio button with a text label.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "spinbox": { "label": "QSpinBox", "purpose": "Provides spin boxes handling integers and discrete sets of values.", diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 65894a6dde..35e7060b72 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -58,7 +58,6 @@ #include "private/qabstractscrollarea_p.h" #include #include -#include #include #include #include diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index a9b32ae065..fda68879d1 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -44,7 +44,9 @@ #include "qdrawutil.h" #include "qevent.h" #include "qlayout.h" +#if QT_CONFIG(radiobutton) #include "qradiobutton.h" +#endif #include "qstyle.h" #include "qstyleoption.h" #include "qstylepainter.h" @@ -430,11 +432,13 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason) QWidget * w = q; while ((w = w->nextInFocusChain()) != q) { if (q->isAncestorOf(w) && (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus && w->isVisibleTo(q)) { +#if QT_CONFIG(radiobutton) if (!best && qobject_cast(w) && ((QRadioButton*)w)->isChecked()) // we prefer a checked radio button or a widget that // already has focus, if there is one best = w; else +#endif if (!candidate) // but we'll accept anything that takes focus candidate = w; diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h index 2dcb0d0fdf..137ae01380 100644 --- a/src/widgets/widgets/qradiobutton.h +++ b/src/widgets/widgets/qradiobutton.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(radiobutton); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index fc002c126a..1821a7f766 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -44,7 +44,6 @@ HEADERS += \ widgets/qprogressbar.h \ widgets/qpushbutton.h \ widgets/qpushbutton_p.h \ - widgets/qradiobutton.h \ widgets/qrubberband.h \ widgets/qscrollbar.h \ widgets/qscrollbar_p.h \ @@ -113,7 +112,6 @@ SOURCES += \ widgets/qmenubar.cpp \ widgets/qprogressbar.cpp \ widgets/qpushbutton.cpp \ - widgets/qradiobutton.cpp \ widgets/qrubberband.cpp \ widgets/qscrollbar.cpp \ widgets/qsizegrip.cpp \ @@ -151,6 +149,14 @@ qtConfig(commandlinkbutton) { widgets/qcommandlinkbutton.cpp } +qtConfig(radiobutton) { + HEADERS += \ + widgets/qradiobutton.h + + SOURCES += \ + widgets/qradiobutton.cpp +} + macx { HEADERS += \ widgets/qmacnativewidget_mac.h \ From 51e8bc9be5347cbc43aee7ae909cb9be0be65843 Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Fri, 3 Mar 2017 00:55:56 +0200 Subject: [PATCH 40/71] Remove library feature condition from the imageformatplugin Change-Id: I951ec5fa6d5788accdc82327326d39aac540bd7b Reviewed-by: Ulf Hermann --- src/gui/configure.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index b1329cc213..a8ae656bcb 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -896,7 +896,6 @@ "label": "QImageIOPlugin", "purpose": "Provides a base for writing a image format plugins.", "section": "Images", - "condition": "features.library", "output": [ "publicFeature", "feature" ] }, "movie": { From 80145d556e5a382cac8c457600b9f6293933d600 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 22 Feb 2017 16:28:24 +0100 Subject: [PATCH 41/71] Increase timeout of tst_QProcess::softExitInSlots even more Commit eab7efd1 increased the timeout for this test, but apparently 10 seconds are still not enough. Set the timeout to a minute. Task-number: QTBUG-59075 Change-Id: Iebab8e5c73c4858ca90063a82aedfbb2546a62cc Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 3f3533c9a1..03c28f4d0b 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1026,7 +1026,7 @@ void tst_QProcess::softExitInSlots() SoftExitProcess proc(signalToConnect); proc.writeAfterStart("OLEBOLE", 8); // include the \0 proc.start(appName); - QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000); + QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 60000); QCOMPARE(proc.state(), QProcess::NotRunning); } From 46bf3d71e58457afcc8177a68243ac71308534db Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 3 Mar 2017 09:00:23 +0100 Subject: [PATCH 42/71] xcb: stringify enums for tablet qt.qpa.input.events qCDebug It's a bit easier to read, not having to look up TabletDevice and PointerType enum values manually. Change-Id: I53353be4dcea3e2cb875f04250502ffe802fc971 Reviewed-by: Andy Shaw --- .../platforms/xcb/qxcbconnection_xi2.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 73a7e97716..4a30f7b7bc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -42,6 +42,7 @@ #include "qxcbscreen.h" #include "qxcbwindow.h" #include "qtouchdevice.h" +#include "QtCore/qmetaobject.h" #include #include #include @@ -1065,6 +1066,18 @@ static QTabletEvent::TabletDevice toolIdToTabletDevice(quint32 toolId) { return QTabletEvent::Stylus; // Safe default assumption if nonzero } +static const char *toolName(QTabletEvent::TabletDevice tool) { + static const QMetaObject *metaObject = qt_getEnumMetaObject(tool); + static const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(tool))); + return me.valueToKey(tool); +} + +static const char *pointerTypeName(QTabletEvent::PointerType ptype) { + static const QMetaObject *metaObject = qt_getEnumMetaObject(ptype); + static const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(ptype))); + return me.valueToKey(ptype); +} + bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletData) { bool handled = true; @@ -1138,9 +1151,9 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD // TODO maybe have a hash of tabletData->deviceId to device data so we can // look up the tablet name here, and distinguish multiple tablets if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) - qCDebug(lcQpaXInputEvents, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d", + qCDebug(lcQpaXInputEvents, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x %s", tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID], - ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool); + ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], toolName(tabletData->tool)); } XFree(data); } @@ -1203,9 +1216,10 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD } if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) - qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d " + qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %s type %s seq %d detail %d time %d " "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf", - tabletData->deviceId, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time, + tabletData->deviceId, toolName(tabletData->tool), pointerTypeName(tabletData->pointerType), + ev->sequenceNumber, ev->detail, ev->time, fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y), fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation); From dc2512f3088d6f836ef06d35cbf1a5f7acb4ce7b Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 2 Mar 2017 13:39:22 +0100 Subject: [PATCH 43/71] Add feature.label and feature.formlayout Change-Id: Ic8dc0aee7f3fc0d8218ba709352b1378078c6070 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- .../dialogs/qprintpreviewdialog.cpp | 5 ++-- src/widgets/accessible/qaccessiblewidget.cpp | 6 ++-- src/widgets/accessible/simplewidgets.cpp | 19 ++++++++++-- src/widgets/configure.json | 30 ++++++++++++++----- src/widgets/itemviews/qheaderview.cpp | 19 ++++++++++-- src/widgets/itemviews/qheaderview_p.h | 6 ++++ src/widgets/itemviews/qitemeditorfactory.cpp | 4 +++ src/widgets/kernel/kernel.pri | 7 +++-- src/widgets/kernel/qformlayout.h | 2 ++ src/widgets/kernel/qlayout.cpp | 6 ++++ src/widgets/kernel/qtooltip.cpp | 5 ++-- src/widgets/styles/qcommonstyle.cpp | 6 ++++ src/widgets/styles/qstylesheetstyle.cpp | 4 +++ src/widgets/util/qsystemtrayicon.cpp | 12 +++++++- src/widgets/util/qsystemtrayicon_x11.cpp | 3 ++ src/widgets/widgets/qdatetimeedit_p.h | 1 - src/widgets/widgets/qlabel.h | 2 ++ src/widgets/widgets/widgets.pri | 12 ++++++-- 18 files changed, 125 insertions(+), 24 deletions(-) diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp index c996e0d556..4bed0b6454 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -56,11 +55,13 @@ #include #include #include -#include #include #ifndef QT_NO_PRINTPREVIEWDIALOG +#include +#include + static void initResources() { static bool resourcesInitialized = false; diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 840a990799..94cf58ae3b 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -44,7 +44,9 @@ #include "qaction.h" #include "qapplication.h" #include "qgroupbox.h" +#if QT_CONFIG(label) #include "qlabel.h" +#endif #include "qtooltip.h" #include "qwhatsthis.h" #include "qwidget.h" @@ -81,7 +83,7 @@ static QString buddyString(const QWidget *widget) QWidget *parent = widget->parentWidget(); if (!parent) return QString(); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) && QT_CONFIG(label) for (QObject *o : parent->children()) { QLabel *label = qobject_cast(o); if (label && label->buddy() == widget) @@ -309,7 +311,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel if (match & QAccessible::Label) { const QAccessible::Relation rel = QAccessible::Label; if (QWidget *parent = widget()->parentWidget()) { -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) && QT_CONFIG(label) // first check for all siblings that are labels to us // ideally we would go through all objects and check, but that // will be too expensive diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 184b934c34..99b22a735e 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -49,7 +49,9 @@ #endif #include #include +#if QT_CONFIG(label) #include +#endif #include #include #include @@ -395,6 +397,7 @@ QAccessibleDisplay::QAccessibleDisplay(QWidget *w, QAccessible::Role role) QAccessible::Role QAccessibleDisplay::role() const { +#if QT_CONFIG(label) QLabel *l = qobject_cast(object()); if (l) { if (l->pixmap()) @@ -416,6 +419,7 @@ QAccessible::Role QAccessibleDisplay::role() const return QAccessible::StatusBar; #endif } +#endif return QAccessibleWidget::role(); } @@ -426,7 +430,9 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const case QAccessible::Name: str = widget()->accessibleName(); if (str.isEmpty()) { - if (qobject_cast(object())) { + if (false) { +#if QT_CONFIG(label) + } else if (qobject_cast(object())) { QLabel *label = qobject_cast(object()); str = label->text(); #ifndef QT_NO_TEXTHTMLPARSER @@ -441,6 +447,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const if (label->buddy()) str = qt_accStripAmp(str); #endif +#endif // QT_CONFIG(label) #ifndef QT_NO_LCDNUMBER } else if (qobject_cast(object())) { QLCDNumber *l = qobject_cast(object()); @@ -475,7 +482,7 @@ QVector > QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector > rels = QAccessibleWidget::relations(match); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) && QT_CONFIG(label) if (match & QAccessible::Labelled) { if (QLabel *label = qobject_cast(object())) { const QAccessible::Relation rel = QAccessible::Labelled; @@ -507,26 +514,34 @@ QString QAccessibleDisplay::imageDescription() const /*! \internal */ QSize QAccessibleDisplay::imageSize() const { +#if QT_CONFIG(label) QLabel *label = qobject_cast(widget()); if (!label) +#endif return QSize(); +#if QT_CONFIG(label) const QPixmap *pixmap = label->pixmap(); if (!pixmap) return QSize(); return pixmap->size(); +#endif } /*! \internal */ QPoint QAccessibleDisplay::imagePosition() const { +#if QT_CONFIG(label) QLabel *label = qobject_cast(widget()); if (!label) +#endif return QPoint(); +#if QT_CONFIG(label) const QPixmap *pixmap = label->pixmap(); if (!pixmap) return QPoint(); return QPoint(label->mapToGlobal(label->pos())); +#endif } #ifndef QT_NO_GROUPBOX diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 399850a932..2ae8872c88 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -156,6 +156,19 @@ "condition": "features.rubberband", "output": [ "publicFeature", "feature" ] }, + "label": { + "label": "QLabel", + "purpose": "Provides a text or image display.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, + "formlayout": { + "label": "QFormLayout", + "purpose": "Manages forms of input widgets and their associated labels.", + "section": "Widgets", + "condition": "features.label", + "output": [ "publicFeature" ] + }, "lcdnumber": { "label": "QLCDNumber", "purpose": "Provides LCD-like digits.", @@ -374,6 +387,7 @@ "label": "QToolTip", "purpose": "Supports presentation of tooltips.", "section": "Widgets", + "condition": "features.label", "output": [ "publicFeature", "feature" ] }, "statustip": { @@ -399,7 +413,7 @@ "label": "QCalendarWidget", "purpose": "Provides a monthly based calendar widget allowing the user to select a date.", "section": "Widgets", - "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton", + "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton && features.label", "output": [ "publicFeature", "feature" ] }, "keysequenceedit": { @@ -413,13 +427,14 @@ "label": "QMessageBox", "purpose": "Provides message boxes displaying informative messages and simple questions.", "section": "Dialogs", + "condition" : "features.label", "output": [ "publicFeature", "feature" ] }, "colordialog": { "label": "QColorDialog", "purpose": "Provides a dialog widget for specifying colors.", "section": "Dialogs", - "condition": "features.spinbox", + "condition": "features.spinbox && features.label", "output": [ "publicFeature", "feature" ] }, "filedialog": { @@ -430,6 +445,7 @@ "features.buttongroup", "features.combobox", "features.dirmodel", + "features.label", "features.proxymodel", "features.splitter", "features.stackedwidget", @@ -442,35 +458,35 @@ "label": "QFontDialog", "purpose": "Provides a dialog widget for selecting fonts.", "section": "Dialogs", - "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox", + "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox && features.label", "output": [ "publicFeature", "feature" ] }, "progressdialog": { "label": "QProgressDialog", "purpose": "Provides feedback on the progress of a slow operation.", "section": "Dialogs", - "condition": "features.progressbar", + "condition": "features.progressbar && features.label", "output": [ "publicFeature", "feature" ] }, "inputdialog": { "label": "QInputDialog", "purpose": "Provides a simple convenience dialog to get a single value from the user.", "section": "Dialogs", - "condition": "features.combobox && features.spinbox && features.stackedwidget && features.textedit", + "condition": "features.combobox && features.spinbox && features.stackedwidget && features.textedit && features.label", "output": [ "publicFeature", "feature" ] }, "errormessage": { "label": "QErrorMessage", "purpose": "Provides an error message display dialog.", "section": "Dialogs", - "condition": "features.textedit", + "condition": "features.textedit && features.label", "output": [ "publicFeature", "feature" ] }, "wizard": { "label": "QWizard", "purpose": "Provides a framework for multi-page click-through dialogs.", "section": "Dialogs", - "condition": "features.properties", + "condition": "features.properties && features.label", "output": [ "publicFeature", "feature" ] }, "dirmodel": { diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 1310a060ea..d2f9618c29 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2479,7 +2479,10 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) if (d->shouldAutoScroll(e->pos())) d->startAutoScroll(); if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance() - || !d->sectionIndicator->isHidden()) { +#if QT_CONFIG(label) + || !d->sectionIndicator->isHidden() +#endif + ) { int visual = visualIndexAt(pos); if (visual == -1) return; @@ -2548,7 +2551,11 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e) int pos = d->orientation == Qt::Horizontal ? e->x() : e->y(); switch (d->state) { case QHeaderViewPrivate::MoveSection: - if (!d->sectionIndicator->isHidden()) { // moving + if (true +#if QT_CONFIG(label) + && !d->sectionIndicator->isHidden() +#endif + ) { // moving int from = visualIndex(d->section); Q_ASSERT(from != -1); int to = visualIndex(d->target); @@ -3138,9 +3145,11 @@ int QHeaderViewPrivate::sectionHandleAt(int position) void QHeaderViewPrivate::setupSectionIndicator(int section, int position) { Q_Q(QHeaderView); +#if QT_CONFIG(label) if (!sectionIndicator) { sectionIndicator = new QLabel(viewport); } +#endif int w, h; int p = q->sectionViewportPosition(section); @@ -3151,7 +3160,9 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position) w = viewport->width(); h = q->sectionSize(section); } +#if QT_CONFIG(label) sectionIndicator->resize(w, h); +#endif QPixmap pm(w, h); pm.fill(QColor(0, 0, 0, 45)); @@ -3162,12 +3173,15 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position) q->paintSection(&painter, rect, section); painter.end(); +#if QT_CONFIG(label) sectionIndicator->setPixmap(pm); +#endif sectionIndicatorOffset = position - qMax(p, 0); } void QHeaderViewPrivate::updateSectionIndicator(int section, int position) { +#if QT_CONFIG(label) if (!sectionIndicator) return; @@ -3182,6 +3196,7 @@ void QHeaderViewPrivate::updateSectionIndicator(int section, int position) sectionIndicator->move(0, position - sectionIndicatorOffset); sectionIndicator->show(); +#endif } /*! diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 6affe7af95..d6b119512c 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -58,7 +58,9 @@ #include "QtCore/qbitarray.h" #include "QtWidgets/qapplication.h" +#if QT_CONFIG(label) #include "QtWidgets/qlabel.h" +#endif QT_BEGIN_NAMESPACE @@ -99,7 +101,9 @@ public: lastSectionSize(0), lastSectionLogicalIdx(-1), // Only trust when we stretch last section sectionIndicatorOffset(0), +#if QT_CONFIG(label) sectionIndicator(0), +#endif globalResizeMode(QHeaderView::Interactive), sectionStartposRecalc(true), resizeContentsPrecision(1000) @@ -296,7 +300,9 @@ public: int lastSectionLogicalIdx; // Only trust if we stretch LastSection int sectionIndicatorOffset; Qt::Alignment defaultAlignment; +#if QT_CONFIG(label) QLabel *sectionIndicator; +#endif QHeaderView::ResizeMode globalResizeMode; QList persistentHiddenSections; mutable bool sectionStartposRecalc; diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 5356ce3ad0..c044d37575 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -45,7 +45,9 @@ #include #include +#if QT_CONFIG(label) #include +#endif #include #include #include @@ -261,8 +263,10 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) ed->setFrame(false); return ed; } #endif +#if QT_CONFIG(label) case QVariant::Pixmap: return new QLabel(parent); +#endif #ifndef QT_NO_SPINBOX case QVariant::Double: { QDoubleSpinBox *sb = new QDoubleSpinBox(parent); diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index ad2180bbfd..c91be918b6 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -15,7 +15,6 @@ HEADERS += \ kernel/qwidgetbackingstore_p.h \ kernel/qboxlayout.h \ kernel/qdesktopwidget.h \ - kernel/qformlayout.h \ kernel/qgridlayout.h \ kernel/qlayout.h \ kernel/qlayout_p.h \ @@ -45,7 +44,6 @@ SOURCES += \ kernel/qapplication.cpp \ kernel/qwidgetbackingstore.cpp \ kernel/qboxlayout.cpp \ - kernel/qformlayout.cpp \ kernel/qgridlayout.cpp \ kernel/qlayout.cpp \ kernel/qlayoutengine.cpp \ @@ -84,3 +82,8 @@ qtConfig(opengl) { HEADERS += kernel/qopenglwidget.h SOURCES += kernel/qopenglwidget.cpp } + +qtConfig(formlayout) { + HEADERS += kernel/qformlayout.h + SOURCES += kernel/qformlayout.cpp +} diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index b4185374fd..5ec27433d3 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(formlayout); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 1a341d155b..b90be2b4f1 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -49,7 +49,9 @@ #include "qvariant.h" #include "qwidget_p.h" #include "qlayout_p.h" +#if QT_CONFIG(formlayout) #include "qformlayout.h" +#endif QT_BEGIN_NAMESPACE @@ -320,8 +322,10 @@ int QLayout::spacing() const return boxlayout->spacing(); } else if (const QGridLayout* gridlayout = qobject_cast(this)) { return gridlayout->spacing(); +#if QT_CONFIG(formlayout) } else if (const QFormLayout* formlayout = qobject_cast(this)) { return formlayout->spacing(); +#endif } else { Q_D(const QLayout); if (d->insideSpacing >=0) { @@ -347,8 +351,10 @@ void QLayout::setSpacing(int spacing) boxlayout->setSpacing(spacing); } else if (QGridLayout* gridlayout = qobject_cast(this)) { gridlayout->setSpacing(spacing); +#if QT_CONFIG(formlayout) } else if (QFormLayout* formlayout = qobject_cast(this)) { formlayout->setSpacing(spacing); +#endif } else { Q_D(QLayout); d->insideSpacing = spacing; diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index a92dc2cbf7..48afeb1dcc 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -43,18 +43,19 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include #include + #ifndef QT_NO_TOOLTIP +#include +#include #if 0 // Used to be included in Qt4 for Q_WS_MAC # include diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 24070f18a6..b54f49c8fc 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -49,7 +49,11 @@ #include #include #include +#if QT_CONFIG(formlayout) #include +#else +#include +#endif #include #include #include @@ -5162,12 +5166,14 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = QWizard::ClassicStyle; break; #endif +#if QT_CONFIG(formlayout) case SH_FormLayoutWrapPolicy: ret = QFormLayout::DontWrapRows; break; case SH_FormLayoutFieldGrowthPolicy: ret = QFormLayout::AllNonFixedFieldsGrow; break; +#endif case SH_FormLayoutFormAlignment: ret = Qt::AlignLeft | Qt::AlignTop; break; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 35e7060b72..3a43f146da 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -75,7 +75,9 @@ #include #include #include +#if QT_CONFIG(label) #include +#endif #include "qdrawutil.h" #include @@ -1414,11 +1416,13 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q static inline QObject *parentObject(const QObject *obj) { +#if QT_CONFIG(tooltip) if (qobject_cast(obj) && qstrcmp(obj->metaObject()->className(), "QTipLabel") == 0) { QObject *p = qvariant_cast(obj->property("_q_stylesheet_parent")); if (p) return p; } +#endif return obj->parent(); } diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 83c1764f38..4ea776d0b1 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -46,7 +46,10 @@ #include "qlist.h" #include "qevent.h" #include "qpoint.h" +#if QT_CONFIG(label) #include "qlabel.h" +#include "private/qlabel_p.h" +#endif #include "qpushbutton.h" #include "qpainterpath.h" #include "qpainter.h" @@ -55,7 +58,6 @@ #include "qapplication.h" #include "qdesktopwidget.h" #include "qbitmap.h" -#include "private/qlabel_p.h" QT_BEGIN_NAMESPACE @@ -481,6 +483,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, setAttribute(Qt::WA_DeleteOnClose); QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close())); +#if QT_CONFIG(label) QLabel *titleLabel = new QLabel; titleLabel->installEventFilter(this); titleLabel->setText(title); @@ -488,6 +491,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, f.setBold(true); titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows +#endif const int iconSize = 18; const int closeButtonSize = 15; @@ -499,6 +503,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, closeButton->setFixedSize(closeButtonSize, closeButtonSize); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); +#if QT_CONFIG(label) QLabel *msgLabel = new QLabel; msgLabel->installEventFilter(this); msgLabel->setText(message); @@ -521,8 +526,10 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); } +#endif QGridLayout *layout = new QGridLayout; +#if QT_CONFIG(label) if (!icon.isNull()) { QLabel *iconLabel = new QLabel; iconLabel->setPixmap(icon.pixmap(iconSize, iconSize)); @@ -533,9 +540,12 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, } else { layout->addWidget(titleLabel, 0, 0, 1, 2); } +#endif layout->addWidget(closeButton, 0, 2); +#if QT_CONFIG(label) layout->addWidget(msgLabel, 1, 0, 1, 3); +#endif layout->setSizeConstraint(QLayout::SetFixedSize); layout->setMargin(3); setLayout(layout); diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index ac6c14dc63..cbd5d9eb80 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -37,7 +37,10 @@ ** ****************************************************************************/ +#include "qtwidgetsglobal.h" +#if QT_CONFIG(label) #include "qlabel.h" +#endif #include "qpainter.h" #include "qpixmap.h" #include "qbitmap.h" diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 730aa0f0b2..5302d6d9a7 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -57,7 +57,6 @@ #include "QtWidgets/qspinbox.h" #include "QtWidgets/qtoolbutton.h" #include "QtWidgets/qmenu.h" -#include "QtWidgets/qlabel.h" #include "QtWidgets/qdatetimeedit.h" #include "private/qabstractspinbox_p.h" #include "private/qdatetimeparser_p.h" diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h index 1f76937a63..3978e34d14 100644 --- a/src/widgets/widgets/qlabel.h +++ b/src/widgets/widgets/qlabel.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(label); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 1821a7f766..7628a86459 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -26,8 +26,6 @@ HEADERS += \ widgets/qgroupbox.h \ widgets/qkeysequenceedit.h \ widgets/qkeysequenceedit_p.h \ - widgets/qlabel.h \ - widgets/qlabel_p.h \ widgets/qlcdnumber.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ @@ -100,7 +98,6 @@ SOURCES += \ widgets/qframe.cpp \ widgets/qgroupbox.cpp \ widgets/qkeysequenceedit.cpp \ - widgets/qlabel.cpp \ widgets/qlcdnumber.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ @@ -149,6 +146,15 @@ qtConfig(commandlinkbutton) { widgets/qcommandlinkbutton.cpp } +qtConfig(label) { + HEADERS += \ + widgets/qlabel.h \ + widgets/qlabel_p.h + + SOURCES += \ + widgets/qlabel.cpp +} + qtConfig(radiobutton) { HEADERS += \ widgets/qradiobutton.h From d5fe06a94ebbd2652034acfb64992ea4e744a1fe Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 1 Mar 2017 15:24:43 +0100 Subject: [PATCH 44/71] Make uic handle -no-feature-shortcut Change-Id: I0f8c9fdc8b0fe573443cfc126f21e473544ddcba Reviewed-by: Lars Knoll --- src/tools/uic/cpp/cppwriteinitialization.cpp | 2 ++ tests/auto/tools/uic/baseline/chatmainwindow.ui.h | 6 +++++- tests/auto/tools/uic/baseline/mydialog.ui.h | 4 +++- tests/auto/tools/uic/baseline/trpreviewtool.ui.h | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 2b0d70eac6..301d6fdabb 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1484,6 +1484,8 @@ void WriteInitialization::writeProperties(const QString &varName, defineC = whatsThisDefineC; else if (propertyName == QLatin1String("statusTip")) defineC = statusTipDefineC; + else if (propertyName == QLatin1String("shortcut")) + defineC = shortcutDefineC; else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription")) defineC = accessibilityDefineC; diff --git a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h index 8cfd9b4851..7f8b026ba5 100644 --- a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h +++ b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'chatmainwindow.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.9.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -151,10 +151,14 @@ public: { ChatMainWindow->setWindowTitle(QApplication::translate("ChatMainWindow", "Qt D-Bus Chat", Q_NULLPTR)); actionQuit->setText(QApplication::translate("ChatMainWindow", "Quit", Q_NULLPTR)); +#ifndef QT_NO_SHORTCUT actionQuit->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+Q", Q_NULLPTR)); +#endif // QT_NO_SHORTCUT actionAboutQt->setText(QApplication::translate("ChatMainWindow", "About Qt...", Q_NULLPTR)); actionChangeNickname->setText(QApplication::translate("ChatMainWindow", "Change nickname...", Q_NULLPTR)); +#ifndef QT_NO_SHORTCUT actionChangeNickname->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+N", Q_NULLPTR)); +#endif // QT_NO_SHORTCUT #ifndef QT_NO_TOOLTIP chatHistory->setToolTip(QApplication::translate("ChatMainWindow", "Messages sent and received from other users", Q_NULLPTR)); #endif // QT_NO_TOOLTIP diff --git a/tests/auto/tools/uic/baseline/mydialog.ui.h b/tests/auto/tools/uic/baseline/mydialog.ui.h index 061b476f63..279dd0e9bf 100644 --- a/tests/auto/tools/uic/baseline/mydialog.ui.h +++ b/tests/auto/tools/uic/baseline/mydialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mydialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.9.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -62,7 +62,9 @@ public: MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Mach 2!", Q_NULLPTR)); aLabel->setText(QApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", Q_NULLPTR)); aButton->setText(QApplication::translate("MyDialog", "&Quit", Q_NULLPTR)); +#ifndef QT_NO_SHORTCUT aButton->setShortcut(QApplication::translate("MyDialog", "Alt+Q", Q_NULLPTR)); +#endif // QT_NO_SHORTCUT } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h index d694ae5a8d..7545b4c803 100644 --- a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h +++ b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'trpreviewtool.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.9.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -168,7 +168,9 @@ public: actionOpenForm->setText(QApplication::translate("TrPreviewToolClass", "&Open Form...", Q_NULLPTR)); actionLoadTranslation->setText(QApplication::translate("TrPreviewToolClass", "&Load Translation...", Q_NULLPTR)); actionReloadTranslations->setText(QApplication::translate("TrPreviewToolClass", "&Reload Translations", Q_NULLPTR)); +#ifndef QT_NO_SHORTCUT actionReloadTranslations->setShortcut(QApplication::translate("TrPreviewToolClass", "F5", Q_NULLPTR)); +#endif // QT_NO_SHORTCUT actionClose->setText(QApplication::translate("TrPreviewToolClass", "&Close", Q_NULLPTR)); actionAbout->setText(QApplication::translate("TrPreviewToolClass", "About", Q_NULLPTR)); actionAbout_Qt->setText(QApplication::translate("TrPreviewToolClass", "About Qt", Q_NULLPTR)); From 51bec76d1041ef809aa0adeec041f14f6124b5ab Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 21 Feb 2017 13:25:43 +0100 Subject: [PATCH 45/71] QLineEditPrivate: introduce SideWidgetLocation class ... as a replacement for QPair, and move some repsonsibilities into it. This avoids the repeated use of the magic number -1 to indicate invalid locations and does away with the confusing .first and .second, replacing them instead with proper names, .position and .index. Change-Id: If904c5333cecf8ce3d5160ca4be9264a13a2b72a Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qlineedit_p.cpp | 27 +++++++++++++-------------- src/widgets/widgets/qlineedit_p.h | 11 +++++++++-- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 791fba49aa..1d81d1fcb5 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -485,21 +485,21 @@ void QLineEditPrivate::positionSideWidgets() } } -QLineEditPrivate::PositionIndexPair QLineEditPrivate::findSideWidget(const QAction *a) const +QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(const QAction *a) const { int i = 0; for (const auto &e : leadingSideWidgets) { if (a == e.action) - return PositionIndexPair(QLineEdit::LeadingPosition, i); + return {QLineEdit::LeadingPosition, i}; ++i; } i = 0; for (const auto &e : trailingSideWidgets) { if (a == e.action) - return PositionIndexPair(QLineEdit::TrailingPosition, i); + return {QLineEdit::TrailingPosition, i}; ++i; } - return PositionIndexPair(QLineEdit::LeadingPosition, -1); + return {QLineEdit::LeadingPosition, -1}; } QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition position, int flags) @@ -534,11 +534,10 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE #endif } // If there is a 'before' action, it takes preference - PositionIndexPair positionIndex = before ? findSideWidget(before) : PositionIndexPair(position, -1); - SideWidgetEntryList &list = positionIndex.first == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; - if (positionIndex.second < 0) - positionIndex.second = int(list.size()); - list.insert(list.begin() + positionIndex.second, SideWidgetEntry(w, newAction, flags)); + const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1}; + SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; + list.insert(location.isValid() ? list.begin() + location.index : list.end(), + SideWidgetEntry(w, newAction, flags)); positionSideWidgets(); w->show(); return w; @@ -548,12 +547,12 @@ void QLineEditPrivate::removeAction(QAction *action) { #if QT_CONFIG(action) Q_Q(QLineEdit); - const PositionIndexPair positionIndex = findSideWidget(action); - if (positionIndex.second == -1) + const auto location = findSideWidget(action); + if (!location.isValid()) return; - SideWidgetEntryList &list = positionIndex.first == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; - SideWidgetEntry entry = list[positionIndex.second]; - list.erase(list.begin() + positionIndex.second); + SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; + SideWidgetEntry entry = list[location.index]; + list.erase(list.begin() + location.index); if (entry.flags & SideWidgetCreatedByWidgetAction) static_cast(entry.action)->releaseWidget(entry.widget); else diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index a903c003e6..2d695f8411 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -235,15 +235,22 @@ public: int effectiveRightTextMargin() const; private: - typedef QPair PositionIndexPair; + struct SideWidgetLocation { + QLineEdit::ActionPosition position; + int index; - PositionIndexPair findSideWidget(const QAction *a) const; + bool isValid() const { return index >= 0; } + }; + friend class QTypeInfo; + + SideWidgetLocation findSideWidget(const QAction *a) const; SideWidgetEntryList leadingSideWidgets; SideWidgetEntryList trailingSideWidgets; int lastTextSize; }; Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetLocation, Q_PRIMITIVE_TYPE); #endif // QT_NO_LINEEDIT From 03b3f7a3af49faecf6ac460c44343063e9597ce4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 4 Mar 2017 13:59:50 -0600 Subject: [PATCH 46/71] Make new QtCore code conform to the coding style Change-Id: I74966ed02f674a7295f8fffd14a8c6389da538c1 Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- src/corelib/tools/qbytearraymatcher.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index 476bc3c049..e3ab25c152 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -83,7 +83,8 @@ private: }; }; -class QStaticByteArrayMatcherBase { +class QStaticByteArrayMatcherBase +{ struct Skiptable { uchar data[256]; } m_skiptable; From 3a2f4bde14221ccc5b81666b3ab8b08f1fdc36e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 4 Mar 2017 14:00:26 -0600 Subject: [PATCH 47/71] QStaticByteArrayMatcher: enforce alignment The data is 256 bytes, so might as well align it on a 16-byte boundary to facilitate copying (if that happens). We should consider similar for QByteArrayMatcher in 6.0. Change-Id: I74966ed02f674a7295f8fffd14a8c64526d734bb Reviewed-by: Marc Mutz --- src/corelib/tools/qbytearraymatcher.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index e3ab25c152..c1c0c3a660 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -85,6 +85,7 @@ private: class QStaticByteArrayMatcherBase { + Q_DECL_ALIGN(16) struct Skiptable { uchar data[256]; } m_skiptable; From 80cbe30798fbc3219f2331f1b5f746dfe57b5c32 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 6 Mar 2017 10:58:53 +0100 Subject: [PATCH 48/71] Remove unused src/tools/moc/mwerks_mac.* files These files are unused. They still contains Qt3 code (QCString for example) Task-number: QTBUG-59302 Change-Id: I661f08db4092311df1d6c7d54b9780d86adab8aa Reviewed-by: Simon Hausmann --- src/tools/moc/mwerks_mac.cpp | 227 ----------------------------------- src/tools/moc/mwerks_mac.h | 54 --------- 2 files changed, 281 deletions(-) delete mode 100644 src/tools/moc/mwerks_mac.cpp delete mode 100644 src/tools/moc/mwerks_mac.h diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp deleted file mode 100644 index fe8bf680fb..0000000000 --- a/src/tools/moc/mwerks_mac.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef MOC_MWERKS_PLUGIN - -#include "mwerks_mac.h" -#include "qt_mac.h" - -/* compiler headers */ -#include "DropInCompilerLinker.h" -#include "CompilerMapping.h" -#include "CWPluginErrors.h" - -/* standard headers */ -#include -#include - -QT_BEGIN_NAMESPACE - -//qglobal.cpp -const unsigned char * p_str(const char * c); -QCString pstring2qstring(const unsigned char *c); - -#if CW_USE_PRAGMA_EXPORT -#pragma export on -#endif - -CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize) -{ - static const DropInFlags sFlags = { - kCurrentDropInFlagsVersion, - CWDROPINCOMPILERTYPE, - DROPINCOMPILERLINKERAPIVERSION_7, - kCompAlwaysReload|kCompRequiresProjectBuildStartedMsg, - Lang_C_CPP, - DROPINCOMPILERLINKERAPIVERSION - }; - *flags = &sFlags; - *flagsSize = sizeof(sFlags); - return cwNoErr; -} - - - -CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName) -{ - static const char sDropInName[] = "McMoc"; - *dropinName = sDropInName; - return cwNoErr; -} - -CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName) -{ - static const char sDisplayName[] = "McMoc"; - *displayName = sDisplayName; - return cwNoErr; -} - -CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList) -{ - static CWDataType sCPU = targetCPUAny; - static CWDataType sOS = targetOSMacintosh; - static CWTargetList sTargetList = {kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS}; - *targetList = &sTargetList; - return cwNoErr; -} - -CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList) -{ - static CWExtensionMapping sExtension[] = { {'TEXT', ".mocs", kPrecompile } }; - static CWExtMapList sExtensionMapList = {kCurrentCWExtMapListVersion, 3, sExtension}; - *defaultMappingList = &sExtensionMapList; - return cwNoErr; -} - -#if CW_USE_PRAGMA_EXPORT -#pragma export off -#endif -typedef short CWFileRef; - -static int line_count = 0; -moc_status do_moc(CWPluginContext, const QCString &, const QCString &, CWFileSpec *, bool); - -static CWResult mocify(CWPluginContext context, const QCString &source) -{ - CWDisplayLines(context, line_count++); - - source.stripWhiteSpace(); - - CWResult err; - bool dotmoc=false; - QCString stem = source, ext; - int dotpos = stem.findRev('.'); - if(dotpos != -1) { - ext = stem.right(stem.length() - (dotpos+1)); - stem = stem.left(dotpos); - if(ext == "cpp") - dotmoc = true; - } else { - //whoa! - } - QCString dest; - if(dotmoc) - dest = stem + ".moc"; - else - dest = "moc_" + stem + ".cpp"; - - //moc it - CWFileSpec destSpec; - moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc); - -#if 0 - QCString derr = "Weird"; - switch(mocd) { - case moc_success: derr = "Success"; break; - case moc_parse_error: derr = "Parser Error"; break; - case moc_no_qobject:derr = "No QOBJECT"; break; - case moc_not_time: derr = "Not Time"; break; - case moc_no_source: derr = "No Source"; break; - case moc_general_error: derr = "General Error"; break; - } - char dmsg[200]; - sprintf(dmsg, "\"%s\" %s", source.data(), derr.data()); - CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0); -#endif - - //handle project - if(mocd == moc_no_qobject) { - char msg[400]; - sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data()); - CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0); - } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc) - { - long whichFile; - CWNewProjectEntryInfo ei; - memset(&ei, '\0', sizeof(ei)); - ei.groupPath = "QtGenerated"; - err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile); - if (!CWSUCCESS(err)) - { - char msg[200]; - sprintf(msg, "\"%s\" not added", dest.data()); - CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0); - } - if(mocd == moc_success) - CWSetModDate(context, &destSpec, NULL, true); - } - return cwNoErr; -} - -pascal short main(CWPluginContext context) -{ - short result; - long request; - - if (CWGetPluginRequest(context, &request) != cwNoErr) - return cwErrRequestFailed; - result = cwErrInvalidParameter; - - /* dispatch on compiler request */ - switch (request) - { - case reqInitCompiler: - case reqTermCompiler: - result = cwNoErr; - break; - - case reqCompile: - { - line_count = 0; - const char *files = NULL; - long filelen; - CWGetMainFileText(context, &files, &filelen); - const char *beg = files; - for(int x = 0; x < filelen; x++) { - if(*(files++) == '\r') { - char file[1024]; - memcpy(file, beg, files - beg); - file[(files-beg)-1] = '\0'; - mocify(context, file); - beg = files; - } - } - if(beg != files) { - char file[1024]; - memcpy(file, beg, files - beg); - file[(files-beg)] = '\0'; - mocify(context, file); - } - - result = cwNoErr; - break; - } - } - - /* return result code */ - return result; -} - -#endif - -QT_END_NAMESPACE diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h deleted file mode 100644 index 9f6f074036..0000000000 --- a/src/tools/moc/mwerks_mac.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MWERKS_MAC_H -#define MWERKS_MAC_H - -#include - -QT_BEGIN_NAMESPACE - -#ifdef Q_OS_MAC - -#define macintosh - -/*make moc a plugin*/ -enum moc_status { - moc_success = 1, - moc_parse_error = 2, - moc_no_qobject = 3, - moc_not_time = 4, - moc_no_source = 5, - moc_general_error = 6 -}; - -#endif - -QT_END_NAMESPACE - -#endif // MWERKS_MAC_H From 0b109a952b532338987c3305d2aa37a185984c80 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Mar 2017 10:40:08 +0100 Subject: [PATCH 49/71] Build fix for -no-feature-formlayout Change-Id: I10a1c4b742bb446f7baa219d4118a03d9f60495c Reviewed-by: Stephan Binner Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index d9da67527a..2cc7b39861 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -71,7 +71,7 @@ "label": "QPrintPreviewDialog", "purpose": "Provides a dialog for previewing and configuring page layouts for printer output.", "section": "Dialogs", - "condition": "features.printpreviewwidget && features.printdialog && features.toolbar", + "condition": "features.printpreviewwidget && features.printdialog && features.toolbar && features.formlayout", "output": [ "publicFeature", "feature" ] } }, From 5c62fd9a2e01047074b3594153e5652794ac6a36 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 2 Mar 2017 09:20:00 +0100 Subject: [PATCH 50/71] Add feature.dialogbuttonbox Change-Id: I8c136024c3bf431529033a806be646d867919daa Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 1 + .../accessible/qaccessiblewidgetfactory.cpp | 2 ++ src/widgets/accessible/qaccessiblewidgets.cpp | 6 ++-- src/widgets/accessible/qaccessiblewidgets_p.h | 2 ++ src/widgets/configure.json | 33 ++++++++++++++++--- src/widgets/styles/qcommonstyle.cpp | 6 ++++ src/widgets/styles/qfusionstyle.cpp | 1 - src/widgets/styles/qmacstyle_mac.mm | 4 +++ src/widgets/styles/qmacstyle_mac_p_p.h | 2 ++ src/widgets/styles/qwindowsvistastyle.cpp | 10 ++++++ src/widgets/styles/qwindowsvistastyle_p_p.h | 2 ++ src/widgets/widgets/qdialogbuttonbox.h | 2 ++ src/widgets/widgets/qpushbutton.cpp | 5 +-- src/widgets/widgets/widgets.pri | 10 ++++-- 14 files changed, 75 insertions(+), 11 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 2cc7b39861..002f7f84cb 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -59,6 +59,7 @@ "features.buttongroup", "features.combobox", "features.datetimeedit", + "features.dialogbuttonbox", "features.printer", "features.radiobutton", "features.spinbox", diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index da184fd90d..6c31b91b45 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -184,8 +184,10 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QMdiSubWindow")) { iface = new QAccessibleMdiSubWindow(widget); #endif +#if QT_CONFIG(dialogbuttonbox) } else if (classname == QLatin1String("QDialogButtonBox")) { iface = new QAccessibleDialogButtonBox(widget); +#endif #ifndef QT_NO_DIAL } else if (classname == QLatin1String("QDial")) { iface = new QAccessibleDial(widget); diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 4c48ecb465..40aca37f11 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -54,7 +54,9 @@ #include #include #include +#if QT_CONFIG(dialogbuttonbox) #include +#endif #include #include #include @@ -480,7 +482,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const } #endif // QT_NO_MDIAREA -#ifndef QT_NO_DIALOGBUTTONBOX +#if QT_CONFIG(dialogbuttonbox) // ======================= QAccessibleDialogButtonBox ====================== QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget) : QAccessibleWidget(widget, QAccessible::Grouping) @@ -488,7 +490,7 @@ QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget) Q_ASSERT(qobject_cast(widget)); } -#endif // QT_NO_DIALOGBUTTONBOX +#endif // QT_CONFIG(dialogbuttonbox) #if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR) QAccessibleTextBrowser::QAccessibleTextBrowser(QWidget *widget) diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h index 052958d4c7..4d945a2016 100644 --- a/src/widgets/accessible/qaccessiblewidgets_p.h +++ b/src/widgets/accessible/qaccessiblewidgets_p.h @@ -248,11 +248,13 @@ protected: }; #endif // QT_NO_MDIAREA +#if QT_CONFIG(dialogbuttonbox) class QAccessibleDialogButtonBox : public QAccessibleWidget { public: explicit QAccessibleDialogButtonBox(QWidget *widget); }; +#endif #if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR) class QAccessibleTextBrowser : public QAccessibleTextEdit diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 2ae8872c88..a59f86e278 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -423,18 +423,28 @@ "condition": "features.lineedit && features.shortcut", "output": [ "publicFeature", "feature" ] }, + "dialogbuttonbox": { + "label": "QDialogButtonBox", + "purpose": "Presents buttons in a layout that is appropriate for the current widget style.", + "section": "Dialogs", + "output": [ "publicFeature" ] + }, "messagebox": { "label": "QMessageBox", "purpose": "Provides message boxes displaying informative messages and simple questions.", "section": "Dialogs", - "condition" : "features.label", + "condition" : "features.dialogbuttonbox && features.label", "output": [ "publicFeature", "feature" ] }, "colordialog": { "label": "QColorDialog", "purpose": "Provides a dialog widget for specifying colors.", "section": "Dialogs", - "condition": "features.spinbox && features.label", + "condition": [ + "features.dialogbuttonbox", + "features.label", + "features.spinbox" + ], "output": [ "publicFeature", "feature" ] }, "filedialog": { @@ -444,6 +454,7 @@ "condition": [ "features.buttongroup", "features.combobox", + "features.dialogbuttonbox", "features.dirmodel", "features.label", "features.proxymodel", @@ -458,7 +469,14 @@ "label": "QFontDialog", "purpose": "Provides a dialog widget for selecting fonts.", "section": "Dialogs", - "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox && features.label", + "condition": [ + "features.combobox", + "features.dialogbuttonbox", + "features.groupbox", + "features.label", + "features.stringlistmodel", + "features.validator" + ], "output": [ "publicFeature", "feature" ] }, "progressdialog": { @@ -472,7 +490,14 @@ "label": "QInputDialog", "purpose": "Provides a simple convenience dialog to get a single value from the user.", "section": "Dialogs", - "condition": "features.combobox && features.spinbox && features.stackedwidget && features.textedit && features.label", + "condition": [ + "features.combobox", + "features.dialogbuttonbox", + "features.label", + "features.spinbox", + "features.stackedwidget", + "features.textedit" + ], "output": [ "publicFeature", "feature" ] }, "errormessage": { diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index b54f49c8fc..604422dc4f 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -48,7 +48,9 @@ #include #include #include +#if QT_CONFIG(dialogbuttonbox) #include +#endif #if QT_CONFIG(formlayout) #include #else @@ -4926,9 +4928,11 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_ScrollBar_ContextMenu: ret = true; break; +#if QT_CONFIG(dialogbuttonbox) case SH_DialogButtons_DefaultButton: // This value not used anywhere. ret = QDialogButtonBox::AcceptRole; break; +#endif #ifndef QT_NO_GROUPBOX case SH_GroupBox_TextLabelVerticalAlignment: ret = Qt::AlignVCenter; @@ -5116,11 +5120,13 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_TabBar_ElideMode: ret = Qt::ElideNone; break; +#if QT_CONFIG(dialogbuttonbox) case SH_DialogButtonLayout: ret = QDialogButtonBox::WinLayout; if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); break; +#endif case SH_ComboBox_PopupFrameStyle: ret = QFrame::StyledPanel | QFrame::Plain; break; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index bf72983138..cf393744f0 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index f884a1c279..e78946577c 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -57,7 +57,9 @@ #include #include #include +#if QT_CONFIG(dialogbuttonbox) #include +#endif #include #include #include @@ -2931,9 +2933,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_TabBar_ElideMode: ret = Qt::ElideRight; break; +#if QT_CONFIG(dialogbuttonbox) case SH_DialogButtonLayout: ret = QDialogButtonBox::MacLayout; break; +#endif case SH_FormLayoutWrapPolicy: ret = QFormLayout::DontWrapRows; break; diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 798f6ed90b..819ac42293 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -55,7 +55,9 @@ #include #include #include +#if QT_CONFIG(dialogbuttonbox) #include +#endif #include #include #include diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 1bdd8bf0c8..5a53627e95 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -775,6 +775,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } case PE_Widget: { +#if QT_CONFIG(dialogbuttonbox) const QDialogButtonBox *buttonBox = 0; if (qobject_cast (widget)) @@ -801,6 +802,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt theme.partId = TDLG_SECONDARYPANEL; d->drawBackground(theme); } +#endif } break; default: @@ -2315,16 +2317,20 @@ void QWindowsVistaStyle::polish(QWidget *widget) } } else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground); +#if QT_CONFIG(dialogbuttonbox) QDialogButtonBox *buttonBox = widget->findChild(QLatin1String("qt_msgbox_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 9, 0, 0); +#endif } #ifndef QT_NO_INPUTDIALOG else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground); +#if QT_CONFIG(dialogbuttonbox) QDialogButtonBox *buttonBox = widget->findChild(QLatin1String("qt_inputdlg_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 9, 0, 0); +#endif } #endif // QT_NO_INPUTDIALOG else if (QTreeView *tree = qobject_cast (widget)) { @@ -2355,16 +2361,20 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) widget->setAttribute(Qt::WA_Hover, false); else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); +#if QT_CONFIG(dialogbuttonbox) QDialogButtonBox *buttonBox = widget->findChild(QLatin1String("qt_msgbox_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 0, 0, 0); +#endif } #ifndef QT_NO_INPUTDIALOG else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); +#if QT_CONFIG(dialogbuttonbox) QDialogButtonBox *buttonBox = widget->findChild(QLatin1String("qt_inputdlg_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 0, 0, 0); +#endif } #endif // QT_NO_INPUTDIALOG else if (QTreeView *tree = qobject_cast (widget)) { diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 18b6f9c3f7..038bad0c58 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -80,7 +80,9 @@ #include #include #include +#if QT_CONFIG(dialogbuttonbox) #include +#endif #include #include #include diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h index 00ec315555..af9e705234 100644 --- a/src/widgets/widgets/qdialogbuttonbox.h +++ b/src/widgets/widgets/qdialogbuttonbox.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(dialogbuttonbox); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index d8eae724ee..20758679f0 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -55,7 +55,9 @@ #include "qtoolbar.h" #include "qdebug.h" #include "qlayoutitem.h" +#if QT_CONFIG(dialogbuttonbox) #include "qdialogbuttonbox.h" +#endif #if 0 // Used to be included in Qt4 for Q_WS_MAC #include "private/qmacstyle_mac_p.h" #include "private/qmacstyle_mac_p_p.h" @@ -400,8 +402,7 @@ QSize QPushButton::sizeHint() const initStyleOption(&opt); // calculate contents size... -#ifndef QT_NO_ICON - +#if !defined(QT_NO_ICON) && QT_CONFIG(dialogbuttonbox) bool showButtonBoxIcons = qobject_cast(parentWidget()) && style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons); diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 7628a86459..bc36105849 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -16,7 +16,6 @@ HEADERS += \ widgets/qdatetimeedit.h \ widgets/qdatetimeedit_p.h \ widgets/qdial.h \ - widgets/qdialogbuttonbox.h \ widgets/qdockwidget.h \ widgets/qdockwidget_p.h \ widgets/qdockarealayout_p.h \ @@ -90,7 +89,6 @@ SOURCES += \ widgets/qcombobox.cpp \ widgets/qdatetimeedit.cpp \ widgets/qdial.cpp \ - widgets/qdialogbuttonbox.cpp \ widgets/qdockwidget.cpp \ widgets/qdockarealayout.cpp \ widgets/qeffects.cpp \ @@ -163,6 +161,14 @@ qtConfig(radiobutton) { widgets/qradiobutton.cpp } +qtConfig(dialogbuttonbox) { + HEADERS += \ + widgets/qdialogbuttonbox.h + + SOURCES += \ + widgets/qdialogbuttonbox.cpp +} + macx { HEADERS += \ widgets/qmacnativewidget_mac.h \ From 0884e424106962785b8f2e6742d3590fb3919a97 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 2 Mar 2017 20:16:58 +0100 Subject: [PATCH 51/71] Add feature.checkbox Change-Id: Ib387390b796c3cab6de4ce94e0d217280a300df8 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 10 +++++++++- src/widgets/accessible/simplewidgets.cpp | 8 ++++++++ src/widgets/configure.json | 19 +++++++++++++++++-- src/widgets/styles/qmacstyle_mac.mm | 3 ++- src/widgets/styles/qmacstyle_mac_p_p.h | 2 ++ src/widgets/styles/qstylesheetstyle.cpp | 4 ++++ src/widgets/styles/qwindowsvistastyle_p_p.h | 1 - src/widgets/widgets/qcheckbox.h | 2 ++ src/widgets/widgets/widgets.pri | 10 ++++++++-- 9 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 002f7f84cb..93d345840f 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -34,7 +34,14 @@ "cupsjobwidget": { "label": "CUPS job control widget", "section": "Widgets", - "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox && features.combobox", + "condition": [ + "features.calendarwidget", + "features.checkbox", + "features.combobox", + "features.cups", + "features.datetimeedit", + "features.groupbox" + ], "output": [ "privateFeature", "feature" ] }, "printer": { @@ -57,6 +64,7 @@ "section": "Dialogs", "condition": [ "features.buttongroup", + "features.checkbox", "features.combobox", "features.datetimeedit", "features.dialogbuttonbox", diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 99b22a735e..97d6f90c0e 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -40,7 +40,9 @@ #include "simplewidgets_p.h" #include +#if QT_CONFIG(checkbox) #include +#endif #include #include #include @@ -140,13 +142,17 @@ QAccessible::State QAccessibleButton::state() const QAccessible::State state = QAccessibleWidget::state(); QAbstractButton *b = button(); +#if QT_CONFIG(checkbox) QCheckBox *cb = qobject_cast(b); +#endif if (b->isCheckable()) state.checkable = true; if (b->isChecked()) state.checked = true; +#if QT_CONFIG(checkbox) else if (cb && cb->checkState() == Qt::PartiallyChecked) state.checkStateMixed = true; +#endif if (b->isDown()) state.pressed = true; QPushButton *pb = qobject_cast(b); @@ -168,12 +174,14 @@ QRect QAccessibleButton::rect() const if (!ab->isVisible()) return QRect(); +#if QT_CONFIG(checkbox) if (QCheckBox *cb = qobject_cast(ab)) { QPoint wpos = cb->mapToGlobal(QPoint(0, 0)); QStyleOptionButton opt; cb->initStyleOption(&opt); return cb->style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, cb).translated(wpos); } +#endif #if QT_CONFIG(radiobutton) else if (QRadioButton *rb = qobject_cast(ab)) { QPoint wpos = rb->mapToGlobal(QPoint(0, 0)); diff --git a/src/widgets/configure.json b/src/widgets/configure.json index a59f86e278..b05bf465a1 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -229,6 +229,12 @@ "condition": "features.combobox && features.stringlistmodel", "output": [ "publicFeature", "feature" ] }, + "checkbox": { + "label": "QCheckBox(", + "purpose": "Provides a checkbox with a text label.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "toolbutton": { "label": "QToolButton", "purpose": "Provides quick-access buttons to commands and options.", @@ -433,7 +439,11 @@ "label": "QMessageBox", "purpose": "Provides message boxes displaying informative messages and simple questions.", "section": "Dialogs", - "condition" : "features.dialogbuttonbox && features.label", + "condition" : [ + "features.checkbox", + "features.dialogbuttonbox", + "features.label" + ], "output": [ "publicFeature", "feature" ] }, "colordialog": { @@ -470,6 +480,7 @@ "purpose": "Provides a dialog widget for selecting fonts.", "section": "Dialogs", "condition": [ + "features.checkbox", "features.combobox", "features.dialogbuttonbox", "features.groupbox", @@ -504,7 +515,11 @@ "label": "QErrorMessage", "purpose": "Provides an error message display dialog.", "section": "Dialogs", - "condition": "features.textedit && features.label", + "condition": [ + "features.checkbox", + "features.textedit", + "features.label" + ], "output": [ "publicFeature", "feature" ] }, "wizard": { diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index e78946577c..8aace93328 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -55,7 +55,6 @@ #include #include #include -#include #include #if QT_CONFIG(dialogbuttonbox) #include @@ -668,8 +667,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ct = QStyle::CT_PushButton; else if (qobject_cast(widg)) ct = QStyle::CT_RadioButton; +#if QT_CONFIG(checkbox) else if (qobject_cast(widg)) ct = QStyle::CT_CheckBox; +#endif #ifndef QT_NO_COMBOBOX else if (qobject_cast(widg)) ct = QStyle::CT_ComboBox; diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 819ac42293..063d7e7c80 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -53,7 +53,9 @@ #include #include #include +#if QT_CONFIG(checkbox) #include +#endif #include #if QT_CONFIG(dialogbuttonbox) #include diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 3a43f146da..ba05155b74 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -62,7 +62,9 @@ #include #include #include +#if QT_CONFIG(checkbox) #include +#endif #include #include #include @@ -4740,10 +4742,12 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const return rule.box()->spacing; break; case PM_CheckBoxLabelSpacing: +#if QT_CONFIG(checkbox) if (qobject_cast(w)) { if (rule.hasBox() && rule.box()->spacing != -1) return rule.box()->spacing; } +#endif // assume group box subRule = renderRule(w, opt, PseudoElement_GroupBoxTitle); if (subRule.hasBox() && subRule.box()->spacing != -1) diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 038bad0c58..7173b2183c 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h index 22f26b6667..8543c4c86f 100644 --- a/src/widgets/widgets/qcheckbox.h +++ b/src/widgets/widgets/qcheckbox.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(checkbox); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index bc36105849..2d082812b6 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -10,7 +10,6 @@ HEADERS += \ widgets/qabstractspinbox.h \ widgets/qabstractspinbox_p.h \ widgets/qcalendarwidget.h \ - widgets/qcheckbox.h \ widgets/qcombobox.h \ widgets/qcombobox_p.h \ widgets/qdatetimeedit.h \ @@ -85,7 +84,6 @@ SOURCES += \ widgets/qabstractslider.cpp \ widgets/qabstractspinbox.cpp \ widgets/qcalendarwidget.cpp \ - widgets/qcheckbox.cpp \ widgets/qcombobox.cpp \ widgets/qdatetimeedit.cpp \ widgets/qdial.cpp \ @@ -136,6 +134,14 @@ SOURCES += \ widgets/qtoolbararealayout.cpp \ widgets/qplaintextedit.cpp +qtConfig(checkbox) { + HEADERS += \ + widgets/qcheckbox.h + + SOURCES += \ + widgets/qcheckbox.cpp +} + qtConfig(commandlinkbutton) { HEADERS += \ widgets/qcommandlinkbutton.h From 00e6863552ab3519e8a9a9ecb6cb56bb6a024041 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 5 Mar 2017 18:54:15 +0100 Subject: [PATCH 52/71] Add feature.pushbutton Change-Id: I654d91635e60b177df16f6dfe00acc940132f66a Reviewed-by: Lars Knoll --- src/corelib/kernel/qtcore_eval.cpp | 2 + .../accessible/qaccessiblewidgetfactory.cpp | 1 - src/widgets/accessible/simplewidgets.cpp | 6 ++- src/widgets/configure.json | 43 ++++++++++++++++--- src/widgets/dialogs/qdialog.cpp | 9 +++- src/widgets/dialogs/qdialog_p.h | 12 +++++- src/widgets/styles/qfusionstyle.cpp | 4 ++ src/widgets/styles/qmacstyle_mac.mm | 8 ++++ src/widgets/styles/qmacstyle_mac_p.h | 2 + src/widgets/styles/qmacstyle_mac_p_p.h | 4 ++ src/widgets/styles/qwindowsvistastyle_p_p.h | 2 + src/widgets/styles/qwindowsxpstyle.cpp | 2 + src/widgets/util/qsystemtrayicon.cpp | 7 +++ src/widgets/widgets/qpushbutton.h | 2 + src/widgets/widgets/qpushbutton_p.h | 2 + src/widgets/widgets/widgets.pri | 13 ++++-- 16 files changed, 106 insertions(+), 13 deletions(-) diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index 787db8a8a6..86992ce10b 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -207,7 +207,9 @@ QT_BEGIN_INCLUDE_NAMESPACE #include #include #include +#if QT_CONFIG(pushbutton) #include +#endif #include #include QT_END_INCLUDE_NAMESPACE diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 6c31b91b45..c95b5b1097 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -45,7 +45,6 @@ #include "complexwidgets_p.h" #include "itemviews_p.h" -#include #include #include #include diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 97d6f90c0e..113172ff5a 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -43,7 +43,9 @@ #if QT_CONFIG(checkbox) #include #endif +#if QT_CONFIG(pushbutton) #include +#endif #include #include #if QT_CONFIG(radiobutton) @@ -115,7 +117,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const switch (t) { case QAccessible::Accelerator: { -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) && QT_CONFIG(pushbutton) QPushButton *pb = qobject_cast(object()); if (pb && pb->isDefault()) str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText); @@ -155,6 +157,7 @@ QAccessible::State QAccessibleButton::state() const #endif if (b->isDown()) state.pressed = true; +#if QT_CONFIG(pushbutton) QPushButton *pb = qobject_cast(b); if (pb) { if (pb->isDefault()) @@ -164,6 +167,7 @@ QAccessible::State QAccessibleButton::state() const state.hasPopup = true; #endif } +#endif return state; } diff --git a/src/widgets/configure.json b/src/widgets/configure.json index b05bf465a1..33dc90b124 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -121,6 +121,7 @@ "label": "QCommandLinkButton", "purpose": "Provides a Vista style command link button.", "section": "Widgets", + "condition": "features.pushbutton", "output": [ "publicFeature" ] }, "datetimeedit": { @@ -179,7 +180,7 @@ "label": "QMenu", "purpose": "Provides popup-menus.", "section": "Widgets", - "condition": "features.action", + "condition": "features.action && features.pushbutton", "output": [ "publicFeature", "feature" ] }, "lineedit": { @@ -235,6 +236,13 @@ "section": "Widgets", "output": [ "publicFeature" ] }, + "pushbutton": { + "label": "QPushButton", + "purpose": "Provides a command button.", + "section": "Widgets", + "condition": "features.action", + "output": [ "publicFeature" ] + }, "toolbutton": { "label": "QToolButton", "purpose": "Provides quick-access buttons to commands and options.", @@ -419,7 +427,15 @@ "label": "QCalendarWidget", "purpose": "Provides a monthly based calendar widget allowing the user to select a date.", "section": "Widgets", - "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton && features.label", + "condition": [ + "features.label", + "features.menu", + "features.pushbutton", + "features.spinbox", + "features.tableview", + "features.textdate", + "features.toolbutton" + ], "output": [ "publicFeature", "feature" ] }, "keysequenceedit": { @@ -433,6 +449,7 @@ "label": "QDialogButtonBox", "purpose": "Presents buttons in a layout that is appropriate for the current widget style.", "section": "Dialogs", + "condition": "features.pushbutton", "output": [ "publicFeature" ] }, "messagebox": { @@ -442,7 +459,8 @@ "condition" : [ "features.checkbox", "features.dialogbuttonbox", - "features.label" + "features.label", + "features.pushbutton" ], "output": [ "publicFeature", "feature" ] }, @@ -453,6 +471,7 @@ "condition": [ "features.dialogbuttonbox", "features.label", + "features.pushbutton", "features.spinbox" ], "output": [ "publicFeature", "feature" ] @@ -485,6 +504,7 @@ "features.dialogbuttonbox", "features.groupbox", "features.label", + "features.pushbutton", "features.stringlistmodel", "features.validator" ], @@ -494,7 +514,11 @@ "label": "QProgressDialog", "purpose": "Provides feedback on the progress of a slow operation.", "section": "Dialogs", - "condition": "features.progressbar && features.label", + "condition": [ + "features.label", + "features.pushbutton", + "features.progressbar" + ], "output": [ "publicFeature", "feature" ] }, "inputdialog": { @@ -505,6 +529,7 @@ "features.combobox", "features.dialogbuttonbox", "features.label", + "features.pushbutton", "features.spinbox", "features.stackedwidget", "features.textedit" @@ -518,7 +543,9 @@ "condition": [ "features.checkbox", "features.textedit", - "features.label" + "features.label", + "features.pushbutton", + "features.textedit" ], "output": [ "publicFeature", "feature" ] }, @@ -526,7 +553,11 @@ "label": "QWizard", "purpose": "Provides a framework for multi-page click-through dialogs.", "section": "Dialogs", - "condition": "features.properties && features.label", + "condition": [ + "features.pushbutton", + "features.properties", + "features.label" + ], "output": [ "publicFeature", "feature" ] }, "dirmodel": { diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index e5715ecd57..8e74c659fa 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -43,7 +43,6 @@ #include "qevent.h" #include "qdesktopwidget.h" -#include "qpushbutton.h" #include "qapplication.h" #include "qlayout.h" #include "qsizegrip.h" @@ -367,6 +366,7 @@ QDialog::~QDialog() default default button becomes the default button. This is what a push button calls when it loses focus. */ +#if QT_CONFIG(pushbutton) void QDialogPrivate::setDefault(QPushButton *pushButton) { Q_Q(QDialog); @@ -411,6 +411,7 @@ void QDialogPrivate::hideDefault() list.at(i)->setDefault(false); } } +#endif void QDialogPrivate::resetModalitySetByOpen() { @@ -644,6 +645,7 @@ void QDialog::keyPressEvent(QKeyEvent *e) #endif if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) { switch (e->key()) { +#if QT_CONFIG(pushbutton) case Qt::Key_Enter: case Qt::Key_Return: { QList list = findChildren(); @@ -657,6 +659,7 @@ void QDialog::keyPressEvent(QKeyEvent *e) } } break; +#endif default: e->ignore(); return; @@ -716,6 +719,7 @@ void QDialog::setVisible(bool visible) and actually catches most cases... If not, then they simply have to use [widget*]->setFocus() themselves... */ +#if QT_CONFIG(pushbutton) if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) { QWidget *first = fw; while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus) @@ -733,6 +737,7 @@ void QDialog::setVisible(bool visible) } } } +#endif if (fw && !fw->hasFocus()) { QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); QApplication::sendEvent(fw, &e); @@ -760,10 +765,12 @@ void QDialog::setVisible(bool visible) d->eventLoop->exit(); } +#if QT_CONFIG(pushbutton) const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); if (d->mainDef && isActiveWindow() && theme->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool()) QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); +#endif } /*!\reimp */ diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index ae9e3bcc93..6723edae38 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -56,7 +56,9 @@ #include "QtCore/qeventloop.h" #include "QtCore/qpointer.h" #include "QtWidgets/qdialog.h" +#if QT_CONFIG(pushbutton) #include "QtWidgets/qpushbutton.h" +#endif #include QT_BEGIN_NAMESPACE @@ -69,7 +71,11 @@ class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate public: QDialogPrivate() - : mainDef(0), orientation(Qt::Horizontal),extension(0), doShowExtension(false), + : +#if QT_CONFIG(pushbutton) + mainDef(0), +#endif + orientation(Qt::Horizontal),extension(0), doShowExtension(false), #ifndef QT_NO_SIZEGRIP resizer(0), sizeGripEnabled(false), @@ -84,7 +90,9 @@ public: QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const; void deletePlatformHelper(); +#if QT_CONFIG(pushbutton) QPointer mainDef; +#endif Qt::Orientation orientation; QWidget *extension; bool doShowExtension; @@ -95,9 +103,11 @@ public: #endif QPoint lastRMBPress; +#if QT_CONFIG(pushbutton) void setDefault(QPushButton *); void setMainDefault(QPushButton *); void hideDefault(); +#endif void resetModalitySetByOpen(); int rescode; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index cf393744f0..96af534099 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -43,7 +43,11 @@ #if QT_CONFIG(style_fusion) || defined(QT_PLUGIN) #include "qcommonstyle_p.h" #include +#if QT_CONFIG(pushbutton) #include +#else +#include +#endif #include #include #include diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 8aace93328..6dcebaaf32 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -75,7 +75,9 @@ #include #include #include +#if QT_CONFIG(pushbutton) #include +#endif #include #include #include @@ -663,8 +665,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg } if (ct == QStyle::CT_CustomBase && widg) { +#if QT_CONFIG(pushbutton) if (qobject_cast(widg)) ct = QStyle::CT_PushButton; +#endif else if (qobject_cast(widg)) ct = QStyle::CT_RadioButton; #if QT_CONFIG(checkbox) @@ -704,6 +708,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg } switch (ct) { +#if QT_CONFIG(pushbutton) case QStyle::CT_PushButton: { const QPushButton *psh = qobject_cast(widg); // If this comparison is false, then the widget was not a push button. @@ -746,6 +751,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg // Since there's no default size we return the large size... ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); } +#endif #if 0 //Not sure we are applying the rules correctly for RadioButtons/CheckBoxes --Sam } else if (ct == QStyle::CT_RadioButton) { QRadioButton *rdo = static_cast(widg); @@ -1308,6 +1314,7 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, } } +#if QT_CONFIG(pushbutton) bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option) { QMacStyle *macStyle = qobject_cast(pushButton->style()); @@ -1317,6 +1324,7 @@ bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOpti macStyle->d_func()->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi); return bdi.kind == kThemeBevelButton; } +#endif /** Creates a HIThemeButtonDrawInfo structure that specifies the correct button diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index 98a9063bf0..7296539356 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -127,7 +127,9 @@ private: Q_DISABLE_COPY(QMacStyle) Q_DECLARE_PRIVATE(QMacStyle) +#if QT_CONFIG(pushbutton) friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); +#endif }; #endif diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 063d7e7c80..1332845f8e 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -78,7 +78,9 @@ #include #include #include +#if QT_CONFIG(pushbutton) #include +#endif #include #include #include @@ -158,7 +160,9 @@ typedef void (^QCocoaDrawRectBlock)(NSRect, CGContextRef); return sizes[controlSize]; \ } while (0) +#if QT_CONFIG(pushbutton) bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); +#endif class QMacStylePrivate : public QCommonStylePrivate { diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 7173b2183c..ec7c2caad3 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -64,7 +64,9 @@ #include #include #include +#if QT_CONFIG(pushbutton) #include +#endif #include #include #include diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index f50c143a4a..f3c6069f8a 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -65,7 +65,9 @@ #include #include #include +#if QT_CONFIG(pushbutton) #include +#endif #include #include #include diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 4ea776d0b1..1e0d2ab857 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -50,7 +50,9 @@ #include "qlabel.h" #include "private/qlabel_p.h" #endif +#if QT_CONFIG(pushbutton) #include "qpushbutton.h" +#endif #include "qpainterpath.h" #include "qpainter.h" #include "qstyle.h" @@ -496,12 +498,14 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, const int iconSize = 18; const int closeButtonSize = 15; +#if QT_CONFIG(pushbutton) QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize)); closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); closeButton->setFixedSize(closeButtonSize, closeButtonSize); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); +#endif #if QT_CONFIG(label) QLabel *msgLabel = new QLabel; @@ -542,7 +546,10 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, } #endif +#if QT_CONFIG(pushbutton) layout->addWidget(closeButton, 0, 2); +#endif + #if QT_CONFIG(label) layout->addWidget(msgLabel, 1, 0, 1, 3); #endif diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h index b0d1ccacdb..ea9baa8ccb 100644 --- a/src/widgets/widgets/qpushbutton.h +++ b/src/widgets/widgets/qpushbutton.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(pushbutton); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h index ee41c345c8..198091503a 100644 --- a/src/widgets/widgets/qpushbutton_p.h +++ b/src/widgets/widgets/qpushbutton_p.h @@ -43,6 +43,8 @@ #include #include "private/qabstractbutton_p.h" +QT_REQUIRE_CONFIG(pushbutton); + // // W A R N I N G // ------------- diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 2d082812b6..d25d8ce63e 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -38,8 +38,6 @@ HEADERS += \ widgets/qmenubar.h \ widgets/qmenubar_p.h \ widgets/qprogressbar.h \ - widgets/qpushbutton.h \ - widgets/qpushbutton_p.h \ widgets/qrubberband.h \ widgets/qscrollbar.h \ widgets/qscrollbar_p.h \ @@ -104,7 +102,6 @@ SOURCES += \ widgets/qmenu.cpp \ widgets/qmenubar.cpp \ widgets/qprogressbar.cpp \ - widgets/qpushbutton.cpp \ widgets/qrubberband.cpp \ widgets/qscrollbar.cpp \ widgets/qsizegrip.cpp \ @@ -159,6 +156,16 @@ qtConfig(label) { widgets/qlabel.cpp } + +qtConfig(pushbutton) { + HEADERS += \ + widgets/qpushbutton.h \ + widgets/qpushbutton_p.h + + SOURCES += \ + widgets/qpushbutton.cpp +} + qtConfig(radiobutton) { HEADERS += \ widgets/qradiobutton.h From 9390c44338b74373c6c076ac2df836ba471c43b0 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 23 Feb 2017 15:40:15 +0000 Subject: [PATCH 53/71] QtXml: add some missing Q_DECLARE_TYPEINFO Change-Id: I4b58aad1c337fe5fdfb70eb517a66b15a34dffc4 Reviewed-by: Marc Mutz --- src/xml/sax/qxml.h | 2 ++ src/xml/sax/qxml_p.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 49c8184d4b..77a5a78650 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -156,11 +156,13 @@ private: struct Attribute { QString qname, uri, localname, value; }; + friend class QTypeInfo; typedef QList AttributeList; AttributeList attList; QXmlAttributesPrivate *d; }; +Q_DECLARE_TYPEINFO(QXmlAttributes::Attribute, Q_MOVABLE_TYPE); Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes) // diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h index 5f3785a289..98dc2aea0c 100644 --- a/src/xml/sax/qxml_p.h +++ b/src/xml/sax/qxml_p.h @@ -85,6 +85,8 @@ private: Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity) }; + friend class QTypeInfo; + struct ExternEntity { ExternEntity() {} @@ -95,6 +97,8 @@ private: QString notation; Q_DUMMY_COMPARISON_OPERATOR(ExternEntity) }; + friend class QTypeInfo; + QMap externParameterEntities; QMap parameterEntities; QMap externEntities; @@ -306,6 +310,8 @@ private: }; Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ParseState, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::XmlRef, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternParameterEntity, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternEntity, Q_MOVABLE_TYPE); QT_END_NAMESPACE From 58cc126defe4528ba171c812fd7544027190175e Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Thu, 2 Mar 2017 22:41:29 +0800 Subject: [PATCH 54/71] Doc: Replace std::bind() with lambdas in Qt Concurrent Lambda functions provide all the benefits of std::bind() plus more Change-Id: Iec30b20bb35ac0fae560435b323f80af2f2e5fce Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../src_concurrent_qtconcurrentfilter.cpp | 14 +++---------- .../code/src_concurrent_qtconcurrentmap.cpp | 14 +++---------- .../code/src_concurrent_qtconcurrentrun.cpp | 5 +++-- src/concurrent/qtconcurrentfilter.cpp | 18 +++-------------- src/concurrent/qtconcurrentmap.cpp | 18 +++-------------- src/concurrent/qtconcurrentrun.cpp | 20 ++----------------- 6 files changed, 17 insertions(+), 72 deletions(-) diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp index d0deed4cc8..9b15eeaa99 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp @@ -145,19 +145,11 @@ bool QString::contains(const QRegularExpression ®exp) const; //! [9] -//! [10] -std::bind(&QString::contains, QRegularExpression("^\\S+$")); // matches strings without whitespace -//! [10] - - -//! [11] -bool contains(const QString &string) -//! [11] - - //! [12] QStringList strings = ...; -std::bind(static_cast( &QString::contains ), QRegularExpression("...")); +QFuture future = QtConcurrent::filtered(list, [](const QString &str) { + return str.contains(QRegularExpression("^\\S+$")); // matches strings without whitespace +}); //! [12] //! [13] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp index 91e76be0db..183b82bb9a 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp @@ -158,19 +158,11 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const; //! [10] -//! [11] -std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation) -//! [11] - - -//! [12] -QImage scaledToWith(const QImage &image) -//! [12] - - //! [13] QList images = ...; -QFuture thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)); +QFuture thumbnails = QtConcurrent::mapped(images, [](const QImage &img) { + return img.scaledToWidth(100, Qt::SmoothTransformation); +}); //! [13] //! [14] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp index 78e4591b0a..5437822842 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp @@ -109,7 +109,8 @@ future.waitForFinished(); //! [6] -void someFunction(int arg1, double arg2); -QFuture future = QtConcurrent::run(std::bind(someFunction, 1, 2.0)); +QFuture future = QtConcurrent::run([=]() { + // Code in this block will run in another thread +}); ... //! [6] diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index a660815daf..3e3ed7cf68 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -148,13 +148,11 @@ \snippet code/src_concurrent_qtconcurrentfilter.cpp 13 - \section2 Using Bound Function Arguments + \section2 Wrapping Functions that Take Multiple Arguments If you want to use a filter function takes more than one argument, you can - use std::bind() to transform it onto a function that takes one argument. If - C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} - {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {std::tr1::bind()} are suitable replacements. + use a lambda function or \c std::bind() to transform it onto a function that + takes one argument. As an example, we use QString::contains(): @@ -166,16 +164,6 @@ use QString::contains() with QtConcurrent::filtered() we have to provide a value for the \e regexp argument: - \snippet code/src_concurrent_qtconcurrentfilter.cpp 10 - - The return value from std::bind() is a function object (functor) with - the following signature: - - \snippet code/src_concurrent_qtconcurrentfilter.cpp 11 - - This matches what QtConcurrent::filtered() expects, and the complete - example becomes: - \snippet code/src_concurrent_qtconcurrentfilter.cpp 12 */ diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index e6c347b511..884bf4b4f9 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -198,13 +198,11 @@ \snippet code/src_concurrent_qtconcurrentmap.cpp 14 - \section2 Using Bound Function Arguments + \section2 Wrapping Functions that Take Multiple Arguments If you want to use a map function that takes more than one argument you can - use std::bind() to transform it onto a function that takes one argument. If - C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} - {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {std::tr1::bind()} are suitable replacements. + use a lambda function or \c std::bind() to transform it onto a function that + takes one argument. As an example, we'll use QImage::scaledToWidth(): @@ -216,16 +214,6 @@ QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a value for the \e{width} and the \e{transformation mode}: - \snippet code/src_concurrent_qtconcurrentmap.cpp 11 - - The return value from std::bind() is a function object (functor) with - the following signature: - - \snippet code/src_concurrent_qtconcurrentmap.cpp 12 - - This matches what QtConcurrent::mapped() expects, and the complete example - becomes: - \snippet code/src_concurrent_qtconcurrentmap.cpp 13 */ diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index d1208e0ffb..1d8f7afe85 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -107,25 +107,9 @@ \snippet code/src_concurrent_qtconcurrentrun.cpp 5 - \section2 Using Bound Function Arguments + \section2 Using Lambda Functions - You can use std::bind() to \e bind a number of arguments to a function when - called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} - {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {std::tr1::bind()} are suitable replacements. - - There are number of reasons for binding: - - \list - \li To call a function that takes more than 5 arguments. - \li To simplify calling a function with constant arguments. - \li Changing the order of arguments. - \endlist - - See the documentation for the relevant functions for details on how to use - the bind API. - - Calling a bound function is done like this: + Calling a lambda function is done like this: \snippet code/src_concurrent_qtconcurrentrun.cpp 6 */ From a12a3c6c8c07c0fe52589cea473ac95e556052c7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 6 Mar 2017 12:46:28 +0100 Subject: [PATCH 55/71] Fix MSVC Makefiles when SOURCES is empty Call sites of NmakeMakefileGenerator::writeResponseFileFiles expect that the output is terminated with '\n'. Do not bail out if files is empty. Task-number: QTBUG-59305 Change-Id: Id3fef8dbc506dad1868e6b352119f5f27b50a368 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_nmake.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 0b0efe4acf..8ac462da6b 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -662,8 +662,6 @@ void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &ext void NmakeMakefileGenerator::writeResponseFileFiles(QTextStream &t, const ProStringList &files) { - if (files.isEmpty()) - return; // Add line breaks in file lists in reponse files to work around LNK1170. // The actual line length limit is 131070, but let's use a smaller limit // in case other tools are similarly hampered. From da730c90a35cce4b24f3cb0cb61246aa87b18e66 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 Feb 2017 00:56:55 +0100 Subject: [PATCH 56/71] QStyleSheetStyle: introduce class Tampered ... as a replacement for two QPairs and move some common QFont/QPalette functionality into it. Change-Id: Iaab92130dd54eaa7900ac2048014a80cbd04bfb6 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 35 +++++++------------------ src/widgets/styles/qstylesheetstyle_p.h | 29 ++++++++++++++++---- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ba05155b74..0c7a3e692c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2594,7 +2594,7 @@ void QStyleSheetStyle::setPalette(QWidget *w) if (!useStyleSheetPropagationInWidgetStyles || p.resolve() != 0) { QPalette wp = w->palette(); - styleSheetCaches->customPaletteWidgets.insert(w, qMakePair(wp, p.resolve())); + styleSheetCaches->customPaletteWidgets.insert(w, {wp, p.resolve()}); if (useStyleSheetPropagationInWidgetStyles) { p = p.resolve(wp); @@ -2614,20 +2614,14 @@ void QStyleSheetStyle::unsetPalette(QWidget *w) const auto it = styleSheetCaches->customPaletteWidgets.find(w); if (it != styleSheetCaches->customPaletteWidgets.end()) { - QPair p = std::move(*it); + auto customizedPalette = std::move(*it); styleSheetCaches->customPaletteWidgets.erase(it); - QPalette original = p.first; - - if (useStyleSheetPropagationInWidgetStyles) { - original.resolve(original.resolve() & p.second); - - QPalette wp = w->palette(); - wp.resolve(wp.resolve() & ~p.second); - wp.resolve(original); - wp.resolve(wp.resolve() | original.resolve()); - original = wp; - } + QPalette original; + if (useStyleSheetPropagationInWidgetStyles) + original = std::move(customizedPalette).reverted(w->palette()); + else + original = customizedPalette.oldWidgetValue; w->setPalette(original); QWidget *ew = embeddedWidget(w); @@ -2657,18 +2651,9 @@ void QStyleSheetStyle::unsetStyleSheetFont(QWidget *w) const { const auto it = styleSheetCaches->customFontWidgets.find(w); if (it != styleSheetCaches->customFontWidgets.end()) { - QPair f = std::move(*it); + auto customizedFont = std::move(*it); styleSheetCaches->customFontWidgets.erase(it); - - QFont original = f.first; - original.resolve(original.resolve() & f.second); - - QFont font = w->font(); - font.resolve(font.resolve() & ~f.second); - font.resolve(original); - font.resolve(font.resolve() | original.resolve()); - - w->setFont(font); + w->setFont(std::move(customizedFont).reverted(w->font())); } } @@ -5953,7 +5938,7 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const if (rule.font.resolve()) { QFont wf = w->font(); - styleSheetCaches->customFontWidgets.insert(w, qMakePair(wf, rule.font.resolve())); + styleSheetCaches->customFontWidgets.insert(w, {wf, rule.font.resolve()}); QFont font = rule.font.resolve(wf); font.resolve(wf.resolve() | rule.font.resolve()); diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h index 55dd2df329..2d302305bd 100644 --- a/src/widgets/styles/qstylesheetstyle_p.h +++ b/src/widgets/styles/qstylesheetstyle_p.h @@ -189,12 +189,31 @@ public: QHash renderRulesCache; QHash styleSheetCache; // parsed style sheets QSet autoFillDisabledWidgets; - // widgets whose palettes and fonts we have tampered. stored value pair is - // QPair - QHash > customPaletteWidgets; - QHash > customFontWidgets; -}; + // widgets with whose palettes and fonts we have tampered: + template + struct Tampered { + T oldWidgetValue; + uint resolveMask; + // only call this function on an rvalue *this (it mangles oldWidgetValue) + T reverted(T current) +#ifdef Q_COMPILER_REF_QUALIFIERS + && +#endif + { + oldWidgetValue.resolve(oldWidgetValue.resolve() & resolveMask); + current.resolve(current.resolve() & ~resolveMask); + current.resolve(oldWidgetValue); + current.resolve(current.resolve() | oldWidgetValue.resolve()); + return current; + } + }; + QHash> customPaletteWidgets; + QHash> customFontWidgets; +}; +template +class QTypeInfo> + : QTypeInfoMerger, T> {}; QT_END_NAMESPACE #endif // QT_NO_STYLE_STYLESHEET From 32463399f7e0a86d6b8463d1665d2a396a7a1af5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 23 Feb 2017 09:39:50 +0100 Subject: [PATCH 57/71] Add documentation for QMAKE_LINK variable Change-Id: I39f11f42750c705feabf5e1a87bcd277693af1fb Reviewed-by: Leena Miettinen Reviewed-by: Joerg Bornemann --- qmake/doc/src/qmake-manual.qdoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 50733836f8..d8ab7d096d 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2024,6 +2024,15 @@ of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LINK + + Specifies the linker that will be used when building + application based projects. Only the file name of the linker + executable needs to be specified as long as it is on a path + contained in the \c PATH variable when the Makefile is processed. + The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LINK_SHLIB_CMD Specifies the command to execute when creating a shared From 535b142393063b8f9504cb3c2eb716bcfddbbeee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Mar 2017 10:33:59 +0100 Subject: [PATCH 58/71] QWidgetWindow::event(): Call base implementation for QEvent::WindowStateChange The base implementation takes care of updating visibility and emitting signals. Task-number: QTBUG-59313 Change-Id: I270b37c894420902488d89dc0c79f4c12b8d9a29 Reviewed-by: Qt CI Bot Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/kernel/qwidgetwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 5abce140ce..31f2d672bb 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -285,6 +285,7 @@ bool QWidgetWindow::event(QEvent *event) return true; case QEvent::WindowStateChange: + QWindow::event(event); // Update QWindow::Visibility and emit signals. handleWindowStateChangedEvent(static_cast(event)); return true; From 40ace7a2a0f5cf1e3f097500240b17a2b9cabf2d Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Sat, 25 Feb 2017 20:31:15 +0100 Subject: [PATCH 59/71] Fix computegles31 example This patch fixes the example that contained problems showing up with mesa/nouveau drivers. Change-Id: Ic90f6028e394138781f00bcc00c145c56134f441 Reviewed-by: Gunnar Sletta --- examples/opengl/computegles31/glwindow.cpp | 65 +++++++++++++--------- examples/opengl/computegles31/glwindow.h | 1 + examples/opengl/computegles31/main.cpp | 64 +++++++++++++-------- 3 files changed, 82 insertions(+), 48 deletions(-) diff --git a/examples/opengl/computegles31/glwindow.cpp b/examples/opengl/computegles31/glwindow.cpp index 178ad9f1e7..7a14cba66d 100644 --- a/examples/opengl/computegles31/glwindow.cpp +++ b/examples/opengl/computegles31/glwindow.cpp @@ -54,7 +54,7 @@ #include #include #include -//#include +#include #include #include #include @@ -80,7 +80,8 @@ GLWindow::GLWindow() m_shaderComputeV(0), m_shaderComputeH(0), m_blurRadius(0.0f), - m_animate(true) + m_animate(true), + m_vao(0) { const float animationStart = 0.0; const float animationEnd = 10.0; @@ -116,6 +117,7 @@ GLWindow::~GLWindow() delete m_animationGroup; delete m_animationForward; delete m_animationBackward; + delete m_vao; } void GLWindow::setBlurRadius(float blurRadius) @@ -178,19 +180,21 @@ static const char *fsDisplaySource = "}\n"; static const char *csComputeSourceV = - //"#extension GL_EXT_gpu_shader5 : require \n" "#define COMPUTEPATCHSIZE 32 \n" "#define IMGFMT rgba8 \n" "layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n" - "layout(binding=0, IMGFMT) uniform highp image2D inputImage; // Use a sampler to improve performance \n" - "layout(binding=1, IMGFMT) uniform highp image2D resultImage;\n" + "layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n" + "layout(binding=1, IMGFMT) uniform writeonly highp image2D resultImage;\n" "uniform int radius;\n" "const float cutoff = 2.2;\n" - "float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" // Const initialization with dynamically uniform expressions doesn't work in GLES - "float expFactor = 1.0 / (2.0 * sigma * sigma);\n" // Same here - "float gaussian(float distance) {\n" - " return exp( -(distance * distance) * expFactor);\n" + "float expFactor() { // a function, otherwise MESA produces error: initializer of global variable `expFactor' must be a constant expression\n" + " float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" + " return 1.0 / (2.0 * sigma * sigma);\n" + "}\n" + + "float gaussian(float distance, float expfactor) {\n" + " return exp( -(distance * distance) * expfactor);\n" "}\n" "void main() {\n" @@ -204,31 +208,34 @@ static const char *csComputeSourceV = " int right = clamp(x + radius, 0, imgSize.x - 1);\n" " int top = clamp(y - radius, 0, imgSize.y - 1);\n" " int bottom = clamp(y + radius, 0, imgSize.y - 1);\n" + " float expfactor = expFactor();\n" " for (int iY = top; iY <= bottom; iY++) {\n" " float dy = float(abs(iY - y));\n" " vec4 imgValue = imageLoad(inputImage, ivec2(x,iY));\n" - " float weight = gaussian(dy);\n" + " float weight = gaussian(dy, expfactor);\n" " sumWeights += weight;\n" " sumPixels += (imgValue * weight);\n" " }\n" " sumPixels /= sumWeights;\n" - " imageStore(resultImage, ivec2(x,y), sumPixels);" + " imageStore(resultImage, ivec2(x,y), sumPixels);\n" "}\n"; static const char *csComputeSourceH = - //"#extension GL_EXT_gpu_shader5 : require \n" "#define COMPUTEPATCHSIZE 32 \n" "#define IMGFMT rgba8 \n" "layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n" - "layout(binding=0, IMGFMT) uniform highp image2D inputImage; // Use a sampler to improve performance \n" - "layout(binding=1, IMGFMT) uniform highp image2D resultImage;\n" + "layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n" + "layout(binding=1, IMGFMT) uniform writeonly highp image2D resultImage;\n" "uniform int radius;\n" "const float cutoff = 2.2;\n" - "float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" - "float expFactor = 1.0 / (2.0 * sigma * sigma);\n" - "float gaussian(float distance) {\n" - " return exp( -(distance * distance) * expFactor);\n" + "float expFactor() { // a function, otherwise MESA produces error: initializer of global variable `expFactor' must be a constant expression\n" + " float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" + " return 1.0 / (2.0 * sigma * sigma);\n" + "}\n" + + "float gaussian(float distance, float expfactor) {\n" + " return exp( -(distance * distance) * expfactor);\n" "}\n" "void main() {\n" @@ -242,15 +249,16 @@ static const char *csComputeSourceH = " int right = clamp(x + radius, 0, imgSize.x - 1);\n" " int top = clamp(y - radius, 0, imgSize.y - 1);\n" " int bottom = clamp(y + radius, 0, imgSize.y - 1);\n" - " for (int iX = left; iX <= right; iX++) {\n" + " float expfactor = expFactor();\n" + " for (int iX = left; iX <= right; iX++) {\n" " float dx = float(abs(iX - x));\n" " vec4 imgValue = imageLoad(inputImage, ivec2(iX,y));\n" - " float weight = gaussian(dx);\n" + " float weight = gaussian(dx, expfactor);\n" " sumWeights += weight;\n" " sumPixels += (imgValue * weight);\n" - " }\n" + " }\n" " sumPixels /= sumWeights;\n" - " imageStore(resultImage, ivec2(x,y), sumPixels);" + " imageStore(resultImage, ivec2(x,y), sumPixels);\n" "}\n"; @@ -262,7 +270,7 @@ QByteArray versionedShaderCode(const char *src) if (QOpenGLContext::currentContext()->isOpenGLES()) versionedSrc.append(QByteArrayLiteral("#version 310 es\n")); else - versionedSrc.append(QByteArrayLiteral("#version 430\n")); + versionedSrc.append(QByteArrayLiteral("#version 430 core\n")); versionedSrc.append(src); return versionedSrc; @@ -315,7 +323,6 @@ void GLWindow::initializeGL() << ctx->format().minorVersion() << ((ctx->format().renderableType() == QSurfaceFormat::OpenGLES) ? (" GLES") : (" GL")) << " context"; - //QOpenGLFunctions *f = ctx->functions(); if (m_texImageInput) { delete m_texImageInput; @@ -373,6 +380,10 @@ void GLWindow::initializeGL() m_shaderComputeH = new QOpenGLShaderProgram; m_shaderComputeH->addShaderFromSourceCode(QOpenGLShader::Compute, versionedShaderCode(csComputeSourceH)); m_shaderComputeH->link(); + + // Create a VAO. Not strictly required for ES 3, but it is for plain OpenGL core context. + m_vao = new QOpenGLVertexArrayObject; + m_vao->create(); } void GLWindow::resizeGL(int w, int h) @@ -421,13 +432,15 @@ void GLWindow::paintGL() // Display processed image f->glClearColor(0, 0, 0, 1); f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - m_texImageProcessed->bind(GL_TEXTURE0); + m_texImageProcessed->bind(0); m_shaderDisplay->bind(); m_shaderDisplay->setUniformValue("matProjection",m_proj); m_shaderDisplay->setUniformValue("imageRatio",m_quadSize); m_shaderDisplay->setUniformValue("samImage",0); + m_vao->bind(); f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + m_vao->release(); m_shaderDisplay->release(); - m_texImageProcessed->release(GL_TEXTURE0); + m_texImageProcessed->release(0); } diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h index a1a429d7c7..877f7b732e 100644 --- a/examples/opengl/computegles31/glwindow.h +++ b/examples/opengl/computegles31/glwindow.h @@ -104,6 +104,7 @@ private: int m_blurRadius; bool m_animate; + QOpenGLVertexArrayObject *m_vao; }; #endif diff --git a/examples/opengl/computegles31/main.cpp b/examples/opengl/computegles31/main.cpp index e4dde8b3bd..88f0f36115 100644 --- a/examples/opengl/computegles31/main.cpp +++ b/examples/opengl/computegles31/main.cpp @@ -56,15 +56,17 @@ #include #include "glwindow.h" -bool OGLSupports(int major, int minor, bool gles = false) +bool OGLSupports(int major, int minor, bool gles = false, QSurfaceFormat::OpenGLContextProfile profile = QSurfaceFormat::NoProfile) { QOpenGLContext ctx; QSurfaceFormat fmt; fmt.setVersion(major, minor); - if (gles) + if (gles) { fmt.setRenderableType(QSurfaceFormat::OpenGLES); - else + } else { fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(profile); + } ctx.setFormat(fmt); ctx.create(); @@ -78,6 +80,8 @@ bool OGLSupports(int major, int minor, bool gles = false) if (ctxMajor < major) return false; if (ctxMajor == major && ctxMinor < minor) return false; + if (!gles && ctx.format().profile() != profile) + return false; return true; } @@ -85,18 +89,34 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - qDebug() << "Support for GL 2.0 "<<( OGLSupports(2,0) ? "yes" : "no"); - qDebug() << "Support for GL 2.1 "<<( OGLSupports(2,1) ? "yes" : "no"); - qDebug() << "Support for GL 3.0 "<<( OGLSupports(3,0) ? "yes" : "no"); - qDebug() << "Support for GL 3.1 "<<( OGLSupports(3,1) ? "yes" : "no"); - qDebug() << "Support for GL 3.2 "<<( OGLSupports(3,2) ? "yes" : "no"); - qDebug() << "Support for GL 3.3 "<<( OGLSupports(3,3) ? "yes" : "no"); - qDebug() << "Support for GL 4.0 "<<( OGLSupports(4,0) ? "yes" : "no"); - qDebug() << "Support for GL 4.1 "<<( OGLSupports(4,1) ? "yes" : "no"); - qDebug() << "Support for GL 4.2 "<<( OGLSupports(4,2) ? "yes" : "no"); - qDebug() << "Support for GL 4.3 "<<( OGLSupports(4,3) ? "yes" : "no"); - qDebug() << "Support for GL 4.4 "<<( OGLSupports(4,4) ? "yes" : "no"); - qDebug() << "Support for GL 4.5 "<<( OGLSupports(4,5) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 noprof "<<( OGLSupports(2,0,false) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 core "<<( OGLSupports(2,0,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 compat "<<( OGLSupports(2,0,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 noprof "<<( OGLSupports(2,1,false) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 core "<<( OGLSupports(2,1,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 compat "<<( OGLSupports(2,1,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 noprof "<<( OGLSupports(3,0,false) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 core "<<( OGLSupports(3,0,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 compat "<<( OGLSupports(3,0,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 noprof "<<( OGLSupports(3,1,false) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 core "<<( OGLSupports(3,1,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 compat "<<( OGLSupports(3,1,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.2 core "<<( OGLSupports(3,2,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.2 compat "<<( OGLSupports(3,2,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.3 core "<<( OGLSupports(3,3,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.3 compat "<<( OGLSupports(3,3,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.0 core "<<( OGLSupports(4,0,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.0 compat "<<( OGLSupports(4,0,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.1 core "<<( OGLSupports(4,1,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.1 compat "<<( OGLSupports(4,1,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.2 core "<<( OGLSupports(4,2,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.2 compat "<<( OGLSupports(4,2,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.3 core "<<( OGLSupports(4,3,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.3 compat "<<( OGLSupports(4,3,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.4 core "<<( OGLSupports(4,4,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.4 compat "<<( OGLSupports(4,4,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.5 core "<<( OGLSupports(4,5,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.5 compat "<<( OGLSupports(4,5,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); qDebug() << "Support for GLES 2.0 "<<( OGLSupports(2,0,true) ? "yes" : "no"); qDebug() << "Support for GLES 3.0 "<<( OGLSupports(3,0,true) ? "yes" : "no"); qDebug() << "Support for GLES 3.1 "<<( OGLSupports(3,1,true) ? "yes" : "no"); @@ -105,16 +125,16 @@ int main(int argc, char *argv[]) QSurfaceFormat fmt; fmt.setDepthBufferSize(24); - // Request OpenGL 4.3 compatibility or OpenGL ES 3.1. - if (OGLSupports(4,3)) { - qDebug("Requesting 4.3 compatibility context"); - fmt.setVersion(4, 3); - fmt.setRenderableType(QSurfaceFormat::OpenGL); - fmt.setProfile(QSurfaceFormat::CompatibilityProfile); - } else if (OGLSupports(3,1,true)) { + // Request OpenGL ES 3.1 context, as this is a GLES example. If not available, go for OpenGL 4.3 core. + if (OGLSupports(3,1,true)) { qDebug("Requesting 3.1 GLES context"); fmt.setVersion(3, 1); fmt.setRenderableType(QSurfaceFormat::OpenGLES); + } else if (OGLSupports(4,3,false,QSurfaceFormat::CoreProfile)) { + qDebug("Requesting 4.3 core context"); + fmt.setVersion(4, 3); + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(QSurfaceFormat::CoreProfile); } else { qWarning("Error: This system does not support OpenGL Compute Shaders! Exiting."); return -1; From 8afc6146be513e7adee6e4ade342e28951bfefc6 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 24 Feb 2017 09:18:10 -0800 Subject: [PATCH 60/71] Windows QPA: Better recover from removed screens when fullscreen QWindowsWindow::handleResized would call isFullScreen_sys which checks if the window's screen geometry matches the one of the window. When switching back from fullscreen, Windows will have set the geometry to fill the next window, but we don't switch QScreen until later in that function, inside handleGeometryChange. This would result in our window to take the whole screen geometry, but the FullScreen state wouldn't be transferred to the new screen. Fix the issue by using screenForGeometry and check if we are fullscreen on any screen. Also make sure that we check the validity of m_savedFrameGeometry when restoring after a screen remove, since we would previously restore to an area not covered by any screen anymore. Change-Id: I43bc02738007918e9a26c1d27a699c51d3365034 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 0028ad1bd0..79dce2fc43 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1750,10 +1750,9 @@ bool QWindowsWindow::isFullScreen_sys() const const QWindow *w = window(); if (!w->isTopLevel()) return false; - const QScreen *screen = w->screen(); - if (!screen) - screen = QGuiApplication::primaryScreen(); - return screen && geometry_sys() == QHighDpi::toNativePixels(screen->geometry(), w); + QRect geometry = geometry_sys(); + QPlatformScreen *screen = screenForGeometry(geometry); + return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen); } /*! @@ -1825,6 +1824,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) newStyle |= WS_VISIBLE; setStyle(newStyle); + const QScreen *screen = window()->screen(); + if (!screen) + screen = QGuiApplication::primaryScreen(); + // That area of the virtual desktop might not be covered by a screen anymore. + if (!screen->geometry().intersects(m_savedFrameGeometry)) + m_savedFrameGeometry.moveTo(screen->geometry().topLeft()); + UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE; if (!m_savedFrameGeometry.isValid()) swpf |= SWP_NOSIZE | SWP_NOMOVE; From 075e669cbe3cbbefe66d954e571db227e60eeda7 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 27 Feb 2017 10:06:12 +0100 Subject: [PATCH 61/71] QHstsPolicy: Replace bool with QFlags As pointed out in the previous code-review: Replace a bool ctor parameter with QFlags to conform to Qt API Design Principles (Boolean Parameter Trap). Since the bool with its many unwanted implicit conversions is gone from the ctor parameter list now, drop the explicit keyword again. It was requested because of the boolean parameter in the first place. Change-Id: Ibaf287a6a3e38c22f033fd5d9e024c54f30a1fd4 Reviewed-by: Marc Mutz --- src/network/access/qhsts.cpp | 6 +++++- src/network/access/qhstspolicy.cpp | 14 +++++++++++--- src/network/access/qhstspolicy.h | 11 +++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp index 3581fbc796..ca9f3b977b 100644 --- a/src/network/access/qhsts.cpp +++ b/src/network/access/qhsts.cpp @@ -110,7 +110,11 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires, // IDNA 2003 (RFC3490) for us, as required by HSTS (RFC6797, section 10). const HostName hostName(host); const auto pos = knownHosts.find(hostName); - const QHstsPolicy newPolicy(expires, includeSubDomains, hostName.name); + QHstsPolicy::PolicyFlags flags; + if (includeSubDomains) + flags = QHstsPolicy::IncludeSubDomains; + + const QHstsPolicy newPolicy(expires, flags, hostName.name); if (pos == knownHosts.end()) { // A new, previously unknown host. if (newPolicy.isExpired()) { diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp index 634bf4784b..0ea9f3f046 100644 --- a/src/network/access/qhstspolicy.cpp +++ b/src/network/access/qhstspolicy.cpp @@ -63,6 +63,14 @@ QT_BEGIN_NAMESPACE \sa QNetworkAccessManager::setStrictTransportSecurityEnabled() */ +/* + \enum QHstsPolicy::PolicyFlag + + Specifies attributes that a policy can have. + + \value IncludeSubDomains HSTS policy also applies to subdomains. +*/ + class QHstsPolicyPrivate : public QSharedData { public: @@ -101,13 +109,13 @@ QHstsPolicy::QHstsPolicy() : d(new QHstsPolicyPrivate) \sa QUrl::setHost(), QUrl::ParsingMode */ -QHstsPolicy::QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host, - QUrl::ParsingMode mode) +QHstsPolicy::QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, + const QString &host, QUrl::ParsingMode mode) : d(new QHstsPolicyPrivate) { d->url.setHost(host, mode); d->expiry = expiry; - d->includeSubDomains = includeSubDomains; + d->includeSubDomains = flags.testFlag(IncludeSubDomains); } /*! diff --git a/src/network/access/qhstspolicy.h b/src/network/access/qhstspolicy.h index 45fa40dfe8..176a8fa635 100644 --- a/src/network/access/qhstspolicy.h +++ b/src/network/access/qhstspolicy.h @@ -43,6 +43,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -53,10 +54,15 @@ class QString; class Q_NETWORK_EXPORT QHstsPolicy { public: + enum PolicyFlag + { + IncludeSubDomains = 1 + }; + Q_DECLARE_FLAGS(PolicyFlags, PolicyFlag) QHstsPolicy(); - explicit QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host, - QUrl::ParsingMode mode = QUrl::DecodedMode); + QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, const QString &host, + QUrl::ParsingMode mode = QUrl::DecodedMode); QHstsPolicy(const QHstsPolicy &rhs); QHstsPolicy &operator=(const QHstsPolicy &rhs); QHstsPolicy &operator=(QHstsPolicy &&other) Q_DECL_NOTHROW { swap(other); return *this; } @@ -81,6 +87,7 @@ private: }; Q_DECLARE_SHARED(QHstsPolicy) +Q_DECLARE_OPERATORS_FOR_FLAGS(QHstsPolicy::PolicyFlags) Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs); From 2e6ec59d47a6787978a628085697b7984434056c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Feb 2017 14:34:09 +0100 Subject: [PATCH 62/71] Avoid QRgba64 arrays in the generic text-rendering routines Like in other functions, allocate arrays of quint64 instead of QRgba64 to avoid the cost of initializing large arrays on every small scanline. Change-Id: Ie132b3157003a18a444ca5c4f94ae668d17327fd Reviewed-by: Gunnar Sletta --- src/gui/painting/qdrawhelper.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 6b7c57673b..5c38648fe7 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5588,7 +5588,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied(); } - QRgba64 buffer[buffer_size]; + quint64 buffer[buffer_size]; const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format]; const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format]; @@ -5598,12 +5598,12 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, int length = mapWidth; while (length > 0) { int l = qMin(buffer_size, length); - QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l); + QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l); for (int j=0; j < l; ++j) { const int coverage = map[j + (i - x)]; alphamapblend_generic(coverage, dest, j, srcColor, color, colorProfile); } - destStore64(rasterBuffer, i, y + ly, buffer, l); + destStore64(rasterBuffer, i, y + ly, dest, l); length -= l; i += l; } @@ -5625,7 +5625,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, int start = qMax(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); Q_ASSERT(clip.len <= buffer_size); - QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len); + QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len); for (int xp=start; xptoLinear(srcColor.unpremultiplied()).premultiplied(); } - QRgba64 buffer[buffer_size]; + quint64 buffer[buffer_size]; const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format]; const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format]; @@ -5883,12 +5883,12 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, int length = mapWidth; while (length > 0) { int l = qMin(buffer_size, length); - QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l); + QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l); for (int j=0; j < l; ++j) { const uint coverage = src[j + (i - x)]; alphargbblend_generic(coverage, dest, j, srcColor, color, colorProfile); } - destStore64(rasterBuffer, i, y + ly, buffer, l); + destStore64(rasterBuffer, i, y + ly, dest, l); length -= l; i += l; } @@ -5910,7 +5910,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, int start = qMax(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); Q_ASSERT(clip.len <= buffer_size); - QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len); + QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len); for (int xp=start; xp Date: Tue, 7 Mar 2017 17:52:59 +0100 Subject: [PATCH 63/71] Document QT_DEPRECATED_WARNINGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-58468 Change-Id: I0f822c2dd14878d70b74ddd2db89b11ba54f687b Reviewed-by: Jake Petroules Reviewed-by: Topi Reiniö --- src/corelib/global/qglobal.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f8c58c6b3e..7ca22e4a93 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1938,6 +1938,19 @@ bool qSharedBuild() Q_DECL_NOTHROW disable functions deprecated in Qt 5.1 and earlier. In any release, set QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones deprecated in Qt 5.0 + + \sa QT_DEPRECATED_WARNINGS + */ + + +/*! + \macro QT_DEPRECATED_WARNINGS + \relates + + If this macro is defined, the compiler will generate warnings if API declared as + deprecated by Qt is used. + + \sa QT_DISABLE_DEPRECATED_BEFORE */ #if defined(QT_BUILD_QMAKE) From cf7d3b524df0ffcba28fdbec0e4ce5a8e685564d Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 6 Mar 2017 14:39:03 +0100 Subject: [PATCH 64/71] Doc: QSizePolicy: Fix documentation warnings warning: Can't link to 'controlType()' warning: Can't link to 'horizontalPolicy()' warning: Can't link to 'verticalPolicy()' Change-Id: I6b31acebf183defee7b4ab36976034ed4a3fc98a Reviewed-by: Marc Mutz --- src/widgets/kernel/qsizepolicy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 07d8393c6f..6cb4e147e9 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -112,7 +112,7 @@ public: QT_SIZEPOLICY_CONSTEXPR QSizePolicy() Q_DECL_NOTHROW : data(0) { } -#ifdef Q_COMPILER_UNIFORM_INIT +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) QT_SIZEPOLICY_CONSTEXPR QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) Q_DECL_NOTHROW : bits{0, 0, quint32(horizontal), quint32(vertical), type == DefaultType ? 0 : toControlTypeFieldValue(type), 0, 0, 0} From b53d7664c90b0deb2c35f586eb8c6d168f58752f Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 7 Mar 2017 21:29:09 +0100 Subject: [PATCH 65/71] Add feature.abstractslider Change-Id: Ib5d0186162fc3b750e6440c74b1181787093ef97 Reviewed-by: Paul Olav Tvete --- src/widgets/configure.json | 7 +++++++ src/widgets/styles/qfusionstyle.cpp | 4 ++++ src/widgets/styles/qstylesheetstyle.cpp | 2 ++ src/widgets/widgets/qabstractslider.h | 2 ++ src/widgets/widgets/qabstractslider_p.h | 2 ++ src/widgets/widgets/qdial.h | 9 +++++---- src/widgets/widgets/qscrollbar.h | 10 +++++----- src/widgets/widgets/qslider.h | 9 +++++---- src/widgets/widgets/widgets.pri | 12 +++++++++--- 9 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 33dc90b124..99e1bd6940 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -330,10 +330,17 @@ "section": "Widgets", "output": [ "publicFeature", "feature" ] }, + "abstractslider": { + "label": "QAbstractSlider", + "purpose": "Common super class for widgets like QScrollBar, QSlider and QDial.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "slider": { "label": "QSlider", "purpose": "Provides sliders controlling a bounded value.", "section": "Widgets", + "condition": "features.abstractslider", "output": [ "publicFeature", "feature" ] }, "scrollbar": { diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 96af534099..33c5a01677 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3294,7 +3294,9 @@ void QFusionStyle::polish(QWidget *widget) #if QT_CONFIG(splitter) || qobject_cast(widget) #endif +#if QT_CONFIG(abstractslider) || qobject_cast(widget) +#endif #if QT_CONFIG(spinbox) || qobject_cast(widget) #endif @@ -3333,7 +3335,9 @@ void QFusionStyle::unpolish(QWidget *widget) #if QT_CONFIG(splitter) || qobject_cast(widget) #endif +#if QT_CONFIG(abstractslider) || qobject_cast(widget) +#endif #if QT_CONFIG(spinbox) || qobject_cast(widget) #endif diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 0c7a3e692c..ab4d0bcb7c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2426,9 +2426,11 @@ static bool unstylable(const QWidget *w) static quint64 extendedPseudoClass(const QWidget *w) { quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0; +#if QT_CONFIG(abstractslider) if (const QAbstractSlider *slider = qobject_cast(w)) { pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal); } else +#endif #ifndef QT_NO_COMBOBOX if (const QComboBox *combo = qobject_cast(w)) { if (combo->isEditable()) diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h index 86d6830f10..8979685724 100644 --- a/src/widgets/widgets/qabstractslider.h +++ b/src/widgets/widgets/qabstractslider.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(abstractslider); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h index 600616061a..419ce2ba07 100644 --- a/src/widgets/widgets/qabstractslider_p.h +++ b/src/widgets/widgets/qabstractslider_p.h @@ -57,6 +57,8 @@ #include "private/qwidget_p.h" #include "qstyle.h" +QT_REQUIRE_CONFIG(abstractslider); + QT_BEGIN_NAMESPACE class QAbstractSliderPrivate : public QWidgetPrivate diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h index 3629ebf8f6..472b14fcdb 100644 --- a/src/widgets/widgets/qdial.h +++ b/src/widgets/widgets/qdial.h @@ -42,13 +42,14 @@ #define QDIAL_H #include + +#if QT_CONFIG(dial) + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_DIAL - class QDialPrivate; class QStyleOptionSlider; @@ -98,8 +99,8 @@ private: Q_DISABLE_COPY(QDial) }; -#endif // QT_NO_DIAL - QT_END_NAMESPACE +#endif // QT_CONFIG(dial) + #endif // QDIAL_H diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h index 2b8a110c99..b99ad219eb 100644 --- a/src/widgets/widgets/qscrollbar.h +++ b/src/widgets/widgets/qscrollbar.h @@ -42,13 +42,13 @@ #include #include + +#if QT_CONFIG(scrollbar) + #include QT_BEGIN_NAMESPACE - -#ifndef QT_NO_SCROLLBAR - class QScrollBarPrivate; class QStyleOptionSlider; @@ -94,8 +94,8 @@ private: #endif }; -#endif // QT_NO_SCROLLBAR - QT_END_NAMESPACE +#endif // QT_CONFIG(scrollbar) + #endif // QSCROLLBAR_H diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h index 33b90ece06..001863c18d 100644 --- a/src/widgets/widgets/qslider.h +++ b/src/widgets/widgets/qslider.h @@ -41,13 +41,14 @@ #define QSLIDER_H #include + +#if QT_CONFIG(slider) + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_SLIDER - class QSliderPrivate; class QStyleOptionSlider; class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider @@ -99,8 +100,8 @@ private: Q_DECLARE_PRIVATE(QSlider) }; -#endif // QT_NO_SLIDER - QT_END_NAMESPACE +#endif // QT_CONFIG(slider) + #endif // QSLIDER_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index d25d8ce63e..f67640e40f 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -5,8 +5,6 @@ HEADERS += \ widgets/qbuttongroup_p.h \ widgets/qabstractbutton.h \ widgets/qabstractbutton_p.h \ - widgets/qabstractslider.h \ - widgets/qabstractslider_p.h \ widgets/qabstractspinbox.h \ widgets/qabstractspinbox_p.h \ widgets/qcalendarwidget.h \ @@ -79,7 +77,6 @@ HEADERS += \ SOURCES += \ widgets/qbuttongroup.cpp \ widgets/qabstractbutton.cpp \ - widgets/qabstractslider.cpp \ widgets/qabstractspinbox.cpp \ widgets/qcalendarwidget.cpp \ widgets/qcombobox.cpp \ @@ -131,6 +128,15 @@ SOURCES += \ widgets/qtoolbararealayout.cpp \ widgets/qplaintextedit.cpp +qtConfig(abstractslider) { + HEADERS += \ + widgets/qabstractslider.h \ + widgets/qabstractslider_p.h + + SOURCES += \ + widgets/qabstractslider.cpp +} + qtConfig(checkbox) { HEADERS += \ widgets/qcheckbox.h From 11d60dcad62b53d20f12c6f548eea3df412a43cc Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Mar 2017 13:14:59 +0100 Subject: [PATCH 66/71] moc: Fix parsing of digit separator [ChangeLog][moc] Fixed parsing errors in presence of C++14 digit separators. Task-number: QTBUG-59351 Change-Id: Iea38ea7388853d84b819c2beb78a59371f57bf7d Reviewed-by: Simon Hausmann --- src/tools/moc/preprocessor.cpp | 16 ++++++++-------- tests/auto/tools/moc/tst_moc.cpp | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index f5639ffe31..32c94639ab 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -236,7 +236,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso data -= 2; break; case DIGIT: - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; if (!*data || *data != '.') { token = INTEGER_LITERAL; @@ -244,7 +244,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso (*data == 'x' || *data == 'X') && *lexem == '0') { ++data; - while (is_hex_char(*data)) + while (is_hex_char(*data) || *data == '\'') ++data; } break; @@ -253,13 +253,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso ++data; Q_FALLTHROUGH(); case FLOATING_LITERAL: - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; if (*data == '+' || *data == '-') ++data; if (*data == 'e' || *data == 'E') { ++data; - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; } if (*data == 'f' || *data == 'F' @@ -413,7 +413,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso token = PP_CHARACTER_LITERAL; break; case PP_DIGIT: - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; if (!*data || *data != '.') { token = PP_INTEGER_LITERAL; @@ -421,7 +421,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso (*data == 'x' || *data == 'X') && *lexem == '0') { ++data; - while (is_hex_char(*data)) + while (is_hex_char(*data) || *data == '\'') ++data; } break; @@ -430,13 +430,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso ++data; Q_FALLTHROUGH(); case PP_FLOATING_LITERAL: - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; if (*data == '+' || *data == '-') ++data; if (*data == 'e' || *data == 'E') { ++data; - while (is_digit_char(*data)) + while (is_digit_char(*data) || *data == '\'') ++data; } if (*data == 'f' || *data == 'F' diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index e704a6877e..98429a1f0d 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -521,6 +521,10 @@ public slots: private: myNS::Points m_points; +#ifdef Q_MOC_RUN + int xx = 11'11; // digit separator must not confuse moc (QTBUG-59351) +#endif + private slots: inline virtual void blub1() {} virtual inline void blub2() {} From 5675334b6e22786195fe69a1fc1f40c49aaea37c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Mar 2017 11:52:37 +0100 Subject: [PATCH 67/71] moc: Add support for C++17 nested namespaces (N4230) [ChangeLog][moc] Added Support for C++17 nested namespaces Change-Id: Ib83fc5bf48f66546fa97b49710582fbf9c984503 Reviewed-by: Simon Hausmann --- src/tools/moc/moc.cpp | 22 ++++++++- tests/auto/tools/moc/cxx17-namespaces.h | 64 +++++++++++++++++++++++++ tests/auto/tools/moc/moc.pro | 2 +- tests/auto/tools/moc/tst_moc.cpp | 21 ++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 tests/auto/tools/moc/cxx17-namespaces.h diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index e2987f1be4..36d84a61d8 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -549,12 +549,20 @@ void Moc::parse() case NAMESPACE: { int rewind = index; if (test(IDENTIFIER)) { + QByteArray nsName = lexem(); + QByteArrayList nested; + while (test(SCOPE)) { + next(IDENTIFIER); + nested.append(nsName); + nsName = lexem(); + } if (test(EQ)) { // namespace Foo = Bar::Baz; until(SEMIC); } else if (!test(SEMIC)) { NamespaceDef def; - def.classname = lexem(); + def.classname = nsName; + next(LBRACE); def.begin = index - 1; until(RBRACE); @@ -568,11 +576,23 @@ void Moc::parse() def.qualified.prepend(namespaceList.at(i).classname + "::"); } } + for (const QByteArray &ns : nested) { + NamespaceDef parentNs; + parentNs.classname = ns; + parentNs.qualified = def.qualified; + def.qualified += ns + "::"; + parentNs.begin = def.begin; + parentNs.end = def.end; + namespaceList += parentNs; + } } + while (parseNamespace && inNamespace(&def) && hasNext()) { switch (next()) { case NAMESPACE: if (test(IDENTIFIER)) { + while (test(SCOPE)) + next(IDENTIFIER); if (test(EQ)) { // namespace Foo = Bar::Baz; until(SEMIC); diff --git a/tests/auto/tools/moc/cxx17-namespaces.h b/tests/auto/tools/moc/cxx17-namespaces.h new file mode 100644 index 0000000000..7c9f54d5f3 --- /dev/null +++ b/tests/auto/tools/moc/cxx17-namespaces.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Olivier Goffart. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CXX17_NAMESPACES_H +#define CXX11_NAMESPACES_H +#include + +#if defined(__cpp_nested_namespace_definitions) || defined(Q_MOC_RUN) +namespace CXX17Namespace::A::B { +namespace C::D { +namespace E::F::G { } // don't confuse moc +#else +namespace CXX17Namespace { namespace A { namespace B { +namespace C { namespace D { +#endif + +Q_NAMESPACE + +class ClassInNamespace +{ + Q_GADGET +public: + enum GadEn { Value = 3 }; + Q_ENUM(GadEn) +}; + +enum NamEn { Value = 4 }; +Q_ENUM_NS(NamEn); + + +#if defined(__cpp_nested_namespace_definitions) || defined(Q_MOC_RUN) +} +} +#else +} } } +} } +#endif + +#endif diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index d2b750bdc5..b7151f9c16 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -29,7 +29,7 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n non-gadget-parent-class.h grand-parent-gadget-class.h \ related-metaobjects-in-gadget.h \ related-metaobjects-name-conflict.h \ - namespace.h + namespace.h cxx17-namespaces.h if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 98429a1f0d..2d7ec2f0b5 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -70,6 +70,7 @@ #include "non-gadget-parent-class.h" #include "grand-parent-gadget-class.h" #include "namespace.h" +#include "cxx17-namespaces.h" #ifdef Q_MOC_RUN // check that moc can parse these constructs, they are being used in Windows winsock2.h header @@ -700,6 +701,7 @@ private slots: void optionsFileError_data(); void optionsFileError(); void testQNamespace(); + void cxx17Namespaces(); signals: void sigWithUnsignedArg(unsigned foo); @@ -3803,6 +3805,25 @@ void tst_Moc::testQNamespace() QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1); } +void tst_Moc::cxx17Namespaces() +{ + QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.className(), + "CXX17Namespace::A::B::C::D"); + QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumeratorCount(), 1); + QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumerator(0).name(), "NamEn"); + QCOMPARE(QMetaEnum::fromType().name(), "NamEn"); + QCOMPARE(QMetaEnum::fromType().keyCount(), 1); + QCOMPARE(QMetaEnum::fromType().value(0), 4); + + QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.className(), + "CXX17Namespace::A::B::C::D::ClassInNamespace"); + QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumeratorCount(), 1); + QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumerator(0).name(), "GadEn"); + QCOMPARE(QMetaEnum::fromType().name(), "GadEn"); + QCOMPARE(QMetaEnum::fromType().keyCount(), 1); + QCOMPARE(QMetaEnum::fromType().value(0), 3); +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS From 175f33ed855b0a8a30daafacd4f48fa3f8e76a9b Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Tue, 31 Jan 2017 13:38:01 -0800 Subject: [PATCH 68/71] QMacStyle: update QTabBar style Task-number: QTBUG-58266 Change-Id: I135e4dae44e2e97d73b7c7c97d8e682bcf459d75 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 458 ++++++++++++++----------- src/widgets/styles/qmacstyle_mac_p_p.h | 4 + src/widgets/widgets/qtabbar.cpp | 44 ++- src/widgets/widgets/qtabbar_p.h | 4 +- src/widgets/widgets/qtabwidget.cpp | 1 - tests/manual/manual.pro | 3 +- tests/manual/qtabbar/main.cpp | 153 +++++++++ tests/manual/qtabbar/qtabbar.pro | 4 + 8 files changed, 466 insertions(+), 205 deletions(-) create mode 100644 tests/manual/qtabbar/main.cpp create mode 100644 tests/manual/qtabbar/qtabbar.pro diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 6dcebaaf32..0d2203f843 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -190,11 +191,33 @@ static const QColor mainWindowGradientEnd(200, 200, 200); static const int DisclosureOffset = 4; +// Tab bar colors +// active: window is active +// selected: tab is selected +// hovered: tab is hovered +static const QColor tabBarTabBackgroundActive(190, 190, 190); +static const QColor tabBarTabBackgroundActiveHovered(178, 178, 178); +static const QColor tabBarTabBackgroundActiveSelected(211, 211, 211); +static const QColor tabBarTabBackground(227, 227, 227); +static const QColor tabBarTabBackgroundSelected(246, 246, 246); +static const QColor tabBarTabLineActive(160, 160, 160); +static const QColor tabBarTabLineActiveHovered(150, 150, 150); +static const QColor tabBarTabLine(210, 210, 210); +static const QColor tabBarTabLineSelected(189, 189, 189); +static const QColor tabBarCloseButtonBackgroundHovered(162, 162, 162); +static const QColor tabBarCloseButtonBackgroundPressed(153, 153, 153); +static const QColor tabBarCloseButtonBackgroundSelectedHovered(192, 192, 192); +static const QColor tabBarCloseButtonBackgroundSelectedPressed(181, 181, 181); +static const QColor tabBarCloseButtonCross(100, 100, 100); +static const QColor tabBarCloseButtonCrossSelected(115, 115, 115); + +static const int closeButtonSize = 14; +static const qreal closeButtonCornerRadius = 2.0; + // Resolve these at run-time, since the functions was moved in Leopard. typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; -static int closeButtonSize = 12; #ifndef QT_NO_TABBAR static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast @@ -217,41 +240,35 @@ static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY) } -void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) +void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed) { - // draw background circle p->setRenderHints(QPainter::Antialiasing); QRect rect(0, 0, closeButtonSize, closeButtonSize); - QColor background; + const int width = rect.width(); + const int height = rect.height(); + if (hover) { - background = QColor(124, 124, 124); - } else { - if (active) { - if (selected) - background = QColor(104, 104, 104); - else - background = QColor(83, 83, 83); + // draw background circle + QColor background; + if (selected) { + background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered; } else { - if (selected) - background = QColor(144, 144, 144); - else - background = QColor(114, 114, 114); + background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered; } + p->setPen(Qt::transparent); + p->setBrush(background); + p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius); } - p->setPen(Qt::transparent); - p->setBrush(background); - p->drawEllipse(rect); // draw cross - int min = 3; - int max = 9; + const int margin = 3; QPen crossPen; - crossPen.setColor(QColor(194, 194, 194)); - crossPen.setWidthF(1.3); + crossPen.setColor(selected ? tabBarCloseButtonCrossSelected : tabBarCloseButtonCross); + crossPen.setWidthF(1.1); crossPen.setCapStyle(Qt::FlatCap); p->setPen(crossPen); - p->drawLine(min, min, max, max); - p->drawLine(min, max, max, min); + p->drawLine(margin, margin, width - margin, height - margin); + p->drawLine(margin, height - margin, width - margin, margin); } #ifndef QT_NO_TABBAR @@ -278,108 +295,71 @@ QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect) return tabRect; } -void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified) +void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified, int tabOverlap) { - QRect r = tabOpt->rect; - p->translate(tabOpt->rect.x(), tabOpt->rect.y()); - r.moveLeft(0); - r.moveTop(0); - QRect tabRect = rotateTabPainter(p, tabOpt->shape, r); + QRect rect = tabOpt->rect; - int width = tabRect.width(); - int height = 20; - bool active = (tabOpt->state & QStyle::State_Active); - bool selected = (tabOpt->state & QStyle::State_Selected); + switch (tabOpt->shape) { + case QTabBar::RoundedNorth: + case QTabBar::TriangularNorth: + case QTabBar::RoundedSouth: + case QTabBar::TriangularSouth: + rect.adjust(-tabOverlap, 0, 0, 0); + break; + case QTabBar::RoundedEast: + case QTabBar::TriangularEast: + case QTabBar::RoundedWest: + case QTabBar::TriangularWest: + rect.adjust(0, -tabOverlap, 0, 0); + break; + default: + break; + } + p->translate(rect.x(), rect.y()); + rect.moveLeft(0); + rect.moveTop(0); + const QRect tabRect = rotateTabPainter(p, tabOpt->shape, rect); + + const int width = tabRect.width(); + const int height = tabRect.height(); + const bool active = (tabOpt->state & QStyle::State_Active); + const bool selected = (tabOpt->state & QStyle::State_Selected); + + const QRect bodyRect(1, 1, width - 2, height - 2); + const QRect topLineRect(1, 0, width - 2, 1); + const QRect bottomLineRect(1, height - 1, width - 2, 1); if (selected) { - QRect rect(1, 0, width - 2, height); - // fill body if (tabOpt->documentMode && isUnified) { p->save(); p->setCompositionMode(QPainter::CompositionMode_Source); - p->fillRect(rect, QColor(Qt::transparent)); + p->fillRect(tabRect, QColor(Qt::transparent)); p->restore(); } else if (active) { - p->fillRect(rect, QColor(167, 167, 167)); + p->fillRect(bodyRect, tabBarTabBackgroundActiveSelected); + // top line + p->fillRect(topLineRect, tabBarTabLineSelected); } else { - QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); - gradient.setColorAt(0, QColor(216, 216, 216)); - gradient.setColorAt(0.5, QColor(215, 215, 215)); - gradient.setColorAt(1, QColor(210, 210, 210)); - p->fillRect(rect, gradient); + p->fillRect(bodyRect, tabBarTabBackgroundSelected); } - - // draw border - QColor borderSides; - QColor borderBottom; - if (active) { - borderSides = QColor(88, 88, 88); - borderBottom = QColor(88, 88, 88); - } else { - borderSides = QColor(121, 121, 121); - borderBottom = QColor(116, 116, 116); - } - - p->setPen(borderSides); - - int bottom = height; - // left line - p->drawLine(0, 1, 0, bottom-2); - // right line - p->drawLine(width-1, 1, width-1, bottom-2); - - // bottom line - if (active) { - p->setPen(QColor(168, 168, 168)); - p->drawLine(3, bottom-1, width-3, bottom-1); - } - p->setPen(borderBottom); - p->drawLine(2, bottom, width-2, bottom); - - int w = 3; - QRectF rectangleLeft(1, height - w, w, w); - QRectF rectangleRight(width - 2, height - 1, w, w); - int startAngle = 180 * 16; - int spanAngle = 90 * 16; - p->setRenderHint(QPainter::Antialiasing); - p->drawArc(rectangleLeft, startAngle, spanAngle); - p->drawArc(rectangleRight, startAngle, -spanAngle); } else { // when the mouse is over non selected tabs they get a new color - bool hover = (tabOpt->state & QStyle::State_MouseOver); + const bool hover = (tabOpt->state & QStyle::State_MouseOver); if (hover) { - QRect rect(1, 2, width - 1, height - 1); - p->fillRect(rect, QColor(110, 110, 110)); - } - - // seperator lines between tabs - bool west = (tabOpt->shape == QTabBar::RoundedWest || tabOpt->shape == QTabBar::TriangularWest); - bool drawOnRight = !west; - if ((!drawOnRight && tabOpt->selectedPosition != QStyleOptionTab::NextIsSelected) - || (drawOnRight && tabOpt->selectedPosition != QStyleOptionTab::NextIsSelected)) { - QColor borderColor; - QColor borderHighlightColor; - if (active) { - borderColor = QColor(64, 64, 64); - borderHighlightColor = QColor(140, 140, 140); - } else { - borderColor = QColor(135, 135, 135); - borderHighlightColor = QColor(178, 178, 178); - } - - int x = drawOnRight ? width : 0; - - // tab seperator line - p->setPen(borderColor); - p->drawLine(x, 2, x, height + 1); - - // tab seperator highlight - p->setPen(borderHighlightColor); - p->drawLine(x-1, 2, x-1, height + 1); - p->drawLine(x+1, 2, x+1, height + 1); + // fill body + p->fillRect(bodyRect, tabBarTabBackgroundActiveHovered); + // bottom line + p->fillRect(bottomLineRect, tabBarTabLineActiveHovered); } } + + // separator lines between tabs + const QRect leftLineRect(0, 1, 1, height - 2); + const QRect rightLineRect(width - 1, 1, 1, height - 2); + const QColor separatorLineColor = active ? tabBarTabLineActive : tabBarTabLine; + p->fillRect(leftLineRect, separatorLineColor); + p->fillRect(rightLineRect, separatorLineColor); } void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget *w) @@ -390,53 +370,25 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget * } else { r.setHeight(w->height()); } - QRect tabRect = rotateTabPainter(p, tbb->shape, r); - int width = tabRect.width(); - int height = tabRect.height(); - bool active = (tbb->state & QStyle::State_Active); + const QRect tabRect = rotateTabPainter(p, tbb->shape, r); + const int width = tabRect.width(); + const int height = tabRect.height(); + const bool active = (tbb->state & QStyle::State_Active); - // top border lines - QColor borderHighlightTop; - QColor borderTop; - if (active) { - borderTop = QColor(64, 64, 64); - borderHighlightTop = QColor(174, 174, 174); - } else { - borderTop = QColor(135, 135, 135); - borderHighlightTop = QColor(207, 207, 207); - } - p->setPen(borderHighlightTop); - p->drawLine(tabRect.x(), 0, width, 0); - p->setPen(borderTop); - p->drawLine(tabRect.x(), 1, width, 1); + // fill body + const QRect bodyRect(0, 1, width, height - 1); + const QColor bodyColor = active ? tabBarTabBackgroundActive : tabBarTabBackground; + p->fillRect(bodyRect, bodyColor); - // center block - QRect centralRect(tabRect.x(), 2, width, height - 2); - if (active) { - QColor mainColor = QColor(120, 120, 120); - p->fillRect(centralRect, mainColor); - } else { - QLinearGradient gradient(centralRect.topLeft(), centralRect.bottomLeft()); - gradient.setColorAt(0, QColor(165, 165, 165)); - gradient.setColorAt(0.5, QColor(164, 164, 164)); - gradient.setColorAt(1, QColor(158, 158, 158)); - p->fillRect(centralRect, gradient); - } + // top line + const QRect topLineRect(0, 0, width, 1); + const QColor topLineColor = active ? tabBarTabLineActive : tabBarTabLine; + p->fillRect(topLineRect, topLineColor); - // bottom border lines - QColor borderHighlightBottom; - QColor borderBottom; - if (active) { - borderHighlightBottom = QColor(153, 153, 153); - borderBottom = QColor(64, 64, 64); - } else { - borderHighlightBottom = QColor(177, 177, 177); - borderBottom = QColor(127, 127, 127); - } - p->setPen(borderHighlightBottom); - p->drawLine(tabRect.x(), height - 2, width, height - 2); - p->setPen(borderBottom); - p->drawLine(tabRect.x(), height - 1, width, height - 1); + // bottom line + const QRect bottomLineRect(0, height - 1, width, 1); + const QColor bottomLineColor = active ? tabBarTabLineActive : tabBarTabLine; + p->fillRect(bottomLineRect, bottomLineColor); } #endif @@ -1105,6 +1057,55 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h QRect(focusRingPixmap.width() - shCornerSize, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize)); } +#ifndef QT_NO_TABBAR +void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const +{ + Q_ASSERT(textRect); + QRect tr = opt->rect; + const bool verticalTabs = opt->shape == QTabBar::RoundedEast + || opt->shape == QTabBar::RoundedWest + || opt->shape == QTabBar::TriangularEast + || opt->shape == QTabBar::TriangularWest; + if (verticalTabs) + tr.setRect(0, 0, tr.height(), tr.width()); // 0, 0 as we will have a translate transform + + int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget); + int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget); + const int hpadding = 4; + const int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; + if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth) + verticalShift = -verticalShift; + tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding); + const bool selected = opt->state & QStyle::State_Selected; + if (selected) { + tr.setTop(tr.top() - verticalShift); + tr.setRight(tr.right() - horizontalShift); + } + + // left widget + if (!opt->leftButtonSize.isEmpty()) { + const int buttonSize = verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width(); + tr.setLeft(tr.left() + 4 + buttonSize); + // make text aligned to center + if (opt->rightButtonSize.isEmpty()) + tr.setRight(tr.right() - 4 - buttonSize); + } + // right widget + if (!opt->rightButtonSize.isEmpty()) { + const int buttonSize = verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width(); + tr.setRight(tr.right() - 4 - buttonSize); + // make text aligned to center + if (opt->leftButtonSize.isEmpty()) + tr.setLeft(tr.left() + 4 + buttonSize); + } + + if (!verticalTabs) + tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); + + *textRect = tr; +} +#endif //QT_NO_TABBAR + QAquaWidgetSize QMacStylePrivate::effectiveAquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct, @@ -2473,6 +2474,26 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = int([NSWindow frameRectForContentRect:NSZeroRect styleMask:NSTitledWindowMask].size.height); break; + case QStyle::PM_TabBarTabHSpace: + switch (d->aquaSizeConstrain(opt, widget)) { + case QAquaSizeLarge: + ret = QCommonStyle::pixelMetric(metric, opt, widget); + break; + case QAquaSizeSmall: + ret = 20; + break; + case QAquaSizeMini: + ret = 16; + break; + case QAquaSizeUnknown: + const QStyleOptionTab *tb = qstyleoption_cast(opt); + if (tb && tb->documentMode) + ret = 24; + else + ret = QCommonStyle::pixelMetric(metric, opt, widget); + break; + } + break; case PM_TabBarTabVSpace: ret = 4; break; @@ -2481,10 +2502,10 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_TabBarBaseHeight: - ret = 0; + ret = 21; break; case PM_TabBarTabOverlap: - ret = 0; + ret = 1; break; case PM_TabBarBaseOverlap: switch (d->aquaSizeConstrain(opt, widget)) { @@ -2661,20 +2682,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW case PM_LayoutHorizontalSpacing: case PM_LayoutVerticalSpacing: return -1; - case QStyle::PM_TabBarTabHSpace: - switch (d->aquaSizeConstrain(opt, widget)) { - case QAquaSizeLarge: - case QAquaSizeUnknown: - ret = QCommonStyle::pixelMetric(metric, opt, widget); - break; - case QAquaSizeSmall: - ret = 20; - break; - case QAquaSizeMini: - ret = 16; - break; - } - break; case PM_MenuHMargin: ret = 0; break; @@ -3526,10 +3533,18 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai case PE_FrameStatusBarItem: break; case PE_IndicatorTabClose: { - bool hover = (opt->state & State_MouseOver); - bool selected = (opt->state & State_Selected); - bool active = (opt->state & State_Active); - drawTabCloseButton(p, hover, active, selected); + // Make close button visible only on the hovered tab. + if (QTabBar *tabBar = qobject_cast(w->parentWidget())) { + const QTabBarPrivate *tabBarPrivate = static_cast(QObjectPrivate::get(tabBar)); + const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex(); + if (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) || + (w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide)))) { + const bool hover = (opt->state & State_MouseOver); + const bool selected = (opt->state & State_Selected); + const bool pressed = (opt->state & State_Sunken); + drawTabCloseButton(p, hover, selected, pressed); + } + } } break; case PE_PanelStatusBar: { // Fill the status bar with the titlebar gradient. @@ -4066,7 +4081,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter #ifndef QT_NO_TABBAR case CE_TabBarTabShape: if (const QStyleOptionTab *tabOpt = qstyleoption_cast(opt)) { - if (tabOpt->documentMode) { p->save(); bool isUnified = false; @@ -4076,7 +4090,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter isUnified = isInMacUnifiedToolbarArea(w->window()->windowHandle(), windowTabStart.y()); } - drawTabShape(p, tabOpt, isUnified); + const int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, opt, w); + drawTabShape(p, tabOpt, isUnified, tabOverlap); + p->restore(); return; } @@ -4202,23 +4218,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } myTab.rect.setHeight(myTab.rect.height() + heightOffset); - if (myTab.documentMode) { - p->save(); - rotateTabPainter(p, myTab.shape, myTab.rect); - - QColor shadowColor = QColor(myTab.documentMode ? Qt::white : Qt::black); - shadowColor.setAlpha(75); - QPalette np = tab->palette; - np.setColor(QPalette::WindowText, shadowColor); - - QRect nr = proxy()->subElementRect(SE_TabBarTabText, opt, w); - nr.moveTop(-1); - int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; - proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, - tab->text, QPalette::WindowText); - p->restore(); - } - QCommonStyle::drawControl(ce, &myTab, p, w); } else { p->save(); @@ -4936,6 +4935,73 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } } break; + case SE_TabBarTabText: + if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { + d->tabLayout(tab, widget, &rect); + } + break; + case SE_TabBarTabLeftButton: + case SE_TabBarTabRightButton: + if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { + bool selected = tab->state & State_Selected; + int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); + int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); + int hpadding = 5; + + bool verticalTabs = tab->shape == QTabBar::RoundedEast + || tab->shape == QTabBar::RoundedWest + || tab->shape == QTabBar::TriangularEast + || tab->shape == QTabBar::TriangularWest; + + QRect tr = tab->rect; + if (tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::TriangularSouth) + verticalShift = -verticalShift; + if (verticalTabs) { + qSwap(horizontalShift, verticalShift); + horizontalShift *= -1; + verticalShift *= -1; + } + if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest) + horizontalShift = -horizontalShift; + + tr.adjust(0, 0, horizontalShift, verticalShift); + if (selected) + { + tr.setBottom(tr.bottom() - verticalShift); + tr.setRight(tr.right() - horizontalShift); + } + + QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize; + int w = size.width(); + int h = size.height(); + int midHeight = static_cast(qCeil(float(tr.height() - h) / 2)); + int midWidth = ((tr.width() - w) / 2); + + bool atTheTop = true; + switch (tab->shape) { + case QTabBar::RoundedWest: + case QTabBar::TriangularWest: + atTheTop = (sr == SE_TabBarTabLeftButton); + break; + case QTabBar::RoundedEast: + case QTabBar::TriangularEast: + atTheTop = (sr == SE_TabBarTabRightButton); + break; + default: + if (sr == SE_TabBarTabLeftButton) + rect = QRect(tab->rect.x() + hpadding, midHeight, w, h); + else + rect = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); + rect = visualRect(tab->direction, tab->rect, rect); + } + if (verticalTabs) { + if (atTheTop) + rect = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h); + else + rect = QRect(midWidth, tr.y() + hpadding, w, h); + } + } + break; #endif case SE_LineEditContents: rect = QCommonStyle::subElementRect(sr, opt, widget); @@ -6543,13 +6609,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, if (vertTabs) sz = sz.transposed(); int defaultTabHeight; - int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK) + int extraHSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); + int extraVSpace = proxy()->pixelMetric(PM_TabBarTabVSpace, tab, widget); QFontMetrics fm = opt->fontMetrics; switch (AquaSize) { case QAquaSizeUnknown: case QAquaSizeLarge: if (tab->documentMode) - defaultTabHeight = 23; + defaultTabHeight = 24; else defaultTabHeight = 21; break; @@ -6563,10 +6630,11 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool setWidth = false; if (differentFont || !tab->icon.isNull()) { sz.rheight() = qMax(defaultTabHeight, sz.height()); + sz.rwidth() += extraHSpace; } else { QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text); sz.rheight() = qMax(defaultTabHeight, textSize.height()); - sz.rwidth() = textSize.width() + defaultExtraSpace; + sz.rwidth() = textSize.width() + extraVSpace; setWidth = true; } diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 1332845f8e..59f6e893b1 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -229,6 +229,10 @@ public: void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const; +#ifndef QT_NO_TABBAR + void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const; +#endif + public: mutable QPointer pressedButton; mutable QPointer defaultButton; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 9bf062b407..eeece1a42a 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -519,12 +519,14 @@ void QTabBarPrivate::layoutTabs() maxExtent = maxWidth; } + if (!expanding) { + // Mirror our front item. + tabChain[tabChainIndex].init(); + tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight) + && (tabAlignment != Qt::AlignJustify); + tabChain[tabChainIndex].empty = true; + } Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. - // Mirror our front item. - tabChain[tabChainIndex].init(); - tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight) - && (tabAlignment != Qt::AlignJustify); - tabChain[tabChainIndex].empty = true; // Do the calculation qGeomCalc(tabChain, 0, tabChain.count(), 0, qMax(available, last), 0); @@ -664,6 +666,15 @@ QRect QTabBarPrivate::normalizedScrollRect(int index) } } +int QTabBarPrivate::hoveredTabIndex() const +{ + if (dragInProgress) + return currentIndex; + if (hoverIndex >= 0) + return hoverIndex; + return -1; +} + void QTabBarPrivate::makeVisible(int index) { Q_Q(QTabBar); @@ -1053,6 +1064,17 @@ void QTabBar::removeTab(int index) } d->refresh(); d->autoHideTabs(); + if (!d->hoverRect.isEmpty()) { + for (int i = 0; i < d->tabList.count(); ++i) { + const QRect area = tabRect(i); + if (area.contains(mapFromGlobal(QCursor::pos()))) { + d->hoverIndex = i; + d->hoverRect = area; + break; + } + } + update(d->hoverRect); + } tabRemoved(index); } } @@ -1577,20 +1599,28 @@ bool QTabBar::event(QEvent *event) QHoverEvent *he = static_cast(event); if (!d->hoverRect.contains(he->pos())) { QRect oldHoverRect = d->hoverRect; + bool cursorOverTabs = false; for (int i = 0; i < d->tabList.count(); ++i) { QRect area = tabRect(i); if (area.contains(he->pos())) { + d->hoverIndex = i; d->hoverRect = area; + cursorOverTabs = true; break; } } + if (!cursorOverTabs) { + d->hoverIndex = -1; + d->hoverRect = QRect(); + } if (he->oldPos() != QPoint(-1, -1)) update(oldHoverRect); update(d->hoverRect); } return true; - } else if (event->type() == QEvent::HoverLeave ) { + } else if (event->type() == QEvent::HoverLeave) { QRect oldHoverRect = d->hoverRect; + d->hoverIndex = -1; d->hoverRect = QRect(); update(oldHoverRect); return true; @@ -2435,7 +2465,7 @@ void QTabBar::setMovable(bool movable) This property is used as a hint for styles to draw the tabs in a different way then they would normally look in a tab widget. On \macos this will - look similar to the tabs in Safari or Leopard's Terminal.app. + look similar to the tabs in Safari or Sierra's Terminal.app. \sa QTabWidget::documentMode */ diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index e8d5503fdf..7c653a95e9 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -87,7 +87,7 @@ class QTabBarPrivate : public QWidgetPrivate public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), - drawBase(true), scrollOffset(0), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false), + drawBase(true), scrollOffset(0), hoverIndex(-1), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), autoHide(false), changeCurrentOnDrag(false), switchTabCurrentIndex(-1), switchTabTimerId(0), movingTab(0) @@ -192,6 +192,7 @@ public: void moveTab(int index, int offset); void moveTabFinished(int index); QRect hoverRect; + int hoverIndex; void refresh(); void layoutTabs(); @@ -202,6 +203,7 @@ public: void setupMovableTab(); void autoHideTabs(); QRect normalizedScrollRect(int index = -1); + int hoveredTabIndex() const; void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 1394c6b44c..be870133ee 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -209,7 +209,6 @@ public: bool dirty; QTabWidget::TabPosition pos; QTabWidget::TabShape shape; - int alignment; QWidget *leftCornerWidget; QWidget *rightCornerWidget; }; diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index a93a003dff..a9d27fa488 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -52,7 +52,8 @@ xembed-widgets \ shortcuts \ dialogs \ windowtransparency \ -unc +unc \ +qtabbar !qtConfig(openssl): SUBDIRS -= qssloptions diff --git a/tests/manual/qtabbar/main.cpp b/tests/manual/qtabbar/main.cpp new file mode 100644 index 0000000000..b1ef0df100 --- /dev/null +++ b/tests/manual/qtabbar/main.cpp @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +const int TabCount = 5; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QWidget widget; + QStackedWidget stackedWidget; + QTabBar tabBar; + tabBar.setDocumentMode(true); + tabBar.setTabsClosable(true); + tabBar.setMovable(true); + tabBar.setExpanding(true); + + // top + tabBar.setShape(QTabBar::RoundedNorth); + // bottom +// tabBar.setShape(QTabBar::RoundedSouth); + // left +// tabBar.setShape(QTabBar::RoundedWest); + // right +// tabBar.setShape(QTabBar::RoundedEast); + + QMap tabs; + for (int i = 0; i < TabCount; i++) { + QString tabNumberString = QString::number(i); + QLabel *label = new QLabel(QStringLiteral("Tab %1 content").arg(tabNumberString)); + tabs[i] = label; + label->setAlignment(Qt::AlignCenter); + stackedWidget.addWidget(label); + tabBar.addTab(QStringLiteral("Tab %1").arg(tabNumberString)); + } + + QObject::connect(&tabBar, &QTabBar::tabMoved, [&tabs](int from, int to) { + QWidget *thisWidget = tabs[from]; + QWidget *thatWidget = tabs[to]; + tabs[from] = thatWidget; + tabs[to] = thisWidget; + }); + + QObject::connect(&tabBar, &QTabBar::currentChanged, [&stackedWidget, &tabs](int index) { + if (index >= 0) + stackedWidget.setCurrentWidget(tabs[index]); + }); + + QObject::connect(&tabBar, &QTabBar::tabCloseRequested, [&stackedWidget, &tabBar, &tabs](int index) { + QWidget *widget = tabs[index]; + tabBar.removeTab(index); + for (int i = index + 1; i < TabCount; i++) + tabs[i-1] = tabs[i]; + int currentIndex = tabBar.currentIndex(); + if (currentIndex >= 0) + stackedWidget.setCurrentWidget(tabs[currentIndex]); + delete widget; + }); + + QLayout *layout; + switch (tabBar.shape()) { + case QTabBar::RoundedEast: + case QTabBar::TriangularEast: + tabBar.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + layout = new QHBoxLayout(&widget); + layout->addWidget(&stackedWidget); + layout->addWidget(&tabBar); + break; + case QTabBar::RoundedWest: + case QTabBar::TriangularWest: + tabBar.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + layout = new QHBoxLayout(&widget); + layout->addWidget(&tabBar); + layout->addWidget(&stackedWidget); + break; + case QTabBar::RoundedNorth: + case QTabBar::TriangularNorth: + tabBar.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); + layout = new QVBoxLayout(&widget); + layout->addWidget(&tabBar); + layout->addWidget(&stackedWidget); + break; + case QTabBar::RoundedSouth: + case QTabBar::TriangularSouth: + tabBar.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); + layout = new QVBoxLayout(&widget); + layout->addWidget(&stackedWidget); + layout->addWidget(&tabBar); + break; + } + + layout->setMargin(0); + widget.resize(QApplication::desktop()->screenGeometry(&widget).size() * 0.5); + widget.show(); + + return app.exec(); +} diff --git a/tests/manual/qtabbar/qtabbar.pro b/tests/manual/qtabbar/qtabbar.pro new file mode 100644 index 0000000000..a63da72158 --- /dev/null +++ b/tests/manual/qtabbar/qtabbar.pro @@ -0,0 +1,4 @@ +TARGET = qtabbar +TEMPLATE = app +QT = core gui widgets +SOURCES = main.cpp From f8218637e9e5fa8f50ef25da293b95f767eaefc2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 9 Mar 2017 10:11:17 +0100 Subject: [PATCH 69/71] Build fix for -no-feature-slider Change-Id: Ibd7d0c2182c6a11f6d595b6d1015ee7de2d35866 Reviewed-by: Lars Knoll --- src/widgets/styles/qfusionstyle.cpp | 3 +++ src/widgets/styles/qstylesheetstyle.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 33c5a01677..1267907303 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -59,6 +59,9 @@ #include #include #include +#if QT_CONFIG(abstractslider) +#include +#endif #include #include #include diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ab4d0bcb7c..275a0550d2 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -60,6 +60,9 @@ #include #include #include +#if QT_CONFIG(abstractslider) +#include +#endif #include #include #if QT_CONFIG(checkbox) From ef26467eb21c5282dcad53c4da109d99ff4395aa Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 14 Feb 2017 10:05:34 -0800 Subject: [PATCH 70/71] Reintroduce a directed QMetaType::typeName array Commit fb376e0fcc8d2d0a1731a588bfc6497d05e090e6 removed an array that facilitated returning the names of built-in types, to avoid the jump tables from the switch statement. This commit brings it back but makes the array a compile-time constant string offset table. The array is created by way of a set of C++11 constexpr functions, so we require that compiler feature. I've tested that MSVC 2015 does support it as well as the ICC 17 when masquerading as MSVC 2015, so I've enabled for that too. The only compiler left out is MSVC 2013. If we didn't need to support MSVC 2015, this could have been written more simply with C++14 relaxed constexpr. This also adds unit tests to confirm that QMetaType::typeName() does return null when we said it would. We're testing QMetaType::User-1 (which we'll likely never use) and QMetaType::LastWidgetsType-1 to select something inside the range of the built-in types. Task-number: QTBUG-58851 Change-Id: I4139d5f93dcb4b429ae9fffd14a33982891e2ac1 Reviewed-by: Marc Mutz --- src/corelib/kernel/qmetatype.cpp | 106 ++++++++++++++++-- .../kernel/qmetatype/tst_qmetatype.cpp | 6 +- 2 files changed, 101 insertions(+), 11 deletions(-) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 1764c8116e..38e0d6055c 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -825,9 +825,91 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, } #endif // QT_NO_DATASTREAM +#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900) +// We don't officially support constexpr in MSVC 2015, but the limited support it +// has is enough for the code below. + +# define STRINGIFY_TYPE_NAME(MetaTypeName, TypeId, RealName) \ + #RealName "\0" +# define CALCULATE_TYPE_LEN(MetaTypeName, TypeId, RealName) \ + short(sizeof(#RealName)), +# define MAP_TYPE_ID_TO_IDX(MetaTypeName, TypeId, RealName) \ + TypeId, + +namespace { +// All type names in one long string. +constexpr char metaTypeStrings[] = QT_FOR_EACH_STATIC_TYPE(STRINGIFY_TYPE_NAME); + +// The sizes of the strings in the metaTypeStrings string (including terminating null) +constexpr short metaTypeNameSizes[] = { + QT_FOR_EACH_STATIC_TYPE(CALCULATE_TYPE_LEN) +}; + +// The type IDs, in the order of the metaTypeStrings data +constexpr short metaTypeIds[] = { + QT_FOR_EACH_STATIC_TYPE(MAP_TYPE_ID_TO_IDX) +}; + +constexpr int MetaTypeNameCount = sizeof(metaTypeNameSizes) / sizeof(metaTypeNameSizes[0]); + +template struct MetaTypeOffsets; +template struct MetaTypeOffsets> +{ + // This would have been a lot easier if the meta types that the macro + // QT_FOR_EACH_STATIC_TYPE declared were in sorted, ascending order, but + // they're not (i.e., the first one declared is QMetaType::Void == 43, + // followed by QMetaType::Bool == 1)... As a consequence, we need to use + // the C++11 constexpr function calculateOffsetForTypeId below in order to + // create the offset array. + + static constexpr int findTypeId(int typeId, int i = 0) + { + return i >= MetaTypeNameCount ? -1 : + metaTypeIds[i] == typeId ? i : findTypeId(typeId, i + 1); + } + + static constexpr short calculateOffsetForIdx(int i) + { + return i < 0 ? -1 : + i == 0 ? 0 : metaTypeNameSizes[i - 1] + calculateOffsetForIdx(i - 1); + } + + static constexpr short calculateOffsetForTypeId(int typeId) + { + return calculateOffsetForIdx(findTypeId(typeId)); +#if 0 + // same as, but this is only valid in C++14: + short offset = 0; + for (int i = 0; i < MetaTypeNameCount; ++i) { + if (metaTypeIds[i] == typeId) + return offset; + offset += metaTypeNameSizes[i]; + } + return -1; +#endif + } + + short offsets[sizeof...(TypeIds)]; + constexpr MetaTypeOffsets() : offsets{calculateOffsetForTypeId(TypeIds)...} {} + + const char *operator[](int typeId) const Q_DECL_NOTHROW + { + short o = offsets[typeId]; + return o < 0 ? nullptr : metaTypeStrings + o; + } +}; +} // anonymous namespace + +constexpr MetaTypeOffsets::Value> metaTypeNames {}; +# undef STRINGIFY_TYPE_NAME +# undef CALCULATE_TYPE_LEN +# undef MAP_TYPE_ID_TO_IDX +#endif + /*! - Returns the type name associated with the given \a typeId, or 0 if no - matching type was found. The returned pointer must not be deleted. + Returns the type name associated with the given \a typeId, or a null + pointer if no matching type was found. The returned pointer must not be + deleted. \sa type(), isRegistered(), Type */ @@ -837,14 +919,18 @@ const char *QMetaType::typeName(int typeId) #define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \ case QMetaType::MetaTypeName: return #RealName; break; - switch (QMetaType::Type(type)) { - QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER) - case QMetaType::UnknownType: - case QMetaType::User: - break; - } - - if (Q_UNLIKELY(type < QMetaType::User)) { + if (Q_LIKELY(type <= QMetaType::HighestInternalId)) { +#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900) + return metaTypeNames[typeId]; +#else + switch (QMetaType::Type(type)) { + QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER) + case QMetaType::UnknownType: + case QMetaType::User: + break; + } +#endif + } else if (Q_UNLIKELY(type < QMetaType::User)) { return nullptr; // It can happen when someone cast int to QVariant::Type, we should not crash... } diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index e3c810984c..f693d14029 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -377,6 +377,8 @@ void tst_QMetaType::typeName_data() QT_FOR_EACH_STATIC_TYPE(TYPENAME_DATA) QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << static_cast(0); + QTest::newRow("QMetaType::User-1") << (int(QMetaType::User) - 1) << static_cast(nullptr); + QTest::newRow("QMetaType::FirstWidgetsType-1") << (int(QMetaType::FirstWidgetsType) - 1) << static_cast(nullptr); QTest::newRow("Whity") << ::qMetaTypeId >() << QString::fromLatin1("Whity"); QTest::newRow("Whity") << ::qMetaTypeId >() << QString::fromLatin1("Whity"); @@ -404,10 +406,12 @@ void tst_QMetaType::typeName() QFETCH(int, aType); QFETCH(QString, aTypeName); - QString name = QString::fromLatin1(QMetaType::typeName(aType)); + const char *rawname = QMetaType::typeName(aType); + QString name = QString::fromLatin1(rawname); QCOMPARE(name, aTypeName); QCOMPARE(name.toLatin1(), QMetaObject::normalizedType(name.toLatin1().constData())); + QCOMPARE(rawname == nullptr, aTypeName.isNull()); } void tst_QMetaType::type_data() From df40b1115db600e8de1c4774476fa30956a34fd9 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 8 Mar 2017 13:21:42 +0100 Subject: [PATCH 71/71] Doc: Ignore QT_SYSINFO_DEPRECATED_X QSysInfo has a customized deprecation directive that QDoc needs to ignore to generate documentation for the deprecated functionality. Change-Id: I1c378f14a2f842f1e9a55614d43fe509bb77fd89 Reviewed-by: Marc Mutz --- doc/global/qt-cpp-defines.qdocconf | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index fc3f78b925..5068ae8be8 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -196,6 +196,7 @@ Cpp.ignoredirectives += \ Q_DECLARE_TYPEINFO \ Q_DECL_NOEXCEPT_EXPR \ QT_DEPRECATED_X \ + QT_SYSINFO_DEPRECATED_X \ Q_DISABLE_COPY \ Q_DUMMY_COMPARISON_OPERATOR \ Q_ENUM \