本文整理汇总了C++中setView函数的典型用法代码示例。如果您正苦于以下问题:C++ setView函数的具体用法?C++ setView怎么用?C++ setView使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setView函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
//Because views are positioned by their center, I have to do funky math
void Window::scroll(sf::Keyboard::Key code)
{
//get the current position of the view
sf::Vector2f viewPos = view.getCenter();
//get the size of the viewport
sf::Vector2f viewSize = view.getSize();
switch(code)
{
//Move the view around
case sf::Keyboard::Up: //Move up
//consider x's at the top of the screen,
//we want to keep from pushing any part of the view off the world
//subtract half the screen to the x and y positions in the
//center of the screen
//we subtract because screen coords start with 0-y at the top
viewPos.y -= viewSize.y/2;
if(isOnMap((viewPos.x)/32, (viewPos.y-32)/32))
{
view.move(0, -32);
setView(view);
}
break;
case sf::Keyboard::Right: //Move right
viewPos.x += viewSize.x/2;
if(isOnMap((viewPos.x+32)/32, (viewPos.y)/32))
{
view.move(32, 0);
setView(view);
}
break;
case sf::Keyboard::Down: //Move down
viewPos.y += viewSize.y/2;
if(isOnMap((viewPos.x)/32, (viewPos.y+32)/32))
{
view.move(0, 32);
setView(view);
}
break;
case sf::Keyboard::Left: //move left
viewPos.x -= viewSize.x/2;
if(isOnMap((viewPos.x-32)/32, (viewPos.y)/32))
{
view.move(-32, 0);
setView(view);
}
break;
default:
break;
}
}
开发者ID:owenstranathan,项目名称:EmpireClassic,代码行数:53,代码来源:display.cpp
示例2: qPow
void QmlMapControl::touchEvent(QTouchEvent *evnt)
{
const QList<QTouchEvent::TouchPoint> & touchs = evnt->touchPoints();
if( touchs.count() != 2 )
{
QQuickPaintedItem::touchEvent(evnt);
}
else
{
evnt->accept();
const QTouchEvent::TouchPoint & t0 = touchs.first();
const QTouchEvent::TouchPoint & t1 = touchs.last();
if( last_t0_startPos.isNull() )
last_t0_startPos = t0.startPos();
if( last_t1_startPos.isNull() )
last_t1_startPos = t1.startPos();
qreal startW = qPow( qPow(last_t0_startPos.x()-last_t1_startPos.x(),2)+qPow(last_t0_startPos.y()-last_t1_startPos.y(),2), 0.5 );
qreal endW = qPow( qPow(t0.pos().x()-t1.pos().x(),2)+qPow(t0.pos().y()-t1.pos().y(),2), 0.5 );
if( startW*4/3<endW )
{
QPoint pnt( last_t0_startPos.x()/2+last_t1_startPos.x()/2, last_t0_startPos.y()/2+last_t1_startPos.y()/2 );
QPoint newPoint( width()-pnt.x(), height()-pnt.y() );
setView(clickToWorldCoordinate(pnt));
zoomIn(pnt);
setView(clickToWorldCoordinate(newPoint));
last_t0_startPos = t0.pos();
last_t1_startPos = t1.pos();
}
else
if( startW*3/4>endW )
{
QPoint pnt( t0.pos().x()/2+t1.pos().x()/2, t0.pos().y()/2+t1.pos().y()/2 );
QPoint newPoint( width()-pnt.x(), height()-pnt.y() );
setView(clickToWorldCoordinate(pnt));
zoomOut(pnt);
setView(clickToWorldCoordinate(newPoint));
last_t0_startPos = t0.pos();
last_t1_startPos = t1.pos();
}
}
}
开发者ID:sialan-labs,项目名称:kaqaz,代码行数:49,代码来源:qmlmapcontrol.cpp
示例3: keyboard
void keyboard( unsigned char key, int x, int y )
{
switch( key )
{
case 'i':
case 'I':
cameraR -= 0.5;
if( cameraR < 0.5 )
{
cameraR = 0.5;
}
break;
case 'o':
case 'O':
cameraR += 0.5;
break;
case 'a':
case 'A':
--lookAt.z;
break;
case 's':
case 'S':
++lookAt.z;
break;
case 'r':
case 'R':
rebuildTree();
sendData();
setView();
break;
case 'w':
case 'W':
wireFrame = !wireFrame;
glPolygonMode( GL_FRONT_AND_BACK, wireFrame ? GL_LINE : GL_FILL );
break;
case 033: // ESC
case 'q':
case 'Q':
exit( EXIT_SUCCESS );
}
setView();
glutPostRedisplay();
}
开发者ID:blaws,项目名称:Tree,代码行数:48,代码来源:tree.cpp
示例4: Entity
Player::Player(TileMapLand* land)
: Entity()
, hitEnemy(false)
, m_sprite_view(new AnimatedSpriteView(*this,"Animation/player.txt"))
, m_plateforme_physics(new PlateformerPhysic(*this,land))
{
name = "Player";
setBody(new Body(*this));
body()->setSize(sf::Vector2f(16,16));
body()->setOrigin(sf::Vector2f(8,8));
body()->setPosition(sf::Vector2f(38,38));
setPhysics(m_plateforme_physics);
m_plateforme_physics->gravity = sf::Vector2f(0,0.3);
m_plateforme_physics->max_speed = sf::Vector2f(2.0,8.0);
m_plateforme_physics->jump_power = 8.0;
m_plateforme_physics->walk_speed = 2.0;
m_plateforme_physics->run_speed = 3.0;
m_plateforme_physics->walk_deceleration = 0.3;
setGamepad(new KeyBoardGamePad(*this));
setView(m_sprite_view);
}
开发者ID:Canadadry,项目名称:TileGameV2,代码行数:27,代码来源:Player.cpp
示例5: tr
void MainWindow::openBS()
{
QString path = QFileDialog::getOpenFileName( this, tr("Open File"), "D:\\Project\\Qt_Creator\\DataBase_0.6", tr("*.sqlite") );
if( path != "" )
{
closeBS();
base = QSqlDatabase::addDatabase("QSQLITE");
base.setDatabaseName(path);
if( base.open() )
qDebug() << "Open successful";
else
{
qDebug() << "Open falied";
return;
}
model = new SqlTableModel;
model->setTable("my_table");
model->select();
model->setEditStrategy(QSqlTableModel::OnFieldChange);
setView();
this->setWindowTitle(path);
}
}
开发者ID:Chester94,项目名称:DataBase_People,代码行数:30,代码来源:mainwindow.cpp
示例6: QComboBox
VNotebookSelector::VNotebookSelector(QWidget *p_parent)
: QComboBox(p_parent),
VNavigationMode(),
m_notebooks(g_vnote->getNotebooks()),
m_lastValidIndex(-1),
m_muted(false),
m_naviLabel(NULL)
{
m_listWidget = new QListWidget(this);
m_listWidget->setItemDelegate(new VNoFocusItemDelegate(this));
m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_listWidget, &QListWidget::customContextMenuRequested,
this, &VNotebookSelector::popupListContextMenuRequested);
setModel(m_listWidget->model());
setView(m_listWidget);
m_listWidget->viewport()->installEventFilter(this);
m_listWidget->installEventFilter(this);
initActions();
connect(this, SIGNAL(currentIndexChanged(int)),
this, SLOT(handleCurIndexChanged(int)));
}
开发者ID:liunianbanbo,项目名称:vnote,代码行数:25,代码来源:vnotebookselector.cpp
示例7: UT_return_if_fail
void AP_Win32Dialog_Styles::runModal(XAP_Frame * pFrame)
{
UT_return_if_fail (pFrame);
//
// Get View and Document pointers. Place them in member variables
//
setFrame(pFrame);
setView((FV_View *) pFrame->getCurrentView());
UT_return_if_fail (getView());
setDoc(getView()->getLayout()->getDocument());
UT_return_if_fail (getDoc());
// raise the dialog
_win32Dialog.runModal(pFrame, AP_DIALOG_ID_STYLES, AP_RID_DIALOG_STYLES_TOP, this);
if (m_answer == AP_Dialog_Styles::a_OK)
{
const char* szStyle = getCurrentStyle();
if (szStyle)
{
getDoc()->updateDocForStyleChange(szStyle, true);
getView()->getCurrentBlock()->setNeedsRedraw();
getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
}
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:31,代码来源:ap_Win32Dialog_Styles.cpp
示例8: QComboBox
ActionComboBoxWidget::ActionComboBoxWidget(QWidget *parent) : QComboBox(parent),
m_view(new ItemViewWidget(this)),
m_filterLineEdit(NULL),
m_wasPopupVisible(false)
{
setEditable(true);
setView(m_view);
setItemDelegate(new ItemDelegate(this));
m_view->setHeaderHidden(true);
lineEdit()->hide();
view()->viewport()->parentWidget()->installEventFilter(this);
QStandardItemModel *model = new QStandardItemModel(this);
const QVector<ActionDefinition> definitions = ActionsManager::getActionDefinitions();
for (int i = 0; i < definitions.count(); ++i)
{
QStandardItem *item = new QStandardItem(definitions.at(i).icon, QCoreApplication::translate("actions", (definitions.at(i).description.isEmpty() ? definitions.at(i).text : definitions.at(i).description).toUtf8().constData()));
item->setData(definitions.at(i).identifier, Qt::UserRole);
item->setToolTip(ActionsManager::getActionName(definitions.at(i).identifier));
item->setFlags(item->flags() | Qt::ItemNeverHasChildren);
model->appendRow(item);
}
setModel(model);
setCurrentIndex(-1);
}
开发者ID:insionng,项目名称:otter-browser,代码行数:31,代码来源:ActionComboBoxWidget.cpp
示例9: CompositeListView
TileView::TileView(const std::list<std::string> & columns, IDelegateFactory * delegateFactory, QWidget * parent)
: CompositeListView(parent), m_listview(0), m_sorter(0)
{
if (! delegateFactory)
throw std::runtime_error("TileView requires a Custom Tile Delegate");
m_listview = new QListView(this);
m_listview->setUniformItemSizes(true);
m_listview->setItemDelegate(delegateFactory->create());
m_listview->setResizeMode(QListView::Adjust);
m_listview->setSelectionBehavior(QAbstractItemView::SelectRows);
m_listview->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_listview->setSpacing(16);
m_listview->setViewMode(QListView::IconMode);
setView(m_listview);
m_sorter = new TileViewSorter(columns, this);
connect(m_sorter, SIGNAL(sortChanged(int, Qt::SortOrder)), this, SLOT(onSortChanged(int, Qt::SortOrder)));
QVBoxLayout * vbox = new QVBoxLayout;
vbox->setContentsMargins(0, 0, 0, 0);
vbox->setSpacing(0);
vbox->addWidget(m_listview);
vbox->addWidget(m_sorter);
setLayout(vbox);
}
开发者ID:asymworks,项目名称:benthos-app,代码行数:28,代码来源:tileview.cpp
示例10: setView
void QgsDualView::setMultiEditEnabled( bool enabled )
{
if ( enabled )
setView( AttributeEditor );
mAttributeForm->setMode( enabled ? QgsAttributeEditorContext::MultiEditMode : QgsAttributeEditorContext::SingleEditMode );
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:7,代码来源:qgsdualview.cpp
示例11: setupData
void setupData()
{
// build tree
rebuildTree();
// matrices
setView();
// create shader program
GLuint sProgram = InitShader( "vert.glsl", "frag.glsl" );
// object buffer
glGenBuffers( 1, &objectBuffer );
glBindBuffer( GL_ARRAY_BUFFER, objectBuffer );
// vertices
vertLoc = glGetAttribLocation( sProgram, "a_vPosition" );
// indices
glGenBuffers( 1, &indexBuffer );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, indexBuffer );
// texture coordinates
//texCoordLoc = glGetAttribLocation( sProgram, "a_vTexCoord" );
// normals
normalLoc = glGetAttribLocation( sProgram, "a_vNormal" );
// buffer to GPU
sendData();
}
开发者ID:blaws,项目名称:Tree,代码行数:31,代码来源:tree.cpp
示例12: mouseMove
void mouseMove( int x, int y )
{
int dx = mouseX - x;
int dy = y - mouseY;
thetaXY += dx / static_cast<float>( windowW / 2 );
thetaZ += dy / static_cast<float>( windowH / 2 );
if( thetaXY >= 2.0 * M_PI )
{
thetaXY -= 2.0 * M_PI;
}
else if( thetaXY < 0.0 )
{
thetaXY += 2.0 * M_PI;
}
if( thetaZ < -0.5 * M_PI + 0.01 )
{
thetaZ = -0.5 * M_PI + 0.01;
}
else if( thetaZ > 0.5 * M_PI - 0.01 )
{
thetaZ = 0.5 * M_PI - 0.01;
}
setView();
mouseX = x;
mouseY = y;
glutPostRedisplay();
}
开发者ID:blaws,项目名称:Tree,代码行数:32,代码来源:tree.cpp
示例13: setView
Ti::TiView *Ti::TiViewProxy::getView()
{
if(view == NULL) {
setView(new Ti::TiView(this));
}
return view;
}
开发者ID:Buder,项目名称:titanium_mobile_blackberry,代码行数:7,代码来源:Ti_ViewProxy.cpp
示例14: ASSERT
void LocalFrame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent)
{
ASSERT(this);
setView(nullptr);
RefPtr<FrameView> frameView;
frameView = FrameView::create(this, viewportSize);
// The layout size is set by WebViewImpl to support @viewport
frameView->setLayoutSizeFixedToFrameSize(false);
setView(frameView);
frameView->updateBackgroundRecursively(backgroundColor, transparent);
}
开发者ID:takaaptech,项目名称:sky_engine,代码行数:16,代码来源:LocalFrame.cpp
示例15: createPropertySetterGetter
TiUIWebViewProxy::TiUIWebViewProxy(const char* name) : Ti::TiViewProxy(name)
{
createPropertySetterGetter("data", _setData, _getData);
createPropertySetterGetter("disableBounce", _setDisableBounce, _getDisableBounce);
createPropertySetterGetter("hideLoadIndicator", _setHideLoadIndicator, _getHideLoadIndicator);
createPropertySetterGetter("html", _setHtml, _getHtml);
createPropertySetterGetter("ignoreSslError", _setIgnoreSslError, _getIgnoreSslError);
createPropertySetterGetter("loading", _setLoading, _getLoading);
createPropertySetterGetter("overScrollMode", _setOverScrollMode, _getOverScrollMode);
createPropertySetterGetter("pluginState", _setPluginState, _getPluginState);
createPropertySetterGetter("scrollsToTop", _setScrollsToTop, _getScrollsToTop);
createPropertySetterGetter("showScrollbars", _setShowScrollbars, _getShowScrollbars);
createPropertySetterGetter("enableZoomControls", _setEnableZoomControls, _getEnableZoomControls);
createPropertySetterGetter("scalesPageToFit", _setScalesPageToFit, _getScalesPageToFit);
createPropertySetterGetter("url", _setUrl, _getUrl);
createPropertySetterGetter("userAgent", _setUserAgent, _getUserAgent);
createPropertySetterGetter("willHandleTouches", _setWillHandleTouches, _getWillHandleTouches);
createPropertyFunction("canGoBack", _canGoBack);
createPropertyFunction("canGoForward", _canGoForward);
createPropertyFunction("evalJS", _evalJS);
createPropertyFunction("goBack", _goBack);
createPropertyFunction("goForward", _goForward);
createPropertyFunction("pause", _pause);
createPropertyFunction("reload", _reload);
createPropertyFunction("repaint", _repaint);
createPropertyFunction("release", _release);
createPropertyFunction("resume", _resume);
createPropertyFunction("setBasicAuthentication", _setBasicAuthentication);
createPropertyFunction("stopLoading", _stopLoading);
_tiWebView = new UIWebView(this);
setView(_tiWebView);
webViews_.append(this);
}
开发者ID:Buder,项目名称:titanium_mobile_blackberry,代码行数:35,代码来源:TiUIWebViewProxy.cpp
示例16: KTopLevelWidget
Game::Game() : KTopLevelWidget()
{
setCaption( kapp->getCaption() );
setIcon(klocale->translate("Snake Race"));
conf = kapp->getConfig();
if(conf == NULL) {
printf(klocale->translate("KConfig error ??\n"));
kapp->quit();
}
levels = new Levels();
score = new Score;
menu();
checkMenuItems();
View *view = new View(this);
rattler = view->rattler;
rattler->setFocus();
connect(rattler, SIGNAL(setPoints(int)), view->lcd, SLOT(display(int)));
connect(rattler, SIGNAL(setTrys(int)), view->trys, SLOT(set(int)));
connect(rattler, SIGNAL(rewind()), view->pg, SLOT(rewind()));
connect(rattler, SIGNAL(advance()), view->pg, SLOT(advance()));
connect(view->pg, SIGNAL(restart()), rattler, SLOT(restartTimer()));
connect(rattler, SIGNAL(togglePaused()), this, SLOT(togglePaused()));
connect(rattler, SIGNAL(setScore(int)), score, SLOT(setScore(int)));
menubar->show();
setMenu(menubar);
view->show();
setView(view);
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:35,代码来源:game.cpp
示例17: QTreeView
void KMyMoneyAccountCombo::setModel(QAbstractItemModel *model)
{
delete d->m_popupView;
KComboBox::setModel(model);
AccountNamesFilterProxyModel* filterModel = qobject_cast<AccountNamesFilterProxyModel*>(model);
if(filterModel) {
filterModel->setFilterKeyColumn(AccountsModel::Account);
filterModel->setFilterRole(AccountsModel::FullNameRole);
}
d->m_popupView = new QTreeView(this);
d->m_popupView->setSelectionMode(QAbstractItemView::SingleSelection);
setView(d->m_popupView);
d->m_popupView->installEventFilter(this);
d->m_popupView->setHeaderHidden(true);
d->m_popupView->setRootIsDecorated(false);
d->m_popupView->setAlternatingRowColors(true);
d->m_popupView->setAnimated(true);
d->m_popupView->expandAll();
connect(this, SIGNAL(activated(int)), SLOT(activated()));
connect(d->m_popupView, SIGNAL(activated(QModelIndex)), this, SLOT(selectItem(QModelIndex)));
connect(d->m_popupView, SIGNAL(pressed(QModelIndex)), this, SLOT(selectItem(QModelIndex)));
if(isEditable()) {
connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(makeCompletion(QString)));
}
}
开发者ID:KDE,项目名称:kmymoney,代码行数:33,代码来源:kmymoneyaccountcombo.cpp
示例18: new
void PWS::show(){
if(createdUI == FALSE){
QPopupMenu *file_menu = new("QPopupMenu") QPopupMenu();
file_menu->insertItem(i18n("E&xit"), kapp, SLOT(quit()));
QPopupMenu *help_menu = new("QPopupMenu") QPopupMenu();
help_menu->insertItem(i18n("&Help"), this, SLOT(invokeHelp()));
// menuBar = new("KMenuBar") KMenuBar(this, "menubar");
// menuBar->insertItem(i18n("&File"), file_menu);
// menuBar->insertItem(i18n("&Help"), help_menu);
// setMenu(menuBar);
// toolBar = new("KToolBar") KToolBar(this);
// addToolBar(toolBar);
// statusBar = new("KStatusBar") KStatusBar(this);
// setStatusBar(statusBar);
// resize(600,440);
view = new("PWSWidget") PWSWidget(this);
setView(view);
connect(view, SIGNAL(quitPressed(QObject *)),
this, SLOT(closeView(QObject *)));
createdUI = TRUE;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:29,代码来源:pws.cpp
示例19: KTopLevelWidget
servercontroller::servercontroller /*FOLD00*/
(
QWidget*,
const char* name
)
:
KTopLevelWidget( name )
{
MenuBar = new("KMenuBar") KMenuBar(this, QString(name) + "_menu");
setMenu(MenuBar);
if(kSircConfig->DisplayMode == 0){
SDI:
displayMgr = new("DisplayMgrSDI") DisplayMgrSDI();
sci = new("scInside") scInside(this, QString(name) + "_mainview");
setView(sci, TRUE);
}
else if(kSircConfig->DisplayMode == 1){
DisplayMgrMDI *displayMgrMDI = new("DisplayMgrMDI") DisplayMgrMDI(this);
sci = new("scInside") scInside(this, QString(name) + "_mainview");
displayMgrMDI->newTopLevel(sci, TRUE);
displayMgrMDI->setCaption(sci, "Server Controller");
KMDIMgrBase *mgr = (KMDIMgrBase *)displayMgrMDI->getMGR();
KMDIWindow *km = mgr->getWindowByName((char *) sci->name());
if(km != 0)
connect(km, SIGNAL(minimized(KMDIWindow *)),
this, SLOT(MDIMinimized(KMDIWindow *)));
else
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:31,代码来源:servercontroller.cpp
示例20: glCheck
void RenderTarget::resetGLStates()
{
if (activate(true))
{
// Make sure that GLEW is initialized
priv::ensureGlewInit();
// Define the default OpenGL states
glCheck(glDisable(GL_CULL_FACE));
glCheck(glDisable(GL_LIGHTING));
glCheck(glDisable(GL_DEPTH_TEST));
glCheck(glDisable(GL_ALPHA_TEST));
glCheck(glEnable(GL_TEXTURE_2D));
glCheck(glEnable(GL_BLEND));
glCheck(glMatrixMode(GL_MODELVIEW));
glCheck(glEnableClientState(GL_VERTEX_ARRAY));
glCheck(glEnableClientState(GL_COLOR_ARRAY));
glCheck(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
m_cache.glStatesSet = true;
// Apply the default SFML states
applyBlendMode(BlendAlpha);
applyTransform(Transform::Identity);
applyTexture(NULL);
if (Shader::isAvailable())
applyShader(NULL);
m_cache.useVertexCache = false;
// Set the default view
setView(getView());
}
}
开发者ID:jadub5,项目名称:SFML,代码行数:32,代码来源:RenderTarget.cpp
注:本文中的setView函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论