MapView::MapView(QWidget *parent) : QGraphicsView(parent) { setDragMode(ScrollHandDrag); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);//反锯齿 }
TmoodView::TmoodView(QWidget *parent) : QGraphicsView(parent) { setScene(new QGraphicsScene(this)); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setFrameShape(QFrame::NoFrame); setStyleSheet("background-color: transparent"); QPen commonPen(Qt::darkRed, 5, Qt::SolidLine, Qt::RoundCap); QGraphicsEllipseItem *face = scene()->addEllipse(0, 0, 400, 400, commonPen, QBrush(Qt::yellow)); face->setZValue(1); face->setGraphicsEffect(new QGraphicsDropShadowEffect); QGraphicsEllipseItem *eye1 = scene()->addEllipse(100, 100, 20, 20, commonPen); eye1->setZValue(2); QGraphicsEllipseItem *eye2 = scene()->addEllipse(280, 100, 20, 20, commonPen); eye2->setZValue(2); QPainterPath path; path.moveTo(200, 150); path.cubicTo(180, 250, 200, 250, 200, 200); QGraphicsPathItem *nose = scene()->addPath(path, commonPen); nose->setZValue(2); m_mood = new QGraphicsPathItem(); scene()->addItem(m_mood); m_mood->setPen(commonPen); m_mood->setZValue(3); setMood(1.0); }
StitcherView::StitcherView(QWidget * parent) :ImageView(parent) { imageViewPanel()->showSaveButton(true); setRenderHints(QPainter::Antialiasing); /* QGraphicsLineItem * centerVerticalIndicator = new QGraphicsLineItem(0,-100000,0,100000); QGraphicsLineItem * centerHorizontalIndicator = new QGraphicsLineItem(-100000,0,100000,0); centerVerticalIndicator->setZValue(11); centerHorizontalIndicator->setZValue(11); graphicsScene->addItem(centerVerticalIndicator); graphicsScene->addItem(centerHorizontalIndicator); QPen pen = centerHorizontalIndicator->pen(); pen.setColor(Qt::white); pen.setStyle(Qt::SolidLine); centerHorizontalIndicator->setPen(pen); centerVerticalIndicator->setPen(pen);*/ /* Solid background */ setBackgroundBrush(QColor("#26466D")); _showIdentifiers = true; setBackgroundDraggable(false); QGraphicsLineItem * centerVerticalIndicator = new QGraphicsLineItem(0,-100,0,100); QGraphicsLineItem * centerHorizontalIndicator = new QGraphicsLineItem(-100,0,100,0); centerVerticalIndicator->setZValue(11); centerHorizontalIndicator->setZValue(11); graphicsScene->addItem(centerVerticalIndicator); graphicsScene->addItem(centerHorizontalIndicator); QPen pen = centerHorizontalIndicator->pen(); pen.setColor(Qt::white); pen.setStyle(Qt::SolidLine); centerHorizontalIndicator->setPen(pen); centerVerticalIndicator->setPen(pen); }
//################################################################################################ //################################# PUBLIC ################################################# //################################################################################################ TnoteNameLabel::TnoteNameLabel(const QString& text, QWidget* parent) : QGraphicsView(parent), m_p2Time(0), m_strikeOut(0), m_blinking(0), m_questMark(0), m_stringNumber(0) { setMouseTracking(false); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // setFrameShape(QFrame::NoFrame); QGraphicsScene *scene = new QGraphicsScene(this); setScene(scene); m_textItem = new QGraphicsTextItem(); scene->addItem(m_textItem); scene->setSceneRect(geometry()); setText(text); m_bgColor = qApp->palette().base().color(); m_bgColor.setAlpha(220); setBackgroundColor(m_bgColor); }
View::View(QWidget *parent): QGraphicsView(parent) { setGeometry(300,300,GS_WIDTH,GS_HEIGHT); menu_scene = new GraphicMenu(-width()/2,-height()/2,width(),height(),this); board_scene = new GraphicBoard(-width()/2,-height()/2,width(),height(),this); QIcon icon(QPixmap(":/Graphic_source/icon.png")); setWindowIcon(icon); setWindowTitle("Pentago"); setFixedSize(this->size());//TODO:equally resize setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); setCacheMode(QGraphicsView::CacheBackground); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); connect(menu_scene, SIGNAL(New_game_selected(int)), this, SIGNAL(New_game(int))); connect(menu_scene, SIGNAL(Join_game_selected(std::string)), this, SIGNAL(Join_game(std::string))); connect(menu_scene, SIGNAL(Host_game_selected(std::string)), this, SIGNAL(Host_game(std::string))); connect(menu_scene, SIGNAL(Exit_game_pressed()), this, SLOT(close())); connect(menu_scene, SIGNAL(Load_game_selected(std::string)),this,SIGNAL(Load_game(std::string))); connect(board_scene, SIGNAL(quadrant_rotated(IView::quadrant,IView::turn)), this, SIGNAL(Rotate(IView::quadrant,IView::turn))); connect(board_scene, SIGNAL(Stone_clicked(int, int)), this, SIGNAL(Put_stone(int,int))); connect(board_scene, SIGNAL(leave_game()),this,SLOT(on_leave_game())); connect(board_scene, SIGNAL(save_game(QString)),this,SLOT(on_save_game(QString))); connect(board_scene, SIGNAL(message_sended(QString)), this, SLOT(on_msg_sended(QString))); connect(menu_scene, SIGNAL(game_go_to_start()),board_scene, SLOT(clean_board())); connect(menu_scene, SIGNAL(game_go_to_start()),board_scene, SLOT(clean_log())); Set_control_settings(View::MENU);//it must be called in presenter after view constructing }
myGraphicsView::myGraphicsView(QWidget *parent) : QGraphicsView(parent) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); this->installEventFilter(this); this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); this->setResizeAnchor( QGraphicsView::AnchorUnderMouse ); origin = QPoint(0,0); mTL = new QLabel(this); scene = new QGraphicsScene(this); scene->addText("No Images Available. Please browse to a folder containing appropriate images."); setScene(scene); setCursor(Qt::CrossCursor); setDisabled(true); mBR = new QLabel(this); mTL->setStyleSheet("QLabel { background-color : white; color : black;}"); mBR->setStyleSheet("QLabel { background-color : white; color : black;}"); mTL->hide(); mBR->hide(); rubberBandActive = false; rubberBand = new QRubberBand(QRubberBand::Rectangle, this); QPalette palette; QColor highlight(Qt::green); highlight.setAlpha(100); palette.setBrush(QPalette::Highlight, QBrush(highlight)); palette.setBrush(QPalette::Shadow, QColor(Qt::red)); rubberBand->setPalette(palette); rubberBand->setGeometry(20, 20, 200, 100); }
lmcMessageLog::lmcMessageLog(QWidget *parent) : QWebView(parent) { connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(log_linkClicked(QUrl))); connect(this->page()->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(log_contentsSizeChanged(QSize))); connect(this->page(), SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(log_linkHovered(QString, QString, QString))); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); setRenderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); createContextMenu(); participantAvatars.clear(); hasData = false; messageTime = false; messageDate = false; allowLinks = false; pathToLink = false; trimMessage = true; fontSizeVal = 0; sendFileMap.clear(); receiveFileMap.clear(); lastId = QString::null; messageLog.clear(); linkHovered = false; outStyle = false; autoScroll = true; }
DialGadgetWidget::DialGadgetWidget(QWidget *parent) : QGraphicsView(parent) { // TODO: create a proper "needle" object instead of hardcoding all this // which is ugly (but easy). setMinimumSize(64, 64); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setScene(new QGraphicsScene(this)); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); m_renderer = new QSvgRenderer(); obj1 = NULL; obj2 = NULL; obj3 = NULL; m_text1 = NULL; m_text2 = NULL; m_text3 = NULL; // Should be initialized to NULL otherwise the setFont method // might segfault upon initialization if called before SetDialFile needle1Target = 0; needle2Target = 0; needle3Target = 0; // beSmooth = true; beSmooth = false; // This timer mechanism makes needles rotate smoothly connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles())); }
AttitudeIndicator::AttitudeIndicator(QWidget *parent) : QGraphicsView(parent) { // Set graphics view properties setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setFrameStyle(QFrame::NoFrame | QFrame::Plain); setStyleSheet("background-color: transparent;"); //setBackgroundRole(QPalette::Window); //setAutoFillBackground(true); // Create graphics items crosshair_item = new QGraphicsPixmapItem(QPixmap( ":/images/attitude_indicator/crosshair.png")); artificial_horizon_item = new ArtificialHorizon(); cover_item = new QGraphicsPixmapItem(QPixmap( ":/images/status_lights/status_light_cover.png")); // Create graphics scene scene = new QGraphicsScene(this); scene->addItem(artificial_horizon_item); scene->addItem(crosshair_item); scene->addItem(cover_item); scene->setSceneRect(scene->itemsBoundingRect()); setScene(scene); setFixedSize(scene->sceneRect().toRect().size()); // Initialize attitude setAttitude(0.0, 0.0); }
WeatherWidgetGraphicsView::WeatherWidgetGraphicsView() { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground,true); setAttribute(Qt::WA_ContentsPropagated,true); setCacheMode(CacheBackground); setViewportUpdateMode(FullViewportUpdate); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); // transparent background QPalette palette = this->palette(); palette.setBrush(QPalette::Base, Qt::transparent); setPalette(palette); setAttribute(Qt::WA_OpaquePaintEvent, false); // trasmit color setFrameStyle(QFrame::NoFrame); iScene = new QGraphicsScene(this); setScene(iScene); resize(KWindowWidth+KExtraStrech,KWindowHeight+KExtraStrech); // Create main window which holds weather data iMainWindow = new WeatherGraphicsWindow(this); iScene->addItem(iMainWindow); iMainWindow->setZValue(0); iMainWindow->setObjectName("mainwindow"); connect(iMainWindow,SIGNAL(minimize()), this,SLOT(on_mainwindow_minimize())); connect(iMainWindow,SIGNAL(temperatureUpdated(const QString&)), this,SLOT(setWindowTitle(const QString&))); }
GrDapView::GrDapView(QWidget *parent) : QGraphicsView(parent) { scene_space = 4; zoomSlider = 250; rotateSlider = 0; visor_height = 76; visor_mode = QPainter::CompositionMode_Darken; visor_color = QColor(255, 0, 0, 255); visor_img.load(":/img16/sinimg.png"); scene = new QGraphicsScene(this); setAlignment(Qt::AlignCenter); // setAcceptDrops(true); setAutoFillBackground(true); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setBackgroundBrush(Qt::darkGray); setBackgroundRole(QPalette::Dark); setCacheMode(QGraphicsView::CacheBackground); setDragMode(QGraphicsView::ScrollHandDrag); setOptimizationFlags(QGraphicsView::DontSavePainterState); setViewportUpdateMode(QGraphicsView::FullViewportUpdate);//SmartViewportUpdate FullViewportUpdate setTransformationAnchor(QGraphicsView::AnchorUnderMouse); setFrameShape(QFrame::NoFrame); setNewScene(400, 400, true); }
void View::setOpenGL( const bool enabled ) { if ( enabled == hasOpenGL_ ) return; hasOpenGL_ = enabled; if (hasOpenGL_) { viewport_ = new QGLWidget( QGLFormat(QGL::SampleBuffers), this ); setViewport(viewport_); viewport_->makeCurrent(); glClearColor( 0, 0, 0, 1.0 ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); // glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glPolygonMode( GL_FRONT, GL_FILL ); glPolygonMode( GL_BACK, GL_LINE ); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset( 1.0, 2.0 ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); } else { defaultVP_ = new QWidget(this); setViewport(defaultVP_); } setViewportUpdateMode(QGraphicsView::FullViewportUpdate); setCacheMode(QGraphicsView::CacheNone); setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); setForegroundBrush(Qt::NoBrush); setBackgroundBrush(Qt::NoBrush); }
//! [0] GraphWidget::GraphWidget(QWidget *parent) : QGraphicsView(parent), timerId(0) { //初始化场景 QGraphicsScene *scene = new QGraphicsScene(this); scene->setItemIndexMethod(QGraphicsScene::NoIndex); //设置场景 setScene(scene); //缓存背景模式,提高绘制效率,防止闪屏 setCacheMode(CacheBackground); setViewportUpdateMode(BoundingRectViewportUpdate); //设置抗锯齿,平滑图像或字体边缘 setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform); //允许节点位置动态调整 setTransformationAnchor(AnchorUnderMouse); //允许上下文菜单 setContextMenuPolicy(Qt::ActionsContextMenu); //允许拖拽滚屏 setDragMode( QGraphicsView::ScrollHandDrag); setInteractive(true); setMinimumSize(Default_width, Default_height); }
EditorGraphicsView::EditorGraphicsView(QWidget * parent) : QGraphicsView(parent) , m_canZoom(true) , m_scaleFactor(1.) , m_autoResize(false) { setInteractive(true); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform ); setCacheMode(QGraphicsView::CacheBackground); setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); setOptimizationFlags(QGraphicsView::DontSavePainterState); setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); setTransformationAnchor(AnchorUnderMouse); setResizeAnchor(AnchorViewCenter); //setFrameStyle(QFrame::NoFrame); //setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setBackgroundBrush(Qt::gray); setDragMode(QGraphicsView::RubberBandDrag); // use own style for drawing the RubberBand (opened on the viewport) viewport()->setStyle(new RubberBandStyle); }
View::View(QWidget *parent) : QGraphicsView(new QGraphicsScene, parent), m_root(new Bone("Root")), m_targetMode(BoneTargetMode), m_ellipseItem(new QGraphicsEllipseItem(-10, -10, 20, 20)), m_thickEllipseItem(new QGraphicsEllipseItem(-10, -10, 20, 20)), m_lineItem(new QGraphicsLineItem), m_solidLineItem(new QGraphicsLineItem), m_parentalLinesVisible(false) { setSceneRect(-512, -400, 1024, 800); setRenderHints(QPainter::Antialiasing); setBackgroundBrush(Qt::darkGray); setStyleSheet("QGraphicsView { border: 0; }"); setAcceptDrops(true); // Bone *bone = new Bone("Bone 2", m_root); // bone->setScaleFromLength(100); // Attachment *attachment1 = new Attachment(QPixmap(":/images/head.png")); // m_root->addAttachment(attachment1); // Attachment *attachment2 = new Attachment(QPixmap(":/images/torso.png")); // bone->addAttachment(attachment2); scene()->addItem(m_root); // scene()->addItem(attachment1); // scene()->addItem(attachment2); setBoneTargetMode(); setTransformEditMode(); setSelectTransformMode(); m_circleItem = new QGraphicsEllipseItem(-10, -10, 20, 20); m_circleItem->setVisible(false); scene()->addItem(m_circleItem); m_ellipseItem->setVisible(false); scene()->addItem(m_ellipseItem); m_thickEllipseItem->setVisible(false); m_thickEllipseItem->setPen(QPen(Qt::black, 2)); scene()->addItem(m_thickEllipseItem); m_lineItem->setPen(QPen(Qt::black, 0, Qt::DashLine)); m_lineItem->setVisible(false); scene()->addItem(m_lineItem); m_solidLineItem->setPen(QPen(Qt::black, 0, Qt::SolidLine)); m_solidLineItem->setVisible(false); scene()->addItem(m_solidLineItem); // setViewportUpdateMode(NoViewportUpdate); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), viewport(), SLOT(update())); timer->start(UpdateInterval); }
Level::Level(int width, int height, QWidget *parent) : QGraphicsView(parent) { // Set the size of the scene. setScene(new QGraphicsScene(0, 0, width, height, this)); setRenderHints(QPainter::SmoothPixmapTransform); setRenderHints(QPainter::Antialiasing); setCacheMode(QGraphicsView::CacheBackground); //setViewportUpdateMode(QGraphicsView::NoViewportUpdate); setPalette(QPalette(QColor(0, 0, 0))); setAutoFillBackground(true); this->show(); gridSpacing = 10; }
AnimatorView::AnimatorView (QGraphicsScene * scene) : QGraphicsView (scene), m_currentZoomFactor (1) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); setViewportUpdateMode (BoundingRectViewportUpdate); }
TreeViewport::TreeViewport(QWidget* parent ): QGraphicsView(parent), m_zoom(0) { setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform); setDragMode(QGraphicsView::RubberBandDrag); setOptimizationFlags(QGraphicsView::DontSavePainterState); //setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); //setViewportUpdateMode(QGraphicsView::FullViewportUpdate); }
TreeView::TreeView(QWidget *parent) : QGraphicsView(parent) { setDragMode(RubberBandDrag); setAlignment(Qt::AlignHCenter | Qt::AlignTop); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); m_zoom = 1; }
WorkspaceView::WorkspaceView(QWidget *parent) : QGraphicsView(parent) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setViewportUpdateMode( QGraphicsView::FullViewportUpdate ); //Use ScrollHand Drag Mode to enable Panning setDragMode(ScrollHandDrag); }
MovementScene::MovementScene(QWidget *parent) : QGraphicsView(parent) { this->gridInterval = 7; this->gridIsVisible = true; setDragMode(RubberBandDrag); setRenderHints(QPainter::Antialiasing); }
GraphicsView:: GraphicsView(QGraphicsScene* scene) : QGraphicsView(scene) // ,pressed_control_(false) { EXCEPTION_ASSERT(scene); setWindowTitle(tr("Sonic AWE")); //setRenderHints(QPainter::SmoothPixmapTransform); //setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); setMouseTracking( true ); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setRenderHints(renderHints() | QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setViewportUpdateMode(QGraphicsView::NoViewportUpdate); // Caching slows down rendering of animated frames. setCacheMode(QGraphicsView::CacheNone); tool_proxy_ = new QGraphicsProxyWidget; layout_widget_ = new QWidget; // Make all child widgets occupy the entire area layout_widget_->setLayout(new QBoxLayout(QBoxLayout::TopToBottom)); layout_widget_->layout()->setMargin(0); layout_widget_->layout()->setSpacing(0); tool_proxy_->setWidget( layout_widget_ ); tool_proxy_->setWindowFlags( Qt::FramelessWindowHint ); setToolFocus( false ); // would prefer WA_NoBackground to hide the background, but some cache (which we're not using) isn't cleared while resizing without more work. Setting alpha to 0 also works //layout_widget_->setAttribute(Qt::WA_NoBackground); layout_widget_->setPalette(QPalette(QPalette::Window, QColor(0,0,0,0))); scene->addItem( tool_proxy_ ); tool_proxy_->setParent( scene ); setAcceptDrops(true); }
/** * Constructor. */ UMLView::UMLView(UMLFolder *parentFolder) : QGraphicsView(UMLApp::app()->mainViewWidget()), m_nZoom(100) { setAcceptDrops(true); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setDragMode(NoDrag); //:TODO: RubberBandDrag); setScene(new UMLScene(parentFolder, this)); }
FigureEditor::FigureEditor( QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) : QGraphicsView(&c,parent) { setObjectName(name); setWindowFlags(f); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); }
Slideshow::Slideshow(Gallery *gallery, ThumbnailModel *model, QVector<int> selection, QWidget *parent) : QGraphicsView(parent), m_gallery(gallery), m_model(model), m_selection(selection), m_picture(0) { setWindowTitle(tr("Slideshow")); setAttribute(Qt::WA_DeleteOnClose, true); setWindowFlags(windowFlags() | Qt::Window); setFrameShape(QFrame::NoFrame); setFocusPolicy(Qt::StrongFocus); m_scene = new QGraphicsScene(); m_scene->setBackgroundBrush(Qt::black); setScene(m_scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setInteractive(false); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); m_slidetimer = new QTimer(this); connect(m_slidetimer, SIGNAL(timeout()), this, SLOT(nextSlide())); // Construct the pause glyph QGraphicsLineItem *p1 = new QGraphicsLineItem(QLineF(20, 20, 20, 70)); QGraphicsLineItem *p2 = new QGraphicsLineItem(QLineF(60, 20, 60, 70)); QPen pen; pen.setWidth(15); pen.setCapStyle(Qt::RoundCap); pen.setColor(Qt::white); p1->setPen(pen); p2->setPen(pen); QGraphicsItemGroup *pauseglyph = new QGraphicsItemGroup(); pauseglyph->setZValue(100); pauseglyph->addToGroup(p1); pauseglyph->addToGroup(p2); addShadowEffect(pauseglyph); pauseglyph->hide(); m_pauseglyph = pauseglyph; m_scene->addItem(m_pauseglyph); // Construct timer text item m_timertext = new QGraphicsTextItem(); m_timertext->setZValue(100); QFont font; font.setPixelSize(20); m_timertext->setFont(font); m_timertext->setDefaultTextColor(Qt::white); setTimerText(); addShadowEffect(m_timertext); m_timertext->hide(); m_scene->addItem(m_timertext); m_scalefill = gallery->database()->getSetting("slideshow.scale").toString() == "fill"; m_upscale = gallery->database()->getSetting("slideshow.upscale").toBool(); }
MapView::MapView(QWidget *parent) : QGraphicsView(parent), m_currentZoom(1.0f), m_minZoom(1.0f), m_maxZoom(2.0f) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); }
DiagramView::DiagramView(QWidget *parent) : QGraphicsView(parent) { setAcceptDrops(true); setAlignment(Qt::AlignLeft | Qt::AlignTop); setDragMode(QGraphicsView::RubberBandDrag); setFrameShape(QFrame::NoFrame); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); }
Figure2D::Figure2D(QWidget *parent) : QGraphicsView(parent), lbProjX(new QLabel("xlabelhere",this)), lbProjY(new QLabel("ylabelhere",this)) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); // Create a new scene setScene(new VibesScene2D(this)); this->scale(1.0, -1.0); this->show(); setDragMode(ScrollHandDrag); // Force full viewport update (avoid problems with axes) setViewportUpdateMode(FullViewportUpdate); // Never show the scrollbars setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Keep the view centered when resizing window setResizeAnchor(AnchorViewCenter); lbProjX->setAlignment(Qt::AlignRight); lbProjX->move(width()-50, 0); lbProjX->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored); lbProjX->resize(100, 20); lbProjX->installEventFilter(this); lbProjX->show(); lbProjY->move(5, 15); lbProjY->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored); lbProjY->resize(100, 20); lbProjY->installEventFilter(this); lbProjY->show(); cbProjX = new QComboBox(lbProjX); cbProjX->setMaximumSize(lbProjX->size()); connect(cbProjX, SIGNAL(currentTextChanged(QString)), lbProjX, SLOT(setText(QString))); connect(cbProjX, SIGNAL(currentIndexChanged(QString)), lbProjX, SLOT(setText(QString))); for (int i=0; i<3; ++i) cbProjX->addItem(QString("x: dim %1").arg(i), i); cbProjX->setCurrentIndex(scene()->dimX()); //cbProjX->installEventFilter(this); connect(cbProjX, SIGNAL(currentIndexChanged(int)), scene(), SLOT(setDimX(int))); connect(scene(), SIGNAL(changedDimX(int)), cbProjX, SLOT(setCurrentIndex(int))); cbProjY = new QComboBox(lbProjY); cbProjY->setMaximumSize(lbProjY->size()); connect(cbProjY, SIGNAL(currentTextChanged(QString)), lbProjY, SLOT(setText(QString))); connect(cbProjY, SIGNAL(currentIndexChanged(QString)), lbProjY, SLOT(setText(QString))); for (int i=0; i<3; ++i) cbProjY->addItem(QString("y: dim %1").arg(i), i); cbProjY->setCurrentIndex(scene()->dimY()); //cbProjY->installEventFilter(this); connect(cbProjY, SIGNAL(currentIndexChanged(int)), scene(), SLOT(setDimY(int))); connect(scene(), SIGNAL(changedDimY(int)), cbProjY, SLOT(setCurrentIndex(int))); connect(scene(), SIGNAL(dimensionsChanged()), this, SLOT(refreshProjectionSelectors())); }
GraphView::GraphView(GraphScene *scene, QWidget *parent) : QGraphicsView(scene, parent), m_temp(NULL), m_model(NULL), m_changingLinkMode(false), m_menu(new QMenu(this)) { setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); createContextMenu(); }
WGraphicsView::WGraphicsView(QWidget * parent) : QGraphicsView(parent) { setDragMode(QGraphicsView::ScrollHandDrag); setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setContextMenuPolicy(Qt::ActionsContextMenu); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setAcceptDrops(true); this->viewport()->installEventFilter(this); }