本文整理汇总了C++中scene函数的典型用法代码示例。如果您正苦于以下问题:C++ scene函数的具体用法?C++ scene怎么用?C++ scene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scene函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: scene
QColor UBAbstractDrawRuler::middleFillColor() const
{
return scene()->isDarkBackground() ? sDarkBackgroundMiddleFillColor : sLightBackgroundMiddleFillColor;
}
开发者ID:199901,项目名称:Sankore-3.1,代码行数:4,代码来源:UBAbstractDrawRuler.cpp
示例2: scene
void StelMainView::resizeEvent(QResizeEvent* event)
{
scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
rootItem->setGeometry(0,0,event->size().width(),event->size().height());
QGraphicsView::resizeEvent(event);
}
开发者ID:magnific0,项目名称:stellarium,代码行数:6,代码来源:StelMainView.cpp
示例3: StelGui
void StelMainView::init(QSettings* conf)
{
gui = new StelGui();
#if STEL_USE_NEW_OPENGL_WIDGETS
//glWidget->initializeGL(); // protected...
//Q_ASSERT(glWidget->isValid());
#else
Q_ASSERT(glWidget->isValid());
glWidget->makeCurrent();
#endif
// Should be check of requirements disabled?
if (conf->value("main/check_requirements", true).toBool())
{
// Find out lots of debug info about supported version of OpenGL and vendor/renderer.
processOpenGLdiagnosticsAndWarnings(conf, glWidget);
}
stelApp= new StelApp();
stelApp->setGui(gui);
stelApp->init(conf);
StelActionMgr *actionMgr = stelApp->getStelActionManager();
actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneous"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Options"), N_("Full-screen mode"), this, "fullScreen", "F11");
StelPainter::initGLShaders();
skyItem = new StelSkyItem();
guiItem = new StelGuiItem();
QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem);
l->setSpacing(0);
l->setContentsMargins(0,0,0,0);
l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner);
l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRightCorner);
l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner);
l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorner);
rootItem->setLayout(l);
scene()->addItem(rootItem);
nightModeEffect = new NightModeGraphicsEffect(this);
updateNightModeProperty();
rootItem->setGraphicsEffect(nightModeEffect);
QSize size = glWidget->windowHandle()->screen()->size();
size = QSize(conf->value("video/screen_w", size.width()).toInt(),
conf->value("video/screen_h", size.height()).toInt());
bool fullscreen = conf->value("video/fullscreen", true).toBool();
// Without this, the screen is not shown on a Mac + we should use resize() for correct work of fullscreen/windowed mode switch. --AW WTF???
resize(size);
QDesktopWidget *desktop = QApplication::desktop();
int screen = conf->value("video/screen_number", 0).toInt();
if (screen < 0 || screen >= desktop->screenCount())
{
qWarning() << "WARNING: screen" << screen << "not found";
screen = 0;
}
QRect screenGeom = desktop->screenGeometry(screen);
if (fullscreen)
{
// The "+1" below is to work around Linux/Gnome problem with mouse focus.
move(screenGeom.x()+1, screenGeom.y()+1);
// The fullscreen window appears on screen where is the majority of
// the normal window. Therefore we crop the normal window to the
// screen area to ensure that the majority is not on another screen.
setGeometry(geometry() & screenGeom);
setFullScreen(true);
}
else
{
setFullScreen(false);
int x = conf->value("video/screen_x", 0).toInt();
int y = conf->value("video/screen_y", 0).toInt();
move(x + screenGeom.x(), y + screenGeom.y());
}
flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool();
setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool());
setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat());
maxfps = conf->value("video/maximum_fps",10000.f).toFloat();
minfps = conf->value("video/minimum_fps",10000.f).toFloat();
flagMaxFpsUpdatePending = false;
// XXX: This should be done in StelApp::init(), unfortunately for the moment we need init the gui before the
// plugins, because the gui create the QActions needed by some plugins.
StelApp::getInstance().initPlugIns();
// activate DE430/431
StelApp::getInstance().getCore()->initEphemeridesFunctions();
// The script manager can only be fully initialized after the plugins have loaded.
StelApp::getInstance().initScriptMgr();
// Set the global stylesheet, this is only useful for the tooltips.
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui!=NULL)
//.........这里部分代码省略.........
开发者ID:magnific0,项目名称:stellarium,代码行数:101,代码来源:StelMainView.cpp
示例4:
MapScene *MapView::mapScene() const
{
return qobject_cast<MapScene *>(scene());
}
开发者ID:zmeyc,项目名称:mapmaker,代码行数:4,代码来源:MapView.cpp
示例5: frame
//!
//! Changes the viewing transformation so that all items are visible at maximum
//! zoom level.
//!
void GraphicsView::frameAll ()
{
frame(scene()->itemsBoundingRect());
}
开发者ID:banduladh,项目名称:levelfour,代码行数:8,代码来源:GraphicsView.cpp
示例6: GET_PRESSURE
void ProfileGraphicsView::plot_cylinder_pressure(struct divecomputer *dc)
{
int i;
int last = -1, last_index = -1;
int lift_pen = FALSE;
int first_plot = TRUE;
int sac = 0;
struct plot_data *last_entry = NULL;
if (!get_cylinder_pressure_range(&gc))
return;
QPointF from, to;
for (i = 0; i < gc.pi.nr; i++) {
int mbar;
struct plot_data *entry = gc.pi.entry + i;
mbar = GET_PRESSURE(entry);
if (entry->cylinderindex != last_index) {
lift_pen = TRUE;
last_entry = NULL;
}
if (!mbar) {
lift_pen = TRUE;
continue;
}
if (!last_entry) {
last = i;
last_entry = entry;
sac = get_local_sac(entry, gc.pi.entry + i + 1, dive);
} else {
int j;
sac = 0;
for (j = last; j < i; j++)
sac += get_local_sac(gc.pi.entry + j, gc.pi.entry + j + 1, dive);
sac /= (i - last);
if (entry->sec - last_entry->sec >= SAC_WINDOW) {
last++;
last_entry = gc.pi.entry + last;
}
}
QColor c = get_sac_color(sac, dive->sac);
if (lift_pen) {
if (!first_plot && entry->cylinderindex == last_index) {
/* if we have a previous event from the same tank,
* draw at least a short line */
int prev_pr;
prev_pr = GET_PRESSURE(entry - 1);
QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC((entry-1)->sec, prev_pr), SCALEGC(entry->sec, mbar));
QPen pen(defaultPen);
pen.setColor(c);
item->setPen(pen);
scene()->addItem(item);
} else {
first_plot = FALSE;
from = QPointF(SCALEGC(entry->sec, mbar));
}
lift_pen = FALSE;
} else {
to = QPointF(SCALEGC(entry->sec, mbar));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
pen.setColor(c);
item->setPen(pen);
scene()->addItem(item);
}
from = QPointF(SCALEGC(entry->sec, mbar));
last_index = entry->cylinderindex;
}
}
开发者ID:kuldipem,项目名称:subsurface,代码行数:75,代码来源:profilegraphics.cpp
示例7: thememanager
// Animation loop
void DisplayIntro::loop()
{
int no = mCards.size();
// Catch no card error
if (no<1) return;
// Retrieve theme data
KConfigGroup cardconfig = thememanager()->config(QLatin1String( "card" ));
double card_width = cardconfig.readEntry("width", 1.0);
KConfigGroup config = thememanager()->config(id());
QPointF start_shift = config.readEntry("start-shift", QPointF(1.0,1.0));
QPointF start_pos = config.readEntry("start-pos", QPointF(1.0,1.0));
double time_clear_in = config.readEntry("time-clear-in", 1.0);
double time_clear_out = config.readEntry("time-clear-out", 1.0);
double aspectRatio = thememanager()->aspectRatio();
// Display the intro text delayed
if (mAnimCnt == 2 && mState == Putting && !mTextShown)
{
mTextShown = true;
QString s1 = i18nc("Title of the game - line 1", "Lieutenant Skat");
QString s2 = i18nc("Title of the game - line 2", "for");
QString s3 = i18nc("Title of the game - line 3", "K D E");
// Text sprite title foreground
TextSprite* text1a = new TextSprite(s1, QLatin1String( "name-front" ), mTheme, scene());
mSprites.append(text1a);
text1a->show();
// Text sprite title background
TextSprite* text1b = new TextSprite(s1, QLatin1String( "name-back" ), mTheme, scene());
mSprites.append(text1b);
text1b->show();
// Text sprite title foreground
TextSprite* text2a = new TextSprite(s2, QLatin1String( "for-front" ), mTheme, scene());
mSprites.append(text2a);
text2a->show();
// Text sprite title background
TextSprite* text2b = new TextSprite(s2, QLatin1String( "for-back" ), mTheme, scene());
mSprites.append(text2b);
text2b->show();
// Text sprite title foreground
TextSprite* text3a = new TextSprite(s3, QLatin1String( "kde-front" ), mTheme, scene());
mSprites.append(text3a);
text3a->show();
// Text sprite title background
TextSprite* text3b = new TextSprite(s3, QLatin1String( "kde-back" ), mTheme, scene());
mSprites.append(text3b);
text3b->show();
}
// Display a card
if (mAnimCnt < no && mState == Putting)
{
double factor = double(mAnimCnt)/double(no-1);
double fsin = sin(factor*M_PI);
CardSprite* sprite = mCards[mAnimCnt];
QPointF pos;
if (mAnimCnt %2 == 0)
{
pos = QPointF(start_pos.x(), start_pos.y());
pos += QPointF(start_shift.x() * fsin, start_shift.y() * factor);
}
else
{
pos = QPointF(1.0-start_pos.x()-card_width, start_pos.y());
pos += QPointF(-start_shift.x() * fsin, start_shift.y() * factor);
}
sprite->setBackside();
sprite->setPosition(pos);
sprite->setZValue(50+mAnimCnt);
sprite->show();
mAnimCnt++;
}
// Change state to turning
else if (mState == Putting)
{
mState = Turning;
mAnimCnt = 0;
}
// Turn cards
else if (mAnimCnt < no && mState == Turning)
{
CardSprite* sprite = mCards[mAnimCnt];
sprite->setTurning(true);
mAnimCnt++;
}
// Change state to waiting
else if (mState == Turning)
{
mState = Waiting;
mAnimCnt = 0;
//.........这里部分代码省略.........
开发者ID:jsj2008,项目名称:kdegames,代码行数:101,代码来源:display_intro.cpp
示例8: CleanMe
void ribi::cmap::QtConceptMap::BuildQtConceptMap()
{
CleanMe();
assert(m_concept_map);
assert(m_concept_map->IsValid());
assert(this->scene());
//This std::vector keeps the QtNodes in the same order as the nodes in the concept map
//You cannot rely on Collect<QtConceptMapNodeConcept*>(scene), as this shuffles the order
std::vector<QtNode*> qtnodes;
assert(Collect<QtNode>(scene()).empty());
//Add the nodes to the scene, if there are any
if (!m_concept_map->GetNodes().empty())
{
//Add the main question as the first node
const boost::shared_ptr<Node> node = m_concept_map->GetFocalNode();
QtNode * qtnode = nullptr;
if (IsCenterNode(node))
{
const boost::shared_ptr<CenterNode> centernode
= boost::dynamic_pointer_cast<CenterNode>(node);
qtnode = new QtCenterNode(centernode);
}
else
{
qtnode = new QtNode(node,this->GetDisplayStrategy(node->GetConcept()));
}
assert(qtnode);
//Let the center node respond to mouse clicks
qtnode->m_signal_request_scene_update.connect(
boost::bind(&ribi::cmap::QtConceptMap::OnRequestSceneUpdate,this));
qtnode->m_signal_item_has_updated.connect(
boost::bind(&ribi::cmap::QtConceptMap::OnItemRequestsUpdate,this,boost::lambda::_1));
//Add the center node to scene
assert(!qtnode->scene());
this->scene()->addItem(qtnode);
qtnodes.push_back(qtnode);
assert(Collect<QtNode>(scene()).size() == 1);
//Add the regular nodes to the scene
const std::vector<boost::shared_ptr<ribi::cmap::Node> > nodes = m_concept_map->GetNodes();
const std::size_t n_nodes = nodes.size();
assert(n_nodes >= 1);
for (std::size_t i=1; i!=n_nodes; ++i) //+1 to skip focal node
{
assert(Collect<QtNode>(scene()).size() == i && "Node not yet added to scene");
assert(i < nodes.size());
boost::shared_ptr<Node> node = nodes[i];
assert(node);
assert( (IsCenterNode(node) || !IsCenterNode(node))
&& "focal node != center node");
QtNode * const qtnode = AddNode(node);
qtnodes.push_back(qtnode);
assert(Collect<QtNode>(scene()).size() == i + 1 && "Node is added to scene");
}
}
#ifndef NDEBUG
{
//Check the number of
const auto qtnodes = Collect<QtNode>(scene());
const auto n_qtnodes = qtnodes.size();
const auto nodes = m_concept_map->GetNodes();
const auto n_nodes = nodes.size();
assert(n_qtnodes == n_nodes
&& "There must as much nodes in the scene as there were in the concept map");
}
#endif
//Add the Concepts on the Edges
{
const std::vector<boost::shared_ptr<ribi::cmap::Edge> > edges = m_concept_map->GetEdges();
std::for_each(edges.begin(),edges.end(),
[this,qtnodes](const boost::shared_ptr<Edge> edge)
{
assert(edge->GetFrom());
assert(edge->GetTo());
assert(edge->GetFrom() != edge->GetTo());
this->AddEdge(edge);
}
);
}
#ifndef NDEBUG
{
//Check the number of edges
const auto qtedges = Collect<QtEdge>(scene());
const auto n_qtedges = qtedges.size();
const auto edges = m_concept_map->GetEdges();
const auto n_edges = edges.size();
assert(n_qtedges == n_edges
&& "There must as much edges in the scene as there were in the concept map");
}
#endif
//Put the nodes around the focal question in an initial position
if (MustReposition(AddConst(m_concept_map->GetNodes())))
{
RepositionItems();
//.........这里部分代码省略.........
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:101,代码来源:qtconceptmap.cpp
示例9: s2o
XYView* View::new_view(Coord x1, Coord y1, Coord x2, Coord y2) {
Coord l,b,r,t;
s2o().inverse_transform(x1,y1,l,b);
s2o().inverse_transform(x2,y2,r,t);
return new View( (x1+x2)/2, (y1+y2)/2, x2-x1, scene(), r-l, t-b);
}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:6,代码来源:xyview.cpp
示例10: scene
void Forest::drawSelf()
{
if( mPriority >= 99-quality() )
mModel->draw( scene()->eye()->viewMatrix(), mInstances );
}
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:5,代码来源:Forest.cpp
示例11: scene
XYView::~XYView() {
// printf("~XYView\n");
scene()->remove_view(this);
}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:4,代码来源:xyview.cpp
示例12: main
int
main (int argc, char *argv[])
{
parseCommandLine (argc, argv);
pcl::PointCloud<PointType>::Ptr model (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr model_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<NormalType>::Ptr model_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<NormalType>::Ptr scene_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<DescriptorType>::Ptr model_descriptors (new pcl::PointCloud<DescriptorType> ());
pcl::PointCloud<DescriptorType>::Ptr scene_descriptors (new pcl::PointCloud<DescriptorType> ());
//
// Load clouds
//
if (pcl::io::loadPCDFile (model_filename_, *model) < 0)
{
std::cout << "Error loading model cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
if (pcl::io::loadPCDFile (scene_filename_, *scene) < 0)
{
std::cout << "Error loading scene cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
//
// Set up resolution invariance
//
if (use_cloud_resolution_)
{
float resolution = static_cast<float> (computeCloudResolution (model));
if (resolution != 0.0f)
{
model_ss_ *= resolution;
scene_ss_ *= resolution;
rf_rad_ *= resolution;
descr_rad_ *= resolution;
cg_size_ *= resolution;
}
std::cout << "Model resolution: " << resolution << std::endl;
std::cout << "Model sampling size: " << model_ss_ << std::endl;
std::cout << "Scene sampling size: " << scene_ss_ << std::endl;
std::cout << "LRF support radius: " << rf_rad_ << std::endl;
std::cout << "SHOT descriptor radius: " << descr_rad_ << std::endl;
std::cout << "Clustering bin size: " << cg_size_ << std::endl << std::endl;
}
//
// Compute Normals
//
pcl::NormalEstimationOMP<PointType, NormalType> norm_est;
norm_est.setKSearch (10);
norm_est.setInputCloud (model);
norm_est.compute (*model_normals);
norm_est.setInputCloud (scene);
norm_est.compute (*scene_normals);
//
// Downsample Clouds to Extract keypoints
//
pcl::PointCloud<int> sampled_indices;
pcl::UniformSampling<PointType> uniform_sampling;
uniform_sampling.setInputCloud (model);
uniform_sampling.setRadiusSearch (model_ss_);
uniform_sampling.compute (sampled_indices);
pcl::copyPointCloud (*model, sampled_indices.points, *model_keypoints);
std::cout << "Model total points: " << model->size () << "; Selected Keypoints: " << model_keypoints->size () << std::endl;
uniform_sampling.setInputCloud (scene);
uniform_sampling.setRadiusSearch (scene_ss_);
uniform_sampling.compute (sampled_indices);
pcl::copyPointCloud (*scene, sampled_indices.points, *scene_keypoints);
std::cout << "Scene total points: " << scene->size () << "; Selected Keypoints: " << scene_keypoints->size () << std::endl;
//
// Compute Descriptor for keypoints
//
pcl::SHOTEstimationOMP<PointType, NormalType, DescriptorType> descr_est;
descr_est.setRadiusSearch (descr_rad_);
descr_est.setInputCloud (model_keypoints);
descr_est.setInputNormals (model_normals);
descr_est.setSearchSurface (model);
descr_est.compute (*model_descriptors);
descr_est.setInputCloud (scene_keypoints);
descr_est.setInputNormals (scene_normals);
descr_est.setSearchSurface (scene);
descr_est.compute (*scene_descriptors);
//
//.........这里部分代码省略.........
开发者ID:iKrishneel,项目名称:sample_programs,代码行数:101,代码来源:correspondence_grouping.cpp
示例13: scene
void ribi::cmap::QtConceptMap::OnRequestSceneUpdate()
{
scene()->update();
}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:4,代码来源:qtconceptmap.cpp
示例14: done
GFXLib::GFXLib() : done(false) {
initialize();
scene();
render();
}
开发者ID:samowitsch,项目名称:sdl2-demos,代码行数:5,代码来源:GFXLib.cpp
示例15: Sort
void ribi::cmap::QtConceptMap::RepositionItems()
{
{
//The ray of the upcoming circle of nodes, is the larger of
//(1) half of the diagonal of the focal question (e.g. for short concepts)
//(2) calculated from the circumference by adding the nodes' length
const std::vector<QtNode *> qtnode_concepts_unsorted = Collect<QtNode>(scene());
if (qtnode_concepts_unsorted.empty()) return;
const std::vector<QtNode *> qtnode_concepts = Sort(qtnode_concepts_unsorted);
assert(!qtnode_concepts.empty());
assert(!qtnode_concepts.empty());
assert(qtnode_concepts[0]);
const QtNode * const qtcenter_node
= dynamic_cast<const QtNode *>(qtnode_concepts[0]);
assert(qtcenter_node);
assert(qtcenter_node->pos().x() > -0.5);
assert(qtcenter_node->pos().x() < 0.5);
assert(qtcenter_node->pos().y() > -0.5);
assert(qtcenter_node->pos().y() < 0.5);
const double r1
= 0.5 * ribi::cmap::GetDistance(
qtcenter_node->boundingRect().width(),
qtcenter_node->boundingRect().height());
const double r3 = 50.0;
const double r = std::max(r1,r3);
assert(r > 10.0);
const int n_nodes = qtnode_concepts.size();
for (int i = 1; i!=n_nodes; ++i) //+1 to skip center node
{
//Added +0 (instead of -1) to n_nodes, to prevent, in a setup with two concepts and
//one edge, the edge to overlap the central question
const double pi = boost::math::constants::pi<double>();
const double angle
= 2.0 * pi * boost::numeric_cast<double>(i)
/ boost::numeric_cast<double>(n_nodes - 1);
const double x = std::cos(angle) * r;
const double y = -std::sin(angle) * r;
QtNode * const qtnode = qtnode_concepts[i];
qtnode->GetNode()->SetPos(x,y);
//qtnode->setPos(x,y);
#ifndef NDEBUG
const double epsilon = 0.000001;
#endif
assert(std::abs(x - qtnode->pos().x()) < epsilon);
assert(std::abs(x - qtnode->GetNode()->GetX()) < epsilon);
assert(std::abs(x - qtnode->GetDisplayStrategy()->pos().x()) < epsilon);
assert(std::abs(y - qtnode->pos().y()) < epsilon);
assert(std::abs(y - qtnode->GetNode()->GetY()) < epsilon);
assert(std::abs(y - qtnode->GetDisplayStrategy()->pos().y()) < epsilon);
}
}
{
//Put the edge concepts in the middle of the nodes
const std::vector<QtEdge *> qtedge_concepts = Collect<QtEdge>(scene());
std::for_each(qtedge_concepts.begin(), qtedge_concepts.end(),
[](QtEdge * const qtedge)
{
const QPointF p((qtedge->GetFrom()->pos() + qtedge->GetTo()->pos()) / 2.0);
const double new_x = p.x();
const double new_y = p.y();
//qtedge->GetEdge()->SetX(new_x);
//qtedge->GetEdge()->SetY(new_y);
qtedge->GetEdge()->SetPos(new_x,new_y);
#ifndef NDEBUG
const double epsilon = 0.000001;
#endif
assert(std::abs(qtedge->pos().x() - qtedge->GetEdge()->GetX()) < epsilon);
assert(std::abs(qtedge->pos().y() - qtedge->GetEdge()->GetY()) < epsilon);
}
);
}
//Put the nodes around the focal question in their improved position
//If there is no focal node, the non-focal nodes are put around an empty spot
while (1)
{
bool done = true;
const std::vector<QtNode *> qtnodes = Sort(Collect<QtNode>(scene()));
assert(!qtnodes.empty());
assert(qtnodes[0]);
//assert(IsCenterNode(qtnodes[0]));
const std::vector<QtEdge* > qtedges = Collect<QtEdge>(scene());
//First node
//const bool is_first_node_center_node {
// boost::dynamic_pointer_cast<QtCenterNode>(qtnodes[0])
//};
const QtNode * const first_node { qtnodes[0] };
assert(first_node);
std::vector<QtRoundedEditRectItem*> nodes_and_edges;
std::copy(qtnodes.begin(),qtnodes.end(),std::back_inserter(nodes_and_edges));
std::copy(qtedges.begin(),qtedges.end(),std::back_inserter(nodes_and_edges));
//.........这里部分代码省略.........
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:101,代码来源:qtconceptmap.cpp
示例16: select_dc
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
{
struct divecomputer *dc;
if (d)
dc = select_dc(&d->dc);
if (!forceRedraw && dive == d && (d && dc == diveDC))
return;
clear();
dive = d;
diveDC = d ? dc : NULL;
if (!isVisible() || !dive) {
return;
}
// best place to put the focus stealer code.
setFocusProxy(mainWindow()->dive_list());
scene()->setSceneRect(0,0, viewport()->width()-50, viewport()->height()-50);
toolTip = new ToolTipItem();
installEventFilter(toolTip);
scene()->addItem(toolTip);
// Fix this for printing / screen later.
// plot_set_scale(scale_mode_t);
if (!dc->samples) {
dc = fake_dc(dc);
}
QString nick = get_dc_nickname(dc->model, dc->deviceid);
if (nick.isEmpty())
nick = QString(dc->model);
if (nick.isEmpty())
nick = tr("unknown divecomputer");
if ( tr("unknown divecomputer") == nick){
mode = PLAN;
}else{
mode = DIVE;
}
/*
* Set up limits that are independent of
* the dive computer
*/
calculate_max_limits(dive, dc, &gc);
QRectF profile_grid_area = scene()->sceneRect();
gc.maxx = (profile_grid_area.width() - 2 * profile_grid_area.x());
gc.maxy = (profile_grid_area.height() - 2 * profile_grid_area.y());
/* This is per-dive-computer */
gc.pi = *create_plot_info(dive, dc, &gc);
/* Bounding box */
QPen pen = defaultPen;
pen.setColor(profile_color[TIME_GRID].at(0));
QGraphicsRectItem *rect = new QGraphicsRectItem(profile_grid_area);
rect->setPen(pen);
scene()->addItem(rect);
/* Depth profile */
plot_depth_profile();
plot_events(dc);
/* Temperature profile */
plot_temperature_profile();
/* Cylinder pressure plot */
plot_cylinder_pressure(dc);
/* Text on top of all graphs.. */
plot_temperature_text();
plot_depth_text();
plot_cylinder_pressure_text();
plot_deco_text();
/* Put the dive computer name in the lower left corner */
gc.leftx = 0; gc.rightx = 1.0;
gc.topy = 0; gc.bottomy = 1.0;
text_render_options_t computer = {DC_TEXT_SIZE, TIME_TEXT, LEFT, TOP};
diveComputer = plot_text(&computer, QPointF(gc.leftx, gc.bottomy), nick);
// The Time ruler should be right after the DiveComputer:
timeMarkers->setPos(0, diveComputer->y());
if (PP_GRAPHS_ENABLED) {
plot_pp_gas_profile();
plot_pp_text();
}
//.........这里部分代码省略.........
开发者ID:kuldipem,项目名称:subsurface,代码行数:101,代码来源:profilegraphics.cpp
示例17: QGraphicsView
YigNetworkChannelView::YigNetworkChannelView(QWidget *parent) :
QGraphicsView(parent)
{
QGLFormat glFormat( QGL::SampleBuffers );
//glFormat.setSwapInterval( 1 ); // set VSync
QGLWidget* viewportGL = new QGLWidget( glFormat );
setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
setViewport(viewportGL);
setRenderHints(QPainter::Antialiasing);
setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, true);
YigGraphicsScene* yigScene = new YigGraphicsScene;
yigScene->setSceneRect(0, 0, 1920, 1200);
setScene(yigScene);
scaleFactor = 1.0;
selectionRect = new QGraphicsRectItem( QRect( 0, 0, 0, 0 ) );
selectionRect->setPen( QColor( 0, 0, 0, 200 ) );
selectionRect->setFlag(QGraphicsItem::ItemIgnoresTransformations);
//selectionRect->setBrush( QColor( 69, 139, 19, 40 ) );
QColor rectColor = YigColorKit::accent;
rectColor.setAlpha(130);
selectionRect->setBrush(rectColor);
selectionRect->setZValue( 10000 );
scene()->addItem( selectionRect );
selectionRect->hide();
//glWidget->startRendering();
mActiveBool = false;
setActiveView(mActiveBool);
currentCableBool = false;
mouseDownBool = false;
cableCounter = 0;
srand((unsigned) time(0));
/*
#ifdef __APPLE__
verticalScrollBar()->setStyle(new QMacStyle);
horizontalScrollBar()->setStyle(new QMacStyle);
#else
verticalScrollBar()->setStyle(new QGtkStyle);
horizontalScrollBar()->setStyle(new QGtkStyle);
#endif
*/
QPalette scrollPalette = verticalScrollBar()->palette();
scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
verticalScrollBar()->setPalette(scrollPalette);
scrollPalette = horizontalScrollBar()->palette();
scrollPalette.setColor(QPalette::Button, YigColorKit::focus2);
horizontalScrollBar()->setPalette(scrollPalette);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
/*
QLinearGradient gradient(0, 0, 0, parent->geometry().height());
gradient.setColorAt(0, YigColorKit::background2);
gradient.setColorAt(0.005, QColor(255, 255, 255));
gradient.setColorAt(1, QColor(190, 190, 190));
gradient.setInterpolationMode(QGradient::ColorInterpolation);
QBrush backgroundBrush(gradient);
backgroundBrush.setStyle(Qt::LinearGradientPattern);*/
//QBrush backgroundBrush(QPixmap(":/images/gui/YigAttractorBackground.png"));
//scene()->setBackgroundBrush(YigColorKit::background);
//backgroundPixmap = scene()->addPixmap(YigAttractor::renderAttractor(width(), height()));
modCableParent = new QGraphicsLineItem();
modCableParent->setZValue(-20);
modCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
//modCableParent->setVisible(false);
scene()->addItem(modCableParent);
audioCableParent = new QGraphicsLineItem();
audioCableParent->setZValue(-5);
//audioCableParent->setVisible(false);
audioCableParent->setFlag(QGraphicsItem::ItemHasNoContents, true);
scene()->addItem(audioCableParent);
/*
QObject::connect(this, SIGNAL(synthForGLAdded(int,QPointF)),
glWidget->getGLThread(), SLOT(addSynth(int,QPointF)), Qt::QueuedConnection);
QObject::connect(this, SIGNAL(synthForGLRemoved(int)), glWidget->getGLThread(), SLOT(removeSynth(int)), Qt::QueuedConnection);
QObject::connect(this, SIGNAL(synthForGLMoved(int,QPointF)),
glWidget->getGLThread(), SLOT(setSynthPos(int,QPointF)), Qt::QueuedConnection);
*/
//glWidget.lower();
//setupViewport(&glWidget);
//scene()->setBackgroundBrush(Qt::transparent);
//setAttribute(Qt::WA_TranslucentBackground);
//setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
//QPalette p = viewport()->palette();
//p.setColor(QPalette::Base, Qt::transparent);
//viewport()->setPalette(p);
//viewport()->setAutoFillBackground(false);
//parent->setAttribute(Qt::WA_TranslucentBackground);
//parent->setAutoFillBackground(false);
//setStyleSheet("background-color: transparent;");
//lower();
//.........这里部分代码省略.........
开发者ID:ChadMcKinney,项目名称:Yig,代码行数:101,代码来源:yignetworkchannelview.cpp
示例18: scene
void Line::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
scene()->sendEvent(parentItem(), event);
}
开发者ID:genuser,项目名称:freesch,代码行数:4,代码来源:line.cpp
示例19: scene
void EmulatedCardWindow::onUpdateFullWindow()
{
if (scene())
scene()->update();
}
开发者ID:Andolamin,项目名称:LunaSysMgr,代码行数:5,代码来源:EmulatedCardWindow.cpp
示例20: scene
void TextTool::mouseMoveEvent(const QList<QGraphicsItem*> & /*itemList*/,
QGraphicsSceneMouseEvent *event)
{ event->setPos(textItem()->mapFromScene(event->scenePos()));
event->setLastPos(textItem()->mapFromScene(event->lastScenePos()));
scene()->sendEvent(textItem(), event);
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:6,代码来源:texttool.cpp
注:本文中的scene函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论