mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 13:49:55 +00:00
TableBottomBox adjusts its size according to the current widget size
This commit is contained in:
parent
6c51e13917
commit
24eb9bddfb
2 changed files with 26 additions and 0 deletions
|
@ -9,6 +9,20 @@
|
|||
|
||||
#include "creator.hpp"
|
||||
|
||||
void CSVWorld::TableBottomBox::updateSize()
|
||||
{
|
||||
// Make sure that the size of the bottom box is determined by the currently visible widget
|
||||
for (int i = 0; i < mLayout->count(); ++i)
|
||||
{
|
||||
QSizePolicy::Policy verPolicy = QSizePolicy::Ignored;
|
||||
if (mLayout->widget(i) == mLayout->currentWidget())
|
||||
{
|
||||
verPolicy = QSizePolicy::Expanding;
|
||||
}
|
||||
mLayout->widget(i)->setSizePolicy(QSizePolicy::Expanding, verPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::updateStatus()
|
||||
{
|
||||
if (mShowStatusBar)
|
||||
|
@ -69,6 +83,7 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
|
|||
|
||||
mLayout = new QStackedLayout;
|
||||
mLayout->setContentsMargins (0, 0, 0, 0);
|
||||
connect (mLayout, SIGNAL (currentChanged (int)), this, SLOT (currentWidgetChanged (int)));
|
||||
|
||||
mStatus = new QLabel;
|
||||
|
||||
|
@ -95,6 +110,8 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
|
|||
mExtendedConfigurator = new ExtendedCommandConfigurator (document, id, this);
|
||||
mLayout->addWidget (mExtendedConfigurator);
|
||||
connect (mExtendedConfigurator, SIGNAL (done()), this, SLOT (requestDone()));
|
||||
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::setEditLock (bool locked)
|
||||
|
@ -137,6 +154,11 @@ void CSVWorld::TableBottomBox::requestDone()
|
|||
mEditMode = EditMode_None;
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::currentWidgetChanged(int /*index*/)
|
||||
{
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::selectionSizeChanged (int size)
|
||||
{
|
||||
if (mStatusCount[3]!=size)
|
||||
|
|
|
@ -46,6 +46,8 @@ namespace CSVWorld
|
|||
TableBottomBox (const TableBottomBox&);
|
||||
TableBottomBox& operator= (const TableBottomBox&);
|
||||
|
||||
void updateSize();
|
||||
|
||||
void updateStatus();
|
||||
|
||||
void extendedConfigRequest(ExtendedCommandConfigurator::Mode mode,
|
||||
|
@ -80,6 +82,8 @@ namespace CSVWorld
|
|||
void requestDone();
|
||||
///< \note This slot being called does not imply success.
|
||||
|
||||
void currentWidgetChanged(int index);
|
||||
|
||||
public slots:
|
||||
|
||||
void selectionSizeChanged (int size);
|
||||
|
|
Loading…
Reference in a new issue