diff options
Diffstat (limited to 'tools/designer/src/lib/shared/qdesigner_toolbar.cpp')
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_toolbar.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 0e98517..2ded7c4 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -39,10 +39,6 @@ ** ****************************************************************************/ -/* -TRANSLATOR qdesigner_internal::Sentinel -*/ - #include "qdesigner_toolbar_p.h" #include "qdesigner_command_p.h" #include "actionrepository_p.h" @@ -65,7 +61,6 @@ TRANSLATOR qdesigner_internal::Sentinel #include <QtGui/QMenu> #include <QtGui/qevent.h> #include <QtGui/QApplication> -#include <QtGui/private/qtoolbarlayout_p.h> #include <QtCore/QDebug> Q_DECLARE_METATYPE(QAction*) @@ -445,11 +440,17 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos) return tb->actions().at(index); } +//that's a trick to get acces to the initStyleOption which is a protected member +class FriendlyToolBar : public QToolBar { +public: + friend class ToolBarEventFilter; +}; + QRect ToolBarEventFilter::handleArea(const QToolBar *tb) { - const QToolBarLayout *tbl = qobject_cast<QToolBarLayout *>(tb->layout()); - Q_ASSERT(tbl); - return tbl->handleRect(); + QStyleOptionToolBar opt; + static_cast<const FriendlyToolBar*>(tb)->initStyleOption(&opt); + return tb->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, tb); } bool ToolBarEventFilter::withinHandleArea(const QToolBar *tb, const QPoint &pos) @@ -465,7 +466,7 @@ QRect ToolBarEventFilter::freeArea(const QToolBar *tb) QRect exclusionRectangle = actionList.empty() ? handleArea(tb) : tb->actionGeometry(actionList.back()); switch (tb->orientation()) { case Qt::Horizontal: - switch (QApplication::layoutDirection()) { + switch (tb->layoutDirection()) { case Qt::LeftToRight: rc.setX(exclusionRectangle.right() + 1); break; |