MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { console = new Console; console->setEnabled(false); settingdialog = new SettingDialog(); settingdialog->setWindowModality(Qt::ApplicationModal); //弹出子窗口时禁用主窗口 settingdialog->setWindowFlags(Qt::Dialog); //设置为子窗口 serial = new QSerialPort(); creatAboutMessageBox(); creatActions(); creatMenu(); creatToolBar(); creatStatusBar(); connect(console, SIGNAL(sendData(QByteArray)), this, SLOT(writeData(QByteArray))); connect(serial, SIGNAL(readyRead()), this, SLOT(getData())); this->setMinimumSize(800, 600); //设置窗口最小为800*600大小 this->setWindowTitle(tr("上海理工大学 飞思卡尔赛队串口调试工具 V1.0")); this->setWindowIcon(QIcon(":/image/icon.png")); this->setWindowIconText(tr("串口调试工具")); this->setCentralWidget(console); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); w = new Setting; this->setMaximumSize(306,306); this->setMinimumSize(306,306); this->setWindowTitle("PowerSet"); /*以上为 主窗口的参数设定*/ tray = new QSystemTrayIcon; icon.addFile(":/new/prefix1/C:/Users/Fuerm/Desktop/electricity-32.png"); tray->setToolTip("PowerSet is working"); tray->setIcon(icon); tray->show(); /*以上为 托盘的设定*/ creatActions(); creatMenu(); /*以上为 托盘菜单的设定*/ connect(ui->CancleButton,SIGNAL(clicked()),this,SLOT(CancelSlot())); connect(ui->ChangeButton,SIGNAL(clicked()),this,SLOT(setPlan())); connect(w,SIGNAL(dlgRturn(bool)),this,SLOT(SetInfoSlot(bool))); /*以上为 主界面上两个按钮的槽函数关联*/ connect(tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(iconActivied(QSystemTrayIcon::ActivationReason))); }
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent) { scene = new FDBScene; scene->setSceneRect(0,0,5000,5000); creatActions(); creatMenus(); creatToolbar(); creatCentralWidget(); connect(scene,SIGNAL(itemInserted(LogicItem*)),this,SLOT(itemInserted(LogicItem*))); }