C++98 compatibility.

This commit is contained in:
mfreiholz
2016-02-12 07:15:10 +01:00
parent c74204d5b7
commit 08f1968b31
17 changed files with 77 additions and 67 deletions

View File

@@ -10,10 +10,10 @@ static void centerWidget(QWidget* widget)
if (widget)
{
QDesktopWidget deskWidget;
const auto screenIndex = deskWidget.primaryScreen();
const auto deskRect = deskWidget.availableGeometry(screenIndex);
const auto x = (deskRect.width() - widget->rect().width()) / 2;
const auto y = (deskRect.height() - widget->rect().height()) / 2;
const int screenIndex = deskWidget.primaryScreen();
const QRect deskRect = deskWidget.availableGeometry(screenIndex);
const int x = (deskRect.width() - widget->rect().width()) / 2;
const int y = (deskRect.height() - widget->rect().height()) / 2;
widget->move(x, y);
}
}
@@ -23,10 +23,10 @@ static void resizeWidgetPerCent(QWidget* widget, qreal widthPC, qreal heightPC)
if (widget && widthPC >= 0.0 && heightPC >= 0.0)
{
QDesktopWidget deskWidget;
const auto screenIndex = deskWidget.primaryScreen();
const auto deskRect = deskWidget.availableGeometry(screenIndex);
const auto w = (deskRect.width() / 100) * widthPC;
const auto h = (deskRect.height() / 100) * heightPC;
const int screenIndex = deskWidget.primaryScreen();
const QRect deskRect = deskWidget.availableGeometry(screenIndex);
const int w = (deskRect.width() / 100) * widthPC;
const int h = (deskRect.height() / 100) * heightPC;
widget->resize(w, h);
}
}