summaryrefslogtreecommitdiff
path: root/src/gui/widgets/windowcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-17 15:54:50 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-17 15:54:50 +0300
commit37597422a0d458a224fed0258d093f7a7e400041 (patch)
tree61996595f7a39351635bdad0172deb5855aa8776 /src/gui/widgets/windowcontainer.cpp
parent794ebb9ccd1b6605a03fee438abc1e4f2f7966c9 (diff)
downloadmanaplus-37597422a0d458a224fed0258d093f7a7e400041.tar.gz
manaplus-37597422a0d458a224fed0258d093f7a7e400041.tar.bz2
manaplus-37597422a0d458a224fed0258d093f7a7e400041.tar.xz
manaplus-37597422a0d458a224fed0258d093f7a7e400041.zip
Exclude useless logic methods calls.
Diffstat (limited to 'src/gui/widgets/windowcontainer.cpp')
-rw-r--r--src/gui/widgets/windowcontainer.cpp34
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