1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-28 03:57:02 +02:00

Merge pull request #228 from vmarkovtsev/develop

Fix launcher's UI for Ubuntu's scaled view on Retina displays
This commit is contained in:
Vadim Markovtsev 2016-10-02 16:29:04 +02:00 committed by GitHub
commit 05dff6b8e2
5 changed files with 24 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -33,6 +33,21 @@ MainWindow::MainWindow(const QStringList& displayList, QWidget *parent) :
load(); // load FS before UI load(); // load FS before UI
ui->setupUi(this); ui->setupUi(this);
auto width = ui->startGameTitle->fontMetrics().boundingRect(ui->startGameTitle->text()).width();
if (ui->startGameButton->iconSize().width() < width)
{
ui->startGameButton->setIconSize(QSize(width, width));
}
auto tab_icon_size = ui->tabSelectList->iconSize();
if (tab_icon_size.width() < width)
{
ui->tabSelectList->setIconSize(QSize(
width,
width + tab_icon_size.height() - tab_icon_size.width()));
ui->tabSelectList->setGridSize(QSize(width, width));
// 4 is a dirty hack to make it look right
ui->tabSelectList->setMaximumWidth(width + 4);
}
ui->tabListWidget->setCurrentIndex(0); ui->tabListWidget->setCurrentIndex(0);
ui->settingsView->setDisplayList(displayList); ui->settingsView->setDisplayList(displayList);
@ -45,7 +60,7 @@ MainWindow::~MainWindow()
delete ui; delete ui;
} }
void MainWindow::on_startGameButon_clicked() void MainWindow::on_startGameButton_clicked()
{ {
startExecutable(pathToQString(VCMIDirs::get().clientPath())); startExecutable(pathToQString(VCMIDirs::get().clientPath()));
} }

View File

@ -19,7 +19,7 @@ public:
~MainWindow(); ~MainWindow();
private slots: private slots:
void on_startGameButon_clicked(); void on_startGameButton_clicked();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@ -120,7 +120,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QToolButton" name="startGameButon"> <widget class="QToolButton" name="startGameButton">
<property name="text"> <property name="text">
<string>Play</string> <string>Play</string>
</property> </property>
@ -199,7 +199,7 @@
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>tabSelectList</tabstop> <tabstop>tabSelectList</tabstop>
<tabstop>startGameButon</tabstop> <tabstop>startGameButton</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -360,7 +360,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>220</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -401,7 +401,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>140</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -426,7 +426,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>140</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -451,7 +451,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>140</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -476,7 +476,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>140</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>