Linux下QT调用TUXEDO函数

#include "Buttons.moc"
#include
#include
#include
#include
#include
#include
#include
#include "atmi.h"

Buttons::Buttons (QWidget *parent, const char *name)
        : QMainWindow(parent, name)
{
  QWidget *widget = new QWidget(this);
  setCentralWidget(widget);

  QVBoxLayout *vbox = new QVBoxLayout(widget,5,10,"vbox");

  checkbox = new QCheckBox("CheckButton", widget, "check");
  vbox -> addWidget(checkbox);

  QButtonGroup *buttongroup = new QButtonGroup(0); //丛[1m~M四1m~F~Y盛1m~¤个四1m~\~F曛1m~L~I雛1m~R?四1m~Oˉ以丛[1m~@起盛1m~B1

  radiobutton1 = new QRadioButton("Radiobutton1", widget, "radio1");
  buttongroup->insert(radiobutton1);
  vbox->addWidget(radiobutton1);


  radiobutton2 = new QRadioButton("Radiobutton2", widget, "radio2");
  buttongroup->insert(radiobutton2);
  vbox->addWidget(radiobutton2);

  QPushButton *button = new QPushButton ("ok", widget, "button");
  vbox->addWidget(button);

  resize(350,200);

  connect (button, SIGNAL(clicked()), this, SLOT(Clicked()) );

}


void Buttons:rintActive(QButton *button)
{
  if (button->isOn())
    std::cout << button->name() << " is checked\n";
  else
    std::cout << button->name() << " is not checked\n";
}

void Buttons::Clicked()
{
  PrintActive(checkbox);
  PrintActive(radiobutton1);
  PrintActive(radiobutton2);
  std::cout << "\n";
}



int main(int argc, char **argv)
{


char *sendbuf, *rcvbuf;
        long sendlen, rcvlen;
        int ret;

        if(argc != 2) {
                (void) fprintf(stderr, "Usage: simpcl string\n");
                exit(1);
        }

        /* Attach to System/T as a Client Process */
        if (tpinit((TPINIT *) NULL) == -1) {
                (void) fprintf(stderr, "Tpinit failed\n");
exit(1);
        }

        sendlen = strlen(argv[1]);

        /* Allocate STRING buffers for the request and the reply */

        if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating send buffer\n");
                tpterm();
                exit(1);
        }

        if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating receive buffer\n");
                tpfree(sendbuf);
                tpterm();
                exit(1);
        }

        (void) strcpy(sendbuf, argv[1]);

        /* Request the service TOUPPER, waiting for a reply */
ret = tpcall("TOUPPER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);

        if(ret == -1) {
                (void) fprintf(stderr, "Can't send request to service TOUPPER\n");
                (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
                tpfree(sendbuf);
                tpfree(rcvbuf);
                tpterm();
                exit(1);
        }

        (void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();



        QApplication app(argc,argv);
        Buttons *window = new Buttons();


        app.setMainWidget(window);
        window -> show();
return app.exec();
}

 

编译用

buildclient -o Buttons2 -f Buttons.cpp -l "-I$QTDIR/include -I/home/oracle/tuxedo/tuxedo11gR1/include -L$QTDIR/lib -L/home/oracle/tuxedo/tuxedo11gR1/lib -lqui"

主要是后面的内容 连接qt和TUXEDO的头文件和类库   Linux下直接在qt代码中调用TUXEDO的函数就行

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25361369/viewspace-702361/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25361369/viewspace-702361/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值