Qt中按钮与槽的关系

调用findPrevious或者findNext信号对应的槽函数,emit  把connect把信号和槽进行关联,emit某个信号,就相当于调用这个信号connect时所关联的槽函数,如下边的例程所示:      
SerialSet :: SerialSet(QWidget * parent)

   : QWidget(parent)

{

   openButton = new QPushButton("open");

     
  connect(openButton, SIGNAL(clicked()), this, SLOT(setSerialData()));

 leftLayout = new QGridLayout;

 leftLayout->addWidget(openButton,1,1);

 this->setLayout(leftLayout);

}

void SerialSet :: setSerialData()

{

   SerialData data;

  data.devName  = "ttySP0" ;

   emit serialDataSeted(data);

}
 

©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页