Exemplo n.º 1
0
        public NoAccountsWidget(QWidget parent) : base(parent)
        {
            SetupUi();

            m_Scene = new QGraphicsScene(m_Scene);
            m_GraphicsView.SetScene(m_Scene);
            m_Scene.SetSceneRect(0, 0, 200, 200);

            var octy = new QGraphicsPixmapItem(new QPixmap("resource:/octy.png"));

            octy.SetPos(0, 10);
            m_Scene.AddItem(octy);

            // TODO: Add bubbles!

            m_TimeLine            = new QTimeLine(2000, m_Scene);
            m_TimeLine.curveShape = QTimeLine.CurveShape.EaseOutCurve;
            QObject.Connect(m_TimeLine, Qt.SIGNAL("finished()"), HandleTimerFinished);

            QGraphicsItemAnimation animation = new QGraphicsItemAnimation(m_Scene);

            animation.SetItem(octy);
            animation.SetTimeLine(m_TimeLine);
            animation.SetPosAt(1, new QPointF(0, 0));

            m_TimeLine.Start();
        }
Exemplo n.º 2
0
    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());
    }
Exemplo n.º 3
0
        public AboutDialog(QWidget parentWindow) : base(parentWindow)
        {
            SetupUi();

            m_Scene = new QGraphicsScene(m_Scene);
            graphicsView.SetScene(m_Scene);
            m_Scene.SetSceneRect(0, 0, 200, 200);

            textLabel.Pixmap = new QPixmap("resource:/text.png");

            var octy = new QGraphicsPixmapItem(new QPixmap("resource:/octy.png"));

            octy.SetPos(0, 10);
            m_Scene.AddItem(octy);

            m_TimeLine            = new QTimeLine(2000, m_Scene);
            m_TimeLine.curveShape = QTimeLine.CurveShape.EaseOutCurve;
            QObject.Connect(m_TimeLine, Qt.SIGNAL("finished()"), TimerFinished);

            QGraphicsItemAnimation animation = new QGraphicsItemAnimation(m_Scene);

            animation.SetItem(octy);
            animation.SetTimeLine(m_TimeLine);
            animation.SetPosAt(1, new QPointF(0, 0));

            m_TimeLine.Start();

            Gui.CenterWidgetOnScreen(this);
        }
Exemplo n.º 4
0
    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());
    }
Exemplo n.º 5
0
 public FigureEditor(QGraphicsScene c, QWidget parent, string name, WindowFlags f)
     : base(c, parent)
 {
     SetObjectName(name);
     SetWindowFlags(f);
     SetRenderHint(RenderHint.Antialiasing | RenderHint.SmoothPixmapTransform);
 }
Exemplo n.º 6
0
        public AvatarGrid(QWidget parent) : base(parent)
        {
            // FIXME: Need a preference to turn this on/off.
            // this.SetViewport(new QGLWidget());

            m_Scene = new AvatarGridScene(this);
            this.SetScene(m_Scene);

            m_InfoPopup = new InfoPopup <T>(this);
            m_InfoPopup.DoubleClicked += delegate {
                MouseDoubleClickEvent(null);
            };
            m_InfoPopup.RightClicked += delegate(QPoint pos) {
                Emit.CustomContextMenuRequested(this.MapFromGlobal(pos));
            };
            m_InfoPopup.MouseMoved += delegate {
                UpdateHoverItem();
            };

            m_TooltipTimer            = new QTimer(this);
            m_TooltipTimer.SingleShot = true;
            m_TooltipTimer.Interval   = 500;
            QObject.Connect(m_TooltipTimer, Qt.SIGNAL("timeout()"), HandleTooltipTimerTimeout);

            this.AcceptDrops = true;
        }
Exemplo n.º 7
0
            public InfoPopup(AvatarGrid <T> grid)
            {
                m_Grid           = grid;
                base.WindowFlags = (uint)Qt.WindowType.FramelessWindowHint | (uint)Qt.WindowType.ToolTip;
                base.SetMinimumSize(260, 95);
                base.SetStyleSheet("background: black; color: white");

                m_GraphicsView            = new MyGraphicsView(this);
                m_GraphicsView.FrameShape = QFrame.Shape.NoFrame;
                m_GraphicsView.HorizontalScrollBarPolicy = Qt.ScrollBarPolicy.ScrollBarAlwaysOff;
                m_GraphicsView.VerticalScrollBarPolicy   = Qt.ScrollBarPolicy.ScrollBarAlwaysOff;
                m_GraphicsView.SetMaximumSize(60, 60);
                m_GraphicsView.SetMinimumSize(60, 60);

                m_Scene = new QGraphicsScene(m_GraphicsView);

                m_PixmapItem = new ResizableGraphicsPixmapItem();
                m_Scene.AddItem(m_PixmapItem);

                m_GraphicsView.SetScene(m_Scene);

                m_Label            = new QLabel(this);
                m_Label.Alignment  = (uint)Qt.AlignmentFlag.AlignTop | (uint)Qt.AlignmentFlag.AlignLeft;
                m_Label.TextFormat = Qt.TextFormat.RichText;
                m_Label.WordWrap   = true;
                m_Label.SizePolicy = new QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding);

                var leftLayout = new QVBoxLayout();

                leftLayout.AddWidget(m_GraphicsView);
                leftLayout.AddStretch();

                var layout = new QHBoxLayout(this);

                layout.Margin  = 6;
                layout.Spacing = 6;
                layout.AddLayout(leftLayout);
                layout.AddWidget(m_Label);

                this.InstallEventFilter(this);
            }