macos autostart fix
This commit is contained in:
parent
51f7e6811e
commit
491a09b175
3 changed files with 19 additions and 3 deletions
|
@ -80,8 +80,13 @@ int main(int argc, char *argv[])
|
|||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
MainWindow mainWindow;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (parser.isSet("a")) mainWindow.showOnStartup();
|
||||
else mainWindow.show();
|
||||
#else
|
||||
mainWindow.showOnStartup();
|
||||
#endif
|
||||
|
||||
if (app.isPrimary()) {
|
||||
QObject::connect(&app, &SingleApplication::instanceStarted, &mainWindow, [&](){
|
||||
|
|
|
@ -71,7 +71,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
ui->stackedWidget_main->setSpeed(200);
|
||||
ui->stackedWidget_main->setAnimation(QEasingCurve::Linear);
|
||||
|
||||
bool needToHideCustomTitlebar = false;
|
||||
if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) {
|
||||
needToHideCustomTitlebar = true;
|
||||
}
|
||||
|
@ -83,7 +82,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
if (needToHideCustomTitlebar) {
|
||||
ui->widget_tittlebar->hide();
|
||||
resize(width(), height() - ui->stackedWidget_main->y());
|
||||
resize(width(), 640);
|
||||
ui->stackedWidget_main->move(0,0);
|
||||
}
|
||||
|
||||
|
@ -164,11 +163,16 @@ MainWindow::~MainWindow()
|
|||
void MainWindow::showOnStartup()
|
||||
{
|
||||
if (! m_settings.isStartMinimized()) show();
|
||||
else {
|
||||
#ifdef Q_OS_MACX
|
||||
setDockIconVisible(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::goToPage(Page page, bool reset, bool slide)
|
||||
{
|
||||
qDebug() << "goToPage" << page;
|
||||
//qDebug() << "goToPage" << page;
|
||||
if (reset) {
|
||||
if (page == Page::ServerSettings) {
|
||||
updateServerPage();
|
||||
|
@ -356,6 +360,11 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||
if (!event->spontaneous()) {
|
||||
setDockIconVisible(true);
|
||||
}
|
||||
if (needToHideCustomTitlebar) {
|
||||
ui->widget_tittlebar->hide();
|
||||
resize(width(), 640);
|
||||
ui->stackedWidget_main->move(0,0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -141,6 +141,8 @@ private:
|
|||
|
||||
bool canMove = false;
|
||||
QPoint offset;
|
||||
bool needToHideCustomTitlebar = false;
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue