1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Preference(false); // 主窗口构造函数中 void MainWindow::Preference(bool checked){ Setting *pre = new Setting(this); connect(pre,SIGNAL(showMainMenuSignal(bool)),this,SLOT(showMainMenu(bool))); connect(pre,SIGNAL(showToolBarSignal(bool)),this,SLOT(showToolBar(bool))); connect(pre,SIGNAL(showStatusBarSignal(bool)),this,SLOT(showStatusBar(bool))); connect(pre,SIGNAL(changeLang(int)),this,SLOT(changeLang(int))); connect(pre,SIGNAL(setTabsClosableSignal(bool)),this,SLOT(setTabsClosable(bool))); connect(pre,SIGNAL(setTabsMovableSignal(bool)),this,SLOT(setTabsMovable(bool))); connect(pre,SIGNAL(setTabPositionSignal(int)),this,SLOT(setTabPosition(int))); connect(pre,SIGNAL(setTabShapeSignal(int)),this,SLOT(setTabShape(int))); connect(pre,SIGNAL(setTextColorSignal(QRgb)),this,SLOT(setTextColor(QRgb))); connect(pre,SIGNAL(setTextbgcolorSignal(QRgb)),this,SLOT(setTextbgcolor(QRgb))); connect(pre,SIGNAL(setbgcolorSignal(QRgb)),this,SLOT(setbgcolor(QRgb))); connect(pre,SIGNAL(setcurRowColorSignal(QRgb)),this,SLOT(setcurRowColor(QRgb))); connect(pre,SIGNAL(setThemeSignal(int)),this,SLOT(setWindowTheme(int))); connect(pre,SIGNAL(newFileNameSignal(QString&)),this,SLOT(setNewFileName(QString&))); connect(pre,SIGNAL(newFileSuffixSignal(QString&)),this,SLOT(setNewFileSuffix(QString&))); pre->sendSignal(); // checked解决在启动主程序时就自动运行Preference读取设置且不显示对话框 // 只有在菜单栏点击后才显示对话框 if(checked){ ui->action_Preference->setChecked(false); pre->show(); }else{ pre->deleteLater(); } }
|