#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/