struct {
const char* label;
const char* file;
}
command[] = {
#ifndef QT_NO_TEXEDITOR
{"Addressbook","(cd /home/addressbook; exec ./addressbook)"},
#endif
{0,0}
};
keyclass
::keyclass( QWidget *parent,
const char *name
):{
setMaximumSize(640,480 );
setMouseTracking(TRUE);
textedit->setGeometry(10,80,100,20 );
textedit
->setFont
( QFont( "Times",
12,
QFont::Bold ) );
connect(textedit, SIGNAL(clicked()),qApp, SLOT(quit()) );
QVBox *vb1 = new QVBox(this);
vb1->setGeometry(10,100,100,100);
int ih;
for(ih=0; command[ih].label; ih++)
{
pb
= new QPushButton(command
[ih
].
label,vb1,command
[ih
].
file);
connect(pb, SIGNAL(clicked()), this, SLOT(execute()));
}
}
void keyclass::run(const char* cmd)
{
c += " &";
system(c.latin1());
}
void keyclass::execute()
{
run(sender()->name());
}
struct {
const char* label;
const char* file;
}
command[] = {
#ifndef QT_NO_TEXEDITOR
{"Addressbook","(cd /home/addressbook; exec ./addressbook)"},
#endif
{0,0}
};
keyclass::keyclass( QWidget *parent, const char *name):
QWidget( parent, name)
{
setMaximumSize(640,480 );
setMouseTracking(TRUE);
QPushButton *textedit = new QPushButton( "Quit", this, "quit" );
textedit->setGeometry(10,80,100,20 );
textedit->setFont( QFont( "Times", 12, QFont::Bold ) );
connect(textedit, SIGNAL(clicked()),qApp, SLOT(quit()) );
QVBox *vb1 = new QVBox(this);
vb1->setGeometry(10,100,100,100);
QPushButton *pb=0;
int ih;
for(ih=0; command[ih].label; ih++)
{
pb = new QPushButton(command[ih].label,vb1,command[ih].file);
connect(pb, SIGNAL(clicked()), this, SLOT(execute()));
}
}
void keyclass::run(const char* cmd)
{
QString c = cmd;
c += " &";
system(c.latin1());
}
void keyclass::execute()
{
run(sender()->name());
}
To copy to clipboard, switch view to plain text mode
Bookmarks