mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Make sure the main windows is initially centered
This commit is contained in:
parent
0b874d9c42
commit
6580d23263
2 changed files with 13 additions and 2 deletions
|
@ -92,7 +92,7 @@ using namespace libtorrent;
|
|||
*****************************************************/
|
||||
|
||||
// Constructor
|
||||
MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), force_exit(false) {
|
||||
MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), m_posInitialized(false), force_exit(false) {
|
||||
setupUi(this);
|
||||
Preferences pref;
|
||||
ui_locked = pref.isUILocked();
|
||||
|
@ -458,7 +458,10 @@ void MainWindow::writeSettings() {
|
|||
void MainWindow::readSettings() {
|
||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
if(settings.contains("geometry")) {
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
m_posInitialized = true;
|
||||
}
|
||||
const QByteArray splitterState = settings.value("vsplitterState").toByteArray();
|
||||
if(splitterState.isEmpty()) {
|
||||
// Default sizes
|
||||
|
@ -680,7 +683,14 @@ void MainWindow::showEvent(QShowEvent *e) {
|
|||
if(getCurrentTabWidget() == transferList) {
|
||||
properties->loadDynamicData();
|
||||
}
|
||||
|
||||
e->accept();
|
||||
|
||||
// Make sure the window is initially centered
|
||||
if(!m_posInitialized) {
|
||||
move(misc::screenCenter(this));
|
||||
m_posInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Called when we close the program
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue