diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-17 15:54:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-17 15:54:50 +0300 |
commit | 37597422a0d458a224fed0258d093f7a7e400041 (patch) | |
tree | 61996595f7a39351635bdad0172deb5855aa8776 /src/gui/widgets/windowcontainer.cpp | |
parent | 794ebb9ccd1b6605a03fee438abc1e4f2f7966c9 (diff) | |
download | mv-37597422a0d458a224fed0258d093f7a7e400041.tar.gz mv-37597422a0d458a224fed0258d093f7a7e400041.tar.bz2 mv-37597422a0d458a224fed0258d093f7a7e400041.tar.xz mv-37597422a0d458a224fed0258d093f7a7e400041.zip |
Exclude useless logic methods calls.
Diffstat (limited to 'src/gui/widgets/windowcontainer.cpp')
-rw-r--r-- | src/gui/widgets/windowcontainer.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index a9b556410..20c3328a7 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -64,18 +64,34 @@ void WindowContainer::moveWidgetAfter(Widget *const after, const WidgetListIterator widgetIter = std::find( mWidgets.begin(), mWidgets.end(), widget); - if (widgetIter == mWidgets.end()) - return; + if (widgetIter != mWidgets.end()) + { + WidgetListIterator afterIter = std::find( + mWidgets.begin(), mWidgets.end(), after); - WidgetListIterator afterIter = std::find( - mWidgets.begin(), mWidgets.end(), after); + if (afterIter != mWidgets.end()) + { + ++ afterIter; + mWidgets.erase(widgetIter); + mWidgets.insert(afterIter, widget); + } + } - if (afterIter == mWidgets.end()) - return; + const WidgetListIterator widgetIter2 = std::find( + mLogicWidgets.begin(), mLogicWidgets.end(), widget); - ++ afterIter; - mWidgets.erase(widgetIter); - mWidgets.insert(afterIter, widget); + if (widgetIter2 != mLogicWidgets.end()) + { + WidgetListIterator afterIter = std::find( + mLogicWidgets.begin(), mLogicWidgets.end(), after); + + if (afterIter != mLogicWidgets.end()) + { + ++ afterIter; + mLogicWidgets.erase(widgetIter2); + mLogicWidgets.insert(afterIter, widget); + } + } } #ifdef USE_PROFILER |