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()); }
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(); }
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); }
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()); }
private void AddGroup(string groupName) { lock (m_Groups) { if (!m_Groups.ContainsKey(groupName)) { RosterItemGroup group = new RosterItemGroup(this, groupName); group.SetVisible(false); m_Scene.AddItem(group); m_Groups.Add(groupName, group); ResizeAndRepositionGroups(); } } }
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); }