mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-30 23:58:47 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
Copyright 2005 Vladimir Prus
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
This directory contains Boost.Build examples for the Qt library
|
||||
(http://www.trolltech.com/products/qt/index.html).
|
||||
|
||||
The current examples are:
|
||||
1. Basic setup -- application with several sources and moccable header.
|
||||
2. Using of .ui source file.
|
||||
3. Running .cpp files via the moc tool.
|
||||
|
||||
For convenience, there are examples both for 3.* and 4.* version of Qt, they are
|
||||
mostly identical and differ only in source code.
|
||||
|
||||
All examples assumes that you just installed Boost.Build and that QTDIR
|
||||
environment variables is set (typical values can be /usr/share/qt3 and
|
||||
/usr/share/qt4). After adding "using qt ..." to your user-config.jam, you would
|
||||
have to remove "using qt ; " statements from example Jamroot files.
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright Vladimir Prus 2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "canvas.h"
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qcanvas.h>
|
||||
#include <qlayout.h>
|
||||
|
||||
Canvas::Canvas(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_pen = QPen(QColor(255, 128, 128));
|
||||
m_brushes = new QBrush[2];
|
||||
m_brushes[0] = QBrush(QColor(255, 0, 0));
|
||||
m_brushes[1] = QBrush(QColor(0, 255, 0));
|
||||
m_current_brush = 0;
|
||||
|
||||
m_canvas = new QCanvas(this);
|
||||
m_canvas->resize(4*1600, 600);
|
||||
|
||||
redraw();
|
||||
|
||||
QVBoxLayout* l = new QVBoxLayout(this);
|
||||
|
||||
m_canvas_view = new QCanvasView(m_canvas, this);
|
||||
l->addWidget(m_canvas_view);
|
||||
m_canvas_view->resize(rect().size());
|
||||
m_canvas_view->show();
|
||||
}
|
||||
|
||||
Canvas::~Canvas()
|
||||
{
|
||||
delete m_brushes;
|
||||
}
|
||||
|
||||
void Canvas::redraw()
|
||||
{
|
||||
QCanvasItemList l = m_canvas->allItems();
|
||||
for(QCanvasItemList::iterator i = l.begin(),
|
||||
e = l.end(); i != e; ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
|
||||
unsigned count = 0;
|
||||
for (unsigned x = 10; x < 4*1600; x += 20)
|
||||
for (unsigned y = 10; y < 600; y += 20) {
|
||||
QCanvasRectangle* r = new QCanvasRectangle(x, y, 10, 10, m_canvas);
|
||||
r->setPen(m_pen);
|
||||
r->setBrush(m_brushes[m_current_brush]);
|
||||
r->show();
|
||||
++count;
|
||||
QCanvasText* t = new QCanvasText("D", m_canvas);
|
||||
t->move(x, y);
|
||||
t->show();
|
||||
++count;
|
||||
}
|
||||
|
||||
(new QCanvasText(QString::number(count), m_canvas))->show();
|
||||
m_canvas->setAllChanged();
|
||||
|
||||
}
|
||||
|
||||
void Canvas::change_color()
|
||||
{
|
||||
m_current_brush = (m_current_brush + 1)%2;
|
||||
redraw();
|
||||
m_canvas->update();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright Vladimir Prus 2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef CANVAS_VP_2004_08_31
|
||||
#define CANVAS_VP_2004_08_31
|
||||
|
||||
#include <qmainwindow.h>
|
||||
#include <qpen.h>
|
||||
#include <qbrush.h>
|
||||
|
||||
class Canvas : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Canvas(QWidget* parent);
|
||||
|
||||
virtual ~Canvas();
|
||||
|
||||
public slots:
|
||||
void change_color();
|
||||
|
||||
private:
|
||||
void redraw();
|
||||
class QCanvas* m_canvas;
|
||||
class QCanvasView* m_canvas_view;
|
||||
class QPen m_pen;
|
||||
class QBrush* m_brushes;
|
||||
int m_current_brush;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Copyright Vladimir Prus 2004.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt
|
||||
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
using qt ;
|
||||
|
||||
project
|
||||
# built MT version, unless asked otherwise.
|
||||
: default-build <threading>multi
|
||||
;
|
||||
|
||||
exe canvas : main.cpp canvas.cpp canvas.h : <library>/qt//qt ;
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright Vladimir Prus 2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "canvas.h"
|
||||
#include <qapplication.h>
|
||||
#include <qvbox.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
class Window : public QMainWindow
|
||||
{
|
||||
public:
|
||||
Window()
|
||||
{
|
||||
setCaption("QCanvas test");
|
||||
QVBox* vb = new QVBox(this);
|
||||
setCentralWidget(vb);
|
||||
|
||||
Canvas* c = new Canvas(vb);
|
||||
QPushButton* b = new QPushButton("Change color", vb);
|
||||
connect(b, SIGNAL(clicked()), c, SLOT(change_color()));
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
Window *w = new Window();
|
||||
|
||||
app.setMainWidget(w);
|
||||
w->show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
using qt ;
|
||||
import cast ;
|
||||
|
||||
project
|
||||
: default-build <threading>multi
|
||||
;
|
||||
|
||||
exe main : main.cpp [ cast _ moccable-cpp : main.cpp ]
|
||||
/qt//qt
|
||||
;
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright Vladimir Prus 2005.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class My_widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
My_widget() : QWidget()
|
||||
{
|
||||
QPushButton* b = new QPushButton("Push me", this);
|
||||
|
||||
connect(b, SIGNAL(clicked()), this, SLOT(theSlot()));
|
||||
}
|
||||
|
||||
private slots:
|
||||
void theSlot()
|
||||
{
|
||||
std::cout << "Clicked\n";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(int ac, char* av[])
|
||||
{
|
||||
QApplication app(ac, av);
|
||||
My_widget mw;
|
||||
mw.show();
|
||||
app.setMainWidget(&mw);
|
||||
app.exec();
|
||||
}
|
||||
|
||||
#include "main.moc"
|
||||
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||
<class>HelloWorldWidget</class>
|
||||
<comment>
|
||||
<!--
|
||||
Copyright Felix E. Klee, 2003
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
</comment>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>HelloWorldWidget</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>124</width>
|
||||
<height>63</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Hello World!</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>TextLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hello World!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>OkButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
@@ -0,0 +1,15 @@
|
||||
# Copyright Felix E. Klee, 2003
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt
|
||||
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Tell that QT should be used. QTDIR will give installation
|
||||
# prefix.
|
||||
using qt ;
|
||||
|
||||
project
|
||||
: default-build <threading>multi
|
||||
;
|
||||
|
||||
exe hello : main.cpp hello_world_widget.ui : <library>/qt//qt ;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright Felix E. Klee, 2003
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "hello_world_widget.h"
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication a(argc, argv);
|
||||
HelloWorldWidget w;
|
||||
QObject::connect(static_cast<QObject*>(w.OkButton), SIGNAL(clicked()), &w, SLOT(close()));
|
||||
a.setMainWidget(&w);
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// Copyright Vladimir Prus 2005.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "arrow.h"
|
||||
|
||||
#include <QtGui/qapplication.h>
|
||||
|
||||
#include <QtGui/qwidget.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qpainterpath.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
Arrow_widget::Arrow_widget(QWidget* parent) : QWidget(parent), color_(0)
|
||||
{
|
||||
QPalette pal = palette();
|
||||
pal.setBrush(backgroundRole(), QBrush(Qt::white));
|
||||
setPalette(pal);
|
||||
}
|
||||
|
||||
void Arrow_widget::slotChangeColor()
|
||||
{
|
||||
color_ = (color_ + 1) % 3;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Arrow_widget::draw_arrow(int x1, int y1, int x2, int y2, QPainter& painter)
|
||||
{
|
||||
// The length of the from the tip of the arrow to the point
|
||||
// where line starts.
|
||||
const int arrowhead_length = 16;
|
||||
|
||||
QPainterPath arrow;
|
||||
arrow.moveTo(x1, y1);
|
||||
|
||||
// Determine the angle of the straight line.
|
||||
double a1 = (x2-x1);
|
||||
double a2 = (y2-y1);
|
||||
double b1 = 1;
|
||||
double b2 = 0;
|
||||
|
||||
double straight_length = sqrt(a1*a1 + a2*a2);
|
||||
|
||||
double dot_product = a1*b1 + a2*b2;
|
||||
double cosine = dot_product/
|
||||
(sqrt(pow(a1, 2) + pow(a2, 2))*sqrt(b1 + b2));
|
||||
double angle = acos(cosine);
|
||||
if (y1 < y2)
|
||||
{
|
||||
angle = -angle;
|
||||
}
|
||||
double straight_angle = angle*180/M_PI;
|
||||
|
||||
double limit = 10;
|
||||
|
||||
double angle_to_vertical;
|
||||
if (fabs(straight_angle) < 90)
|
||||
angle_to_vertical = fabs(straight_angle);
|
||||
else if (straight_angle > 0)
|
||||
angle_to_vertical = 180-straight_angle;
|
||||
else
|
||||
angle_to_vertical = 180-(-straight_angle);
|
||||
|
||||
double angle_delta = 0;
|
||||
if (angle_to_vertical > limit)
|
||||
angle_delta = 30 * (angle_to_vertical - limit)/90;
|
||||
double start_angle = straight_angle > 0
|
||||
? straight_angle - angle_delta :
|
||||
straight_angle + angle_delta;
|
||||
|
||||
|
||||
QMatrix m1;
|
||||
m1.translate(x1, y1);
|
||||
m1.rotate(-start_angle);
|
||||
|
||||
double end_angle = straight_angle > 0
|
||||
? (straight_angle + 180 + angle_delta) :
|
||||
(straight_angle + 180 - angle_delta);
|
||||
|
||||
QMatrix m2;
|
||||
m2.reset();
|
||||
m2.translate(x2, y2);
|
||||
m2.rotate(-end_angle);
|
||||
|
||||
arrow.cubicTo(m1.map(QPointF(straight_length/2, 0)),
|
||||
m2.map(QPointF(straight_length/2, 0)),
|
||||
m2.map(QPointF(arrowhead_length, 0)));
|
||||
|
||||
painter.save();
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
painter.drawPath(arrow);
|
||||
painter.restore();
|
||||
|
||||
painter.save();
|
||||
painter.translate(x2, y2);
|
||||
|
||||
painter.rotate(-90);
|
||||
painter.rotate(-end_angle);
|
||||
painter.rotate(180);
|
||||
|
||||
QPolygon arrowhead(4);
|
||||
arrowhead.setPoint(0, 0, 0);
|
||||
arrowhead.setPoint(1, arrowhead_length/3, -arrowhead_length*5/4);
|
||||
arrowhead.setPoint(2, 0, -arrowhead_length);
|
||||
arrowhead.setPoint(3, -arrowhead_length/3, -arrowhead_length*5/4);
|
||||
|
||||
painter.drawPolygon(arrowhead);
|
||||
|
||||
painter.restore();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Arrow_widget::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter p(this);
|
||||
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
int base_x = 550;
|
||||
int base_y = 200;
|
||||
|
||||
if (color_ == 0)
|
||||
p.setBrush(Qt::black);
|
||||
else if (color_ == 1)
|
||||
p.setBrush(Qt::green);
|
||||
else if (color_ == 2)
|
||||
p.setBrush(Qt::yellow);
|
||||
else
|
||||
p.setBrush(Qt::black);
|
||||
|
||||
for (int x_step = 0; x_step < 6; ++x_step)
|
||||
{
|
||||
for (int y_step = 1; y_step <= 3; ++y_step)
|
||||
{
|
||||
draw_arrow(base_x, base_y, base_x+x_step*100,
|
||||
base_y - y_step*50, p);
|
||||
|
||||
draw_arrow(base_x, base_y, base_x+x_step*100,
|
||||
base_y + y_step*50, p);
|
||||
|
||||
draw_arrow(base_x, base_y, base_x-x_step*100,
|
||||
base_y + y_step*50, p);
|
||||
|
||||
draw_arrow(base_x, base_y, base_x-x_step*100,
|
||||
base_y - y_step*50, p);
|
||||
}
|
||||
}
|
||||
|
||||
draw_arrow(50, 400, 1000, 450, p);
|
||||
draw_arrow(1000, 400, 50, 450, p);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright Vladimir Prus 2005.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <QtGui/qapplication.h>
|
||||
|
||||
#include <QtGui/qwidget.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qpainterpath.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
class Arrow_widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Arrow_widget(QWidget* parent = 0);
|
||||
|
||||
public slots:
|
||||
void slotChangeColor();
|
||||
|
||||
private:
|
||||
void draw_arrow(int x1, int y1, int x2, int y2, QPainter& painter);
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
private:
|
||||
int color_;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
import qt4 ;
|
||||
|
||||
if ! [ qt4.initialized ]
|
||||
{
|
||||
ECHO "Warning: Qt4 not initialized in user-config.jam" ;
|
||||
ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
|
||||
ECHO "This is very likely won't work for you. " ;
|
||||
using qt4 : /space/p2/ghost/build/Qt4 ;
|
||||
}
|
||||
|
||||
project : requirements <threading>multi ;
|
||||
|
||||
exe arrow : main.cpp arrow.cpp arrow.h /qt//QtGui ;
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright Vladimir Prus 2005.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "arrow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
|
||||
int main(int ac, char* av[])
|
||||
{
|
||||
QApplication app(ac, av);
|
||||
Arrow_widget* w = new Arrow_widget;
|
||||
w->resize(1100, 480);
|
||||
|
||||
QTimer timer;
|
||||
QObject::connect(&timer, SIGNAL(timeout()),
|
||||
w, SLOT(slotChangeColor()));
|
||||
|
||||
timer.start(2000);
|
||||
|
||||
w->show();
|
||||
app.exec();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
import qt4 ;
|
||||
if ! [ qt4.initialized ]
|
||||
{
|
||||
ECHO "Warning: Qt4 not initialized in user-config.jam" ;
|
||||
ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
|
||||
ECHO "This is very likely won't work for you. " ;
|
||||
using qt4 : /space/p2/ghost/build/Qt4 ;
|
||||
}
|
||||
|
||||
import cast ;
|
||||
exe main : main.cpp
|
||||
[ cast _ moccable-cpp : main.cpp ]
|
||||
/qt//QtGui
|
||||
: <threading>multi
|
||||
;
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright Vladimir Prus 2005.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class My_widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
My_widget() : QWidget()
|
||||
{
|
||||
QPushButton* b = new QPushButton("Push me", this);
|
||||
|
||||
connect(b, SIGNAL(clicked()), this, SLOT(theSlot()));
|
||||
}
|
||||
|
||||
private slots:
|
||||
void theSlot()
|
||||
{
|
||||
std::cout << "Clicked\n";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(int ac, char* av[])
|
||||
{
|
||||
QApplication app(ac, av);
|
||||
My_widget mw;
|
||||
mw.show();
|
||||
app.exec();
|
||||
}
|
||||
|
||||
#include "main.moc"
|
||||
@@ -0,0 +1,55 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment>
|
||||
<!--
|
||||
Copyright Felix E. Klee, 2003
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
</comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>HelloWorldWidget</class>
|
||||
<widget class="QWidget" name="HelloWorldWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>124</width>
|
||||
<height>63</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Hello World!</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="TextLabel2" >
|
||||
<property name="text" >
|
||||
<string>Hello World!</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="OkButton" >
|
||||
<property name="text" >
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright Felix E. Klee, 2003
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt
|
||||
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import qt4 ;
|
||||
if ! [ qt4.initialized ]
|
||||
{
|
||||
ECHO "Warning: Qt4 not initialized in user-config.jam" ;
|
||||
ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
|
||||
ECHO "This is very likely won't work for you. " ;
|
||||
using qt4 : /space/p2/ghost/build/Qt4 ;
|
||||
}
|
||||
|
||||
project : requirements <threading>multi
|
||||
;
|
||||
|
||||
exe hello : main.cpp hello_world_widget.ui : <library>/qt//QtGui ;
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright Felix E. Klee, 2003
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "ui_hello_world_widget.h"
|
||||
#include <qapplication.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QWidget w;
|
||||
Ui::HelloWorldWidget wm;
|
||||
wm.setupUi(&w);
|
||||
|
||||
QObject::connect(wm.OkButton, SIGNAL(clicked()), &w, SLOT(close()));
|
||||
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user