Пример #1
0
GraphGraphicsView::GraphGraphicsView(QWidget *parent) :
    QGraphicsView(parent)
{
    setScene(&scene);
    resize(1000,500);
    setBackgroundBrush(Qt::white);
    setFocus();

    QLinearGradient linearGrad(-500, -500, 500, 500); // átmenetes ecset
    linearGrad.setColorAt(0, QColor(255, 255, 255));
    linearGrad.setColorAt(1, QColor(192, 192, 192));
    setBackgroundBrush(linearGrad);
    setRenderHint(QPainter::Antialiasing);
    setFrameStyle(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    qsrand(QTime::currentTime().msec());

    randomGraph();

    dDialog = new dijkstraDialog();
    source = -1;
    destination = -1;

    QObject::connect(dDialog, SIGNAL(runDijkstraFromTo(int,int)),
                     this, SLOT(runDijkstra(int,int)));
}
Пример #2
0
void SCgScene::renderToImage(QPainter *painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode)
{
    QBrush brush = backgroundBrush();
    setBackgroundBrush(QBrush(Qt::NoBrush));
    render(painter, target, source, aspectRatioMode);
    setBackgroundBrush(brush);
}
Пример #3
0
void MainWindow::changeBackground(){
	if(scene->inherits("StartScene")){
		setBackgroundBrush(true);
		StartScene *start_scene = qobject_cast<StartScene *>(scene);
		start_scene->setServerLogBackground();
	}else{
		setBackgroundBrush(false);
	}
}
Пример #4
0
	CanvasGraphicsView::CanvasGraphicsView()
		: m_scene( new QGraphicsScene )
	{

		setBackgroundBrush( QBrush( QColor( Qt::black ) ) );
		setScene( m_scene.get() );
	}
Пример #5
0
Overview::Overview(QWidget* parent)
	: QGraphicsView(parent),
	m_min_scale_level(0),
	m_scale_level(0)
{
	setWindowTitle(tr("Overview"));
	setWindowFlags(Qt::Tool);

	setBackgroundBrush(Qt::darkGray);
	setBackgroundRole(QPalette::Window);
	setRenderHint(QPainter::SmoothPixmapTransform, true);
	setDragMode(ScrollHandDrag);
	setFrameStyle(NoFrame);

	// Create scene
	QGraphicsScene* scene = new QGraphicsScene(this);
	setScene(scene);
	m_pixmap = new QGraphicsPixmapItem;
	m_pixmap->setTransformationMode(Qt::SmoothTransformation);
	scene->addItem(m_pixmap);
	reset();

	// Restore geometry
	QSettings settings;
	if (settings.contains("Overview/Geometry")) {
		restoreGeometry(settings.value("Overview/Geometry").toByteArray());
		setMinimumSize(size());
	} else {
		resize(400, 400);
		setMinimumSize(size());
	}
	m_default = settings.value("Overview/Default", true).toBool();
}
Пример #6
0
/**This constructor creates a new scene for the game to take place in
 * @brief Game::Game constructor creates a new QGraphicsScene, sets its Pixmap and sets its size
 * @param parent of Game is QGraphicsView
 */
Game::Game(QWidget *parent) :
    QGraphicsView(parent),
    ui(new Ui::Game)
{
    ui->setupUi(this);

    // create a new QGraphicsScene
    scene = new QGraphicsScene();
    // set the size of the scene
    scene->setSceneRect(0,0,1200,500);
    // set the background
    setBackgroundBrush(QBrush(QImage(":/new/prefix1/country-field.png").scaledToWidth(1200)));

    setScene(scene);
    //turn off vertical and horizontal scroll bars
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //set size of the scene
    setFixedSize(1200, 500);

    // set up all music
    menu_music = new QMediaPlayer();
    menu_music->setMedia(QUrl("qrc:/sounds/sound/101-opening.mp3"));
    game_music = new QMediaPlayer();
    game_music->setMedia(QUrl("qrc:/sounds/sound/107-battle-vs-wild-pokemon-.mp3"));
    win_music = new QMediaPlayer();
    win_music->setMedia(QUrl("qrc:/sounds/sound/108-victory-vs-wild-pokemon-.mp3"));
    lose_music = new QMediaPlayer();
    lose_music->setMedia(QUrl("qrc:/sounds/sound/fail-trombone-02.mp3"));
}
Пример #7
0
/// @brief constructor
///
/// @param parent parent widget
ScrollScene::ScrollScene (QWidget * parent, ResultsTab *resultsTab)
    : QGraphicsScene (parent)
    , resultsTab (resultsTab)
    , testing (false)
    , text1 (new QGraphicsTextItem ("Scroll until the red circle is centered.  Press SPACE to begin."))
    , text2 (new QGraphicsTextItem ("Scroll until the red circle is centered.  Press SPACE to begin."))
{
    // set the text font
    text1->setFont (QFont ("Arial", 18, QFont::Bold));
    text2->setFont (QFont ("Arial", 18, QFont::Bold));
    QRectF r = text1->boundingRect ();
    const size_t NCIRCLES = 100;
    text1->setPos (-r.width () / 2, -4 * RADIUS);
    text2->setPos (-r.width () / 2, NCIRCLES * RADIUS * 2);
    // add it
    addItem (text1);
    addItem (text2);
    // set background of client area
    setBackgroundBrush (Qt::white);
    circles.resize (NCIRCLES);
    for (size_t i = 0; i < circles.size (); ++i)
    {
        QGraphicsEllipseItem *c = new QGraphicsEllipseItem (0);
        c->setRect (-RADIUS, -RADIUS, RADIUS, RADIUS);
        int y = i * RADIUS * 2;
        c->setPos (0, y);
        addItem (c);
        circles[i] = c;
    }
}
Пример #8
0
void PaintScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    qreal widthScene = sceneRect().width();
    qreal sceneHeight = sceneRect().height();
    QImage image(widthScene, sceneHeight,QImage::Format_RGB32);
    //image.fill(Qt::white);
    QPainter painter(&image);
    painter.setRenderHint(QPainter::Antialiasing);
    render(&painter);

    QPoint newPos;
    newPos.setX(event->scenePos().x());
    newPos.setY(event->scenePos().y());

    QPen pen;
    pen.setWidth(brushWidth());
    pen.setColor(brushColor());
    painter.setPen(pen);
    QString type("Pencil");
    QRect rect = drawRect(type, painter, m_oldPos, newPos);
    m_oldPos = newPos;

    QBrush br(image);
    br.setColor(Qt::transparent);
    setBackgroundBrush(br);

    update();
    QGraphicsScene::mouseMoveEvent(event);
}
Пример #9
0
GEvScene::GEvScene(GSequence *parentSeq)
    : QGraphicsScene(parentSeq)
    , m_pSeq(parentSeq)
{
    // to have the scene match the sequence length
    connect(m_pSeq, SIGNAL(LengthChanged(double)), this, SLOT(UpdateLength(double)), Qt::QueuedConnection);

    // background color
    setBackgroundBrush(QColor(230, 255, 230));

    // this is a QGraphicsWidget to use a layout in the scene
    QGraphicsWidget* pGraWid = new QGraphicsWidget();
    addItem(pGraWid);
    m_pChannelLayout = new QGraphicsLinearLayout(Qt::Vertical);
    pGraWid->setLayout(m_pChannelLayout);
    // margins from the view border
    m_pChannelLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
    // spacing between channels
    m_pChannelLayout->setSpacing(1.0);

    // makes the root item, parent of all event in the sequence
    m_pRootEvent = new GSynchEvent(0);
    m_pRootEvent->setParent(this);
    m_pRootEvent->setFlag(QGraphicsItem::ItemIsMovable, false);;
    addItem(m_pRootEvent);
}
Пример #10
0
void MinesweeperView::initView(int row, int column)
{
    hide();
    const QRect rect{0, 0, static_cast<int>(cellBase * column + cellGap),
                     static_cast<int>(cellBase * row + cellGap)};
    ui_->graphicsView->setSceneRect(rect);
    constexpr int widthSizeOffset = 22 * 2;
    constexpr int heightSizeOffset = 25;
    setGeometry(0, 0, rect.width() + ui_->titleLabel->width() + widthSizeOffset,
                rect.height() + heightSizeOffset);
    auto scene = new QGraphicsScene(rect);
    for (int i = 0; i < row; ++i) {
        for (int j = 0; j < column; ++j) {
            auto cellRectItem = new CellRectItem{i, j};
            connect(cellRectItem, &CellRectItem::clicked, this,
                    &MinesweeperView::clicked);
            scene->addItem(cellRectItem);
        }
    }
    if (auto oldScene = ui_->graphicsView->scene()) {
        delete oldScene;
    }

    QBrush backgroundBrush{{153, 204, 255}};
    scene->setBackgroundBrush(backgroundBrush);

    ui_->graphicsView->setScene(scene);
    ui_->graphicsView->show();
    ui_->timeLabel->setText("00:00:00");
    setEnabled(true);
    show();
}
Пример #11
0
/// @brief constructor
///
/// @param parent parent widget
CursorScene::CursorScene (QWidget * parent, ResultsTab *resultsTab)
    : QGraphicsScene (parent)
    , resultsTab (resultsTab)
    , testing (false)
    , text (new QGraphicsTextItem ("Try to keep the cursor inside of the circle.  Press SPACE to begin."))
    , circle (new QGraphicsEllipseItem (0))
{
    // set the text font
    text->setFont (QFont ("Arial", 18, QFont::Bold));
    // center the instruction text
    QRectF r = text->boundingRect ();
    text->setPos (-r.width () / 2, -r.height () / 2 + 100);
    // add it
    addItem (text);
    // make a circle
    circle->setRect (-RADIUS, -RADIUS, RADIUS, RADIUS);
    addItem (circle);
    // set background of client area
    setBackgroundBrush (Qt::white);
    // show the text
    text->setVisible (true);
    circle->setVisible (true);
    // start circle in the center
    circle->setPos (QPointF (0, 0));
}
Пример #12
0
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);
}
Пример #13
0
PhotoKitScene::PhotoKitScene(QObject *parent) :
	QGraphicsScene(parent)
{
    //setItemIndexMethod(QGraphicsScene::NoIndex);
	setBackgroundBrush(QBrush(Config::backgroundColor));

}
Пример #14
0
// ///////////////////////////////////////////////////////////////////////////////////////////
//
PGraphicsView::PGraphicsView(QWidget *parent) : QGraphicsView(parent)
{
    setBackgroundBrush(QBrush(QColor(77,120,58)));
    setAcceptDrops(true);
    setInteractive(true);
    setDragMode(QGraphicsView::ScrollHandDrag); //defini le comportement de la Vue qd on drag la souris dans une zone vide
}
Пример #15
0
MapView::MapView(QWidget *parent)
    : QGraphicsView(parent)
{
    settings_ = Settings::sharedInstance();
    setBackgroundBrush(Qt::lightGray);

    setAcceptDrops(true);
    setFocusPolicy(Qt::StrongFocus);
    setViewportUpdateMode(FullViewportUpdate);
    //setAlignment(Qt::AlignLeft | Qt::AlignTop);

    setScene(new MapScene(this));
    //setSceneRect(0, 0, 0, 0);

    updateGridPixmap();

    connect(settings_, SIGNAL(showGridChanged(bool)),
            this, SLOT(updateGridPixmap()));
    connect(settings_, SIGNAL(finalGridSizeChanged(QSizeF)),
            this, SLOT(updateGridPixmap()));

    connect(settings_, SIGNAL(zoomChanged(double)),
            this, SLOT(onZoomChanged(double)));
    onZoomChanged(settings_->zoom());
}
Пример #16
0
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);
	
}
Пример #17
0
GameCanvas::GameCanvas(QGraphicsScene* gs, QWidget *parent )
 : QGraphicsView( gs, parent )
{
    unsigned int i = 0;
    for(;i<PLAYERS;i++)
    {
        m_stich[i] = new CanvasCard();
        scene()->addItem( m_stich[i] );
        m_players[i]=new CanvasPlayer( i, scene(), this );
    }
    
    m_item = NULL;
        
    QFont f( "Helvetica", 24 );
    
    m_message = new QGraphicsSimpleTextItem();
    m_message->setFont( f );
    //    m_message->setBrush( QBrush( Qt::yellow ) );
    m_message->setBrush( QBrush( Qt::black ) );

    m_yes = new CanvasText( i18n("Yes"), f, m_message );
    m_no = new CanvasText( i18n("No"), f, m_message );
    m_ok = new CanvasText( i18n("OK"), f, m_message );

    scene()->addItem( m_message );

    m_message->hide();
    m_yes->hide();
    m_no->hide();
    m_ok->hide();

    // Does not work :-(
    /*
    m_message->setZ( 100 );
    m_yes->setZ( 100 );
    m_no->setZ( 100 );
    m_ok->setZ( 100 );
    */
    
    m_result = 0;
    setFocusPolicy( Qt::StrongFocus );
    
    setBackgroundBrush( QBrush( Qt::darkGreen ) );
    
    loadOK = ImgBack.load( Settings::instance()->backgroundImage() );

    QTimer *timer = new QTimer( this) ;
    connect( timer, SIGNAL( timeout() ), scene(), SLOT( advance() ) );
    timer->start( 30 );
    update();
    
    connect( Settings::instance(), SIGNAL(cardChanged()), this, SLOT(positionObjects()));
    connect( this, SIGNAL(clicked( QGraphicsItem* )), this, SLOT(yesNoClicked(QGraphicsItem*)));
    
    m_focus_list.append( m_yes );
    m_focus_list.append( m_no );
    m_focus_list.append( m_ok );
    for( i=0;i<NUMCARDS;i++ )
        m_focus_list.append( m_players[0]->canvasCard( i ) );
}    
Пример #18
0
GamePlay::GamePlay(QWidget *parent)
{
    gameOver = false;
    scene = new QGraphicsScene();
    scene->setSceneRect(0,0,640,480);
    setBackgroundBrush(QBrush(QImage(":/images/background.jpg")));

    setScene(scene);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    Actor *actor = new Actor();
    actor->setPos(320, 380);
    actor->setFlag(QGraphicsItem::ItemIsFocusable);
    actor->setFocus();

    scene->addItem(actor);
    setFixedSize(640,480);

    score = new Score();
    scene->addItem(score);

    timer = new QTimer();
    QObject::connect(timer,SIGNAL(timeout()),actor,SLOT(spawn()));
    timer->start(2000);

    show();
}
/**
 * @brief Diagram::Diagram
 * Constructor
 * @param project : The project of this diagram and also parent QObject
 */
