当前位置: 首页>>代码示例>>C++>>正文


C++ setBackgroundBrush函数代码示例

本文整理汇总了C++中setBackgroundBrush函数的典型用法代码示例。如果您正苦于以下问题:C++ setBackgroundBrush函数的具体用法?C++ setBackgroundBrush怎么用?C++ setBackgroundBrush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setBackgroundBrush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QGraphicsView

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)));
}
开发者ID:DaytimeAH,项目名称:DataVisualize,代码行数:28,代码来源:graphgraphicsview.cpp

示例2: backgroundBrush

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);
}
开发者ID:burikella,项目名称:kbe,代码行数:7,代码来源:scgscene.cpp

示例3: setBackgroundBrush

void MainWindow::changeBackground(){
	if(scene->inherits("StartScene")){
		setBackgroundBrush(true);
		StartScene *start_scene = qobject_cast<StartScene *>(scene);
		start_scene->setServerLogBackground();
	}else{
		setBackgroundBrush(false);
	}
}
开发者ID:takashiro,项目名称:OnePieceBang,代码行数:9,代码来源:mainwindow.cpp

示例4: m_scene

	CanvasGraphicsView::CanvasGraphicsView()
		: m_scene( new QGraphicsScene )
	{

		setBackgroundBrush( QBrush( QColor( Qt::black ) ) );
		setScene( m_scene.get() );
	}
开发者ID:Klaim,项目名称:aos-designer,代码行数:7,代码来源:canvasgraphicsview.cpp

示例5: QGraphicsView

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();
}
开发者ID:gottcode,项目名称:tetzle,代码行数:33,代码来源:overview.cpp

示例6: QGraphicsView

/**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"));
}
开发者ID:moeishihara,项目名称:GetPikachu,代码行数:34,代码来源:game.cpp

示例7: QGraphicsScene

/// @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;
    }
}
开发者ID:jeffsp,项目名称:soma,代码行数:33,代码来源:usability.cpp

示例8: sceneRect

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);
}
开发者ID:4js-qtguys,项目名称:android,代码行数:29,代码来源:PaintScene.cpp

示例9: QGraphicsScene

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);
}
开发者ID:GaelReinaudi,项目名称:LabExe,代码行数:26,代码来源:GEvScene.cpp

示例10: hide

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();
}
开发者ID:colajam93,项目名称:Minesweeper,代码行数:32,代码来源:minesweeperview.cpp

示例11: QGLWidget

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);
}
开发者ID:0xd0d9e,项目名称:anthracitarium,代码行数:33,代码来源:view.cpp

示例12: QGraphicsScene

PhotoKitScene::PhotoKitScene(QObject *parent) :
	QGraphicsScene(parent)
{
    //setItemIndexMethod(QGraphicsScene::NoIndex);
	setBackgroundBrush(QBrush(Config::backgroundColor));

}
开发者ID:BIbiLion,项目名称:PhotoKit,代码行数:7,代码来源:PhotoKitScene.cpp

示例13: QGraphicsView

// ///////////////////////////////////////////////////////////////////////////////////////////
//
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
}
开发者ID:Zugzwangs,项目名称:Eternal-Deck-Builder,代码行数:9,代码来源:playground.cpp

示例14: QGraphicsView

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());
}
开发者ID:zmeyc,项目名称:mapmaker,代码行数:25,代码来源:MapView.cpp

示例15: QGraphicsView

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);
	
}
开发者ID:TritonSailor,项目名称:livepro,代码行数:28,代码来源:EditorGraphicsView.cpp


注:本文中的setBackgroundBrush函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。