Esempio n. 1
0
File: main.cs Progetto: KDE/qyoto
    public static int Main(string[] args)
    {
        new QApplication(args);

        QGraphicsScene scene = new QGraphicsScene();
        scene.SetSceneRect(-500, -500, 1000, 1000);
        scene.itemIndexMethod = QGraphicsScene.ItemIndexMethod.NoIndex;

        Car car = new Car();
        scene.AddItem(car);

        QGraphicsView view = new QGraphicsView(scene);
        view.SetRenderHint(QPainter.RenderHint.Antialiasing);
        view.BackgroundBrush = Qt.GlobalColor.darkGray;
        view.WindowTitle = QT_TRANSLATE_NOOP("QGraphicsView", "Qt DBus Controlled Car");
        view.Resize(400, 300);
        view.Show();

        CarAdaptor adaptor = new CarAdaptor(car);
        QDBusConnection connection = QDBusConnection.SessionBus();
        connection.RegisterObject("/Car", adaptor, (int) QDBusConnection.RegisterOption.ExportAllSlots);
        connection.RegisterService("com.trolltech.CarExample");

        return QApplication.Exec();
    }
Esempio n. 2
0
File: main.cs Progetto: KDE/qyoto
    public static int Main(string[] args)
    {
        Q_INIT_RESOURCE("mice");
        new QApplication(args);

        scene = new QGraphicsScene();
        scene.SetSceneRect(-300, -300, 600, 600);
        scene.itemIndexMethod = QGraphicsScene.ItemIndexMethod.NoIndex;

        for (int i = 0; i < MouseCount; ++i) {
            Mouse mouse = new Mouse();
            mouse.SetPos(Math.Sin((i * 6.28) / MouseCount) * 200,
                          Math.Cos((i * 6.28) / MouseCount) * 200);
            scene.AddItem(mouse);
        }

        QGraphicsView view = new QGraphicsView(scene);
        view.SetRenderHint(QPainter.RenderHint.Antialiasing);
        view.BackgroundBrush = new QBrush(new QPixmap(":/images/cheese.jpg"));
        view.CacheMode = (int) QGraphicsView.CacheModeFlag.CacheBackground;
        view.dragMode = QGraphicsView.DragMode.ScrollHandDrag;
        view.WindowTitle = QT_TRANSLATE_NOOP("QGraphicsView", "Colliding Mice");
        view.Resize(400, 300);
        view.Show();

        return QApplication.Exec();
    }