Diagram::Diagram(QETProject *project) :
	QGraphicsScene           (project),
	project_                 (NULL),
	diagram_qet_version_     (-1),
	draw_grid_               (true),
	use_border_              (true),
	draw_terminals_          (true),
	draw_colored_conductors_ (true)
{
	setProject(project);
	qgi_manager_ = new QGIManager(this);
	setBackgroundBrush(Qt::white);
	conductor_setter_ = new QGraphicsLineItem(0, 0);
	conductor_setter_ -> setZValue(1000000);
	QPen t;
	t.setColor(Qt::black);
	t.setWidthF(1.5);
	t.setStyle(Qt::DashLine);
	conductor_setter_ -> setPen(t);
	conductor_setter_ -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
	
		//Init object for manage movement
	elements_mover_      = new ElementsMover();
	element_texts_mover_ = new ElementTextsMover();

	connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &)));
	connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)),    this, SLOT(titleChanged(const QString &)));
}
Пример #20
0
PoseMeshScene::PoseMeshScene(QObject *parent)
: QGraphicsScene(parent)
{    
   double graphicsWidth  = 512;
   double graphicsHeight = 1024;   

   // This rectangle will be a visual representation 
   // of the bounds that the map can be dragged in  
   mCanvasRect.setLeft(0);
   mCanvasRect.setTop(0);
   mCanvasRect.setWidth(graphicsWidth);
   mCanvasRect.setHeight(graphicsHeight);   

   mVerticalMeshOffset = mCanvasRect.y() + 64;

   QBrush canvasBrush(QColor(192, 192, 255));

   QGraphicsRectItem *canvasItem = addRect(mCanvasRect, QPen(), canvasBrush);  
   canvasItem->setZValue(-100.0f);
   canvasItem->setEnabled(false);

   QBrush backgroundBrush(QPixmap(":/images/checker.png"));  
   setBackgroundBrush(backgroundBrush);

   CreateTest();
}
Пример #21
0
FMSampleTextView::FMSampleTextView ( QWidget* parent )
		: QGraphicsView ( parent ),
		hasPendingUpdate ( false )
{
#if 0
	QGLFormat glfmt;
	glfmt.setSampleBuffers ( true );
	QGLWidget *glwgt = new QGLWidget ( glfmt );
// 	qDebug()<<"GL:: A DR S"<<glwgt->format().alpha()<<glwgt->format().directRendering()<<glwgt->format().sampleBuffers();
// 	setViewport(glwgt);
	if ( glwgt->format().sampleBuffers() )
	{
		setViewport ( glwgt );
		qDebug() <<"opengl enabled - DirectRendering("<< glwgt->format().directRendering() <<") - SampleBuffers("<< glwgt->format().sampleBuffers() <<")";
	}
	else
	{
		qDebug() <<"opengl disabled - DirectRendering("<< glwgt->format().directRendering() <<") - SampleBuffers("<< glwgt->format().sampleBuffers() <<")";
		delete glwgt;
	}
#endif

	setInteractive ( false );
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	theRect = 0;
	fPage = 0;
	isSelecting = false;
	isPanning = false;
	setAlignment ( Qt::AlignTop | Qt::AlignHCenter );
	setTransformationAnchor ( QGraphicsView::NoAnchor );
	setRenderHint ( QPainter::Antialiasing, true );
	setBackgroundBrush(Qt::white);
}
Пример #22
0
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);
}
Пример #23
0
/*!
  */
