Commit 51d11338 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: use qt QStyle to center dialogs on screen

parent 91392b25
......@@ -26,14 +26,13 @@
#include <QWidget>
#include <QDialog>
#include <QSpacerItem>
#include <QHBoxLayout>
#include <QApplication>
#include <QMainWindow>
#include <QPushButton>
#include <QKeyEvent>
#include <QDesktopWidget>
#include <QSettings>
#include <QStyle>
#include "qt4.hpp"
......@@ -76,7 +75,7 @@ class QVLCTools
widget->resize(defSize);
if(defPos.x() == 0 && defPos.y()==0)
centerWidgetOnScreen(widget);
widget->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, widget->size(), qApp->desktop()->availableGeometry()));
return true;
}
return false;
......@@ -97,19 +96,6 @@ class QVLCTools
return defaultUsed;
}
/*
call this method for a window or dialog to show it centred on
current screen
*/
static void centerWidgetOnScreen(QWidget *widget)
{
QDesktopWidget * const desktop = QApplication::desktop();
QRect screenRect = desktop->availableGeometry(widget);
QPoint p1 = widget->frameGeometry().center();
widget->move ( screenRect.center() - p1 );
}
};
class QVLCFrame : public QWidget
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment