mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Made scaling of left panel limited, within well-defined bounds
This commit is contained in:
@@ -47,6 +47,29 @@ void MainWindow::load()
|
|||||||
settings.init();
|
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)
|
MainWindow::MainWindow(QWidget * parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
@@ -73,6 +96,8 @@ MainWindow::MainWindow(QWidget * parent)
|
|||||||
ui->startEditorButton->hide();
|
ui->startEditorButton->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
computeSidePanelSizes();
|
||||||
|
|
||||||
ui->tabListWidget->setCurrentIndex(0);
|
ui->tabListWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->settingsView->isExtraResolutionsModEnabled = ui->modlistView->isExtraResolutionsModEnabled();
|
ui->settingsView->isExtraResolutionsModEnabled = ui->modlistView->isExtraResolutionsModEnabled();
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
const CModList & getModList() const;
|
const CModList & getModList() const;
|
||||||
|
|
||||||
void updateTranslation();
|
void updateTranslation();
|
||||||
|
void computeSidePanelSizes();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_startGameButton_clicked();
|
void on_startGameButton_clicked();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>508</height>
|
<height>410</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -47,6 +47,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mods</string>
|
<string>Mods</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -91,6 +97,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -135,6 +147,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Lobby</string>
|
<string>Lobby</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -165,6 +183,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QToolButton" name="startEditorButton">
|
<widget class="QToolButton" name="startEditorButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -179,6 +210,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@@ -226,6 +263,12 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
|
|||||||
Reference in New Issue
Block a user