BoardView::BoardView(QWidget *parent)
    : QGraphicsView(parent)
{
    setCacheMode(CacheBackground);

    setMouseTracking(true);
    setRenderHint(QPainter::Antialiasing);
    setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);

    setBackgroundBrush(QColor(230, 200, 167));

    if (isRunningOnDesktop()) {
        // run on PC desktop.
        m_scene = new QGraphicsScene(-225, -225, 450, 450);
    } else {
        // run on a phone/mobile device.
        m_scene = new QGraphicsScene(-90, -90, 180, 180);
    }
    setScene(m_scene);

    m_grid = new GridItem(9);
    m_scene->addItem(m_grid);

    //
    PathFinder::instance()->init(m_grid->dim());

    // initializes the ball items provider
    BallItemsProvider::instance()->init(m_grid);
    //

    BallItemsProvider::instance()->nextBalls(true);
}
Пример #24
0
/**
	Constructeur
	@param parent Le QObject parent du schema
*/
Diagram::Diagram(QObject *parent) :
	QGraphicsScene(parent),
	draw_grid_(true),
	use_border_(true),
	draw_terminals_(true),
	draw_colored_conductors_(true),
	project_(0),
	read_only_(false),
	diagram_qet_version_(-1)
{
	undo_stack_ = new QUndoStack();
	qgi_manager_ = new QGIManager(this);
	setBackgroundBrush(Qt::white);
	conductor_setter_ = new QGraphicsLineItem(0, 0);
	conductor_setter_ -> setZValue(1000000);
	QPen t;
	t.setColor(Qt::black);
	t.setWidthF(1.5);
	t.setStyle(Qt::DashLine);
	conductor_setter_ -> setPen(t);
	conductor_setter_ -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
	
	// initialise les objets gerant les deplacements
	elements_mover_ = new ElementsMover();           // deplacements d'elements/conducteurs/textes
	element_texts_mover_ = new ElementTextsMover();  // deplacements d'ElementTextItem
	
	connect(
		&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)),
		this, SLOT(setTitleBlockTemplate(const QString &))
	);
	connect(
		&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)),
		this, SLOT(titleChanged(const QString &))
	);
}
Пример #25
0
void OverlayEditorScene::resync() {
	QRadialGradient gradient(0, 0, 10 * uiZoom);
	gradient.setSpread(QGradient::ReflectSpread);
	gradient.setColorAt(0.0f, QColor(255, 255, 255, 64));
	gradient.setColorAt(0.2f, QColor(0, 0, 0, 64));
	gradient.setColorAt(0.4f, QColor(255, 128, 0, 64));
	gradient.setColorAt(0.6f, QColor(0, 0, 0, 64));
	gradient.setColorAt(0.8f, QColor(0, 128, 255, 64));
	gradient.setColorAt(1.0f, QColor(0, 0, 0, 64));
	setBackgroundBrush(gradient);

	updateMuted();
	updateUserName();
	updateChannel();
	updateAvatar();

	moveMuted();
	moveUserName();
	moveChannel();
	moveAvatar();

	moveBox();

	qgiGroup->setOpacity(os.fUser[tsColor]);

	qgpiSelected = NULL;
	qgriSelected->setVisible(false);
}
Пример #26
0
LevelChooser::LevelChooser(Game *parent) :
    Menu(parent)
{
    // set size
    setSceneRect(parent->rect());
    m_width = sceneRect().width()/2;
    setBackgroundBrush(Qt::gray);

    // sets button attributes
    b_margin = 20;
    b_width = m_width - b_margin*2;
    b_height = 60;

    // buttons for level chooser
    QVector<QString> levels = parent->levelList();

    // because of laziness, maximum amount of levels is 7 (else they will be positioned outside Xx768 resolution..
    int levellimit = 7;
    for(int i = 0; i < levels.size() && i < levellimit; i++) {
        Button* button = new Button(b_width, b_height, levels[i], Button::GFunctionPlayLevel);
        button->levelKey(i);
        buttons.append(button);
    }

    buttons.append(new Button(b_width, b_height, "Back to Main Menu", Button::GFunctionMainMenu));

    addButtons(buttons);
}
FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) :
    QGraphicsView(parent)
{
    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
    setResizeAnchor(QGraphicsView::AnchorViewCenter);
    setCacheMode(QGraphicsView::CacheNone);
//    setCacheMode(QGraphicsView::CacheBackground);
    setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    setOptimizationFlags(QGraphicsView::DontSavePainterState);
//    setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
    setRenderHint(QPainter::Antialiasing, false);

    setFrameShape(QFrame::NoFrame);

    setAutoFillBackground(true);
    setBackgroundRole(QPalette::Window);

    const int checkerbordSize= 20;
    QPixmap tilePixmap(checkerbordSize * 2, checkerbordSize * 2);
    tilePixmap.fill(Qt::white);
    QPainter tilePainter(&tilePixmap);
    QColor color(220, 220, 220);
    tilePainter.fillRect(0, 0, checkerbordSize, checkerbordSize, color);
    tilePainter.fillRect(checkerbordSize, checkerbordSize, checkerbordSize, checkerbordSize, color);
    tilePainter.end();

    setBackgroundBrush(tilePixmap);

    viewport()->setMouseTracking(true);
}
Пример #28
0
void ReportView::init()
{
	setBackgroundBrush(Qt::lightGray);
	//setRenderHints(QPainter::Antialiasing | 
	//	QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);
	scaleView(1);
}
Пример #29
0
Graph::Graph ()
  :background_color(255, 255, 255)
  ,drawing_edge_from_input_anchor(false)
  ,drawing_edge_from_output_anchor(false)
{
  setBackgroundBrush (QBrush (background_color));
}
Пример #30
0
/**
 * @brief Game::Game This is the class constructor, it establishes all elements of the UI the scene,the view and set the objects in the view.
 * @param parent
 */
Game::Game(QWidget *parent){
    scene = new QGraphicsScene();
    scene->setSceneRect(0,0,1000,800); // make the scene 800x600 instead of infinity by infinity (default)
    setBackgroundBrush(QBrush(QImage(":/images/bg.png")));
    setScene(scene);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFixedSize(1000,800);
    setMouseTracking(true);

    player = new Player();
    player->setPos(200,750);
    player->setFlag(QGraphicsItem::ItemIsFocusable);
    player->setFocus();
    scene->addItem(player);
    player->grabMouse();
    player->spawn();

    createBlockGrid();

    score = new Score();
    scene->addItem(score);

    show();

}