From 0c98e05dfeccdca99bc180ccccd04b38305ad025 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 10 Aug 2009 16:07:33 +0200 Subject: Compile fix on Linux. Reviewed-by: brad The declaration of getQApplicationPrivateInternal was only available as 'friend' on Q_WS_WIN. --- src/gui/kernel/qapplication.h | 4 ---- src/gui/kernel/qapplication_win.cpp | 11 +++-------- src/gui/kernel/qstandardgestures.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 19ae085..58e0cc3 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -375,10 +375,6 @@ private: friend class QDirectPainterPrivate; #endif -#if defined(Q_WS_WIN) - friend QApplicationPrivate* getQApplicationPrivateInternal(); -#endif - #if defined(Q_WS_MAC) || defined(Q_WS_X11) Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut()) #endif diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index cb67409..d5448db 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -428,11 +428,6 @@ extern QCursor *qt_grab_cursor(); #define __export #endif -QApplicationPrivate* getQApplicationPrivateInternal() -{ - return qApp->d_func(); -} - extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); class QETWidget : public QWidget // event translator widget @@ -1461,7 +1456,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // we receive the message for each toplevel window included internal hidden ones, // but the aboutToQuit signal should be emitted only once. - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); if (endsession && !qAppPriv->aboutToQuitEmitted) { qAppPriv->aboutToQuitEmitted = true; int index = QApplication::staticMetaObject.indexOfSignal("aboutToQuit()"); @@ -1648,7 +1643,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } else { switch (message) { case WM_TOUCH: - result = getQApplicationPrivateInternal()->translateTouchEvent(msg); + result = QApplicationPrivate::instance()->translateTouchEvent(msg); break; case WM_KEYDOWN: // keyboard event case WM_SYSKEYDOWN: @@ -3719,7 +3714,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index ac03cd2..b4c3787 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -293,7 +293,7 @@ QPinchGesture::QPinchGesture(QWidget *parent) : QGesture(*new QPinchGesturePrivate, parent) { if (parent) { - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); qAppPriv->widgetGestures[parent].pinch = this; #ifdef Q_WS_WIN qt_widget_private(parent)->winSetupGestures(); @@ -307,7 +307,7 @@ bool QPinchGesture::event(QEvent *event) switch (event->type()) { case QEvent::ParentAboutToChange: if (QWidget *w = qobject_cast(parent())) { - getQApplicationPrivateInternal()->widgetGestures[w].pinch = 0; + QApplicationPrivate::instance()->widgetGestures[w].pinch = 0; #ifdef Q_WS_WIN qt_widget_private(w)->winSetupGestures(); #endif @@ -315,7 +315,7 @@ bool QPinchGesture::event(QEvent *event) break; case QEvent::ParentChange: if (QWidget *w = qobject_cast(parent())) { - getQApplicationPrivateInternal()->widgetGestures[w].pinch = this; + QApplicationPrivate::instance()->widgetGestures[w].pinch = this; #ifdef Q_WS_WIN qt_widget_private(w)->winSetupGestures(); #endif @@ -333,7 +333,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event) Q_D(QPinchGesture); if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { QNativeGestureEvent *ev = static_cast(event); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); QApplicationPrivate::WidgetStandardGesturesMap::iterator it; it = qAppPriv->widgetGestures.find(static_cast(receiver)); if (it == qAppPriv->widgetGestures.end()) -- cgit v0.12 From eeb206d41d386d4d3dee1ff2813d132d15f670d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 10 Aug 2009 16:16:16 +0200 Subject: Compile and work on Linux. Reviewed-by: Kim --- tests/arthur/lance/main.cpp | 2 +- tests/arthur/lance/widgets.h | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp index f95b426..0c9f3d8 100644 --- a/tests/arthur/lance/main.cpp +++ b/tests/arthur/lance/main.cpp @@ -271,7 +271,7 @@ int main(int argc, char **argv) QString format = QString(argv[++i]).toLower(); imageFormat = QImage::Format_Invalid; - static const unsigned int formatCount = + static const int formatCount = sizeof(imageFormats) / sizeof(imageFormats[0]); for (int ff = 0; ff < formatCount; ++ff) { if (QLatin1String(imageFormats[ff].name) == format) { diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h index 7247608..61691dc 100644 --- a/tests/arthur/lance/widgets.h +++ b/tests/arthur/lance/widgets.h @@ -56,6 +56,9 @@ #include #include #include +#include +#include + #include @@ -96,8 +99,8 @@ public: OnScreenWidget(const QString &file, QWidget *parent = 0) : T(parent), - m_view_mode(RenderView), - m_filename(file) + m_filename(file), + m_view_mode(RenderView) { QSettings settings("Trolltech", "lance"); for (int i=0; i<10; ++i) { @@ -117,36 +120,36 @@ public: } if (m_baseline.isNull()) { - setWindowTitle("Rendering: '" + file + "'. No baseline available"); + T::setWindowTitle("Rendering: '" + file + "'. No baseline available"); } else { - setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); + T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode); QSignalMapper *mapper = new QSignalMapper(this); - connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); - connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); + T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); + T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); QAction *renderViewAction = new QAction("Render View", this); renderViewAction->setShortcut(Qt::Key_1); - connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(renderViewAction, RenderView); mapper->setMapping(renderViewAction, "Render View: " + file); - addAction(renderViewAction); + T::addAction(renderViewAction); QAction *baselineAction = new QAction("Baseline", this); baselineAction->setShortcut(Qt::Key_2); - connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(baselineAction, BaselineView); mapper->setMapping(baselineAction, "Baseline View: " + file); - addAction(baselineAction); + T::addAction(baselineAction); QAction *differenceAction = new QAction("Differenfe View", this); differenceAction->setShortcut(Qt::Key_3); - connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); + T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); mapper->setMapping(differenceAction, DifferenceView); mapper->setMapping(differenceAction, "Difference View" + file); - addAction(differenceAction); + T::addAction(differenceAction); } @@ -178,7 +181,7 @@ public: } } - void OnScreenWidget::paintRenderView() + void paintRenderView() { QPainter pt; QPaintDevice *dev = this; @@ -233,7 +236,7 @@ public: } if (m_render_view.isNull()) { - m_render_view = window()->windowSurface()->grabWidget(this); + m_render_view = T::window()->windowSurface()->grabWidget(this); m_render_view.save("renderView.png"); } } @@ -242,7 +245,7 @@ public: QPainter p(this); if (m_baseline.isNull()) { - p.drawText(rect(), Qt::AlignCenter, + p.drawText(T::rect(), Qt::AlignCenter, "No baseline found\n" "file '" + m_baseline_name + "' does not exist..."); return; @@ -258,7 +261,7 @@ public: QPixmap generateDifference() { - QImage img(size(), QImage::Format_RGB32); + QImage img(T::size(), QImage::Format_RGB32); img.fill(0); QPainter p(&img); @@ -275,13 +278,13 @@ public: void paintDifferenceView() { QPainter p(this); if (m_baseline.isNull()) { - p.drawText(rect(), Qt::AlignCenter, + p.drawText(T::rect(), Qt::AlignCenter, "No baseline found\n" "file '" + m_baseline_name + "' does not exist..."); return; } - p.fillRect(rect(), Qt::black); + p.fillRect(T::rect(), Qt::black); p.drawPixmap(0, 0, generateDifference()); } -- cgit v0.12 From 9c4ed99ede2de8dae005cef9a6c519e2b561a54f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 10 Aug 2009 16:15:03 +0200 Subject: Fixed a possible problem when unplugging a QToolBar The 'break' statement was misplaced... This was found thanks to coverity --- src/gui/widgets/qtoolbararealayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index b4a0ef0..afd526a 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -1156,8 +1156,8 @@ QLayoutItem *QToolBarAreaLayout::unplug(const QList &path, QToolBarAreaLayo if (!next.skip()) { newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint()); previous.resize(line.o, next.pos - previous.pos); + break; } - break; } break; } -- cgit v0.12