• 5207阅读
  • 1回复

[提问]自定义了几个槽,单击后运行一些算法,可是算法该加在哪里呢 [复制链接]

上一主题 下一主题
离线viviansjl
 
只看楼主 正序阅读 楼主  发表于: 2009-12-27
先用designer做了一个ui,然后生成了ui.h,然后分别手动添加了.cpp 和.h,make,本来自定义槽显示msgbox,可以实现,现在想要实现一些算法,该怎么加算法呢,可以把c写的算法直接添加进来么,我是新手,请前辈指导~谢谢~

#include <QMessageBox>
#include "MyDlg.h"
  
MyDlg::MyDlg()
{
  ui.setupUi(this);
  QObject::connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(close()));
  QObject::connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(show()));
  QObject::connect(ui.pushButton_3, SIGNAL(clicked()), this, SLOT(openio()));
  QObject::connect(ui.pushButton_4, SIGNAL(clicked()), this, SLOT(start(int)));
  QObject::connect(ui.pushButton_5, SIGNAL(clicked()), this, SLOT(stop()));
}
//自定义槽
void MyDlg::show()
{
   QMessageBox::information(this, tr("Hello"), tr("Hello World"), tr("OK"));
}

void MyDlg::openio()
{
   QMessageBox::information(this, tr("Hello"), tr("Open IO"), tr("OK"));
}

void MyDlg::start(int value) //解算,此处为算法槽
{
  Functionforstart(value) //  test:return "0" in Text Browser
}

void MyDlg::stop()
{
   QMessageBox::information(this, tr("Hello"), tr("Stop"), tr("OK"));
}


离线huangjiwei
只看该作者 1楼 发表于: 2009-12-27
我也关注这样的问题 ,帮忙顶
如题!
快速回复
限100 字节
 
上一个 下一个