mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Made scaling of left panel limited, within well-defined bounds
This commit is contained in:
parent
8010bff866
commit
78ae6d6ed0
@ -47,6 +47,29 @@ void MainWindow::load()
|
||||
settings.init();
|
||||
}
|
||||
|
||||
void MainWindow::computeSidePanelSizes()
|
||||
{
|
||||
QVector<QToolButton*> widgets = {
|
||||
ui->modslistButton,
|
||||
ui->settingsButton,
|
||||
ui->lobbyButton,
|
||||
ui->startEditorButton,
|
||||
ui->startGameButton
|
||||
};
|
||||
|
||||
for(auto & widget : widgets)
|
||||
{
|
||||
QFontMetrics metrics(widget->font());
|
||||
QSize iconSize = widget->iconSize();
|
||||
|
||||
// this is minimal space that is needed for our button to avoid text clipping
|
||||
int buttonHeight = iconSize.height() + metrics.height() + 4;
|
||||
|
||||
widget->setMinimumHeight(buttonHeight);
|
||||
widget->setMaximumHeight(buttonHeight * 1.2);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget * parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||
{
|
||||
@ -73,6 +96,8 @@ MainWindow::MainWindow(QWidget * parent)
|
||||
ui->startEditorButton->hide();
|
||||
#endif
|
||||
|
||||
computeSidePanelSizes();
|
||||
|
||||
ui->tabListWidget->setCurrentIndex(0);
|
||||
|
||||
ui->settingsView->isExtraResolutionsModEnabled = ui->modlistView->isExtraResolutionsModEnabled();
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
const CModList & getModList() const;
|
||||
|
||||
void updateTranslation();
|
||||
void computeSidePanelSizes();
|
||||
|
||||
public slots:
|
||||
void on_startGameButton_clicked();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>508</height>
|
||||
<height>410</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -47,6 +47,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mods</string>
|
||||
</property>
|
||||
@ -91,6 +97,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
@ -135,6 +147,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lobby</string>
|
||||
</property>
|
||||
@ -165,6 +183,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="startEditorButton">
|
||||
<property name="sizePolicy">
|
||||
@ -179,6 +210,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
@ -226,6 +263,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
Loading…
Reference in New Issue
Block a user