summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-4.6.05
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp6
-rw-r--r--src/corelib/tools/qstringbuilder.cpp6
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm79
-rw-r--r--src/gui/kernel/qt_mac_p.h15
-rw-r--r--src/gui/kernel/qwidget_x11.cpp53
-rw-r--r--src/gui/painting/qpaintengine.cpp4
-rw-r--r--src/gui/painting/qpaintengineex_p.h2
-rw-r--r--src/gui/widgets/qmenu.cpp40
-rw-r--r--src/gui/widgets/qmenu_mac.mm28
-rw-r--r--src/gui/widgets/qmenu_p.h2
-rw-r--r--src/gui/widgets/qstatusbar.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp37
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h1
-rw-r--r--src/opengl/qgl_p.h2
-rw-r--r--src/opengl/qpixmapdata_gl.cpp69
-rw-r--r--tests/benchmarks/qstringbuilder/main.cpp174
-rw-r--r--tests/benchmarks/qstringbuilder/qstringbuilder.pro4
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp7
-rw-r--r--tools/designer/src/lib/uilib/formbuilder.cpp25
-rw-r--r--tools/designer/src/lib/uilib/formbuilderextra.cpp18
-rw-r--r--tools/designer/src/lib/uilib/formbuilderextra_p.h8
-rw-r--r--tools/designer/src/uitools/quiloader.cpp3
-rw-r--r--tools/qdoc3/codeparser.cpp14
-rw-r--r--tools/qdoc3/codeparser.h1
-rw-r--r--tools/qdoc3/config.h1
-rw-r--r--tools/qdoc3/main.cpp22
27 files changed, 425 insertions, 203 deletions
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0
index 6a94f26..bedf58a 100644
--- a/dist/changes-4.6.0
+++ b/dist/changes-4.6.0
@@ -49,3 +49,8 @@ information about a particular change.
- QStyleOptionGraphicsItem::levelOfDetails is obsoleted and its value
is always initialized to 1. For a more fine-grained value use
QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &).
+
+ - When mixing OpenGL and QPainter calls you need to first call syncState()
+ on the paint engine, for example "painter->paintEngine()->syncState()".
+ This is to ensure that the engine flushes any pending drawing and sets up
+ the GL modelview/projection matrices properly.
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 790f1eb..9da9e66 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1770,10 +1770,10 @@ QString QFSFileEngine::fileName(FileName file) const
if(slash == -1) {
if(d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
return d->filePath.left(2);
- return QLatin1Char('.');
+ return QString(QLatin1Char('.'));
} else {
if(!slash)
- return QLatin1Char('/');
+ return QString(QLatin1Char('/'));
if(slash == 2 && d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
slash++;
return d->filePath.left(slash);
@@ -1831,7 +1831,7 @@ QString QFSFileEngine::fileName(FileName file) const
if (slash == -1)
ret = QDir::currentPath();
else if (slash == 0)
- ret = QLatin1Char('/');
+ ret = QString(QLatin1Char('/'));
ret = ret.left(slash);
}
return ret;
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index b807a89..2b4a242 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -71,8 +71,8 @@
/*! \fn int QLatin1Literal::size() const
- Returns the number of characters in the literal \i{excluding} the trailing
- NUL char.
+ Returns the number of characters in the literal \e{excluding} the trailing
+ NULL char.
*/
/*! \fn char *QLatin1Literal::data() const
@@ -122,7 +122,7 @@
\sa QLatin1Literal, QString
*/
-/* !fn template <class A, class B> QStringBuilder<A, B> operator%(const A &a, const B &b)
+/* \fn template <class A, class B> QStringBuilder<A, B> operator%(const A &a, const B &b)
Returns a \c QStringBuilder object that is converted to a QString object
when assigned to a variable of QString type or passed to a function that
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 9165836..554e9d5 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -88,6 +88,52 @@
QT_BEGIN_NAMESPACE
+Q_GLOBAL_STATIC(QMacWindowFader, macwindowFader);
+
+QMacWindowFader::QMacWindowFader()
+ : m_duration(0.250)
+{
+}
+
+QMacWindowFader *QMacWindowFader::currentFader()
+{
+ return macwindowFader();
+}
+
+void QMacWindowFader::registerWindowToFade(QWidget *window)
+{
+ m_windowsToFade.append(window);
+}
+
+void QMacWindowFader::performFade()
+{
+ const QWidgetList myWidgetsToFade = m_windowsToFade;
+ const int widgetCount = myWidgetsToFade.count();
+#if QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+ [NSAnimationContext beginGrouping];
+ [[NSAnimationContext currentContext] setDuration:NSTimeInterval(m_duration)];
+#endif
+
+ for (int i = 0; i < widgetCount; ++i) {
+ QWidget *widget = m_windowsToFade.at(i);
+ OSWindowRef window = qt_mac_window_for(widget);
+#if QT_MAC_USE_COCOA
+ [[window animator] setAlphaValue:0.0];
+ QTimer::singleShot(qRound(m_duration * 1000), widget, SLOT(hide()));
+#else
+ TransitionWindowOptions options = {0, m_duration, 0, 0};
+ TransitionWindowWithOptions(window, kWindowFadeTransitionEffect, kWindowHideTransitionAction,
+ 0, 1, &options);
+#endif
+ }
+#if QT_MAC_USE_COCOA
+ [NSAnimationContext endGrouping];
+#endif
+ m_duration = 0.250;
+ m_windowsToFade.clear();
+}
+
extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // qapplication.cpp;
extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
extern QWidget * mac_mouse_grabber;
@@ -95,29 +141,26 @@ extern QWidget * mac_mouse_grabber;
void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds)
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
- if( wnd ) {
+ if (wnd) {
+ QWidget *widget;
#if QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
- [NSAnimationContext beginGrouping];
- [[wnd animator] setAlphaValue:0.0];
- if (durationSeconds > 0) {
- [[NSAnimationContext currentContext] setDuration:NSTimeInterval(durationSeconds)];
- } else {
- durationSeconds = [[NSAnimationContext currentContext] duration];
- }
- [NSAnimationContext endGrouping];
- QTimer::singleShot(qRound(durationSeconds * 1000), [wnd QT_MANGLE_NAMESPACE(qt_qwidget)], SLOT(hide()));
+ widget = [wnd QT_MANGLE_NAMESPACE(qt_qwidget)];
#else
- if (durationSeconds <= 0)
- durationSeconds = 0.15;
- TransitionWindowOptions options = {0, durationSeconds, 0, 0};
- TransitionWindowWithOptions(wnd, kWindowFadeTransitionEffect, kWindowHideTransitionAction, 0, 1, &options);
+ const UInt32 kWidgetCreatorQt = kEventClassQt;
+ enum {
+ kWidgetPropertyQWidget = 'QWId' //QWidget *
+ };
+ if (GetWindowProperty(static_cast<WindowRef>(window), kWidgetCreatorQt, kWidgetPropertyQWidget, sizeof(widget), 0, &widget) != noErr)
+ widget = 0;
#endif
- }
+ if (widget) {
+ QMacWindowFader::currentFader()->setFadeDuration(durationSeconds);
+ QMacWindowFader::currentFader()->registerWindowToFade(widget);
+ QMacWindowFader::currentFader()->performFade();
+ }
+ }
}
-
-
bool macWindowIsTextured( void * /*OSWindowRef*/ window )
{
OSWindowRef wnd = static_cast<OSWindowRef>(window);
diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h
index ca995dc..3b0f546 100644
--- a/src/gui/kernel/qt_mac_p.h
+++ b/src/gui/kernel/qt_mac_p.h
@@ -120,6 +120,21 @@ public:
}
};
+// Class for chaining to gether a bunch of fades. It pretty much is only used for qmenu fading.
+class QMacWindowFader
+{
+ QWidgetList m_windowsToFade;
+ float m_duration;
+ Q_DISABLE_COPY(QMacWindowFader)
+public:
+ QMacWindowFader(); // PLEASE DON'T CALL THIS.
+ static QMacWindowFader *currentFader();
+ void registerWindowToFade(QWidget *window);
+ void setFadeDuration(float durationInSecs) { m_duration = durationInSecs; }
+ float fadeDuration() const { return m_duration; }
+ void performFade();
+};
+
class Q_GUI_EXPORT QMacCocoaAutoReleasePool
{
private:
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 7e41ea1..adb48a8 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1359,17 +1359,10 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
// already been set
return;
- XWMHints *h = 0;
- if (q->internalWinId())
- h = XGetWMHints(X11->display, q->internalWinId());
- XWMHints wm_hints;
- if (!h) {
- memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy
- h = &wm_hints;
- }
-
// preparing images to set the _NET_WM_ICON property
QIcon icon = q->windowIcon();
+ QVector<long> icon_data;
+ Qt::HANDLE pixmap_handle = 0;
if (!icon.isNull()) {
QList<QSize> availableSizes = icon.availableSizes();
if(availableSizes.isEmpty()) {
@@ -1379,7 +1372,6 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
availableSizes.push_back(QSize(64,64));
availableSizes.push_back(QSize(128,128));
}
- QVector<long> icon_data;
for(int i = 0; i < availableSizes.size(); ++i) {
QSize size = availableSizes.at(i);
QPixmap pixmap = icon.pixmap(size);
@@ -1401,11 +1393,6 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
}
}
if (!icon_data.isEmpty()) {
- if (q->internalWinId()) {
- XChangeProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON), XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *) icon_data.data(),
- icon_data.size());
- }
extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap);
/*
if the app is running on an unknown desktop, or it is not
@@ -1419,22 +1406,44 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
// unknown DE or non-default visual/colormap, use 1bpp bitmap
if (!forceReset || !topData->iconPixmap)
topData->iconPixmap = new QBitmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64))));
- h->icon_pixmap = topData->iconPixmap->handle();
+ pixmap_handle = topData->iconPixmap->handle();
} else {
// default depth, use a normal pixmap (even though this
// violates the ICCCM), since this works on all DEs known to Qt
if (!forceReset || !topData->iconPixmap)
topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64))));
- h->icon_pixmap = static_cast<QX11PixmapData*>(topData->iconPixmap->data)->x11ConvertToDefaultDepth();
+ pixmap_handle = static_cast<QX11PixmapData*>(topData->iconPixmap->data)->x11ConvertToDefaultDepth();
}
- h->flags |= IconPixmapHint;
- } else {
- h->flags &= ~(IconPixmapHint | IconMaskHint);
}
}
- if (q->internalWinId())
- XSetWMHints(X11->display, q->internalWinId(), h);
+ if (!q->internalWinId())
+ return;
+
+ if (!icon_data.isEmpty()) {
+ XChangeProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON), XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *) icon_data.data(),
+ icon_data.size());
+ } else {
+ XDeleteProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON));
+ }
+
+ XWMHints *h = XGetWMHints(X11->display, q->internalWinId());
+ XWMHints wm_hints;
+ if (!h) {
+ memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy
+ h = &wm_hints;
+ }
+
+ if (pixmap_handle) {
+ h->icon_pixmap = pixmap_handle;
+ h->flags |= IconPixmapHint;
+ } else {
+ h->icon_pixmap = 0;
+ h->flags &= ~(IconPixmapHint | IconMaskHint);
+ }
+
+ XSetWMHints(X11->display, q->internalWinId(), h);
if (h != &wm_hints)
XFree((char *)h);
}
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 7de1ec4..9859425 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -49,6 +49,7 @@
#include <private/qtextengine_p.h>
#include <qvarlengtharray.h>
#include <private/qfontengine_p.h>
+#include <private/qpaintengineex_p.h>
QT_BEGIN_NAMESPACE
@@ -302,6 +303,9 @@ void QPaintEngine::syncState()
{
Q_ASSERT(state);
updateState(*state);
+
+ if (isExtended())
+ static_cast<QPaintEngineEx *>(this)->sync();
}
static QPaintEngine *qt_polygon_recursion = 0;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 593726c..1c55242 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -216,6 +216,8 @@ public:
inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); }
inline const QPainterState *state() const { return static_cast<const QPainterState *>(QPaintEngine::state); }
+ virtual void sync() {}
+
virtual QPixmapFilter *createPixmapFilter(int /*type*/) const { return 0; }
protected:
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 3004841..50100af 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -398,9 +398,12 @@ QRect QMenuPrivate::actionRect(QAction *act) const
return ret;
}
+static const float MenuFadeTimeInSec = 0.150;
+
void QMenuPrivate::hideUpToMenuBar()
{
Q_Q(QMenu);
+ bool fadeMenus = q->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide);
if (!tornoff) {
QWidget *caused = causedPopup.widget;
hideMenu(q); //hide after getting causedPopup
@@ -415,8 +418,9 @@ void QMenuPrivate::hideUpToMenuBar()
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
caused = m->d_func()->causedPopup.widget;
if (!m->d_func()->tornoff)
- hideMenu(m);
- m->d_func()->setCurrentAction(0);
+ hideMenu(m, fadeMenus);
+ if (!fadeMenus) // Mac doesn't clear the action until after hidden.
+ m->d_func()->setCurrentAction(0);
} else {
#ifndef QT_NO_TOOLBUTTON
if (qobject_cast<QToolButton*>(caused) == 0)
@@ -425,26 +429,32 @@ void QMenuPrivate::hideUpToMenuBar()
caused = 0;
}
}
+#if defined(Q_WS_MAC)
+ if (fadeMenus) {
+ QEventLoop eventLoop;
+ QTimer::singleShot(int(MenuFadeTimeInSec * 1000), &eventLoop, SLOT(quit()));
+ QMacWindowFader::currentFader()->performFade();
+ eventLoop.exec();
+ }
+#endif
}
setCurrentAction(0);
}
-void QMenuPrivate::hideMenu(QMenu *menu)
+void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister)
{
if (!menu)
return;
-
#if !defined(QT_NO_EFFECTS)
menu->blockSignals(true);
aboutToHide = true;
// Flash item which is about to trigger (if any).
if (menu->style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)
- && currentAction && currentAction == actionAboutToTrigger) {
-
+ && currentAction && currentAction == actionAboutToTrigger
+ && menu->actions().contains(currentAction)) {
QEventLoop eventLoop;
QAction *activeAction = currentAction;
- // Deselect and wait 60 ms.
menu->setActiveAction(0);
QTimer::singleShot(60, &eventLoop, SLOT(quit()));
eventLoop.exec();
@@ -458,22 +468,24 @@ void QMenuPrivate::hideMenu(QMenu *menu)
// Fade out.
if (menu->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide)) {
// ### Qt 4.4:
- // Should be something like: q->transitionWindow(Qt::FadeOutTransition, 150);
+ // Should be something like: q->transitionWindow(Qt::FadeOutTransition, MenuFadeTimeInSec);
// Hopefully we'll integrate qt/research/windowtransitions into main before 4.4.
// Talk to Richard, Trenton or Bjoern.
#if defined(Q_WS_MAC)
- macWindowFade(qt_mac_window_for(menu)); // FIXME - what is the default duration for view animations
+ if (justRegister) {
+ QMacWindowFader::currentFader()->setFadeDuration(MenuFadeTimeInSec);
+ QMacWindowFader::currentFader()->registerWindowToFade(menu);
+ } else {
+ macWindowFade(qt_mac_window_for(menu), MenuFadeTimeInSec);
+ }
- // Wait for the transition to complete.
- QEventLoop eventLoop;
- QTimer::singleShot(150, &eventLoop, SLOT(quit()));
- eventLoop.exec();
#endif // Q_WS_MAC
}
aboutToHide = false;
menu->blockSignals(false);
#endif // QT_NO_EFFECTS
- menu->hide();
+ if (!justRegister)
+ menu->hide();
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index cce083f..87c886c 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1829,6 +1829,9 @@ OSMenuRef QMenuBar::macMenu() { return d_func()->macMenu(); }
*/
static bool qt_mac_is_ancestor(QWidget* possibleAncestor, QWidget *child)
{
+ if (!possibleAncestor)
+ return false;
+
QWidget * current = child->parentWidget();
while (current != 0) {
if (current == possibleAncestor)
@@ -1847,22 +1850,19 @@ static bool qt_mac_should_disable_menu(QMenuBar *menuBar, QWidget *modalWidget)
{
if (modalWidget == 0 || menuBar == 0)
return false;
- const Qt::WindowModality modality = modalWidget->windowModality();
- if (modality == Qt::ApplicationModal) {
- return true;
- } else if (modality == Qt::WindowModal) {
- QWidget * parent = menuBar->parentWidget();
-
- // Special case for the global menu bar: It's not associated
- // with a window so don't disable it.
- if (parent == 0)
- return false;
- // Disable menu entries in menu bars that belong to ancestors of
- // the modal widget, leave entries in unrelated menu bars enabled.
- return qt_mac_is_ancestor(parent, modalWidget);
+ // If there is an application modal window on
+ // screen, the entries of the menubar should be disabled:
+ QWidget *w = modalWidget;
+ while (w) {
+ if (w->isVisible() && w->windowModality() == Qt::ApplicationModal)
+ return true;
+ w = w->parentWidget();
}
- return false; // modality == NonModal
+
+ // INVARIANT: modalWidget is window modal. Disable menu entries
+ // if the menu bar belongs to an ancestor of modalWidget:
+ return qt_mac_is_ancestor(menuBar->parentWidget(), modalWidget);
}
static void cancelAllMenuTracking()
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index edfeee7..f08283d 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -220,7 +220,7 @@ public:
virtual QList<QPointer<QWidget> > calcCausedStack() const;
QMenuCaused causedPopup;
void hideUpToMenuBar();
- void hideMenu(QMenu *menu);
+ void hideMenu(QMenu *menu, bool justRegister = false);
//index mappings
inline QAction *actionAt(int i) const { return q_func()->actions().at(i); }
diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp
index c970838..3829bcb 100644
--- a/src/gui/widgets/qstatusbar.cpp
+++ b/src/gui/widgets/qstatusbar.cpp
@@ -144,7 +144,7 @@ QRect QStatusBarPrivate::messageRect() const
if (rtl)
left = qMax(left, item->w->x() + item->w->width() + 2);
else
- right = qMin(right, item->w->x()-1);
+ right = qMin(right, item->w->x() - 2);
}
break;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index e7b6ee4..40f3a8d 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -449,6 +449,43 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
+void QGL2PaintEngineEx::sync()
+{
+ Q_D(QGL2PaintEngineEx);
+ ensureActive();
+ d->transferMode(BrushDrawingMode);
+
+ QGLContext *ctx = d->ctx;
+ glUseProgram(0);
+
+#ifndef QT_OPENGL_ES_2
+ // be nice to people who mix OpenGL 1.x code with QPainter commands
+ // by setting modelview and projection matrices to mirror the GL 1
+ // paint engine
+ const QTransform& mtx = state()->matrix;
+
+ float mv_matrix[4][4] =
+ {
+ { mtx.m11(), mtx.m12(), 0, mtx.m13() },
+ { mtx.m21(), mtx.m22(), 0, mtx.m23() },
+ { 0, 0, 1, 0 },
+ { mtx.dx(), mtx.dy(), 0, mtx.m33() }
+ };
+
+ const QSize sz = d->drawable.size();
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadMatrixf(&mv_matrix[0][0]);
+#endif
+
+ glDisable(GL_BLEND);
+ glActiveTexture(GL_TEXTURE0);
+}
+
void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
{
if (newMode == mode)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index dececa3..7213474 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -126,6 +126,7 @@ public:
return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
}
void updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op);
+ virtual void sync();
private:
Q_DISABLE_COPY(QGL2PaintEngineEx)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index b1a63b5..b3523d4 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -440,7 +440,7 @@ inline bool qt_gl_preferGL2Engine()
return true;
#else
return (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)
- && !qgetenv("QT_GL_USE_OPENGL2ENGINE").isEmpty();
+ && qgetenv("QT_GL_USE_OPENGL1ENGINE").isEmpty();
#endif
}
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 85bcda5..8d94c8b 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -372,45 +372,50 @@ QPaintEngine* QGLPixmapData::paintEngine() const
if (m_engine)
return m_engine;
- else if (!useFramebufferObjects()) {
- m_dirty = true;
- if (m_source.size() != size())
- m_source = QImage(size(), QImage::Format_ARGB32_Premultiplied);
- if (m_hasFillColor) {
- m_source.fill(PREMUL(m_fillColor.rgba()));
- m_hasFillColor = false;
- }
- return m_source.paintEngine();
- }
- extern QGLWidget* qt_gl_share_widget();
+ if (useFramebufferObjects()) {
+ extern QGLWidget* qt_gl_share_widget();
- if (!QGLContext::currentContext())
- qt_gl_share_widget()->makeCurrent();
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ if (!QGLContext::currentContext())
+ qt_gl_share_widget()->makeCurrent();
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
- if (textureBufferStack.size() <= currentTextureBuffer) {
- textureBufferStack << createTextureBuffer(size());
- } else {
- QSize sz = textureBufferStack.at(currentTextureBuffer).fbo->size();
- if (sz.width() < m_width || sz.height() < m_height) {
- if (sz.width() < m_width)
- sz.setWidth(qMax(m_width, qRound(sz.width() * 1.5)));
- if (sz.height() < m_height)
- sz.setHeight(qMax(m_height, qRound(sz.height() * 1.5)));
- delete textureBufferStack.at(currentTextureBuffer).fbo;
- textureBufferStack[currentTextureBuffer] =
- createTextureBuffer(sz, textureBufferStack.at(currentTextureBuffer).engine);
- qDebug() << "Creating new pixmap texture buffer:" << sz;
+ if (textureBufferStack.size() <= currentTextureBuffer) {
+ textureBufferStack << createTextureBuffer(size());
+ } else {
+ QSize sz = textureBufferStack.at(currentTextureBuffer).fbo->size();
+ if (sz.width() < m_width || sz.height() < m_height) {
+ if (sz.width() < m_width)
+ sz.setWidth(qMax(m_width, qRound(sz.width() * 1.5)));
+ if (sz.height() < m_height)
+ sz.setHeight(qMax(m_height, qRound(sz.height() * 1.5)));
+ delete textureBufferStack.at(currentTextureBuffer).fbo;
+ textureBufferStack[currentTextureBuffer] =
+ createTextureBuffer(sz, textureBufferStack.at(currentTextureBuffer).engine);
+ qDebug() << "Creating new pixmap texture buffer:" << sz;
+ }
}
- }
- m_renderFbo = textureBufferStack.at(currentTextureBuffer).fbo;
- m_engine = textureBufferStack.at(currentTextureBuffer).engine;
+ if (textureBufferStack.at(currentTextureBuffer).fbo->isValid()) {
+ m_renderFbo = textureBufferStack.at(currentTextureBuffer).fbo;
+ m_engine = textureBufferStack.at(currentTextureBuffer).engine;
+
+ ++currentTextureBuffer;
+
+ return m_engine;
+ }
- ++currentTextureBuffer;
+ qWarning() << "Failed to create pixmap texture buffer of size " << size() << ", falling back to raster paint engine";
+ }
- return m_engine;
+ m_dirty = true;
+ if (m_source.size() != size())
+ m_source = QImage(size(), QImage::Format_ARGB32_Premultiplied);
+ if (m_hasFillColor) {
+ m_source.fill(PREMUL(m_fillColor.rgba()));
+ m_hasFillColor = false;
+ }
+ return m_source.paintEngine();
}
GLuint QGLPixmapData::bind(bool copyBack) const
diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp
index 8eb4e78..d4e2fa0 100644
--- a/tests/benchmarks/qstringbuilder/main.cpp
+++ b/tests/benchmarks/qstringbuilder/main.cpp
@@ -1,17 +1,64 @@
-#include "qstringbuilder.h"
+// Select one of the scenarios below
+#define SCENARIO 3
+
+#if SCENARIO == 1
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+#endif
-#include <QDebug>
-#include <QString>
-#include <qtest.h>
+#if SCENARIO == 2
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * defined
+#define P %
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+#endif
+
+#if SCENARIO == 3
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * _not_ defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+#endif
+
+#if SCENARIO == 4
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * _not_ defined
+#define P %
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+#endif
+
+#include <qbytearray.h>
+#include <qdebug.h>
+#include <qstring.h>
+#include <qstringbuilder.h>
+
+#include <qtest.h>
#define COMPARE(a, b) QCOMPARE(a, b)
//#define COMPARE(a, b)
#define SEP(s) qDebug() << "\n\n-------- " s " ---------";
-#define L(s) QLatin1String(s)
+
+#define LITERAL "some string literal"
class tst_qstringbuilder : public QObject
{
@@ -19,12 +66,16 @@ class tst_qstringbuilder : public QObject
public:
tst_qstringbuilder()
- : l1literal("some string literal"),
- l1string("some string literal"),
- ba("some string literal"),
+ : l1literal(LITERAL),
+ l1string(LITERAL),
+ ba(LITERAL),
string(l1string),
stringref(&string, 2, 10),
- achar('c')
+ achar('c'),
+ r2(QLatin1String(LITERAL LITERAL)),
+ r3(QLatin1String(LITERAL LITERAL LITERAL)),
+ r4(QLatin1String(LITERAL LITERAL LITERAL LITERAL)),
+ r5(QLatin1String(LITERAL LITERAL LITERAL LITERAL LITERAL))
{}
@@ -51,10 +102,10 @@ public:
int s = 0;
for (int i = 0; i < N; ++i) {
#if 0
- s += QString(l1literal % l1literal).size();
- s += QString(l1literal % l1literal % l1literal).size();
- s += QString(l1literal % l1literal % l1literal % l1literal).size();
- s += QString(l1literal % l1literal % l1literal % l1literal % l1literal).size();
+ s += QString(l1literal P l1literal).size();
+ s += QString(l1literal P l1literal P l1literal).size();
+ s += QString(l1literal P l1literal P l1literal P l1literal).size();
+ s += QString(l1literal P l1literal P l1literal P l1literal P l1literal).size();
#endif
s += QString(achar % l1literal % achar).size();
}
@@ -71,24 +122,30 @@ private slots:
void separator_1() { SEP("literal + literal (builder first)"); }
void b_2_l1literal() {
- QBENCHMARK { r = l1literal % l1literal; }
- COMPARE(r, QString(l1string + l1string));
+ QBENCHMARK { r = l1literal P l1literal; }
+ COMPARE(r, r2);
+ }
+ #ifndef QT_NO_CAST_FROM_ASCII
+ void b_l1literal_LITERAL() {
+ QBENCHMARK { r = l1literal P LITERAL; }
+ COMPARE(r, r2);
}
+ #endif
void s_2_l1string() {
QBENCHMARK { r = l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal));
+ COMPARE(r, r2);
}
void separator_2() { SEP("2 strings"); }
void b_2_string() {
- QBENCHMARK { r = string % string; }
- COMPARE(r, QString(string + string));
+ QBENCHMARK { r = string P string; }
+ COMPARE(r, r2);
}
void s_2_string() {
QBENCHMARK { r = string + string; }
- COMPARE(r, QString(string % string));
+ COMPARE(r, r2);
}
@@ -107,12 +164,12 @@ private slots:
void separator_2b() { SEP("3 strings"); }
void b_3_string() {
- QBENCHMARK { r = string % string % string; }
- COMPARE(r, QString(string + string + string));
+ QBENCHMARK { r = string P string P string; }
+ COMPARE(r, r3);
}
void s_3_string() {
QBENCHMARK { r = string + string + string; }
- COMPARE(r, QString(string % string % string));
+ COMPARE(r, r3);
}
@@ -120,56 +177,66 @@ private slots:
void b_string_l1literal() {
QBENCHMARK { r = string % l1literal; }
- COMPARE(r, QString(string + l1string));
+ COMPARE(r, r2);
}
+ #ifndef QT_NO_CAST_FROM_ASCII
+ void b_string_LITERAL() {
+ QBENCHMARK { r = string P LITERAL; }
+ COMPARE(r, r2);
+ }
+ void b_LITERAL_string() {
+ QBENCHMARK { r = LITERAL P string; }
+ COMPARE(r, r2);
+ }
+ #endif
void b_string_l1string() {
- QBENCHMARK { r = string % l1string; }
- COMPARE(r, QString(string + l1string));
+ QBENCHMARK { r = string P l1string; }
+ COMPARE(r, r2);
}
void s_string_l1literal() {
QBENCHMARK { r = string + l1string; }
- COMPARE(r, QString(string % l1literal));
+ COMPARE(r, r2);
}
void s_string_l1string() {
QBENCHMARK { r = string + l1string; }
- COMPARE(r, QString(string % l1literal));
+ COMPARE(r, r2);
}
void separator_3() { SEP("3 literals"); }
void b_3_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal; }
- COMPARE(r, QString(l1string + l1string + l1string));
+ QBENCHMARK { r = l1literal P l1literal P l1literal; }
+ COMPARE(r, r3);
}
void s_3_l1string() {
QBENCHMARK { r = l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal));
+ COMPARE(r, r3);
}
void separator_4() { SEP("4 literals"); }
void b_4_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal % l1literal; }
- COMPARE(r, QString(l1string + l1string + l1string + l1string));
+ QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal; }
+ COMPARE(r, r4);
}
void s_4_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal % l1literal));
+ COMPARE(r, r4);
}
void separator_5() { SEP("5 literals"); }
void b_5_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal % l1literal %l1literal; }
- COMPARE(r, QString(l1string + l1string + l1string + l1string + l1string));
+ QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal P l1literal; }
+ COMPARE(r, r5);
}
void s_5_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal % l1literal % l1literal));
+ COMPARE(r, r5);
}
@@ -177,12 +244,12 @@ private slots:
void b_string_4_char() {
QBENCHMARK { r = string + achar + achar + achar + achar; }
- COMPARE(r, QString(string % achar % achar % achar % achar));
+ COMPARE(r, QString(string P achar P achar P achar P achar));
}
void s_string_4_char() {
QBENCHMARK { r = string + achar + achar + achar + achar; }
- COMPARE(r, QString(string % achar % achar % achar % achar));
+ COMPARE(r, QString(string P achar P achar P achar P achar));
}
@@ -190,26 +257,26 @@ private slots:
void b_char_string_char() {
QBENCHMARK { r = achar + string + achar; }
- COMPARE(r, QString(achar % string % achar));
+ COMPARE(r, QString(achar P string P achar));
}
void s_char_string_char() {
QBENCHMARK { r = achar + string + achar; }
- COMPARE(r, QString(achar % string % achar));
+ COMPARE(r, QString(achar P string P achar));
}
void separator_8() { SEP("string.arg"); }
void b_string_arg() {
- const QString pattern = l1string + QLatin1String("%1") + l1string;
- QBENCHMARK { r = l1literal % string % l1literal; }
- COMPARE(r, QString(l1string + string + l1string));
+ const QString pattern = l1string + QString::fromLatin1("%1") + l1string;
+ QBENCHMARK { r = l1literal P string P l1literal; }
+ COMPARE(r, r3);
}
void s_string_arg() {
const QString pattern = l1string + QLatin1String("%1") + l1string;
QBENCHMARK { r = pattern.arg(string); }
- COMPARE(r, QString(l1string + string + l1string));
+ COMPARE(r, r3);
}
void s_bytearray_arg() {
@@ -223,16 +290,16 @@ private slots:
void b_reserve() {
QBENCHMARK {
r.clear();
- r = string % string % string % string;
+ r = string P string P string P string;
}
- COMPARE(r, QString(string + string + string + string));
+ COMPARE(r, r4);
}
void b_reserve_lit() {
QBENCHMARK {
r.clear();
- r = string % l1literal % string % string;
+ r = string P l1literal P string P string;
}
- COMPARE(r, QString(string + string + string + string));
+ COMPARE(r, r4);
}
void s_reserve() {
QBENCHMARK {
@@ -243,7 +310,7 @@ private slots:
r += string;
r += string;
}
- COMPARE(r, QString(string + string + string + string));
+ COMPARE(r, r4);
}
void s_reserve_lit() {
QBENCHMARK {
@@ -256,7 +323,7 @@ private slots:
r += string;
r += string;
}
- COMPARE(r, QString(string + string + string + string));
+ COMPARE(r, r4);
}
private:
@@ -266,6 +333,7 @@ private:
const QString string;
const QStringRef stringref;
const QLatin1Char achar;
+ const QString r2, r3, r4, r5;
QString r;
};
@@ -280,12 +348,14 @@ int main(int argc, char *argv[])
//QString("x") % 2; // Sanity test, should only compile when the
// operator%(QString, int) is visible.
- if (argc == 2 && (argv[1] == L("--run-builder") || argv[1] == L("-b"))) {
+ if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-builder")
+ || QLatin1String(argv[1]) == QLatin1String("-b"))) {
tst_qstringbuilder test;
return test.run_builder();
}
- if (argc == 2 && (argv[1] == L("--run-traditional") || argv[1] == L("-t"))) {
+ if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-traditional")
+ || QLatin1String(argv[1]) == QLatin1String("-t"))) {
tst_qstringbuilder test;
return test.run_traditional();
}
diff --git a/tests/benchmarks/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/qstringbuilder/qstringbuilder.pro
index 02daaaa..79171b4 100644
--- a/tests/benchmarks/qstringbuilder/qstringbuilder.pro
+++ b/tests/benchmarks/qstringbuilder/qstringbuilder.pro
@@ -2,10 +2,6 @@ load(qttest_p4)
TEMPLATE = app
TARGET = tst_qstringbuilder
-# Uncomment to test compilation of the drop-in
-# replacement operator+()
-#DEFINES += QT_USE_FAST_OPERATOR_PLUS
-
QMAKE_CXXFLAGS += -g
QMAKE_CFLAGS += -g
diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
index 4dae28e..c5aefb1 100644
--- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -403,6 +403,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent)
if (!a)
return 0;
+ m_actions.insert(ui_action->attributeName(), a);
applyProperties(a, ui_action->elementProperty());
return a;
}
@@ -415,7 +416,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj
QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName());
if (!a)
return 0;
-
+ m_actionGroups.insert(ui_action_group->attributeName(), a);
applyProperties(a, ui_action_group->elementProperty());
foreach (DomAction *ui_action, ui_action_group->elementAction()) {
@@ -1184,8 +1185,6 @@ QAction *QAbstractFormBuilder::createAction(QObject *parent, const QString &name
{
QAction *action = new QAction(parent);
action->setObjectName(name);
- m_actions.insert(name, action);
-
return action;
}
@@ -1196,8 +1195,6 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
{
QActionGroup *g = new QActionGroup(parent);
g->setObjectName(name);
- m_actionGroups.insert(name, g);
-
return g;
}
diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp
index 414eb14..53d1e9d 100644
--- a/tools/designer/src/lib/uilib/formbuilder.cpp
+++ b/tools/designer/src/lib/uilib/formbuilder.cpp
@@ -120,7 +120,10 @@ QFormBuilder::~QFormBuilder()
*/
QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
{
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
+ if (!fb->parentWidgetIsSet())
+ fb->setParentWidget(parentWidget);
+ fb->setProcessingLayoutWidget(false);
if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
&& parentWidget
#ifndef QT_NO_MAINWINDOW
@@ -145,7 +148,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
&& !qobject_cast<QDockWidget *>(parentWidget)
#endif
)
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true);
+ fb->setProcessingLayoutWidget(true);
return QAbstractFormBuilder::create(ui_widget, parentWidget);
}
@@ -228,9 +231,6 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
if (qobject_cast<QDialog *>(w))
w->setParent(parentWidget);
- if (!fb->rootWidget())
- fb->setRootWidget(w);
-
return w;
}
@@ -369,9 +369,10 @@ QWidget *QFormBuilder::create(DomUI *ui, QWidget *parentWidget)
*/
QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget)
{
+ QFormBuilderExtra *fb = QFormBuilderExtra::instance(this);
// Is this a temporary layout widget used to represent QLayout hierarchies in Designer?
// Set its margins to 0.
- bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget();
+ bool layoutWidget = fb->processingLayoutWidget();
QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
if (layoutWidget) {
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
@@ -392,7 +393,7 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa
bottom = prop->elementNumber();
l->setContentsMargins(left, top, right, bottom);
- QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);
+ fb->setProcessingLayoutWidget(false);
}
return l;
}
@@ -525,6 +526,7 @@ QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
/*!
\internal
*/
+
void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
{
typedef QList<DomProperty*> DomPropertyList;
@@ -542,11 +544,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
continue;
const QString attributeName = (*it)->attributeName();
- if (o == fb->rootWidget() && attributeName == strings.geometryProperty) {
- // apply only the size for the rootWidget
- fb->rootWidget()->resize(qvariant_cast<QRect>(v).size());
+ const bool isWidget = o->isWidgetType();
+ if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) {
+ // apply only the size part of a geometry for the root widget
+ static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size());
} else if (fb->applyPropertyInternally(o, attributeName, v)) {
- } else if (!qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
+ } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
// ### special-casing for Line (QFrame) -- try to fix me
o->setProperty("frameShape", v); // v is of QFrame::Shape enum
} else {
diff --git a/tools/designer/src/lib/uilib/formbuilderextra.cpp b/tools/designer/src/lib/uilib/formbuilderextra.cpp
index cb82967..38fe2ae 100644
--- a/tools/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/tools/designer/src/lib/uilib/formbuilderextra.cpp
@@ -81,7 +81,8 @@ QFormBuilderExtra::~QFormBuilderExtra()
void QFormBuilderExtra::clear()
{
m_buddies.clear();
- m_rootWidget = 0;
+ m_parentWidget = 0;
+ m_parentWidgetIsSet = false;
#ifndef QT_FORMBUILDER_NO_SCRIPT
m_FormScriptRunner.clearErrors();
m_customWidgetScriptHash.clear();
@@ -136,14 +137,21 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode
return false;
}
-const QPointer<QWidget> &QFormBuilderExtra::rootWidget() const
+const QPointer<QWidget> &QFormBuilderExtra::parentWidget() const
{
- return m_rootWidget;
+ return m_parentWidget;
}
-void QFormBuilderExtra::setRootWidget(const QPointer<QWidget> &w)
+bool QFormBuilderExtra::parentWidgetIsSet() const
{
- m_rootWidget = w;
+ return m_parentWidgetIsSet;
+}
+
+void QFormBuilderExtra::setParentWidget(const QPointer<QWidget> &w)
+{
+ // Parent widget requires special handling of the geometry property.
+ m_parentWidget = w;
+ m_parentWidgetIsSet = true;
}
#ifndef QT_FORMBUILDER_NO_SCRIPT
diff --git a/tools/designer/src/lib/uilib/formbuilderextra_p.h b/tools/designer/src/lib/uilib/formbuilderextra_p.h
index f357239..9166c48 100644
--- a/tools/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/tools/designer/src/lib/uilib/formbuilderextra_p.h
@@ -101,8 +101,9 @@ public:
void applyInternalProperties() const;
static bool applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label);
- const QPointer<QWidget> &rootWidget() const;
- void setRootWidget(const QPointer<QWidget> &w);
+ const QPointer<QWidget> &parentWidget() const;
+ bool parentWidgetIsSet() const;
+ void setParentWidget(const QPointer<QWidget> &w);
#ifndef QT_FORMBUILDER_NO_SCRIPT
QFormScriptRunner &formScriptRunner();
@@ -182,7 +183,8 @@ private:
QResourceBuilder *m_resourceBuilder;
QTextBuilder *m_textBuilder;
- QPointer<QWidget> m_rootWidget;
+ QPointer<QWidget> m_parentWidget;
+ bool m_parentWidgetIsSet;
};
void uiLibWarning(const QString &message);
diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp
index 2a66095..c6c2d80 100644
--- a/tools/designer/src/uitools/quiloader.cpp
+++ b/tools/designer/src/uitools/quiloader.cpp
@@ -613,8 +613,7 @@ void QUiLoaderPrivate::setupWidgetMap() const
reason, you can subclass the QUiLoader class and reimplement these
functions to intervene the process of constructing a user interface. For
example, you might want to have a list of the actions created when loading
- a form or creating a custom widget. However, in your reimplementation, you
- must call QUiLoader's original implementation of these functions first.
+ a form or creating a custom widget.
For a complete example using the QUiLoader class, see the
\l{Calculator Builder Example}.
diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp
index f0ff27e..20b37a0 100644
--- a/tools/qdoc3/codeparser.cpp
+++ b/tools/qdoc3/codeparser.cpp
@@ -47,6 +47,7 @@
#include "codeparser.h"
#include "node.h"
#include "tree.h"
+#include "config.h"
QT_BEGIN_NAMESPACE
@@ -67,6 +68,7 @@ QT_BEGIN_NAMESPACE
#define COMMAND_TITLE Doc::alias(QLatin1String("title"))
QList<CodeParser *> CodeParser::parsers;
+bool CodeParser::showInternal = false;
/*!
The constructor adds this code parser to the static
@@ -87,11 +89,11 @@ CodeParser::~CodeParser()
}
/*!
- Initializing a code parser is trivial.
+ Initialize the code parser base class.
*/
-void CodeParser::initializeParser(const Config & /* config */)
+void CodeParser::initializeParser(const Config& config)
{
- // nothing.
+ showInternal = config.getBool(QLatin1String(CONFIG_SHOWINTERNAL));
}
/*!
@@ -217,8 +219,10 @@ void CodeParser::processCommonMetaCommand(const Location &location,
node->setStatus(Node::Preliminary);
}
else if (command == COMMAND_INTERNAL) {
- node->setAccess(Node::Private);
- node->setStatus(Node::Internal);
+ if (!showInternal) {
+ node->setAccess(Node::Private);
+ node->setStatus(Node::Internal);
+ }
}
else if (command == COMMAND_REENTRANT) {
node->setThreadSafeness(Node::Reentrant);
diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h
index 019e806..0152b9c 100644
--- a/tools/qdoc3/codeparser.h
+++ b/tools/qdoc3/codeparser.h
@@ -87,6 +87,7 @@ class CodeParser
private:
static QList<CodeParser *> parsers;
+ static bool showInternal;
};
QT_END_NAMESPACE
diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h
index 9443f0d..7eb7048 100644
--- a/tools/qdoc3/config.h
+++ b/tools/qdoc3/config.h
@@ -147,6 +147,7 @@ class Config
#define CONFIG_QHP "qhp"
#define CONFIG_QUOTINGINFORMATION "quotinginformation"
#define CONFIG_SLOW "slow"
+#define CONFIG_SHOWINTERNAL "showinternal"
#define CONFIG_SOURCEDIRS "sourcedirs"
#define CONFIG_SOURCES "sources"
#define CONFIG_SPURIOUS "spurious"
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 514d06e..995d037 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -95,6 +95,7 @@ static const struct {
};
static bool slow = false;
+static bool showInternal = false;
static QStringList defines;
static QHash<QString, Tree *> trees;
@@ -120,14 +121,16 @@ static void printHelp()
{
Location::information(tr("Usage: qdoc [options] file1.qdocconf ...\n"
"Options:\n"
- " -help "
+ " -help "
"Display this information and exit\n"
- " -version "
+ " -version "
"Display version of qdoc and exit\n"
- " -D<name> "
+ " -D<name> "
"Define <name> as a macro while parsing sources\n"
- " -slow "
- "Turn on features that slow down qdoc") );
+ " -slow "
+ "Turn on features that slow down qdoc"
+ " -showinternal "
+ "Include stuff marked internal") );
}
/*!
@@ -160,6 +163,8 @@ static void processQdocconfFile(const QString &fileName)
++i;
}
config.setStringList(CONFIG_SLOW, QStringList(slow ? "true" : "false"));
+ config.setStringList(CONFIG_SHOWINTERNAL,
+ QStringList(showInternal ? "true" : "false"));
/*
With the default configuration values in place, load
@@ -326,10 +331,11 @@ static void processQdocconfFile(const QString &fileName)
/*
Generate the XML tag file, if it was requested.
*/
+
QString tagFile = config.getString(CONFIG_TAGFILE);
if (!tagFile.isEmpty())
tree->generateTagFile(tagFile);
-
+
tree->setVersion("");
Generator::terminate();
CodeParser::terminate();
@@ -342,7 +348,6 @@ static void processQdocconfFile(const QString &fileName)
foreach (QTranslator *translator, translators)
delete translator;
-
delete tree;
}
@@ -426,6 +431,9 @@ int main(int argc, char **argv)
else if (opt == "-slow") {
slow = true;
}
+ else if (opt == "-showinternal") {
+ showInternal = true;
+ }
else {
qdocFiles.append(opt);
}