diff options
author | Liang Qi <liang.qi@qt.io> | 2017-09-06 17:41:06 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-09-06 17:57:12 +0000 |
commit | 71ec67a0fd8aa8d9caab743647c2fdd4385c3e19 (patch) | |
tree | 25f541805067ffaf0d1a6365c19aac7eaf295551 /src | |
parent | 03bcf389c0b525919b82a64ab5290189f2994846 (diff) | |
parent | 19dd2ca93b8b95a5e2792b29ed62ea23800fb53e (diff) |
Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10
Diffstat (limited to 'src')
105 files changed, 473 insertions, 1194 deletions
diff --git a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh index 9e9c90b4bf..dc2fb05453 100755 --- a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh +++ b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh @@ -100,7 +100,6 @@ FILES=" src/pcre2_newline.c src/pcre2_ord2utf.c src/pcre2_pattern_info.c - src/pcre2_printint.c src/pcre2_serialize.c src/pcre2_string_utils.c src/pcre2_study.c diff --git a/src/3rdparty/pcre2/pcre2.pro b/src/3rdparty/pcre2/pcre2.pro index d3a4e08bc5..3dde2f62f8 100644 --- a/src/3rdparty/pcre2/pcre2.pro +++ b/src/3rdparty/pcre2/pcre2.pro @@ -15,7 +15,7 @@ load(qt_helper_lib) DEFINES += HAVE_CONFIG_H # platform/compiler specific definitions -ios|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT +uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT SOURCES += \ $$PWD/src/pcre2_auto_possess.c \ @@ -33,7 +33,6 @@ SOURCES += \ $$PWD/src/pcre2_newline.c \ $$PWD/src/pcre2_ord2utf.c \ $$PWD/src/pcre2_pattern_info.c \ - $$PWD/src/pcre2_printint.c \ $$PWD/src/pcre2_serialize.c \ $$PWD/src/pcre2_string_utils.c \ $$PWD/src/pcre2_study.c \ diff --git a/src/3rdparty/pcre2/src/pcre2_printint.c b/src/3rdparty/pcre2/src/pcre2_printint.c deleted file mode 100644 index e4dd53fe8c..0000000000 --- a/src/3rdparty/pcre2/src/pcre2_printint.c +++ /dev/null @@ -1,831 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - - Written by Philip Hazel - Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2017 University of Cambridge - ------------------------------------------------------------------------------ -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 University of Cambridge 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. ------------------------------------------------------------------------------ -*/ - - -/* This module contains a PCRE private debugging function for printing out the -internal form of a compiled regular expression, along with some supporting -local functions. This source file is #included in pcre2test.c at each supported -code unit width, with PCRE2_SUFFIX set appropriately, just like the functions -that comprise the library. It can also optionally be included in -pcre2_compile.c for detailed debugging in error situations. */ - - -/* Tables of operator names. The same 8-bit table is used for all code unit -widths, so it must be defined only once. The list itself is defined in -pcre2_internal.h, which is #included by pcre2test before this file. */ - -#ifndef OP_LISTS_DEFINED -static const char *OP_names[] = { OP_NAME_LIST }; -#define OP_LISTS_DEFINED -#endif - -/* The functions and tables herein must all have mode-dependent names. */ - -#define OP_lengths PCRE2_SUFFIX(OP_lengths_) -#define get_ucpname PCRE2_SUFFIX(get_ucpname_) -#define pcre2_printint PCRE2_SUFFIX(pcre2_printint_) -#define print_char PCRE2_SUFFIX(print_char_) -#define print_custring PCRE2_SUFFIX(print_custring_) -#define print_custring_bylen PCRE2_SUFFIX(print_custring_bylen_) -#define print_prop PCRE2_SUFFIX(print_prop_) - -/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that -the definition is next to the definition of the opcodes in pcre2_internal.h. -The contents of the table are, however, mode-dependent. */ - -static const uint8_t OP_lengths[] = { OP_LENGTHS }; - - - -/************************************************* -* Print one character from a string * -*************************************************/ - -/* In UTF mode the character may occupy more than one code unit. - -Arguments: - f file to write to - ptr pointer to first code unit of the character - utf TRUE if string is UTF (will be FALSE if UTF is not supported) - -Returns: number of additional code units used -*/ - -static unsigned int -print_char(FILE *f, PCRE2_SPTR ptr, BOOL utf) -{ -uint32_t c = *ptr; -BOOL one_code_unit = !utf; - -/* If UTF is supported and requested, check for a valid single code unit. */ - -#ifdef SUPPORT_UNICODE -if (utf) - { -#if PCRE2_CODE_UNIT_WIDTH == 8 - one_code_unit = c < 0x80; -#elif PCRE2_CODE_UNIT_WIDTH == 16 - one_code_unit = (c & 0xfc00) != 0xd800; -#else - one_code_unit = (c & 0xfffff800u) != 0xd800u; -#endif /* CODE_UNIT_WIDTH */ - } -#endif /* SUPPORT_UNICODE */ - -/* Handle a valid one-code-unit character at any width. */ - -if (one_code_unit) - { - if (PRINTABLE(c)) fprintf(f, "%c", (char)c); - else if (c < 0x80) fprintf(f, "\\x%02x", c); - else fprintf(f, "\\x{%02x}", c); - return 0; - } - -/* Code for invalid UTF code units and multi-unit UTF characters is different -for each width. If UTF is not supported, control should never get here, but we -need a return statement to keep the compiler happy. */ - -#ifndef SUPPORT_UNICODE -return 0; -#else - -/* Malformed UTF-8 should occur only if the sanity check has been turned off. -Rather than swallow random bytes, just stop if we hit a bad one. Print it with -\X instead of \x as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 8 -if ((c & 0xc0) != 0xc0) - { - fprintf(f, "\\X{%x}", c); /* Invalid starting byte */ - return 0; - } -else - { - int i; - int a = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes */ - int s = 6*a; - c = (c & PRIV(utf8_table3)[a]) << s; - for (i = 1; i <= a; i++) - { - if ((ptr[i] & 0xc0) != 0x80) - { - fprintf(f, "\\X{%x}", c); /* Invalid secondary byte */ - return i - 1; - } - s -= 6; - c |= (ptr[i] & 0x3f) << s; - } - fprintf(f, "\\x{%x}", c); - return a; -} -#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */ - -/* UTF-16: rather than swallow a low surrogate, just stop if we hit a bad one. -Print it with \X instead of \x as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 16 -if ((ptr[1] & 0xfc00) != 0xdc00) - { - fprintf(f, "\\X{%x}", c); - return 0; - } -c = (((c & 0x3ff) << 10) | (ptr[1] & 0x3ff)) + 0x10000; -fprintf(f, "\\x{%x}", c); -return 1; -#endif /* PCRE2_CODE_UNIT_WIDTH == 16 */ - -/* For UTF-32 we get here only for a malformed code unit, which should only -occur if the sanity check has been turned off. Print it with \X instead of \x -as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 32 -fprintf(f, "\\X{%x}", c); -return 0; -#endif /* PCRE2_CODE_UNIT_WIDTH == 32 */ -#endif /* SUPPORT_UNICODE */ -} - - - -/************************************************* -* Print string as a list of code units * -*************************************************/ - -/* These take no account of UTF as they always print each individual code unit. -The string is zero-terminated for print_custring(); the length is given for -print_custring_bylen(). - -Arguments: - f file to write to - ptr point to the string - len length for print_custring_bylen() - -Returns: nothing -*/ - -static void -print_custring(FILE *f, PCRE2_SPTR ptr) -{ -while (*ptr != '\0') - { - uint32_t c = *ptr++; - if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c); - } -} - -static void -print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len) -{ -for (; len > 0; len--) - { - uint32_t c = *ptr++; - if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c); - } -} - - - -/************************************************* -* Find Unicode property name * -*************************************************/ - -/* When there is no UTF/UCP support, the table of names does not exist. This -function should not be called in such configurations, because a pattern that -tries to use Unicode properties won't compile. Rather than put lots of #ifdefs -into the main code, however, we just put one into this function. */ - -static const char * -get_ucpname(unsigned int ptype, unsigned int pvalue) -{ -#ifdef SUPPORT_UNICODE -int i; -for (i = PRIV(utt_size) - 1; i >= 0; i--) - { - if (ptype == PRIV(utt)[i].type && pvalue == PRIV(utt)[i].value) break; - } -return (i >= 0)? PRIV(utt_names) + PRIV(utt)[i].name_offset : "??"; -#else /* No UTF support */ -(void)ptype; -(void)pvalue; -return "??"; -#endif /* SUPPORT_UNICODE */ -} - - - -/************************************************* -* Print Unicode property value * -*************************************************/ - -/* "Normal" properties can be printed from tables. The PT_CLIST property is a -pseudo-property that contains a pointer to a list of case-equivalent -characters. - -Arguments: - f file to write to - code pointer in the compiled code - before text to print before - after text to print after - -Returns: nothing -*/ - -static void -print_prop(FILE *f, PCRE2_SPTR code, const char *before, const char *after) -{ -if (code[1] != PT_CLIST) - { - fprintf(f, "%s%s %s%s", before, OP_names[*code], get_ucpname(code[1], - code[2]), after); - } -else - { - const char *not = (*code == OP_PROP)? "" : "not "; - const uint32_t *p = PRIV(ucd_caseless_sets) + code[2]; - fprintf (f, "%s%sclist", before, not); - while (*p < NOTACHAR) fprintf(f, " %04x", *p++); - fprintf(f, "%s", after); - } -} - - - -/************************************************* -* Print compiled pattern * -*************************************************/ - -/* The print_lengths flag controls whether offsets and lengths of items are -printed. Lenths can be turned off from pcre2test so that automatic tests on -bytecode can be written that do not depend on the value of LINK_SIZE. - -Arguments: - re a compiled pattern - f the file to write to - print_lengths show various lengths - -Returns: nothing -*/ - -static void -pcre2_printint(pcre2_code *re, FILE *f, BOOL print_lengths) -{ -PCRE2_SPTR codestart, nametable, code; -uint32_t nesize = re->name_entry_size; -BOOL utf = (re->overall_options & PCRE2_UTF) != 0; - -nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code)); -code = codestart = nametable + re->name_count * re->name_entry_size; - -for(;;) - { - PCRE2_SPTR ccode; - uint32_t c; - int i; - const char *flag = " "; - unsigned int extra = 0; - - if (print_lengths) - fprintf(f, "%3d ", (int)(code - codestart)); - else - fprintf(f, " "); - - switch(*code) - { -/* ========================================================================== */ - /* These cases are never obeyed. This is a fudge that causes a compile- - time error if the vectors OP_names or OP_lengths, which are indexed - by opcode, are not the correct length. It seems to be the only way to do - such a check at compile time, as the sizeof() operator does not work in - the C preprocessor. */ - - case OP_TABLE_LENGTH: - case OP_TABLE_LENGTH + - ((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) && - (sizeof(OP_lengths) == OP_TABLE_LENGTH)): - return; -/* ========================================================================== */ - - case OP_END: - fprintf(f, " %s\n", OP_names[*code]); - fprintf(f, "------------------------------------------------------------------\n"); - return; - - case OP_CHAR: - fprintf(f, " "); - do - { - code++; - code += 1 + print_char(f, code, utf); - } - while (*code == OP_CHAR); - fprintf(f, "\n"); - continue; - - case OP_CHARI: - fprintf(f, " /i "); - do - { - code++; - code += 1 + print_char(f, code, utf); - } - while (*code == OP_CHARI); - fprintf(f, "\n"); - continue; - - case OP_CBRA: - case OP_CBRAPOS: - case OP_SCBRA: - case OP_SCBRAPOS: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); - break; - - case OP_BRA: - case OP_BRAPOS: - case OP_SBRA: - case OP_SBRAPOS: - case OP_KETRMAX: - case OP_KETRMIN: - case OP_KETRPOS: - case OP_ALT: - case OP_KET: - case OP_ASSERT: - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - case OP_ONCE: - case OP_COND: - case OP_SCOND: - case OP_REVERSE: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_CLOSE: - fprintf(f, " %s %d", OP_names[*code], GET2(code, 1)); - break; - - case OP_CREF: - fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]); - break; - - case OP_DNCREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s Cond ref <", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - break; - - case OP_RREF: - c = GET2(code, 1); - if (c == RREF_ANY) - fprintf(f, " Cond recurse any"); - else - fprintf(f, " Cond recurse %d", c); - break; - - case OP_DNRREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s Cond recurse <", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - break; - - case OP_FALSE: - fprintf(f, " Cond false"); - break; - - case OP_TRUE: - fprintf(f, " Cond true"); - break; - - case OP_STARI: - case OP_MINSTARI: - case OP_POSSTARI: - case OP_PLUSI: - case OP_MINPLUSI: - case OP_POSPLUSI: - case OP_QUERYI: - case OP_MINQUERYI: - case OP_POSQUERYI: - flag = "/i"; - /* Fall through */ - case OP_STAR: - case OP_MINSTAR: - case OP_POSSTAR: - case OP_PLUS: - case OP_MINPLUS: - case OP_POSPLUS: - case OP_QUERY: - case OP_MINQUERY: - case OP_POSQUERY: - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEPOSSTAR: - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - case OP_TYPEPOSPLUS: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - case OP_TYPEPOSQUERY: - fprintf(f, " %s ", flag); - - if (*code >= OP_TYPESTAR) - { - if (code[1] == OP_PROP || code[1] == OP_NOTPROP) - { - print_prop(f, code + 1, "", " "); - extra = 2; - } - else fprintf(f, "%s", OP_names[code[1]]); - } - else extra = print_char(f, code+1, utf); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_EXACTI: - case OP_UPTOI: - case OP_MINUPTOI: - case OP_POSUPTOI: - flag = "/i"; - /* Fall through */ - case OP_EXACT: - case OP_UPTO: - case OP_MINUPTO: - case OP_POSUPTO: - fprintf(f, " %s ", flag); - extra = print_char(f, code + 1 + IMM2_SIZE, utf); - fprintf(f, "{"); - if (*code != OP_EXACT && *code != OP_EXACTI) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_MINUPTO || *code == OP_MINUPTOI) fprintf(f, "?"); - else if (*code == OP_POSUPTO || *code == OP_POSUPTOI) fprintf(f, "+"); - break; - - case OP_TYPEEXACT: - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - case OP_TYPEPOSUPTO: - if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP) - { - print_prop(f, code + IMM2_SIZE + 1, " ", " "); - extra = 2; - } - else fprintf(f, " %s", OP_names[code[1 + IMM2_SIZE]]); - fprintf(f, "{"); - if (*code != OP_TYPEEXACT) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_TYPEMINUPTO) fprintf(f, "?"); - else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+"); - break; - - case OP_NOTI: - flag = "/i"; - /* Fall through */ - case OP_NOT: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1, utf); - fprintf(f, "]"); - break; - - case OP_NOTSTARI: - case OP_NOTMINSTARI: - case OP_NOTPOSSTARI: - case OP_NOTPLUSI: - case OP_NOTMINPLUSI: - case OP_NOTPOSPLUSI: - case OP_NOTQUERYI: - case OP_NOTMINQUERYI: - case OP_NOTPOSQUERYI: - flag = "/i"; - /* Fall through */ - - case OP_NOTSTAR: - case OP_NOTMINSTAR: - case OP_NOTPOSSTAR: - case OP_NOTPLUS: - case OP_NOTMINPLUS: - case OP_NOTPOSPLUS: - case OP_NOTQUERY: - case OP_NOTMINQUERY: - case OP_NOTPOSQUERY: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1, utf); - fprintf(f, "]%s", OP_names[*code]); - break; - - case OP_NOTEXACTI: - case OP_NOTUPTOI: - case OP_NOTMINUPTOI: - case OP_NOTPOSUPTOI: - flag = "/i"; - /* Fall through */ - - case OP_NOTEXACT: - case OP_NOTUPTO: - case OP_NOTMINUPTO: - case OP_NOTPOSUPTO: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1 + IMM2_SIZE, utf); - fprintf(f, "]{"); - if (*code != OP_NOTEXACT && *code != OP_NOTEXACTI) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_NOTMINUPTO || *code == OP_NOTMINUPTOI) fprintf(f, "?"); - else - if (*code == OP_NOTPOSUPTO || *code == OP_NOTPOSUPTOI) fprintf(f, "+"); - break; - - case OP_RECURSE: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_REFI: - flag = "/i"; - /* Fall through */ - case OP_REF: - fprintf(f, " %s \\%d", flag, GET2(code,1)); - ccode = code + OP_lengths[*code]; - goto CLASS_REF_REPEAT; - - case OP_DNREFI: - flag = "/i"; - /* Fall through */ - case OP_DNREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s \\k<", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - ccode = code + OP_lengths[*code]; - goto CLASS_REF_REPEAT; - - case OP_CALLOUT: - fprintf(f, " %s %d %d %d", OP_names[*code], code[1 + 2*LINK_SIZE], - GET(code, 1), GET(code, 1 + LINK_SIZE)); - break; - - case OP_CALLOUT_STR: - c = code[1 + 4*LINK_SIZE]; - fprintf(f, " %s %c", OP_names[*code], c); - extra = GET(code, 1 + 2*LINK_SIZE); - print_custring_bylen(f, code + 2 + 4*LINK_SIZE, extra - 3 - 4*LINK_SIZE); - for (i = 0; PRIV(callout_start_delims)[i] != 0; i++) - if (c == PRIV(callout_start_delims)[i]) - { - c = PRIV(callout_end_delims)[i]; - break; - } - fprintf(f, "%c %d %d %d", c, GET(code, 1 + 3*LINK_SIZE), GET(code, 1), - GET(code, 1 + LINK_SIZE)); - break; - - case OP_PROP: - case OP_NOTPROP: - print_prop(f, code, " ", ""); - break; - - /* OP_XCLASS cannot occur in 8-bit, non-UTF mode. However, there's no harm - in having this code always here, and it makes it less messy without all - those #ifdefs. */ - - case OP_CLASS: - case OP_NCLASS: - case OP_XCLASS: - { - unsigned int min, max; - BOOL printmap; - BOOL invertmap = FALSE; - uint8_t *map; - uint8_t inverted_map[32]; - - fprintf(f, " ["); - - if (*code == OP_XCLASS) - { - extra = GET(code, 1); - ccode = code + LINK_SIZE + 1; - printmap = (*ccode & XCL_MAP) != 0; - if ((*ccode & XCL_NOT) != 0) - { - invertmap = (*ccode & XCL_HASPROP) == 0; - fprintf(f, "^"); - } - ccode++; - } - else - { - printmap = TRUE; - ccode = code + 1; - } - - /* Print a bit map */ - - if (printmap) - { - map = (uint8_t *)ccode; - if (invertmap) - { - for (i = 0; i < 32; i++) inverted_map[i] = ~map[i]; - map = inverted_map; - } - - for (i = 0; i < 256; i++) - { - if ((map[i/8] & (1 << (i&7))) != 0) - { - int j; - for (j = i+1; j < 256; j++) - if ((map[j/8] & (1 << (j&7))) == 0) break; - if (i == '-' || i == ']') fprintf(f, "\\"); - if (PRINTABLE(i)) fprintf(f, "%c", i); - else fprintf(f, "\\x%02x", i); - if (--j > i) - { - if (j != i + 1) fprintf(f, "-"); - if (j == '-' || j == ']') fprintf(f, "\\"); - if (PRINTABLE(j)) fprintf(f, "%c", j); - else fprintf(f, "\\x%02x", j); - } - i = j; - } - } - ccode += 32 / sizeof(PCRE2_UCHAR); - } - - /* For an XCLASS there is always some additional data */ - - if (*code == OP_XCLASS) - { - PCRE2_UCHAR ch; - while ((ch = *ccode++) != XCL_END) - { - BOOL not = FALSE; - const char *notch = ""; - - switch(ch) - { - case XCL_NOTPROP: - not = TRUE; - notch = "^"; - /* Fall through */ - - case XCL_PROP: - { - unsigned int ptype = *ccode++; - unsigned int pvalue = *ccode++; - - switch(ptype) - { - case PT_PXGRAPH: - fprintf(f, "[:%sgraph:]", notch); - break; - - case PT_PXPRINT: - fprintf(f, "[:%sprint:]", notch); - break; - - case PT_PXPUNCT: - fprintf(f, "[:%spunct:]", notch); - break; - - default: - fprintf(f, "\\%c{%s}", (not? 'P':'p'), - get_ucpname(ptype, pvalue)); - break; - } - } - break; - - default: - ccode += 1 + print_char(f, ccode, utf); - if (ch == XCL_RANGE) - { - fprintf(f, "-"); - ccode += 1 + print_char(f, ccode, utf); - } - break; - } - } - } - - /* Indicate a non-UTF class which was created by negation */ - - fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : ""); - - /* Handle repeats after a class or a back reference */ - - CLASS_REF_REPEAT: - switch(*ccode) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - case OP_CRPOSSTAR: - case OP_CRPOSPLUS: - case OP_CRPOSQUERY: - fprintf(f, "%s", OP_names[*ccode]); - extra += OP_lengths[*ccode]; - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - case OP_CRPOSRANGE: - min = GET2(ccode,1); - max = GET2(ccode,1 + IMM2_SIZE); - if (max == 0) fprintf(f, "{%u,}", min); - else fprintf(f, "{%u,%u}", min, max); - if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); - else if (*ccode == OP_CRPOSRANGE) fprintf(f, "+"); - extra += OP_lengths[*ccode]; - break; - - /* Do nothing if it's not a repeat; this code stops picky compilers - warning about the lack of a default code path. */ - - default: - break; - } - } - break; - - case OP_MARK: - case OP_PRUNE_ARG: - case OP_SKIP_ARG: - case OP_THEN_ARG: - fprintf(f, " %s ", OP_names[*code]); - print_custring_bylen(f, code + 2, code[1]); - extra += code[1]; - break; - - case OP_THEN: - fprintf(f, " %s", OP_names[*code]); - break; - - case OP_CIRCM: - case OP_DOLLM: - flag = "/m"; - /* Fall through */ - - /* Anything else is just an item with no data, but possibly a flag. */ - - default: - fprintf(f, " %s %s", flag, OP_names[*code]); - break; - } - - code += OP_lengths[*code] + extra; - fprintf(f, "\n"); - } -} - -/* End of pcre2_printint.c */ diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 79a9936785..35ddb41215 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -440,12 +440,17 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, if (data.missingFlags(QFileSystemMetaData::LinkType)) QFileSystemEngine::fillMetaData(link, data, QFileSystemMetaData::LinkType); - QString ret; + QString target; if (data.isLnkFile()) - ret = readLink(link); + target = readLink(link); else if (data.isLink()) - ret = readSymLink(link); - return QFileSystemEntry(ret); + target = readSymLink(link); + QFileSystemEntry ret(target); + if (!target.isEmpty() && ret.isRelative()) { + target.prepend(absoluteName(link).path() + QLatin1Char('/')); + ret = QFileSystemEntry(QDir::cleanPath(target)); + } + return ret; } //static diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 907ba09676..a211d8e8ca 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -79,7 +79,7 @@ public: return r < other.r || (r == other.r && (c < other.c || (c == other.c && (i < other.i - || (i == other.i && m < other.m ))))); + || (i == other.i && std::less<const QAbstractItemModel *>()(m, other.m)))))); } private: inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 481971f21a..99aaed0444 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -117,9 +117,9 @@ void QBasicDrag::disableEventFilter() } -static inline QPoint getNativeMousePos(QEvent *e, QObject *o) +static inline QPoint getNativeMousePos(QEvent *e, QWindow *window) { - return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), qobject_cast<QWindow*>(o)); + return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), window); } bool QBasicDrag::eventFilter(QObject *o, QEvent *e) @@ -156,14 +156,14 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) case QEvent::MouseMove: { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); move(nativePosition); return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: disableEventFilter(); if (canDrop()) { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); drop(nativePosition); } else { cancel(); diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 4281a870a7..e8669dcec8 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -1,7 +1,6 @@ # Qt network access module HEADERS += \ - access/qftp_p.h \ access/qhttpnetworkheader_p.h \ access/qhttpnetworkrequest_p.h \ access/qhttpnetworkreply_p.h \ @@ -18,7 +17,6 @@ HEADERS += \ access/qnetworkaccessdebugpipebackend_p.h \ access/qnetworkaccessfilebackend_p.h \ access/qnetworkaccesscachebackend_p.h \ - access/qnetworkaccessftpbackend_p.h \ access/qnetworkcookie.h \ access/qnetworkcookie_p.h \ access/qnetworkcookiejar.h \ @@ -33,8 +31,6 @@ HEADERS += \ access/qnetworkreplyfileimpl_p.h \ access/qabstractnetworkcache_p.h \ access/qabstractnetworkcache.h \ - access/qnetworkdiskcache_p.h \ - access/qnetworkdiskcache.h \ access/qhttpthreaddelegate_p.h \ access/qhttpmultipart.h \ access/qhttpmultipart_p.h \ @@ -45,7 +41,6 @@ HEADERS += \ access/qhstsstore_p.h SOURCES += \ - access/qftp.cpp \ access/qhttpnetworkheader.cpp \ access/qhttpnetworkrequest.cpp \ access/qhttpnetworkreply.cpp \ @@ -61,7 +56,6 @@ SOURCES += \ access/qnetworkaccessdebugpipebackend.cpp \ access/qnetworkaccessfilebackend.cpp \ access/qnetworkaccesscachebackend.cpp \ - access/qnetworkaccessftpbackend.cpp \ access/qnetworkcookie.cpp \ access/qnetworkcookiejar.cpp \ access/qnetworkrequest.cpp \ @@ -71,7 +65,6 @@ SOURCES += \ access/qnetworkreplyhttpimpl.cpp \ access/qnetworkreplyfileimpl.cpp \ access/qabstractnetworkcache.cpp \ - access/qnetworkdiskcache.cpp \ access/qhttpthreaddelegate.cpp \ access/qhttpmultipart.cpp \ access/qnetworkfile.cpp \ @@ -80,6 +73,24 @@ SOURCES += \ access/qhstspolicy.cpp \ access/qhstsstore.cpp +qtConfig(ftp) { + HEADERS += \ + access/qftp_p.h \ + access/qnetworkaccessftpbackend_p.h + + SOURCES += \ + access/qftp.cpp \ + access/qnetworkaccessftpbackend.cpp +} + +qtConfig(networkdiskcache) { + HEADERS += \ + access/qnetworkdiskcache_p.h \ + access/qnetworkdiskcache.h + + SOURCES += access/qnetworkdiskcache.cpp +} + mac: LIBS_PRIVATE += -framework Security include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 47579ba654..762ef00225 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -43,8 +43,6 @@ #include "private/qftp_p.h" #include "qabstractsocket.h" -#ifndef QT_NO_FTP - #include "qcoreapplication.h" #include "qtcpsocket.h" #include "qurlinfo_p.h" @@ -2453,5 +2451,3 @@ QT_END_NAMESPACE #include "qftp.moc" #include "moc_qftp_p.cpp" - -#endif // QT_NO_FTP diff --git a/src/network/access/qftp_p.h b/src/network/access/qftp_p.h index 6cf5116798..bba1f9b09d 100644 --- a/src/network/access/qftp_p.h +++ b/src/network/access/qftp_p.h @@ -56,10 +56,9 @@ #include <private/qurlinfo_p.h> #include <QtCore/qobject.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(ftp); -#ifndef QT_NO_FTP +QT_BEGIN_NAMESPACE class QFtpPrivate; @@ -169,8 +168,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_piFtpReply(int, const QString&)) }; -#endif // QT_NO_FTP - QT_END_NAMESPACE #endif // QFTP_P_H diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 95d87d909c..0c9a88596d 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -42,7 +42,9 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" #include "qfileinfo.h" +#if QT_CONFIG(ftp) #include "qurlinfo_p.h" +#endif #include "qdir.h" #include "qcoreapplication.h" diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 604394383d..a5e7daff11 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -39,7 +39,9 @@ #include "qnetworkaccessfilebackend_p.h" #include "qfileinfo.h" +#if QT_CONFIG(ftp) #include "qurlinfo_p.h" +#endif #include "qdir.h" #include "private/qnoncontiguousbytedevice_p.h" diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 6d1ee645fe..0df2569e87 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -43,8 +43,6 @@ #include "private/qnoncontiguousbytedevice_p.h" #include <QStringList> -#ifndef QT_NO_FTP - QT_BEGIN_NAMESPACE enum { @@ -382,5 +380,3 @@ void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text) } QT_END_NAMESPACE - -#endif // QT_NO_FTP diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index cdf6b7a07f..0f26d05327 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -60,7 +60,7 @@ #include "QtCore/qpointer.h" -#ifndef QT_NO_FTP +QT_REQUIRE_CONFIG(ftp); QT_BEGIN_NAMESPACE @@ -122,6 +122,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_FTP - #endif diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 15a0359391..8bbef0a0d8 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -51,7 +51,9 @@ #include "QtNetwork/qnetworksession.h" #include "QtNetwork/private/qsharednetworksession_p.h" +#if QT_CONFIG(ftp) #include "qnetworkaccessftpbackend_p.h" +#endif #include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessdebugpipebackend_p.h" #include "qnetworkaccesscachebackend_p.h" @@ -76,9 +78,9 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend) -#ifndef QT_NO_FTP +#if QT_CONFIG(ftp) Q_GLOBAL_STATIC(QNetworkAccessFtpBackendFactory, ftpBackend) -#endif // QT_NO_FTP +#endif // QT_CONFIG(ftp) #ifdef QT_BUILD_INTERNAL Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend) @@ -146,7 +148,7 @@ bool getProxyAuth(const QString& proxyHostname, const QString &scheme, QString& static void ensureInitialized() { -#ifndef QT_NO_FTP +#if QT_CONFIG(ftp) (void) ftpBackend(); #endif diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index d72791c1f0..fca880d9b3 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -60,8 +60,6 @@ #define MAX_COMPRESSION_SIZE (1024 * 1024 * 3) -#ifndef QT_NO_NETWORKDISKCACHE - QT_BEGIN_NAMESPACE /*! @@ -737,5 +735,3 @@ bool QCacheItem::read(QFile *device, bool readData) } QT_END_NAMESPACE - -#endif // QT_NO_NETWORKDISKCACHE diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h index a3aa8d3a07..0e9258f6de 100644 --- a/src/network/access/qnetworkdiskcache.h +++ b/src/network/access/qnetworkdiskcache.h @@ -43,10 +43,9 @@ #include <QtNetwork/qtnetworkglobal.h> #include <QtNetwork/qabstractnetworkcache.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(networkdiskcache); -#ifndef QT_NO_NETWORKDISKCACHE +QT_BEGIN_NAMESPACE class QNetworkDiskCachePrivate; class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache @@ -84,8 +83,6 @@ private: Q_DISABLE_COPY(QNetworkDiskCache) }; -#endif // QT_NO_NETWORKDISKCACHE - QT_END_NAMESPACE #endif // QNETWORKDISKCACHE_H diff --git a/src/network/access/qnetworkdiskcache_p.h b/src/network/access/qnetworkdiskcache_p.h index e47b93b09d..f7988e7dda 100644 --- a/src/network/access/qnetworkdiskcache_p.h +++ b/src/network/access/qnetworkdiskcache_p.h @@ -58,7 +58,7 @@ #include <qhash.h> #include <qtemporaryfile.h> -#ifndef QT_NO_NETWORKDISKCACHE +QT_REQUIRE_CONFIG(networkdiskcache); QT_BEGIN_NAMESPACE @@ -123,6 +123,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_NETWORKDISKCACHE - #endif // QNETWORKDISKCACHE_P_H diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index ac6bebbfae..716f745bc9 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -17,8 +17,7 @@ HEADERS += kernel/qtnetworkglobal.h \ kernel/qnetworkdatagram_p.h \ kernel/qnetworkinterface.h \ kernel/qnetworkinterface_p.h \ - kernel/qnetworkproxy.h \ - kernel/qurlinfo_p.h + kernel/qnetworkproxy.h SOURCES += kernel/qauthenticator.cpp \ kernel/qdnslookup.cpp \ @@ -26,8 +25,12 @@ SOURCES += kernel/qauthenticator.cpp \ kernel/qhostinfo.cpp \ kernel/qnetworkdatagram.cpp \ kernel/qnetworkinterface.cpp \ - kernel/qnetworkproxy.cpp \ - kernel/qurlinfo.cpp + kernel/qnetworkproxy.cpp + +qtConfig(ftp) { + HEADERS += kernel/qurlinfo_p.h + SOURCES += kernel/qurlinfo.cpp +} unix { !integrity: SOURCES += kernel/qdnslookup_unix.cpp diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 37f3f84653..6b53b4b58e 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -227,7 +227,9 @@ #ifndef QT_NO_NETWORKPROXY #include "private/qnetworkrequest_p.h" +#if QT_CONFIG(socks5) #include "private/qsocks5socketengine_p.h" +#endif #include "private/qhttpsocketengine_p.h" #include "qauthenticator.h" #include "qdebug.h" @@ -251,7 +253,7 @@ public: : mutex(QMutex::Recursive) , applicationLevelProxy(0) , applicationLevelProxyFactory(0) -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) , socks5SocketEngineHandler(0) #endif #ifndef QT_NO_HTTP @@ -263,7 +265,7 @@ public: , useSystemProxies(false) #endif { -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); #endif #ifndef QT_NO_HTTP @@ -275,7 +277,7 @@ public: { delete applicationLevelProxy; delete applicationLevelProxyFactory; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) delete socks5SocketEngineHandler; #endif #ifndef QT_NO_HTTP @@ -335,7 +337,7 @@ private: QMutex mutex; QNetworkProxy *applicationLevelProxy; QNetworkProxyFactory *applicationLevelProxyFactory; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QSocks5SocketEngineHandler *socks5SocketEngineHandler; #endif #ifndef QT_NO_HTTP diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp index 300a51d3e7..7ae6822fb4 100644 --- a/src/network/kernel/qurlinfo.cpp +++ b/src/network/kernel/qurlinfo.cpp @@ -39,8 +39,6 @@ #include "qurlinfo_p.h" -#ifndef QT_NO_FTP - #include "qurl.h" #include "qdir.h" #include <limits.h> @@ -727,5 +725,3 @@ bool QUrlInfo::isValid() const } QT_END_NAMESPACE - -#endif // QT_NO_FTP diff --git a/src/network/kernel/qurlinfo_p.h b/src/network/kernel/qurlinfo_p.h index 3a430a3321..8180796f49 100644 --- a/src/network/kernel/qurlinfo_p.h +++ b/src/network/kernel/qurlinfo_p.h @@ -56,10 +56,9 @@ #include <QtCore/qstring.h> #include <QtCore/qiodevice.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(ftp); -#ifndef QT_NO_FTP +QT_BEGIN_NAMESPACE class QUrl; class QUrlInfoPrivate; @@ -129,8 +128,6 @@ private: QUrlInfoPrivate *d; }; -#endif // QT_NO_FTP - QT_END_NAMESPACE #endif // QURLINFO_H diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 2847b910f3..fa5f198bf2 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -39,8 +39,6 @@ #include "qsocks5socketengine_p.h" -#ifndef QT_NO_SOCKS5 - #include "qtcpsocket.h" #include "qudpsocket.h" #include "qtcpserver.h" @@ -1938,6 +1936,4 @@ QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr so return 0; } -#endif // QT_NO_SOCKS5 - QT_END_NAMESPACE diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index ec50d71283..b248554ae5 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -55,9 +55,9 @@ #include "qabstractsocketengine_p.h" #include "qnetworkproxy.h" -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(socks5); -#ifndef QT_NO_SOCKS5 +QT_BEGIN_NAMESPACE class QSocks5SocketEnginePrivate; @@ -291,7 +291,6 @@ public: virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) Q_DECL_OVERRIDE; }; - QT_END_NAMESPACE -#endif // QT_NO_SOCKS5 + #endif // QSOCKS5SOCKETENGINE_H diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 9b62240767..5c9ebac283 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2293,6 +2293,9 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode) q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)), q, SLOT(_q_channelBytesWrittenSlot(int, qint64)), Qt::DirectConnection); + q->connect(plainSocket, SIGNAL(readChannelFinished()), + q, SLOT(_q_readChannelFinishedSlot()), + Qt::DirectConnection); #ifndef QT_NO_NETWORKPROXY q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); @@ -2514,6 +2517,15 @@ void QSslSocketPrivate::_q_channelBytesWrittenSlot(int channel, qint64 written) /*! \internal */ +void QSslSocketPrivate::_q_readChannelFinishedSlot() +{ + Q_Q(QSslSocket); + emit q->readChannelFinished(); +} + +/*! + \internal +*/ void QSslSocketPrivate::_q_flushWriteBuffer() { Q_Q(QSslSocket); diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index 1b29cd4637..39e70bccda 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -224,6 +224,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int)) Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64)) Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64)) + Q_PRIVATE_SLOT(d_func(), void _q_readChannelFinishedSlot()) Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation()) diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 5e5a8d2371..00fda43b7e 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -180,6 +180,7 @@ public: void _q_channelReadyReadSlot(int); void _q_bytesWrittenSlot(qint64); void _q_channelBytesWrittenSlot(int, qint64); + void _q_readChannelFinishedSlot(); void _q_flushWriteBuffer(); void _q_flushReadBuffer(); void _q_resumeImplementation(); diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index d3e4daa341..58b700b93f 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1621,6 +1621,7 @@ void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont) m_uniqueFontData[uniqueFont].refCount.ref(); } +// ### fixme Qt 6 (QTBUG-58610): See comment at QWindowsFontDatabase::systemDefaultFont() HFONT QWindowsFontDatabase::systemFont() { static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); @@ -1961,12 +1962,31 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q QFont QWindowsFontDatabase::systemDefaultFont() { +#if QT_VERSION >= 0x060000 + // Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610) + NONCLIENTMETRICS ncm; + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); + const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont); +#else LOGFONT lf; GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf); QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf); // "MS Shell Dlg 2" is the correct system font >= Win2k if (systemFont.family() == QLatin1String("MS Shell Dlg")) systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); + // Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to + // obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been + // long deprecated; the message font of the NONCLIENTMETRICS structure obtained by + // SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see + // QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger. + // In single monitor setups, the point sizes revolve around 8 (depending on UI + // scale factor, but not proportional to it). However, in multi monitor setups, + // where the DPI of the primary monitor are smaller than those of the secondary, + // large bogus values are returned. Limit to 8.25 in that case. + if (GetSystemMetrics(SM_CMONITORS) > 1 && systemFont.pointSizeF() > 8.25) + systemFont.setPointSizeF(8.25); +#endif // Qt 5 qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont; return systemFont; } diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm index 9e3d747cd7..9221099a57 100644 --- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm @@ -124,7 +124,22 @@ void QCocoaInputContext::connectSignals() void QCocoaInputContext::focusObjectChanged(QObject *focusObject) { Q_UNUSED(focusObject); - mWindow = QGuiApplication::focusWindow(); + if (mWindow == QGuiApplication::focusWindow()) { + if (!mWindow) + return; + + QCocoaWindow *window = static_cast<QCocoaWindow *>(mWindow->handle()); + QNSView *view = qnsview_cast(window->view()); + if (!view) + return; + + if (NSTextInputContext *ctxt = [NSTextInputContext currentInputContext]) { + [ctxt discardMarkedText]; + [view cancelComposingText]; + } + } else { + mWindow = QGuiApplication::focusWindow(); + } } void QCocoaInputContext::updateLocale() diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index a031853422..f8903725a6 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -63,6 +63,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); Qt::MouseButtons m_acceptedMouseDowns; Qt::MouseButtons m_frameStrutButtons; QString m_composingText; + QPointer<QObject> m_composingFocusObject; bool m_sendKeyEvent; QStringList *currentCustomDragTypes; bool m_dontOverrideCtrlLMB; @@ -93,6 +94,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); - (void)textInputContextKeyboardSelectionDidChangeNotification : (NSNotification *) textInputContextKeyboardSelectionDidChangeNotification; - (void)viewDidHide; - (void)removeFromSuperview; +- (void)cancelComposingText; - (BOOL)isFlipped; - (BOOL)acceptsFirstResponder; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 16207d8de8..011bbd9d08 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1544,6 +1544,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } m_composingText.clear(); + m_composingFocusObject = nullptr; } - (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange @@ -1598,6 +1599,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_composingText = preeditString; if (QObject *fo = m_platformWindow->window()->focusObject()) { + m_composingFocusObject = fo; QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1610,6 +1612,25 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } +- (void)cancelComposingText +{ + if (m_composingText.isEmpty()) + return; + + if (m_composingFocusObject) { + QInputMethodQueryEvent queryEvent(Qt::ImEnabled); + if (QCoreApplication::sendEvent(m_composingFocusObject, &queryEvent)) { + if (queryEvent.value(Qt::ImEnabled).toBool()) { + QInputMethodEvent e; + QCoreApplication::sendEvent(m_composingFocusObject, &e); + } + } + } + + m_composingText.clear(); + m_composingFocusObject = nullptr; +} + - (void) unmarkText { if (!m_composingText.isEmpty()) { @@ -1625,6 +1646,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } m_composingText.clear(); + m_composingFocusObject = nullptr; } - (BOOL) hasMarkedText diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 6d4b7922db..7683f0da4d 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -65,6 +65,7 @@ #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformnativeinterface.h> #include <QtGui/QGuiApplication> +#include <QtGui/QOpenGLContext> #include <QtCore/QSet> #include <QtCore/QHash> @@ -867,6 +868,18 @@ static inline bool resizeOnDpiChanged(const QWindow *w) return result; } +static bool shouldHaveNonClientDpiScaling(const QWindow *window) +{ + return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 + && window->isTopLevel() + && !window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid() +#if QT_CONFIG(opengl) // /QTBUG-62901, EnableNonClientDpiScaling has problems with GL + && (window->surfaceType() != QSurface::OpenGLSurface + || QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) +#endif + ; +} + /*! \brief Main windows procedure registered for windows. @@ -988,10 +1001,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::NonClientCreate: - if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel() - && !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) { + if (shouldHaveNonClientDpiScaling(d->m_creationContext->window)) enableNonClientDpiScaling(msg.hwnd); - } return false; case QtWindows::CalculateSize: return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result); diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index c10f990b19..5449807cde 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -77,7 +77,9 @@ #include <qlineedit.h> #include <qmainwindow.h> #include <qmdisubwindow.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #include <qpaintdevice.h> #include <qpainter.h> #include <qpixmapcache.h> @@ -838,7 +840,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg #endif else if (qobject_cast<const QHeaderView *>(widg)) ct = QStyle::CT_HeaderSection; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) else if (qobject_cast<const QMenuBar *>(widg)) ct = QStyle::CT_MenuBar; #endif diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 9c3280784a..69de4c960d 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -80,7 +80,9 @@ #endif #include <qmainwindow.h> #include <qmap.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #include <qpaintdevice.h> #include <qpainter.h> #include <qpixmapcache.h> diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 60a5c25b1f..016a2f3ccc 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -1869,7 +1869,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption sz.setHeight(minimumHeight); } return sz; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(windowsItemHMargin * 5 + 1, 5); diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 9880edf0b4..347b0f28f9 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -72,7 +72,9 @@ #if QT_CONFIG(listview) #include <qlistview.h> #endif +#if QT_CONFIG(stackedwidget) #include <qstackedwidget.h> +#endif #if QT_CONFIG(pushbutton) #include <qpushbutton.h> #endif @@ -3665,7 +3667,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_Menu: sz += QSize(1, 0); break; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(windowsItemHMargin * 5 + 1, 6); diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index e8cec22c09..abc704fa18 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -38,6 +38,7 @@ "label": "CUPS job control widget", "section": "Widgets", "condition": [ + "features.buttongroup", "features.calendarwidget", "features.checkbox", "features.combobox", diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 51c8a593a1..71312d65f1 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -63,7 +63,9 @@ #include <QtWidgets/qdialogbuttonbox.h> +#if QT_CONFIG(completer) #include <private/qcompleter_p.h> +#endif #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" @@ -679,7 +681,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * } widget.properties->setEnabled(true); -#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER) +#if QT_CONFIG(filesystemmodel) && QT_CONFIG(completer) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 166622e950..8f55c1801f 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -94,8 +94,10 @@ namespace QTest extern int Q_TESTLIB_EXPORT defaultMouseDelay(); // pos is in window local coordinates - if (window->geometry().width() <= pos.x() || window->geometry().height() <= pos.y()) { - QTest::qWarn("Mouse event occurs outside of target window."); + const QSize windowSize = window->geometry().size(); + if (windowSize.width() <= pos.x() || windowSize.height() <= pos.y()) { + QTest::qWarn(qPrintable(QString::fromLatin1("Mouse event at %1, %2 occurs outside of target window (%3x%4).") + .arg(pos.x()).arg(pos.y()).arg(windowSize.width()).arg(windowSize.height()))); } if (delay == -1 || delay < defaultMouseDelay()) diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index efbca0331d..7c19c5d20c 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -60,7 +60,9 @@ #include <qwhatsthis.h> #endif #include <QAbstractScrollArea> +#if QT_CONFIG(scrollarea) #include <QScrollArea> +#endif #if QT_CONFIG(scrollbar) #include <QScrollBar> #endif @@ -388,7 +390,7 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam #endif // QT_CONFIG(combobox) -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) // ======================= QAccessibleAbstractScrollArea ======================= QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget) : QAccessibleWidget(widget, QAccessible::Client) @@ -497,7 +499,7 @@ QAccessibleScrollArea::QAccessibleScrollArea(QWidget *widget) { Q_ASSERT(qobject_cast<QScrollArea *>(widget)); } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h index 6f5c950631..1887f98dca 100644 --- a/src/widgets/accessible/complexwidgets_p.h +++ b/src/widgets/accessible/complexwidgets_p.h @@ -70,7 +70,7 @@ class QTitleBar; class QAbstractScrollArea; class QScrollArea; -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QAccessibleAbstractScrollArea : public QAccessibleWidget { public: @@ -105,7 +105,7 @@ class QAccessibleScrollArea : public QAccessibleAbstractScrollArea public: explicit QAccessibleScrollArea(QWidget *widget); }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) #if QT_CONFIG(tabbar) class QAccessibleTabBar : public QAccessibleWidget diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index ae50bbaef0..715bf1c53f 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -40,7 +40,9 @@ #include "qaccessiblemenu_p.h" #include <qmenu.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #include <QtWidgets/QAction> #include <qstyle.h> @@ -139,7 +141,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const return -1; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w) : QAccessibleWidget(w, QAccessible::MenuBar) { @@ -173,7 +175,7 @@ int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const return -1; } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action) : m_action(action), m_owner(owner) @@ -253,13 +255,13 @@ QRect QAccessibleMenuItem::rect() const { QRect rect; QWidget *own = owner(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) { rect = menuBar->actionGeometry(m_action); QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0)); rect = rect.translated(globalPos); } else -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (QMenu *menu = qobject_cast<QMenu*>(own)) { rect = menu->actionGeometry(m_action); QPoint globalPos = menu->mapToGlobal(QPoint(0,0)); @@ -289,7 +291,7 @@ QAccessible::State QAccessibleMenuItem::state() const if (QMenu *menu = qobject_cast<QMenu*>(own)) { if (menu->activeAction() == m_action) s.focused = true; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) { if (menuBar->activeAction() == m_action) s.focused = true; diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h index 52afeb5a04..35dcd9bad1 100644 --- a/src/widgets/accessible/qaccessiblemenu_p.h +++ b/src/widgets/accessible/qaccessiblemenu_p.h @@ -82,7 +82,7 @@ protected: QMenu *menu() const; }; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) class QAccessibleMenuBar : public QAccessibleWidget { public: @@ -96,7 +96,7 @@ public: protected: QMenuBar *menuBar() const; }; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 3fbc9714f5..0865281202 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -138,7 +138,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje #endif } else if (classname == QLatin1String("QToolBar")) { iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (classname == QLatin1String("QMenuBar")) { iface = new QAccessibleMenuBar(widget); #endif @@ -177,7 +177,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje iface = new QAccessibleDisplay(widget, QAccessible::ToolTip); } else if (classname == QLatin1String("QFrame")) { iface = new QAccessibleWidget(widget, QAccessible::Border); -#ifndef QT_NO_STACKEDWIDGET +#if QT_CONFIG(stackedwidget) } else if (classname == QLatin1String("QStackedWidget")) { iface = new QAccessibleStackedWidget(widget); #endif @@ -207,7 +207,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QTextBrowser")) { iface = new QAccessibleTextBrowser(widget); #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) } else if (classname == QLatin1String("QAbstractScrollArea")) { iface = new QAccessibleAbstractScrollArea(widget); } else if (classname == QLatin1String("QScrollArea")) { diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 4e7ba78620..0ac7d736f8 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -52,7 +52,9 @@ #endif #include "qdebug.h" #include <QApplication> +#if QT_CONFIG(stackedwidget) #include <QStackedWidget> +#endif #if QT_CONFIG(toolbox) #include <QToolBox> #endif @@ -310,7 +312,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex) #endif // QT_NO_TEXTEDIT && QT_NO_CURSOR -#ifndef QT_NO_STACKEDWIDGET +#if QT_CONFIG(stackedwidget) // ======================= QAccessibleStackedWidget ====================== QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget) : QAccessibleWidget(widget, QAccessible::LayeredPane) @@ -356,7 +358,7 @@ QStackedWidget *QAccessibleStackedWidget::stackedWidget() const { return static_cast<QStackedWidget *>(object()); } -#endif // QT_NO_STACKEDWIDGET +#endif // QT_CONFIG(stackedwidget) #if QT_CONFIG(toolbox) // ======================= QAccessibleToolBox ====================== diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 2c183dad65..4c596c09a5 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -74,7 +74,8 @@ "effects": { "label": "Effects", "purpose": "Provides special widget effects (e.g. fading and scrolling).", - "section": "Kernel" + "section": "Kernel", + "output": [ "privateFeature" ] }, "filesystemmodel": { "label": "QFileSystemModel", diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 97afce1734..8d0161d96b 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -4130,7 +4130,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const return parts; } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) QT_END_NAMESPACE diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index f7a3c6b091..371826eccc 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -69,7 +69,9 @@ #include <qstackedwidget.h> #include <qdialogbuttonbox.h> #include <qabstractproxymodel.h> +#if QT_CONFIG(completer) #include <qcompleter.h> +#endif #include <qpointer.h> #include <qdebug.h> #include "qsidebar_p.h" diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 129c12885a..56edd019bb 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -41,7 +41,9 @@ #include "qapplication.h" #include "qlayoutengine_p.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" +#endif #include "qtoolbar.h" #include "qsizegrip.h" #include "qevent.h" @@ -583,7 +585,7 @@ void QLayoutPrivate::doResize(const QSize &r) const int mbTop = rect.top(); rect.setTop(mbTop + mbh); q->setGeometry(rect); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (menubar) menubar->setGeometry(rect.left(), mbTop, r.width(), mbh); #endif @@ -615,7 +617,7 @@ void QLayout::widgetEvent(QEvent *e) { QChildEvent *c = (QChildEvent *)e; if (c->child()->isWidgetType()) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (c->child() == d->menubar) d->menubar = 0; #endif @@ -664,7 +666,7 @@ int QLayout::totalHeightForWidth(int w) const top += wd->topmargin + wd->bottommargin; } int h = heightForWidth(w - side) + top; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) h += menuBarHeightForWidth(d->menubar, w); #endif return h; @@ -687,7 +689,7 @@ QSize QLayout::totalMinimumSize() const } QSize s = minimumSize(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width() + side); #endif return s + QSize(side, top); @@ -712,7 +714,7 @@ QSize QLayout::totalSizeHint() const QSize s = sizeHint(); if (hasHeightForWidth()) s.setHeight(heightForWidth(s.width() + side)); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); #endif return s + QSize(side, top); @@ -735,7 +737,7 @@ QSize QLayout::totalMaximumSize() const } QSize s = maximumSize(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); #endif @@ -813,7 +815,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) Q_Q(QLayout); int n = q->count(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (menubar && menubar->parentWidget() != mw) { menubar->setParent(mw); } diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 51793bf060..0bdac43c56 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -41,7 +41,9 @@ #include "qapplication.h" #include "qlayoutengine_p.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" +#endif #include "qtoolbar.h" #include "qevent.h" #include "qstyle.h" diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 891cf563d6..18376bb183 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -46,7 +46,9 @@ #include <qwhatsthis.h> #endif #include <qmenu.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #include <qapplication.h> #include <private/qapplication_p.h> #include <private/qshortcutmap_p.h> @@ -143,7 +145,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(w)) { if (menuBar->isNativeMenuBar()) visible = true; @@ -208,7 +210,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR) +#if defined(Q_OS_DARWIN) && QT_CONFIG(menubar) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) visible = true; #endif diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 813b64b2dd..80dc65e2d2 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -40,6 +40,8 @@ # include <private/qcore_mac_p.h> #endif +#include <QtWidgets/private/qtwidgetsglobal_p.h> + #include <qapplication.h> #include <qdesktopwidget.h> #include <private/qdesktopwidget_p.h> @@ -49,7 +51,9 @@ #include <qstyleoption.h> #include <qstylepainter.h> #include <qtimer.h> +#if QT_CONFIG(effects) #include <private/qeffects_p.h> +#endif #include <qtextdocument.h> #include <qdebug.h> #include <private/qstylesheetstyle_p.h> @@ -286,7 +290,7 @@ void QTipLabel::timerEvent(QTimerEvent *e) || e->timerId() == expireTimer.timerId()){ hideTimer.stop(); expireTimer.stop(); -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(effects) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ // Fade out tip on mac (makes it invisible). // The tip will not be deleted until a new tip is shown. @@ -506,7 +510,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label")); -#if !defined(QT_NO_EFFECTS) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ +#if QT_CONFIG(effects) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) qFadeEffect(QTipLabel::instance); else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b38f046c21..b8ec5774b0 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2439,7 +2439,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int { Q_Q(const QWidget); -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) bool resetBrushOrigin = false; QPointF oldBrushOrigin; //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture @@ -2452,7 +2452,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int painter->setBrushOrigin(-priv->contentsOffset()); } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) const QBrush autoFillBrush = q->palette().brush(q->backgroundRole()); @@ -2479,10 +2479,10 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q); } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (resetBrushOrigin) painter->setBrushOrigin(oldBrushOrigin); -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) } /* diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index a17c69c5ce..e509f522d8 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -101,7 +101,7 @@ public: #ifndef QT_NO_MDIAREA || qobject_cast<QMdiSubWindow *>(p) != 0 #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) || qobject_cast<QAbstractScrollArea *>(p) != 0 #endif ) { diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index d5b8d2b32b..1f3198907f 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1392,7 +1392,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2); break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CE_MenuBarItem: if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip @@ -1412,7 +1412,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) p->eraseRect(opt->rect); break; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(progressbar) case CE_ProgressBar: if (const QStyleOptionProgressBar *pb diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index fa964a09b8..44ab9079b0 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -46,7 +46,9 @@ #include <qdebug.h> #include <qapplication.h> #include <qmenu.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #include <qpainter.h> #include <qstyleoption.h> #include <qlineedit.h> @@ -1662,7 +1664,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (qobject_cast<const QMenuBar *>(w)) return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); #endif @@ -2365,7 +2367,7 @@ static QWidget *embeddedWidget(QWidget *w) return sb->findChild<QLineEdit *>(); #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) return sa->viewport(); #endif @@ -2396,7 +2398,7 @@ static QWidget *containerWidget(const QWidget *w) } #endif // QT_NO_LINEEDIT -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) { if (sa->viewport() == w) return w->parentWidget(); @@ -2800,7 +2802,7 @@ void QStyleSheetStyle::polish(QWidget *w) } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) { QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled); if ((rule.hasBorder() && rule.border()->hasBorderImage()) @@ -2831,7 +2833,7 @@ void QStyleSheetStyle::polish(QWidget *w) #ifndef QT_NO_MDIAREA || qobject_cast<QMdiSubWindow *>(w) #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) || qobject_cast<QMenuBar *>(w) #endif #if QT_CONFIG(dialog) @@ -2902,7 +2904,7 @@ void QStyleSheetStyle::unpolish(QWidget *w) w->setProperty("_q_stylesheet_maxh", QVariant()); w->setAttribute(Qt::WA_StyleSheet, false); QObject::disconnect(w, 0, this, 0); -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) { QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), sa, SLOT(update())); @@ -4374,7 +4376,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op } break; } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) { const QAbstractScrollAreaPrivate *sap = sa->d_func(); rule.drawBackground(p, opt->rect, sap->contentsOffset()); diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 818c3ea07e..2cdfebae0a 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -47,8 +47,10 @@ #include "qdrawutil.h" // for now #include "qevent.h" #include "qmenu.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" #include <private/qmenubar_p.h> +#endif #include "qpaintengine.h" #include "qpainter.h" #if QT_CONFIG(rubberband) @@ -166,7 +168,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) // Update state and repaint the menu bars. d->alt_down = false; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QList<QMenuBar *> l = widget->findChildren<QMenuBar *>(); for (int i = 0; i < l.size(); ++i) l.at(i)->update(); @@ -574,7 +576,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid // Do nothing if we always paint underlines Q_D(const QWindowsStyle); if (!ret && widget && d) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget); if (!menuBar && qobject_cast<const QMenu *>(widget)) { QWidget *w = QApplication::activeWindow(); @@ -587,7 +589,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 1; // Otherwise draw underlines if the toplevel widget has seen an alt-press } else -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (d->hasSeenAlt(widget)) { ret = 1; } @@ -1260,7 +1262,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CE_MenuBarItem: if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { bool active = mbi->state & State_Selected; @@ -1284,7 +1286,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai QCommonStyle::drawControl(ce, &newMbi, p, widget); } break; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(tabbar) case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { @@ -2392,7 +2394,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2); diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 25e08c3921..88c83b0c3f 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -143,8 +143,6 @@ #include "qcompleter_p.h" -#ifndef QT_NO_COMPLETER - #include "QtWidgets/qscrollbar.h" #include "QtCore/qstringlistmodel.h" #if QT_CONFIG(dirmodel) @@ -1920,5 +1918,3 @@ QT_END_NAMESPACE #include "moc_qcompleter.cpp" #include "moc_qcompleter_p.cpp" - -#endif // QT_NO_COMPLETER diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h index 33e6540264..1a2c2440f5 100644 --- a/src/widgets/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -47,10 +47,9 @@ #include <QtCore/qabstractitemmodel.h> #include <QtCore/qrect.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(completer); -#ifndef QT_NO_COMPLETER +QT_BEGIN_NAMESPACE class QCompleterPrivate; class QAbstractItemView; @@ -162,8 +161,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_fileSystemModelDirectoryLoaded(const QString&)) }; -#endif // QT_NO_COMPLETER - QT_END_NAMESPACE #endif // QCOMPLETER_H diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 3cb7c59b6d..179e116d51 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -55,8 +55,6 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qobject_p.h" -#ifndef QT_NO_COMPLETER - #include "QtWidgets/qabstractitemview.h" #include "QtCore/qabstractproxymodel.h" #include "qcompleter.h" @@ -64,6 +62,8 @@ #include "QtGui/qpainter.h" #include "private/qabstractproxymodel_p.h" +QT_REQUIRE_CONFIG(completer); + QT_BEGIN_NAMESPACE class QCompletionModel; @@ -258,6 +258,4 @@ class QCompletionModelPrivate : public QAbstractProxyModelPrivate QT_END_NAMESPACE -#endif // QT_NO_COMPLETER - #endif // QCOMPLETER_P_H diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 701758a406..a3bd8897f1 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -3,14 +3,19 @@ HEADERS += \ util/qsystemtrayicon.h \ util/qcolormap.h \ - util/qcompleter.h \ - util/qcompleter_p.h \ util/qsystemtrayicon_p.h SOURCES += \ util/qsystemtrayicon.cpp \ - util/qcolormap.cpp \ - util/qcompleter.cpp + util/qcolormap.cpp + +qtConfig(completer) { + HEADERS += \ + util/qcompleter.h \ + util/qcompleter_p.h + + SOURCES += util/qcompleter.cpp +} qtConfig(scroller) { HEADERS += \ diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 1d78d24a88..dbd94e890d 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -39,11 +39,13 @@ #include "private/qabstractbutton_p.h" -#include "private/qbuttongroup_p.h" #if QT_CONFIG(itemviews) #include "qabstractitemview.h" #endif +#if QT_CONFIG(buttongroup) #include "qbuttongroup.h" +#include "private/qbuttongroup_p.h" +#endif #include "qabstractbutton_p.h" #include "qevent.h" #include "qpainter.h" @@ -173,7 +175,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) #endif checkable(false), checked(false), autoRepeat(false), autoExclusive(false), down(false), blockRefresh(false), pressed(false), -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) group(0), #endif autoRepeatDelay(AUTO_REPEAT_DELAY), @@ -183,7 +185,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->buttonList; #endif @@ -192,7 +194,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const if (autoExclusive) { auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) { return !candidate->autoExclusive() -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || candidate->group() #endif ; @@ -206,7 +208,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->checkedButton; #endif @@ -226,7 +228,7 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const void QAbstractButtonPrivate::notifyChecked() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_Q(QAbstractButton); if (group) { QAbstractButton *previous = group->d_func()->checkedButton; @@ -244,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked() void QAbstractButtonPrivate::moveFocus(int key) { QList<QAbstractButton *> buttonList = queryButtonList();; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) bool exclusive = group ? group->d_func()->exclusive : autoExclusive; #else bool exclusive = autoExclusive; @@ -335,7 +337,7 @@ void QAbstractButtonPrivate::moveFocus(int key) void QAbstractButtonPrivate::fixFocusPolicy() { Q_Q(QAbstractButton); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (!group && !autoExclusive) #else if (!autoExclusive) @@ -382,7 +384,7 @@ void QAbstractButtonPrivate::click() bool changeState = true; if (checked && queryCheckedButton() == q) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group ? group->d_func()->exclusive : autoExclusive) #else if (autoExclusive) @@ -410,7 +412,7 @@ void QAbstractButtonPrivate::emitClicked() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->clicked(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonClicked(group->id(q)); if (guard && group) @@ -424,7 +426,7 @@ void QAbstractButtonPrivate::emitPressed() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->pressed(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonPressed(group->id(q)); if (guard && group) @@ -438,7 +440,7 @@ void QAbstractButtonPrivate::emitReleased() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->released(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonReleased(group->id(q)); if (guard && group) @@ -452,7 +454,7 @@ void QAbstractButtonPrivate::emitToggled(bool checked) Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->toggled(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonToggled(group->id(q), checked); if (guard && group) @@ -476,7 +478,7 @@ QAbstractButton::QAbstractButton(QWidget *parent) */ QAbstractButton::~QAbstractButton() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_D(QAbstractButton); if (d->group) d->group->removeButton(this); @@ -623,7 +625,7 @@ void QAbstractButton::setChecked(bool checked) if (!checked && d->queryCheckedButton() == this) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) return; if (d->group) @@ -798,7 +800,7 @@ bool QAbstractButton::autoExclusive() const return d->autoExclusive; } -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) /*! Returns the group that this button belongs to. @@ -812,7 +814,7 @@ QButtonGroup *QAbstractButton::group() const Q_D(const QAbstractButton); return d->group; } -#endif // QT_NO_BUTTONGROUP +#endif // QT_CONFIG(buttongroup) /*! Performs an animated click: the button is pressed immediately, and @@ -1070,7 +1072,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) #endif QWidget *pw = parentWidget(); if (d->autoExclusive -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || d->group #endif #if QT_CONFIG(itemviews) diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h index 4e438bd851..01dbf4e92d 100644 --- a/src/widgets/widgets/qabstractbutton.h +++ b/src/widgets/widgets/qabstractbutton.h @@ -108,7 +108,7 @@ public: void setAutoExclusive(bool); bool autoExclusive() const; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) QButtonGroup *group() const; #endif diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h index 8f67c0d367..39e2e399a7 100644 --- a/src/widgets/widgets/qabstractbutton_p.h +++ b/src/widgets/widgets/qabstractbutton_p.h @@ -80,7 +80,7 @@ public: uint blockRefresh :1; uint pressed : 1; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) QButtonGroup* group; #endif QBasicTimer repeatTimer; diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d9cbad4766..249ebd35d3 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -39,7 +39,7 @@ #include "qabstractscrollarea.h" -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) #include "qscrollbar.h" #include "qapplication.h" @@ -1662,4 +1662,4 @@ QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" #include "moc_qabstractscrollarea_p.cpp" -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 193fabce56..cee8481e6f 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QMargins; class QScrollBar; @@ -146,7 +146,7 @@ private: friend class QWidgetPrivate; }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index a3af77b11b..c52e7f9fd4 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QScrollBar; class QAbstractScrollAreaScrollBarContainer; @@ -149,7 +149,7 @@ private: Qt::Orientation orientation; }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index ef73fd1b67..fa1ccd347f 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -39,8 +39,6 @@ #include "private/qbuttongroup_p.h" -#ifndef QT_NO_BUTTONGROUP - #include "private/qabstractbutton_p.h" QT_BEGIN_NAMESPACE @@ -362,5 +360,3 @@ int QButtonGroup::checkedId() const QT_END_NAMESPACE #include "moc_qbuttongroup.cpp" - -#endif // QT_NO_BUTTONGROUP diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h index ff931b1ee0..1b4f2377ae 100644 --- a/src/widgets/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -43,10 +43,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(buttongroup); -#ifndef QT_NO_BUTTONGROUP +QT_BEGIN_NAMESPACE class QAbstractButton; class QAbstractButtonPrivate; @@ -94,8 +93,6 @@ private: friend class QAbstractButtonPrivate; }; -#endif // QT_NO_BUTTONGROUP - QT_END_NAMESPACE #endif // QBUTTONGROUP_H diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h index 93f3f4e0ec..148f572373 100644 --- a/src/widgets/widgets/qbuttongroup_p.h +++ b/src/widgets/widgets/qbuttongroup_p.h @@ -54,14 +54,14 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qbuttongroup.h> -#ifndef QT_NO_BUTTONGROUP - #include <QtCore/private/qobject_p.h> #include <QtCore/qlist.h> #include <QtCore/qpointer.h> #include <QtCore/qhash.h> +QT_REQUIRE_CONFIG(buttongroup); + QT_BEGIN_NAMESPACE class QButtonGroupPrivate: public QObjectPrivate @@ -81,6 +81,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_BUTTONGROUP - #endif // QBUTTONGROUP_P_H diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 9a375ae420..ed0fd3e2b0 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -71,7 +71,7 @@ #include <private/qabstractscrollarea_p.h> #include <private/qlineedit_p.h> #include <qdebug.h> -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) # include <private/qeffects_p.h> #endif #ifndef QT_NO_ACCESSIBILITY @@ -103,7 +103,7 @@ QComboBoxPrivate::QComboBoxPrivate() #ifdef Q_OS_MAC , m_platformMenu(0) #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) , completer(0) #endif { @@ -189,7 +189,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt return menuOption; } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) { Q_Q(QComboBox); @@ -224,7 +224,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) } # endif // QT_KEYPAD_NAVIGATION } -#endif // !QT_NO_COMPLETER +#endif // QT_CONFIG(completer) void QComboBoxPrivate::updateArrow(QStyle::StateFlag state) { @@ -1214,7 +1214,7 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const { // Base how duplicates are determined on the autocompletion case sensitivity Qt::MatchFlags flags = Qt::MatchFixedString; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) #endif flags |= Qt::MatchCaseSensitive; @@ -1443,7 +1443,7 @@ int QComboBox::maxCount() const return d->maxCount; } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \property QComboBox::autoCompletion @@ -1538,7 +1538,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity d->lineEdit->completer()->setCaseSensitivity(sensitivity); } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! \property QComboBox::duplicatesEnabled @@ -1820,12 +1820,12 @@ void QComboBox::setLineEdit(QLineEdit *edit) d->updateFocusPolicy(); d->lineEdit->setFocusProxy(this); d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) setAutoCompletion(d->autoCompletion); #endif #ifdef QT_KEYPAD_NAVIGATION -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (QApplication::keypadNavigationEnabled()) { // Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion. // This means that when the user enters edit mode they are immediately presented with a @@ -1889,7 +1889,7 @@ const QValidator *QComboBox::validator() const } #endif // QT_NO_VALIDATOR -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \fn void QComboBox::setCompleter(QCompleter *completer) @@ -1929,7 +1929,7 @@ QCompleter *QComboBox::completer() const return d->lineEdit ? d->lineEdit->completer() : 0; } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! Returns the item delegate used by the popup list view. @@ -1995,7 +1995,7 @@ void QComboBox::setModel(QAbstractItemModel *model) if (model == d->model) return; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer() == d->completer) d->lineEdit->completer()->setModel(model); @@ -2141,7 +2141,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) const QString newText = itemText(normalized); if (lineEdit->text() != newText) { lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (lineEdit && lineEdit->completer()) lineEdit->completer()->setCompletionPrefix(newText); #endif @@ -2592,7 +2592,7 @@ void QComboBox::showPopup() #endif // Q_OS_MAC #ifdef QT_KEYPAD_NAVIGATION -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (QApplication::keypadNavigationEnabled() && d->completer) { // editable combo box is line edit plus completer setEditFocus(true); @@ -2754,7 +2754,7 @@ void QComboBox::showPopup() const bool updatesEnabled = container->updatesEnabled(); #endif -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) bool scrollDown = (listRect.topLeft() == below); if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) @@ -2826,7 +2826,7 @@ void QComboBox::hidePopup() { Q_D(QComboBox); if (d->container && d->container->isVisible()) { -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) QSignalBlocker modelBlocker(d->model); QSignalBlocker viewBlocker(d->container->itemView()); QSignalBlocker containerBlocker(d->container); @@ -2870,7 +2870,7 @@ void QComboBox::hidePopup() modelBlocker.unblock(); if (!didFade) -#endif // QT_NO_EFFECTS +#endif // QT_CONFIG(effects) // Fade should implicitly hide as well ;-) d->container->hide(); } @@ -2934,7 +2934,7 @@ void QComboBox::focusInEvent(QFocusEvent *e) update(); if (d->lineEdit) { d->lineEdit->event(e); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit->completer()) d->lineEdit->completer()->setWidget(this); #endif @@ -3160,7 +3160,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) { Q_D(QComboBox); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer()->popup() @@ -3496,7 +3496,7 @@ void QComboBox::setModelColumn(int visibleColumn) QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView()); if (lv) lv->setModelColumn(visibleColumn); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer() == d->completer) d->lineEdit->completer()->setCompletionColumn(visibleColumn); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index a6aac6f8aa..ff27a999d9 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -71,10 +71,10 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false) Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false) -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled) Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) @@ -91,7 +91,7 @@ public: void setMaxCount(int max); int maxCount() const; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) bool autoCompletion() const; void setAutoCompletion(bool enable); @@ -149,7 +149,7 @@ public: const QValidator *validator() const; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void setCompleter(QCompleter *c); QCompleter *completer() const; #endif @@ -262,7 +262,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex & parent, int start, int end)) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index)) #endif }; diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 6bee9409ee..835bbf866e 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -67,7 +67,9 @@ #include "QtCore/qtimer.h" #include "private/qwidget_p.h" #include "QtCore/qpointer.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtGui/qevent.h" #include "QtCore/qdebug.h" @@ -356,7 +358,7 @@ public: void _q_emitCurrentIndexChanged(const QModelIndex &index); void _q_modelDestroyed(); void _q_modelReset(); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void _q_completerActivated(const QModelIndex &index); #endif void _q_resetButton(); @@ -416,7 +418,7 @@ public: #ifdef Q_OS_MAC QPlatformMenu *m_platformMenu; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) QPointer<QCompleter> completer; #endif static QPalette viewContainerPalette(QComboBox *cmb) diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index 4dc5939bfb..d4ef33966b 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qapplication.h" -#ifndef QT_NO_EFFECTS #include "qdesktopwidget.h" #include "qeffects_p.h" #include "qevent.h" @@ -607,5 +606,3 @@ QT_END_NAMESPACE */ #include "qeffects.moc" - -#endif //QT_NO_EFFECTS diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h index a93efce1ec..92f459651f 100644 --- a/src/widgets/widgets/qeffects_p.h +++ b/src/widgets/widgets/qeffects_p.h @@ -53,8 +53,9 @@ // #include "QtCore/qnamespace.h" +#include <QtWidgets/private/qtwidgetsglobal_p.h> -#ifndef QT_NO_EFFECTS +QT_REQUIRE_CONFIG(effects); QT_BEGIN_NAMESPACE @@ -77,6 +78,4 @@ extern void Q_WIDGETS_EXPORT qFadeEffect(QWidget*, int time = -1); QT_END_NAMESPACE -#endif // QT_NO_EFFECTS - #endif // QEFFECTS_P_H diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index 4d86c7cfc7..6f2a6b2d5a 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_KEYSEQUENCEEDIT - Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here void QKeySequenceEditPrivate::init() @@ -332,8 +330,6 @@ void QKeySequenceEdit::timerEvent(QTimerEvent *e) QWidget::timerEvent(e); } -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #include "moc_qkeysequenceedit.cpp" diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 81339a9852..d5b4b199cd 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -44,9 +44,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(keysequenceedit); -#ifndef QT_NO_KEYSEQUENCEEDIT +QT_BEGIN_NAMESPACE class QKeySequenceEditPrivate; class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget @@ -82,8 +82,6 @@ private: Q_DECLARE_PRIVATE(QKeySequenceEdit) }; -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #endif // QKEYSEQUENCEEDIT_H diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h index 67e60b4032..7af034e735 100644 --- a/src/widgets/widgets/qkeysequenceedit_p.h +++ b/src/widgets/widgets/qkeysequenceedit_p.h @@ -58,9 +58,9 @@ #include <private/qwidget_p.h> #include <private/qkeysequence_p.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(keysequenceedit); -#ifndef QT_NO_KEYSEQUENCEEDIT +QT_BEGIN_NAMESPACE class QLineEdit; @@ -81,8 +81,6 @@ public: int releaseTimer; }; -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #endif // QKEYSEQUENCEEDIT_P_H diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 7f47fdde87..06e878f657 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -610,7 +610,7 @@ void QLineEdit::setValidator(const QValidator *v) } #endif // QT_NO_VALIDATOR -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \since 4.2 @@ -662,7 +662,7 @@ QCompleter *QLineEdit::completer() const return d->control->completer(); } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! Returns a recommended size for the widget. @@ -1764,7 +1764,7 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) d->control->processInputMethodEvent(e); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (!e->commitString().isEmpty()) d->control->complete(Qt::Key_unknown); #endif @@ -1841,7 +1841,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->control->setCancelText(d->control->text()); } #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->control->completer()) { d->control->completer()->setWidget(this); QObject::connect(d->control->completer(), SIGNAL(activated(QString)), @@ -1884,7 +1884,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) #ifdef QT_KEYPAD_NAVIGATION d->control->setCancelText(QString()); #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->control->completer()) { QObject::disconnect(d->control->completer(), 0, this, 0); } diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index d84eeedaf6..ba6ef5c181 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -124,7 +124,7 @@ public: const QValidator * validator() const; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void setCompleter(QCompleter *completer); QCompleter *completer() const; #endif @@ -252,7 +252,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &)) #endif #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 79241ef720..ae35a64663 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -90,7 +90,7 @@ QRect QLineEditPrivate::cursorRect() const return adjustedControlRect(control->cursorRect()); } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void QLineEditPrivate::_q_completionHighlighted(const QString &newText) { @@ -111,7 +111,7 @@ void QLineEditPrivate::_q_completionHighlighted(const QString &newText) } } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) void QLineEditPrivate::_q_handleWindowActivate() { @@ -124,7 +124,7 @@ void QLineEditPrivate::_q_textEdited(const QString &text) { Q_Q(QLineEdit); emit q->textEdited(text); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (control->completer() && control->completer()->completionMode() != QCompleter::InlineCompletion) control->complete(-1); // update the popup on cut/paste/del diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 92bdd4ad60..094425e45e 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -63,7 +63,9 @@ #include "QtGui/qicon.h" #include "QtWidgets/qstyleoption.h" #include "QtCore/qbasictimer.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtCore/qpointer.h" #include "QtCore/qmimedata.h" @@ -203,7 +205,7 @@ public: #endif void _q_selectionChanged(); void _q_updateNeeded(const QRect &); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void _q_completionHighlighted(const QString &); #endif QPoint mousePressPos; diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index e1841bbc55..15480e527e 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -50,7 +50,10 @@ #include "qtoolbar.h" #include <qapplication.h> +#include <qmenu.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #if QT_CONFIG(statusbar) #include <qstatusbar.h> #endif @@ -491,7 +494,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) emit toolButtonStyleChanged(d->toolButtonStyle); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! Returns the menu bar for the main window. This function creates and returns an empty menu bar if the menu bar does not exist. @@ -578,7 +581,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar) } d->layout->setMenuBar(menuBar); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(statusbar) /*! @@ -1412,7 +1415,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event) // children and for the menu bar as well QWidget *child = childAt(event->pos()); while (child && child != this) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) { if (mb->parentWidget() != this) return; diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h index e0592d2c3f..ff489efa2d 100644 --- a/src/widgets/widgets/qmainwindow.h +++ b/src/widgets/widgets/qmainwindow.h @@ -123,7 +123,7 @@ public: bool isSeparator(const QPoint &pos) const; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QMenuBar *menuBar() const; void setMenuBar(QMenuBar *menubar); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 43158fa1fd..418764223d 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -171,6 +171,7 @@ #include <private/qdesktopwidget_p.h> #include <QDebug> #include <qmath.h> +#include <qmenu.h> #include <private/qlayoutengine_p.h> #include <algorithm> diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 498744e81e..4819e0d104 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -162,6 +162,7 @@ #include <QDebug> #include <QMdiArea> #include <QScopedValueRollback> +#include <QMenu> QT_BEGIN_NAMESPACE @@ -702,7 +703,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) : QObject(mdiChild), previousLeft(0), previousRight(0), -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) m_menuBar(0), #endif mdiChild(mdiChild) @@ -724,7 +725,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) ControlContainer::~ControlContainer() { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) removeButtonsFromMenuBar(); #endif delete m_menuLabel; @@ -733,7 +734,7 @@ ControlContainer::~ControlContainer() m_controllerWidget = 0; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /* \internal */ @@ -845,7 +846,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar) mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) void ControlContainer::updateWindowIcon(const QIcon &windowIcon) { @@ -1265,7 +1266,7 @@ void QMdiSubWindowPrivate::setNormalMode() isMaximizeMode = false; ensureWindowState(Qt::WindowNoState); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) removeButtonsFromMenuBar(); #endif @@ -1372,7 +1373,7 @@ void QMdiSubWindowPrivate::setMaximizeMode() updateGeometryConstraints(); if (wasVisible) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mBar = menuBar()) showButtonsInMenuBar(mBar); else @@ -1435,7 +1436,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) Qt::WindowStates oldWindowState = q->windowState(); ensureWindowState(Qt::WindowActive); emit q->aboutToActivate(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mBar = menuBar()) showButtonsInMenuBar(mBar); #endif @@ -1772,7 +1773,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) return true; -#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW) +#if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else @@ -1785,7 +1786,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const #endif } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! \internal @@ -1856,7 +1857,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar() originalTitle.clear(); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) { @@ -2281,7 +2282,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) QMdiSubWindow::~QMdiSubWindow() { Q_D(QMdiSubWindow); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->setActive(false); @@ -2614,7 +2615,7 @@ void QMdiSubWindow::showShaded() d->ensureWindowState(Qt::WindowMinimized); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif @@ -2754,7 +2755,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) if (object == d->baseWidget) { d->updateWindowTitle(true); d->lastChildWindowTitle = d->baseWidget->windowTitle(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { d->originalTitle.clear(); @@ -2817,7 +2818,7 @@ bool QMdiSubWindow::event(QEvent *event) break; case QEvent::ParentChange: { bool wasResized = testAttribute(Qt::WA_Resized); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->currentOperation = QMdiSubWindowPrivate::None; @@ -2874,12 +2875,12 @@ bool QMdiSubWindow::event(QEvent *event) case QEvent::ModifiedChange: if (!windowTitle().contains(QLatin1String("[*]"))) break; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { window()->setWindowModified(isWindowModified()); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) d->updateInternalWindowTitle(); break; case QEvent::LayoutDirectionChange: @@ -2942,7 +2943,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) d->updateDirtyRegions(); // Show buttons in the menu bar if they're already not there. // We want to do this when QMdiSubWindow becomes visible after being hidden. -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (d->controlContainer) { if (QMenuBar *menuBar = d->menuBar()) { if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget()) @@ -2958,7 +2959,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) */ void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d_func()->removeButtonsFromMenuBar(); #endif } @@ -3032,7 +3033,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent) closeEvent->ignore(); return; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->setActive(false); diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h index 71fcc38378..51652a78ff 100644 --- a/src/widgets/widgets/qmdisubwindow_p.h +++ b/src/widgets/widgets/qmdisubwindow_p.h @@ -58,7 +58,9 @@ #include <QStyle> #include <QStyleOptionTitleBar> +#if QT_CONFIG(menubar) #include <QMenuBar> +#endif #include <QSizeGrip> #include <QPointer> #include <QDebug> @@ -96,7 +98,7 @@ public: ControlContainer(QMdiSubWindow *mdiChild); ~ControlContainer(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) void showButtonsInMenuBar(QMenuBar *menuBar); void removeButtonsFromMenuBar(QMenuBar *menuBar = 0); QMenuBar *menuBar() const { return m_menuBar; } @@ -108,7 +110,7 @@ public: private: QPointer<QWidget> previousLeft; QPointer<QWidget> previousRight; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QPointer<QMenuBar> m_menuBar; #endif QPointer<QWidget> m_controllerWidget; @@ -252,7 +254,7 @@ public: int titleBarHeight(const QStyleOptionTitleBar &options) const; void sizeParameters(int *margin, int *minWidth) const; bool drawTitleBarWhenMaximized() const; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QMenuBar *menuBar() const; void showButtonsInMenuBar(QMenuBar *menuBar); void removeButtonsFromMenuBar(); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 0355bb44f7..c1fb409380 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -41,6 +41,8 @@ #ifndef QT_NO_MENU +#include <QtWidgets/private/qtwidgetsglobal_p.h> + #include "qdebug.h" #include "qstyle.h" #include "qevent.h" @@ -56,7 +58,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) # include <private/qeffects_p.h> #endif #if QT_CONFIG(whatsthis) @@ -64,7 +66,9 @@ #endif #include "qmenu_p.h" +#if QT_CONFIG(menubar) #include "qmenubar_p.h" +#endif #include "qwidgetaction.h" #if QT_CONFIG(toolbutton) #include "qtoolbutton.h" @@ -498,7 +502,7 @@ void QMenuPrivate::hideUpToMenuBar() QWidget *caused = causedPopup.widget; hideMenu(q); //hide after getting causedPopup while(caused) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { mb->d_func()->setCurrentAction(0); mb->d_func()->setKeyboardMode(false); @@ -522,7 +526,7 @@ void QMenuPrivate::hideMenu(QMenu *menu) { if (!menu) return; -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) QSignalBlocker blocker(menu); aboutToHide = true; // Flash item which is about to trigger (if any). @@ -544,7 +548,7 @@ void QMenuPrivate::hideMenu(QMenu *menu) aboutToHide = false; blocker.unblock(); -#endif // QT_NO_EFFECTS +#endif // QT_CONFIG(effects) if (activeMenu == menu) activeMenu = 0; menu->d_func()->causedPopup.action = 0; @@ -675,7 +679,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } if (hideActiveMenu && previousAction != currentAction) { if (popup == -1) { -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) // kill any running effect qFadeEffect(0); qScrollEffect(0); @@ -1280,7 +1284,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) bool passOnEvent = false; QWidget *next_widget = 0; QPoint cpos = caused->mapFromGlobal(e->globalPos()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { passOnEvent = mb->rect().contains(cpos); } else @@ -1322,7 +1326,7 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused } else if (action_e == QAction::Hover) { emit qmenu->hovered(action); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) { if (action_e == QAction::Trigger) { emit qmenubar->triggered(action); @@ -1417,7 +1421,7 @@ void QMenuPrivate::_q_actionTriggered() QVector< QPointer<QWidget> > list; for(QWidget *widget = q->parentWidget(); widget; ) { if (qobject_cast<QMenu*>(widget) -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) || qobject_cast<QMenuBar*>(widget) #endif ) { @@ -2318,7 +2322,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->doChildEffects = true; d->updateLayoutDirection(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) // if this menu is part of a chain attached to a QMenuBar, set the // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0); @@ -2414,11 +2418,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (snapToMouse) // position flowing left from the mouse pos.setX(mouse.x() - size.width()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) // if the menu is in a menubar or is a submenu, it should be right-aligned if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget)) pos.rx() -= size.width(); -#endif //QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (pos.x() < screen.left() + desktopFrame) pos.setX(qMax(p.x(), screen.left() + desktopFrame)); @@ -2479,7 +2483,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } } setGeometry(QRect(pos, size)); -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; if (isRightToLeft()) { @@ -2492,7 +2496,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) hGuess = QEffects::LeftScroll; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) || (qobject_cast<QMenuBar*>(d->causedPopup.widget) && pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) @@ -2500,7 +2504,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #endif if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) { bool doChildEffects = true; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) { doChildEffects = mb->d_func()->doChildEffects; mb->d_func()->doChildEffects = false; @@ -2662,7 +2666,7 @@ void QMenu::hideEvent(QHideEvent *) QAccessibleEvent event(this, QAccessible::PopupMenuEnd); QAccessible::updateAccessibility(&event); #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) mb->d_func()->setCurrentAction(0); #endif @@ -3211,7 +3215,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) { d->hideMenu(this); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) { mb->d_func()->setKeyboardMode(false); } @@ -3273,7 +3277,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) { QPointer<QWidget> caused = d->causedPopup.widget; d->hideMenu(this); // hide after getting causedPopup -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { mb->d_func()->setCurrentAction(d->menuAction); mb->d_func()->setKeyboardMode(true); @@ -3350,7 +3354,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) } } if (!key_consumed) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) { QAction *oldAct = mb->d_func()->currentAction; QApplication::sendEvent(mb, e); diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index f9f3ad08dc..65b7030e20 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -41,8 +41,10 @@ #import <AppKit/AppKit.h> #include "qmenu.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" #include "qmenubar_p.h" +#endif #include "qmacnativewidget_mac.h" #include <QtCore/QDebug> @@ -139,7 +141,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* #endif //QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! \since 5.2 @@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu() } return nil; } -#endif //QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 574c71c31e..e86545ad2a 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -52,7 +52,9 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> +#if QT_CONFIG(menubar) #include "QtWidgets/qmenubar.h" +#endif #include "QtWidgets/qstyleoption.h" #include "QtCore/qdatetime.h" #include "QtCore/qmap.h" diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 5284c16ab0..b2fd932486 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -62,9 +62,6 @@ #include "qpa/qplatformintegration.h" #include <private/qdesktopwidget_p.h> -#ifndef QT_NO_MENUBAR - - #include "qmenu_p.h" #include "qmenubar_p.h" #include "qdebug.h" @@ -1875,9 +1872,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar() // for private slots - QT_END_NAMESPACE #include <moc_qmenubar.cpp> - -#endif // QT_NO_MENUBAR diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index 7ad205b77a..be70f4ea48 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -43,10 +43,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qmenu.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(menubar); -#ifndef QT_NO_MENUBAR +QT_BEGIN_NAMESPACE class QMenuBarPrivate; class QStyleOptionMenuItem; @@ -140,8 +139,6 @@ private: friend class QWindowsStyle; }; -#endif // QT_NO_MENUBAR - QT_END_NAMESPACE #endif // QMENUBAR_H diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index f5409b9762..01d8793a3a 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -56,9 +56,10 @@ #include <private/qmenu_p.h> // Mac needs what in this file! #include <qpa/qplatformmenu.h> +QT_REQUIRE_CONFIG(menubar); + QT_BEGIN_NAMESPACE -#ifndef QT_NO_MENUBAR class QMenuBarExtension; class QMenuBarPrivate : public QWidgetPrivate { @@ -136,8 +137,6 @@ public: inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); } }; -#endif // QT_NO_MENUBAR - QT_END_NAMESPACE #endif // QMENUBAR_P_H diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index ac711d34c7..dfba32d3e8 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -40,7 +40,9 @@ #include "qradiobutton.h" #include "qapplication.h" #include "qbitmap.h" +#if QT_CONFIG(buttongroup) #include "qbuttongroup.h" +#endif #include "qstylepainter.h" #include "qstyle.h" #include "qstyleoption.h" diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index 0868dcbd69..0bfc56f7fa 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -40,8 +40,6 @@ #include "qscrollarea.h" #include "private/qscrollarea_p.h" -#ifndef QT_NO_SCROLLAREA - #include "qscrollbar.h" #include "qlayout.h" #include "qstyle.h" @@ -539,5 +537,3 @@ Qt::Alignment QScrollArea::alignment() const QT_END_NAMESPACE #include "moc_qscrollarea.cpp" - -#endif // QT_NO_SCROLLAREA diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h index 92ce287566..d38bced2f2 100644 --- a/src/widgets/widgets/qscrollarea.h +++ b/src/widgets/widgets/qscrollarea.h @@ -43,10 +43,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(scrollarea); -#ifndef QT_NO_SCROLLAREA +QT_BEGIN_NAMESPACE class QScrollAreaPrivate; @@ -91,8 +90,6 @@ private: Q_DISABLE_COPY(QScrollArea) }; -#endif // QT_NO_SCROLLAREA - QT_END_NAMESPACE #endif // QSCROLLAREA_H diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h index f7c0725dbe..fa2e0241cf 100644 --- a/src/widgets/widgets/qscrollarea_p.h +++ b/src/widgets/widgets/qscrollarea_p.h @@ -53,11 +53,11 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> -#ifndef QT_NO_SCROLLAREA - #include "private/qabstractscrollarea_p.h" #include <QtWidgets/qscrollbar.h> +QT_REQUIRE_CONFIG(scrollarea); + QT_BEGIN_NAMESPACE class QScrollAreaPrivate: public QAbstractScrollAreaPrivate @@ -74,8 +74,6 @@ public: Qt::Alignment alignment; }; -#endif - QT_END_NAMESPACE #endif diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index 85efd680ec..fcbdbc7674 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -321,13 +321,13 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) // Check if tlw is inside QAbstractScrollArea/QScrollArea. // If that's the case tlw->parentWidget() will return the viewport // and tlw->parentWidget()->parentWidget() will return the scroll area. -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget()); if (scrollArea) { hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) availableGeometry = tlwParent->contentsRect(); } diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index 38ce182fbf..9d92855a40 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -39,8 +39,6 @@ #include "qstackedwidget.h" -#ifndef QT_NO_STACKEDWIDGET - #include <qstackedlayout.h> #include <qevent.h> #include <private/qframe_p.h> @@ -294,5 +292,3 @@ bool QStackedWidget::event(QEvent *e) QT_END_NAMESPACE #include "moc_qstackedwidget.cpp" - -#endif // QT_NO_STACKEDWIDGET diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h index 36088ae033..29df145b70 100644 --- a/src/widgets/widgets/qstackedwidget.h +++ b/src/widgets/widgets/qstackedwidget.h @@ -43,10 +43,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(stackedwidget); -#ifndef QT_NO_STACKEDWIDGET +QT_BEGIN_NAMESPACE class QStackedWidgetPrivate; @@ -87,8 +86,6 @@ private: Q_DECLARE_PRIVATE(QStackedWidget) }; -#endif // QT_NO_STACKEDWIDGET - QT_END_NAMESPACE #endif // QSTACKEDWIDGET_H diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index e162d46935..1c6d41ee2f 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -49,7 +49,9 @@ #include <qlayout.h> #include <qmainwindow.h> #include <qmenu.h> +#if QT_CONFIG(menubar) #include <qmenubar.h> +#endif #if QT_CONFIG(rubberband) #include <qrubberband.h> #endif diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 9281cc8ced..3abe82ce59 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1428,7 +1428,7 @@ void QWidgetLineControl::emitCursorPositionChanged() } } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) // iterating forward(dir=1)/backward(dir=-1) from the // current row based. dir=0 indicates a new completion prefix was set. bool QWidgetLineControl::advanceToEnabledItem(int dir) @@ -1627,7 +1627,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) { bool inlineCompletionAccepted = false; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (m_completer) { QCompleter::CompletionMode completionMode = m_completer->completionMode(); if ((completionMode == QCompleter::PopupCompletion @@ -1672,7 +1672,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) } } } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput() || fixup()) { @@ -1774,7 +1774,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) end(1); } else if (event == QKeySequence::MoveToNextChar) { -#if defined(QT_NO_COMPLETER) +#if !QT_CONFIG(completer) const bool inlineCompletion = false; #else const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; @@ -1791,7 +1791,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); } else if (event == QKeySequence::MoveToPreviousChar) { -#if defined(QT_NO_COMPLETER) +#if !QT_CONFIG(completer) const bool inlineCompletion = false; #else const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; @@ -1886,7 +1886,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) del(); } break; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) case Qt::Key_Up: case Qt::Key_Down: complete(event->key()); @@ -1901,7 +1901,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) case Qt::Key_Backspace: if (!isReadOnly()) { backspace(); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) complete(Qt::Key_Backspace); #endif } @@ -1941,7 +1941,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) && !isReadOnly() && isAcceptableInput(event)) { insert(event->text()); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) complete(event->key()); #endif event->accept(); diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 257402e9dc..243a1a7723 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -62,7 +62,9 @@ #include "QtGui/qclipboard.h" #include "QtGui/qinputmethod.h" #include "QtCore/qpoint.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtCore/qthread.h" #include "QtGui/private/qinputcontrol_p.h" @@ -289,7 +291,7 @@ public: void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); } #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) QCompleter *completer() const { return m_completer; } /* Note that you must set the widget for the completer separately */ void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); } @@ -461,7 +463,7 @@ private: QPointer<QValidator> m_validator; #endif QPointer<QCompleter> m_completer; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) bool advanceToEnabledItem(int dir); #endif diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index 79502cdd26..0e971a37cd 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -39,7 +39,6 @@ #include "qwidgetresizehandler_p.h" -#ifndef QT_NO_RESIZEHANDLER #include "qframe.h" #include "qapplication.h" #include "qdesktopwidget.h" @@ -544,5 +543,3 @@ void QWidgetResizeHandler::doMove() QT_END_NAMESPACE #include "moc_qwidgetresizehandler_p.cpp" - -#endif //QT_NO_RESIZEHANDLER diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h index 7bb7d6cd94..669cb6f256 100644 --- a/src/widgets/widgets/qwidgetresizehandler_p.h +++ b/src/widgets/widgets/qwidgetresizehandler_p.h @@ -55,7 +55,7 @@ #include "QtCore/qobject.h" #include "QtCore/qpoint.h" -#ifndef QT_NO_RESIZEHANDLER +QT_REQUIRE_CONFIG(resizehandler); QT_BEGIN_NAMESPACE @@ -135,6 +135,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_RESIZEHANDLER - #endif // QWIDGETRESIZEHANDLER_P_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index c204dad08d..5737af41c3 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -1,14 +1,10 @@ # Qt widgets module HEADERS += \ - widgets/qbuttongroup.h \ - widgets/qbuttongroup_p.h \ widgets/qabstractspinbox.h \ widgets/qabstractspinbox_p.h \ widgets/qframe.h \ widgets/qframe_p.h \ - widgets/qkeysequenceedit.h \ - widgets/qkeysequenceedit_p.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ widgets/qmainwindow.h \ @@ -19,13 +15,9 @@ HEADERS += \ widgets/qmdisubwindow_p.h \ widgets/qmenu.h \ widgets/qmenu_p.h \ - widgets/qmenubar.h \ - widgets/qmenubar_p.h \ - widgets/qscrollarea_p.h \ widgets/qsizegrip.h \ widgets/qslider.h \ widgets/qspinbox.h \ - widgets/qstackedwidget.h \ widgets/qtextedit.h \ widgets/qtextedit_p.h \ widgets/qtoolbar.h \ @@ -34,9 +26,7 @@ HEADERS += \ widgets/qtoolbarseparator_p.h \ widgets/qabstractscrollarea.h \ widgets/qabstractscrollarea_p.h \ - widgets/qwidgetresizehandler_p.h \ widgets/qfocusframe.h \ - widgets/qscrollarea.h \ widgets/qwidgetanimator_p.h \ widgets/qwidgetlinecontrol_p.h \ widgets/qtoolbararealayout_p.h \ @@ -44,11 +34,8 @@ HEADERS += \ widgets/qplaintextedit_p.h SOURCES += \ - widgets/qbuttongroup.cpp \ widgets/qabstractspinbox.cpp \ - widgets/qeffects.cpp \ widgets/qframe.cpp \ - widgets/qkeysequenceedit.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ widgets/qmainwindow.cpp \ @@ -56,19 +43,15 @@ SOURCES += \ widgets/qmdiarea.cpp \ widgets/qmdisubwindow.cpp \ widgets/qmenu.cpp \ - widgets/qmenubar.cpp \ widgets/qsizegrip.cpp \ widgets/qslider.cpp \ widgets/qspinbox.cpp \ - widgets/qstackedwidget.cpp \ widgets/qtextedit.cpp \ widgets/qtoolbar.cpp \ widgets/qtoolbarlayout.cpp \ widgets/qtoolbarseparator.cpp \ widgets/qabstractscrollarea.cpp \ - widgets/qwidgetresizehandler.cpp \ widgets/qfocusframe.cpp \ - widgets/qscrollarea.cpp \ widgets/qwidgetanimator.cpp \ widgets/qwidgetlinecontrol.cpp \ widgets/qtoolbararealayout.cpp \ @@ -92,6 +75,14 @@ qtConfig(abstractslider) { widgets/qabstractslider.cpp } +qtConfig(buttongroup) { + HEADERS += \ + widgets/qbuttongroup.h \ + widgets/qbuttongroup_p.h + + SOURCES += widgets/qbuttongroup.cpp +} + qtConfig(calendarwidget) { HEADERS += widgets/qcalendarwidget.h SOURCES += widgets/qcalendarwidget.cpp @@ -146,6 +137,11 @@ qtConfig(dockwidget) { widgets/qdockarealayout.cpp } +qtConfig(effects) { + HEADERS += widgets/qeffects_p.h + SOURCES += widgets/qeffects.cpp +} + qtConfig(fontcombobox) { HEADERS += widgets/qfontcombobox.h SOURCES += widgets/qfontcombobox.cpp @@ -156,6 +152,14 @@ qtConfig(groupbox) { SOURCES += widgets/qgroupbox.cpp } +qtConfig(keysequenceedit) { + HEADERS += \ + widgets/qkeysequenceedit.h \ + widgets/qkeysequenceedit_p.h + + SOURCES += widgets/qkeysequenceedit.cpp +} + qtConfig(label) { HEADERS += \ widgets/qlabel.h \ @@ -173,6 +177,14 @@ qtConfig(lcdnumber) { widgets/qlcdnumber.cpp } +qtConfig(menubar) { + HEADERS += \ + widgets/qmenubar.h \ + widgets/qmenubar_p.h + + SOURCES += widgets/qmenubar.cpp +} + qtConfig(progressbar) { HEADERS += widgets/qprogressbar.h SOURCES += widgets/qprogressbar.cpp @@ -195,6 +207,11 @@ qtConfig(radiobutton) { widgets/qradiobutton.cpp } +qtConfig(resizehandler) { + HEADERS += widgets/qwidgetresizehandler_p.h + SOURCES += widgets/qwidgetresizehandler.cpp +} + qtConfig(dialogbuttonbox) { HEADERS += \ widgets/qdialogbuttonbox.h @@ -208,6 +225,14 @@ qtConfig(rubberband) { SOURCES += widgets/qrubberband.cpp } +qtConfig(scrollarea) { + HEADERS += \ + widgets/qscrollarea.h \ + widgets/qscrollarea_p.h + + SOURCES += widgets/qscrollarea.cpp +} + qtConfig(scrollbar) { HEADERS += \ widgets/qscrollbar.h \ @@ -232,6 +257,11 @@ qtConfig(splitter) { SOURCES += widgets/qsplitter.cpp } +qtConfig(stackedwidget) { + HEADERS += widgets/qstackedwidget.h + SOURCES += widgets/qstackedwidget.cpp +} + qtConfig(statusbar) { HEADERS += widgets/qstatusbar.h SOURCES += widgets/qstatusbar.cpp |