1 // Copyright Vladimir Prus 2004. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt 4 // or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include "canvas.h" 7 #include <qapplication.h> 8 #include <qvbox.h> 9 #include <qpushbutton.h> 10 11 class Window : public QMainWindow 12 { 13 public: Window()14 Window() 15 { 16 setCaption("QCanvas test"); 17 QVBox* vb = new QVBox(this); 18 setCentralWidget(vb); 19 20 Canvas* c = new Canvas(vb); 21 QPushButton* b = new QPushButton("Change color", vb); 22 connect(b, SIGNAL(clicked()), c, SLOT(change_color())); 23 } 24 }; 25 main(int argc,char ** argv)26int main(int argc, char **argv) 27 { 28 QApplication app(argc, argv); 29 Window *w = new Window(); 30 31 app.setMainWidget(w); 32 w->show(); 33 34 return app.exec(); 35 } 36 37