本文整理汇总了C++中setBackgroundBrush函数的典型用法代码示例。如果您正苦于以下问题:C++ setBackgroundBrush函数的具体用法?C++ setBackgroundBrush怎么用?C++ setBackgroundBrush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setBackgroundBrush函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: QGraphicsView
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 ) );
}
开发者ID:dosas,项目名称:SchafKopf,代码行数:60,代码来源:gamecanvas.cpp
示例17: QGraphicsScene
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();
}
开发者ID:andrei-andrianov,项目名称:qt-spaceinvaders,代码行数:28,代码来源:gameplay.cpp
示例18: draw_colored_conductors_
/**
* @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 &)));
}
开发者ID:wangchenxicool,项目名称:qelectrotech-0.4-src-qt-everywhere,代码行数:33,代码来源:diagram.cpp
示例19: QGraphicsScene
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();
}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:26,代码来源:PoseMeshScene.cpp
示例20: QGraphicsView
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);
}
开发者ID:gonboy,项目名称:fontmatrix,代码行数:34,代码来源:fmsampletextview.cpp
注:本文中的setBackgroundBrush函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论