Created
February 21, 2012 13:37
-
-
Save mythosil/1876623 to your computer and use it in GitHub Desktop.
qt4-mac sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtGui> | |
using namespace std; | |
class Sample : public QObject { | |
Q_OBJECT | |
public slots: | |
void action() { | |
emit quitApplication(); | |
} | |
signals: | |
void quitApplication(); | |
private: | |
}; | |
#include "qt_sample.moc" | |
int main(int argc, char** argv) | |
{ | |
QApplication app(argc, argv); | |
QPushButton *quitButton = new QPushButton("Quit"); | |
Sample obj; | |
QObject::connect(quitButton, SIGNAL(clicked()), &obj, SLOT(action())); | |
QObject::connect(&obj, SIGNAL(quitApplication()), qApp, SLOT(quit())); | |
QVBoxLayout *layout = new QVBoxLayout(); | |
layout->addWidget(quitButton); | |
QWidget window; | |
window.setLayout(layout); | |
window.show(); | |
qDebug() << "Launching Application"; | |
return app.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
qmake -project
qmake
make mocables
make