aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qmlcompiler/qcoloroutput.cpp22
-rw-r--r--src/quickcontrols/doc/src/includes/varying-delegate-heights-section.qdocinc8
-rw-r--r--src/quicktemplates/qquickscrollbar.cpp2
-rw-r--r--src/quicktemplates/qquickscrollindicator.cpp2
-rw-r--r--src/quicktemplates/qquickscrollview.cpp2
5 files changed, 30 insertions, 6 deletions
diff --git a/src/qmlcompiler/qcoloroutput.cpp b/src/qmlcompiler/qcoloroutput.cpp
index f3f5b86d7a..6a99a8007e 100644
--- a/src/qmlcompiler/qcoloroutput.cpp
+++ b/src/qmlcompiler/qcoloroutput.cpp
@@ -6,7 +6,9 @@
#include <QtCore/qfile.h>
#include <QtCore/qhash.h>
-#ifndef Q_OS_WIN
+#ifdef Q_OS_WIN
+#include <qt_windows.h>
+#else
#include <unistd.h>
#endif
@@ -75,17 +77,25 @@ private:
*/
inline bool isColoringPossible() const
{
+ static std::optional<bool> canColor;
+ if (canColor.has_value())
+ return canColor.value();
+
#if defined(Q_OS_WIN)
- /* Windows doesn't at all support ANSI escape codes, unless
- * the user install a "device driver". See the Wikipedia links in the
- * class documentation for details. */
- return false;
+ HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE);
+ DWORD mode = 0;
+
+ if (GetConsoleMode(hErr, &mode))
+ canColor = SetConsoleMode(hErr, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
+ else
+ canColor = false;
#else
/* We use QFile::handle() to get the file descriptor. It's a bit unsure
* whether it's 2 on all platforms and in all cases, so hopefully this layer
* of abstraction helps handle such cases. */
- return isatty(fileno(stderr));
+ canColor = isatty(fileno(stderr));
#endif
+ return canColor.value();
}
};
diff --git a/src/quickcontrols/doc/src/includes/varying-delegate-heights-section.qdocinc b/src/quickcontrols/doc/src/includes/varying-delegate-heights-section.qdocinc
new file mode 100644
index 0000000000..a2ca1e6513
--- /dev/null
+++ b/src/quickcontrols/doc/src/includes/varying-delegate-heights-section.qdocinc
@@ -0,0 +1,8 @@
+//! [file]
+\section\1 Varying Delegate Sizes
+
+Variable delegate sizes can lead \2 to "jump around" as new delegates are
+loaded into the view. It is recommended to have equally-sized delegates for
+this reason. See \l {Variable Delegate Size and Section Labels} for more
+information.
+//! [file]
diff --git a/src/quicktemplates/qquickscrollbar.cpp b/src/quicktemplates/qquickscrollbar.cpp
index fe41252db5..54f593cc81 100644
--- a/src/quicktemplates/qquickscrollbar.cpp
+++ b/src/quicktemplates/qquickscrollbar.cpp
@@ -119,6 +119,8 @@ QT_BEGIN_NAMESPACE
visible.
\endlist
+ \include varying-delegate-heights-section.qdocinc {file} {1} {ScrollBar}
+
\sa ScrollIndicator, ScrollView, {Customizing ScrollBar}, {Indicator Controls}
*/
diff --git a/src/quicktemplates/qquickscrollindicator.cpp b/src/quicktemplates/qquickscrollindicator.cpp
index 2c94181471..0e6d855198 100644
--- a/src/quicktemplates/qquickscrollindicator.cpp
+++ b/src/quicktemplates/qquickscrollindicator.cpp
@@ -90,6 +90,8 @@ QT_BEGIN_NAMESPACE
\image qtquickcontrols-scrollindicator-non-attached.png
+ \include varying-delegate-heights-section.qdocinc {file} {1} {ScrollIndicator}
+
\sa ScrollBar, {Customizing ScrollIndicator}, {Indicator Controls}
*/
diff --git a/src/quicktemplates/qquickscrollview.cpp b/src/quicktemplates/qquickscrollview.cpp
index e46c7ea4b6..0eb5aa4200 100644
--- a/src/quicktemplates/qquickscrollview.cpp
+++ b/src/quicktemplates/qquickscrollview.cpp
@@ -86,6 +86,8 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols-scrollview-interactive.qml file
+ \include varying-delegate-heights-section.qdocinc {file} {2} {ScrollBar}
+
\sa ScrollBar, ScrollIndicator, {Customizing ScrollView}, {Container Controls},
{Focus Management in Qt Quick Controls}
*/