Debugger: Fix QImage dumper

Change-Id: I423d139a16a8a08d9135a1d489c4d38ebac9c0f6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-11-02 13:32:40 +01:00
parent aa9206ca81
commit 5becefbe72
2 changed files with 12 additions and 5 deletions

View File

@@ -1163,8 +1163,12 @@ def qdump__QImage(d, value):
d.putExpandable() d.putExpandable()
if d.isExpanded(): if d.isExpanded():
if d.qtVersion() < 0x060000:
(ref, width, height, depth, nbytes, pad, devicePixelRatio, colorTable, (ref, width, height, depth, nbytes, pad, devicePixelRatio, colorTable,
bits, iformat) = d.split('iiiii@dppi', image_data) bits, iformat) = d.split('iiiii@dppi', image_data)
else:
(ref, width, height, depth, nbytes, pad, devicePixelRatio, _, _, _,
bits, iformat) = d.split('iiiii@dppppi', image_data)
with Children(d): with Children(d):
d.putIntItem('width', width) d.putIntItem('width', width)
d.putIntItem('height', height) d.putIntItem('height', height)

View File

@@ -2514,7 +2514,7 @@ void tst_Dumpers::dumper_data()
"#include <QPainter>\n", "#include <QPainter>\n",
"QApplication app(argc, argv);\n" "QApplication app(argc, argv);\n"
"QImage im(QSize(200, 200), QImage::Format_RGB32);\n" "QImage im(QSize(200, 199), QImage::Format_RGB32);\n"
"im.fill(QColor(200, 100, 130).rgba());\n\n" "im.fill(QColor(200, 100, 130).rgba());\n\n"
"QPainter pain;\n" "QPainter pain;\n"
"pain.begin(&im);\n" "pain.begin(&im);\n"
@@ -2525,9 +2525,12 @@ void tst_Dumpers::dumper_data()
+ GuiProfile() + GuiProfile()
+ Check("im", "(200x200)", "@QImage") + Check("im", "(200x199)", "@QImage")
+ Check("im.width", "200", "int")
+ Check("im.height", "199", "int")
+ Check("im.data", ValuePattern("0x[[:xdigit:]]{2,}"), "void *")
+ Check("pain", AnyValue, "@QPainter") + Check("pain", AnyValue, "@QPainter")
+ Check("pm", "(200x200)", "@QPixmap"); + Check("pm", "(200x199)", "@QPixmap");
QTest::newRow("QLinkedList") QTest::newRow("QLinkedList")