From 1e80a56b8444373997f3f7458bf0547c298c7abd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 17 Oct 2013 21:16:13 +0300 Subject: dont call virtual functions in characterview constructor. --- src/gui/widgets/characterviewnormal.cpp | 6 +++++- src/gui/widgets/characterviewsmall.cpp | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/characterviewnormal.cpp b/src/gui/widgets/characterviewnormal.cpp index 7e6fe380d..b24828fcc 100644 --- a/src/gui/widgets/characterviewnormal.cpp +++ b/src/gui/widgets/characterviewnormal.cpp @@ -44,7 +44,11 @@ CharacterViewNormal::CharacterViewNormal(CharSelectDialog *const widget, add(character); character->setVisible(true); } - show(0); + if (mSelected >= 0) + (*mCharacterEntries)[mSelected]->setSelect(false); + mSelected = 0; + (*mCharacterEntries)[0]->setSelect(true); + const CharacterDisplay *const firtChar = (*mCharacterEntries)[0]; setWidth(firtChar->getWidth() * 5 + mPadding * 2); } diff --git a/src/gui/widgets/characterviewsmall.cpp b/src/gui/widgets/characterviewsmall.cpp index 6cdb01c7e..010bb3bba 100644 --- a/src/gui/widgets/characterviewsmall.cpp +++ b/src/gui/widgets/characterviewsmall.cpp @@ -45,7 +45,12 @@ CharacterViewSmall::CharacterViewSmall(CharSelectDialog *const widget, { add(*it); } - show(0); + const int sz = static_cast(mCharacterEntries->size()); + mSelected = 0; + mSelectedEntry = (*mCharacterEntries)[mSelected]; + mSelectedEntry->setVisible(true); + mNumber->setCaption(strprintf("%d / %d", mSelected + 1, sz)); + mNumber->adjustSize(); } add(mPrevious); add(mNext); -- cgit v1.2.3-70-g09d2