-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 03 June 2002 06:12 pm,
Haris Fauzi wrote :
> main.cc-nya manggil apa aja? Pake macro Q_OBJECT? Sudah coba baca manual
> moc? Baca dokumentasi tentang moc. Kemungkinan masalah anda adalah, ada
> file yang harus dibikinin moc-nya (in this case, main.cc). Nanti programnya
> dilink dengan moc itu.
Isi main.cc adalah :
/****************************************************************************/
#include <qapplication.h>
#include "mydialog.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
myDialog myDlg; // Ini ( myDialog ) adalah class yang ada pada mydialog.h
app.setMainWidget(&myDlg);
myDlg.show();
return app.exec();
}
/****************************************************************************/
Karena saya tidak menggunakan Q_OBJECT berarti kan nggak pake moc, ya kan ?
Oh ya, ini juga dech sekalian file-file lainnya :
Isi mydialog.h adalah :
/****************************************************************************
** Form interface generated from reading ui file 'mydialog.ui'
**
** Created: Mon Jun 3 16:58:34 2002
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MYDIALOG_H
#define MYDIALOG_H
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QPushButton;
class myDialog : public QDialog
{
Q_OBJECT
public:
myDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE,
WFlags fl = 0 );
~myDialog();
QPushButton* myButton;
protected slots:
virtual void getOut();
protected:
QGridLayout* myDialogLayout;
};
#endif // MYDIALOG_H
/****************************************************************************/
Sedangkan file mydialog.cpp adalah :
/****************************************************************************
** Form implementation generated from reading ui file 'mydialog.ui'
**
** Created: Mon Jun 3 16:58:49 2002
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "mydialog.h"
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a myDialog which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
myDialog::myDialog( QWidget* parent, const char* name, bool modal, WFlags fl
)
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "myDialog" );
resize( 154, 100 );
setCaption( tr( "Test Dialog" ) );
myDialogLayout = new QGridLayout( this );
myDialogLayout->setSpacing( 6 );
myDialogLayout->setMargin( 11 );
myButton = new QPushButton( this, "myButton" );
myButton->setText( tr( "&Berhenti" ) );
myDialogLayout->addWidget( myButton, 1, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum,
QSizePolicy::Expanding );
myDialogLayout->addItem( spacer, 0, 1 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum,
QSizePolicy::Expanding );
myDialogLayout->addItem( spacer_2, 2, 1 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding,
QSizePolicy::Minimum );
myDialogLayout->addItem( spacer_3, 1, 0 );
QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding,
QSizePolicy::Minimum );
myDialogLayout->addItem( spacer_4, 1, 2 );
// signals and slots connections
connect( myButton, SIGNAL( clicked() ), this, SLOT( getOut() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
myDialog::~myDialog()
{
// no need to delete child widgets, Qt does it all for us
}
void myDialog::getOut()
{
qWarning( "myDialog::getOut(): Not implemented yet!" );
}
/****************************************************************************/
( Sorry ya kalau kepanjangan.... :) )
Dan terimakasih atas perhatiannya.....
- --
Hadi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8+2KWUO1lUH8lCOkRAgk8AKCyoq/q9zDuP+5T19MP5e3KPbU94gCfbUcz
cKpqG6fAMXZykZM6NyQ/5vc=
=VdM8
-----END PGP SIGNATURE-----
--
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3