[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Newbie KDE/QT Programming question...
From: John Toon <john.toon () btinternet ! com>
Date: 2001-07-19 22:23:42
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Did you include the moc file? Did you actually create the moc files
> of the .h files before you started compiling?
Yes and yes.
Just for reference, here are all the source files:
mywindow.h:
#include <qwidget.h>
#include <qpushbutton.h>
class MyWindow : public QWidget
{
Q_OBJECT
public:
MyWindow();
public slots:
void slotButton();
private:
QPushButton *button;
};
- --------------------------------------------------
main.cpp:
#include <kapp.h>
#include "mywindow.h"
int main(int argc, char **argv)
{
KApplication app(argc, argv);
MyWindow window;
window.setGeometry(100, 100, 200, 100);
window.setCaption("Aha!");
app.setMainWidget(&window);
window.show();
return app.exec();
}
- ---------------------------------------------------------
mywindow.cpp:
#include "mywindow.moc"
#include <iostream.h>
MyWindow::MyWindow() : QWidget()
{
button = new QPushButton("Click me", this);
button->setGeometry(10,10,100,40);
button->show();
connect(button, SIGNAL(clicked()), this, SLOT(slotButton()));
}
void slotButton()
{
cout << "You clicked me" << endl;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7V13u/bmJi/HoKMQRAp0zAJ0exCnsDrIdf76Vjp6eM4J6I6F52QCggLaU
6LpxjWEaAR2Ystbb4qfZyag=
=l5Ci
-----END PGP SIGNATURE-----
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic