示例#1
0
void
MainWindow::
InitializeUi() {

    EnableToolbar(false);

    QHeaderView *header = ui->tableWidget->horizontalHeader();
    header->setSectionResizeMode(QHeaderView::ResizeToContents);
    header->setResizeContentsPrecision(QHeaderView::Stretch);

    connect(ui->actionStep_Run, SIGNAL(triggered(bool)), this, SLOT(StepRun()));
    connect(ui->actionPause, SIGNAL(triggered(bool)), this, SLOT(Stop()));
    connect(ui->actionPlay, SIGNAL(triggered(bool)), this, SLOT(Run()));
    connect(ui->actionConnect, SIGNAL(triggered(bool)), this, SLOT(managePortConnection()));
    connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(SendGroupCommand()));
    connect(ui->actionReset_Script_Table, SIGNAL(triggered(bool)), this, SLOT(ClearTable()));
    connect(ui->tableWidget, SIGNAL(cellPressed(int,int)), this, SLOT(SetRowCol(int,int)));
    connect(ui->actionTimer_Reset, SIGNAL(triggered(bool)), this, SLOT(ResetTimer()));
    connect(ui->actionSave, SIGNAL(triggered(bool)), this, SLOT(SaveScript()));
    connect(ui->actionOpen, SIGNAL(triggered(bool)), this, SLOT(LoadScript()));
    connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(Exit()));

    //////////// RIGHT MOUSE BUTTON MENU /////////////////////////////
    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint &)),this, SLOT(ShowContextMenu(const QPoint &)));
    //////////////////////////////////////////////////////////////////
}