本文整理汇总了C++中setRenderHints函数的典型用法代码示例。如果您正苦于以下问题:C++ setRenderHints函数的具体用法?C++ setRenderHints怎么用?C++ setRenderHints使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setRenderHints函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGraphicsView
MapView::MapView(QWidget *parent)
: QGraphicsView(parent)
{
setDragMode(ScrollHandDrag);
setRenderHints(QPainter::Antialiasing
| QPainter::TextAntialiasing);//反锯齿
}
示例2: QGraphicsView
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);
}
示例3: imageViewPanel
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);
}
示例4: QGraphicsView
//################################################################################################
//################################# 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);
}
示例5: QGraphicsView
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);
}
示例6: QWebView
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;
}
示例7: QGraphicsView
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()));
}
示例8: QGraphicsView
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);
}
示例9: setHorizontalScrollBarPolicy
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&)));
}
示例10: QGraphicsView
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);
}
示例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);
}
示例12: QGraphicsView
//! [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);
}
示例13: 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);
}
示例14: QGraphicsView
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);
}
示例15: QGraphicsView
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;
}