summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-07-01 10:41:09 +0200
committerhjk <qtc-committer@nokia.com>2009-07-01 10:41:09 +0200
commit126cbbde485ad1c6933e1bc987a6c263484c4f11 (patch)
treef89224e42b229e39b53639a3d2bd5baa0d70bc14
parent67a0281cdd851ab824b5c2f48d809f1bdd7b0264 (diff)
downloadqt-creator-126cbbde485ad1c6933e1bc987a6c263484c4f11.tar.gz
debugger: remove QtGui dependency from debugging helpers
It was only used for the watch-QImage-while-it-is-being-drawn-on feature, which does not seem overly useful. [Cherry-picked from master]
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros.cpp34
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros.pro9
-rw-r--r--src/plugins/debugger/dumper.pro8
-rw-r--r--tests/manual/gdbdebugger/helper/helper.pro1
-rw-r--r--tests/manual/gdbdebugger/helper/main.cpp4
5 files changed, 40 insertions, 16 deletions
diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp
index 672810d03a..11c470a5d7 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.cpp
+++ b/share/qtcreator/gdbmacros/gdbmacros.cpp
@@ -55,7 +55,13 @@
int qtGhVersion = QT_VERSION;
-#ifdef QT_GUI_LIB
+#ifndef USE_QT_GUI
+# ifdef QT_GUI_LIB
+# define USE_QT_GUI 1
+# endif
+#endif
+
+#if USE_QT_GUI
# include <QtGui/QWidget>
# include <QtGui/QPixmap>
# include <QtGui/QImage>
@@ -1299,9 +1305,9 @@ static void qDumpQHashNode(QDumper &d)
d.disarm();
}
+#if USE_QT_GUI
static void qDumpQImage(QDumper &d)
{
-#ifdef QT_GUI_LIB
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
P(d, "value", "(" << im.width() << "x" << im.height() << ")");
P(d, "type", NS"QImage");
@@ -1315,14 +1321,12 @@ static void qDumpQImage(QDumper &d)
d.endHash();
}
d.disarm();
-#else
- Q_UNUSED(d);
-#endif
}
+#endif
+#if USE_QT_GUI
static void qDumpQImageData(QDumper &d)
{
-#ifdef QT_GUI_LIB
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
const QByteArray ba(QByteArray::fromRawData((const char*)im.bits(), im.numBytes()));
P(d, "type", NS"QImageData");
@@ -1337,10 +1341,8 @@ static void qDumpQImageData(QDumper &d)
P(d, "value", ba);
#endif
d.disarm();
-#else
- Q_UNUSED(d);
-#endif
}
+#endif
static void qDumpQList(QDumper &d)
{
@@ -2023,18 +2025,16 @@ static void qDumpQObjectSlotList(QDumper &d)
}
+#if USE_QT_GUI
static void qDumpQPixmap(QDumper &d)
{
-#ifdef QT_GUI_LIB
const QPixmap &im = *reinterpret_cast<const QPixmap *>(d.data);
P(d, "value", "(" << im.width() << "x" << im.height() << ")");
P(d, "type", NS"QPixmap");
P(d, "numchild", "0");
d.disarm();
-#else
- Q_UNUSED(d);
-#endif
}
+#endif
static void qDumpQSet(QDumper &d)
{
@@ -2698,10 +2698,12 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdList(d);
break;
case 'I':
+ #if USE_QT_GUI
if (isEqual(type, "QImage"))
qDumpQImage(d);
else if (isEqual(type, "QImageData"))
qDumpQImageData(d);
+ #endif
break;
case 'L':
if (isEqual(type, "QList"))
@@ -2738,8 +2740,10 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpQObjectSlotList(d);
break;
case 'P':
+ #if USE_QT_GUI
if (isEqual(type, "QPixmap"))
qDumpQPixmap(d);
+ #endif
break;
case 'S':
if (isEqual(type, "QSet"))
@@ -2861,7 +2865,9 @@ void *qDumpObjectData440(
"\""NS"QTextCodec\","
"\""NS"QVariant\","
"\""NS"QVector\","
+#if USE_QT_GUI
"\""NS"QWidget\","
+#endif
#if QT_VERSION >= 0x040500
"\""NS"QMultiMap\","
"\""NS"QSharedPointer\","
@@ -2896,7 +2902,7 @@ void *qDumpObjectData440(
<< ""NS"QString=\"" << sizeof(QString) << "\","
<< ""NS"QStringList=\"" << sizeof(QStringList) << "\","
<< ""NS"QObject=\"" << sizeof(QObject) << "\","
-#ifdef QT_GUI_LIB
+#if USE_QT_GUI
<< ""NS"QWidget=\"" << sizeof(QWidget)<< "\","
#endif
#ifdef Q_OS_WIN
diff --git a/share/qtcreator/gdbmacros/gdbmacros.pro b/share/qtcreator/gdbmacros/gdbmacros.pro
index 5aacbfb84a..67133e732e 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.pro
+++ b/share/qtcreator/gdbmacros/gdbmacros.pro
@@ -1,11 +1,20 @@
TEMPLATE = lib
CONFIG += shared
+QT = core
linux-* {
CONFIG -= release
CONFIG += debug
}
SOURCES=gdbmacros.cpp
+true {
+ DEFINES += USE_QT_GUI=0
+ QT = core
+} else {
+ DEFINES += USE_QT_GUI=1
+ QT = core gui
+}
+
exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h) {
DEFINES+=HAS_QOBJECT_P_H
}
diff --git a/src/plugins/debugger/dumper.pro b/src/plugins/debugger/dumper.pro
index 5d373abdd2..fda9873f85 100644
--- a/src/plugins/debugger/dumper.pro
+++ b/src/plugins/debugger/dumper.pro
@@ -14,5 +14,13 @@ CONFIG += debug
QMAKE_CXXFLAGS *= -O2
}
+true {
+ DEFINES += USE_QT_GUI=0
+ QT = core
+} else {
+ DEFINES += USE_QT_GUI=1
+ QT = core gui
+}
+
SOURCES += ../../../share/qtcreator/gdbmacros/gdbmacros.cpp
diff --git a/tests/manual/gdbdebugger/helper/helper.pro b/tests/manual/gdbdebugger/helper/helper.pro
index 57e1272b65..5bd9da5484 100644
--- a/tests/manual/gdbdebugger/helper/helper.pro
+++ b/tests/manual/gdbdebugger/helper/helper.pro
@@ -1,5 +1,6 @@
TEMPLATE = app
+QT = core
SOURCES += ../../../../share/qtcreator/gdbmacros/gdbmacros.cpp
SOURCES += main.cpp
diff --git a/tests/manual/gdbdebugger/helper/main.cpp b/tests/manual/gdbdebugger/helper/main.cpp
index 2c00c12780..8d861b4d47 100644
--- a/tests/manual/gdbdebugger/helper/main.cpp
+++ b/tests/manual/gdbdebugger/helper/main.cpp
@@ -1,5 +1,5 @@
-#include <QApplication>
+#include <QCoreApplication>
extern "C"
void qDumpObjectData440(
@@ -14,6 +14,6 @@ void qDumpObjectData440(
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QCoreApplication app(argc, argv);
return 0;
}