Changeset 561 for trunk/demos/boxes/qtbox.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/demos/boxes/qtbox.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 123 123 124 124 foreach (QGraphicsItem *item, selected) { 125 ItemBase *itemBase = dynamic_cast<ItemBase *>(item);125 ItemBase *itemBase = _cast<ItemBase *>(item); 126 126 if (itemBase) 127 127 scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y())); … … 138 138 139 139 foreach (QGraphicsItem *item, selected) { 140 ItemBase *itemBase = dynamic_cast<ItemBase *>(item);140 ItemBase *itemBase = _cast<ItemBase *>(item); 141 141 if (itemBase) 142 142 delete itemBase; … … 153 153 154 154 foreach (QGraphicsItem *item, selected) { 155 ItemBase *itemBase = dynamic_cast<ItemBase *>(item);155 ItemBase *itemBase = _cast<ItemBase *>(item); 156 156 if (itemBase) { 157 157 itemBase->prepareGeometryChange(); … … 172 172 173 173 foreach (QGraphicsItem *item, selected) { 174 ItemBase *itemBase = dynamic_cast<ItemBase *>(item);174 ItemBase *itemBase = _cast<ItemBase *>(item); 175 175 if (itemBase) { 176 176 itemBase->prepareGeometryChange(); … … 258 258 } 259 259 260 261 262 263 264 265 260 266 bool ItemBase::isInResizeArea(const QPointF &pos) 261 267 { … … 270 276 { 271 277 for (int i = 0; i < 8; ++i) { 272 m_vertices[i] [0] =(i & 1 ? 0.5f : -0.5f);273 m_vertices[i] [1] =(i & 2 ? 0.5f : -0.5f);274 m_vertices[i] [2] =(i & 4 ? 0.5f : -0.5f);278 m_vertices[i](i & 1 ? 0.5f : -0.5f); 279 m_vertices[i](i & 2 ? 0.5f : -0.5f); 280 m_vertices[i](i & 4 ? 0.5f : -0.5f); 275 281 } 276 282 for (int i = 0; i < 4; ++i) { 277 m_texCoords[i][0] = (i & 1 ? 1.0f : 0.0f); 278 m_texCoords[i][1] = (i & 2 ? 1.0f : 0.0f); 279 } 280 memset(m_normals, 0, sizeof(m_normals)); 281 for (int i = 0; i < 3; ++i) { 282 m_normals[2 * i + 0][i] = -1.0f; 283 m_normals[2 * i + 1][i] = 1.0f; 284 } 283 m_texCoords[i].setX(i & 1 ? 1.0f : 0.0f); 284 m_texCoords[i].setY(i & 2 ? 1.0f : 0.0f); 285 } 286 m_normals[0] = QVector3D(-1.0f, 0.0f, 0.0f); 287 m_normals[1] = QVector3D(1.0f, 0.0f, 0.0f); 288 m_normals[2] = QVector3D(0.0f, -1.0f, 0.0f); 289 m_normals[3] = QVector3D(0.0f, 1.0f, 0.0f); 290 m_normals[4] = QVector3D(0.0f, 0.0f, -1.0f); 291 m_normals[5] = QVector3D(0.0f, 0.0f, 1.0f); 285 292 } 286 293 … … 313 320 }; 314 321 322 323 315 324 glMatrixMode(GL_PROJECTION); 316 325 glPushMatrix(); … … 352 361 353 362 glBegin(GL_TRIANGLE_STRIP); 354 glNormal3fv( m_normals[2 * dir + 0].bits());363 glNormal3fv()); 355 364 for (int i = 0; i < 2; ++i) { 356 365 for (int j = 0; j < 2; ++j) { 357 glTexCoord2fv( m_texCoords[(j << 1) | i].bits());358 glVertex3fv( m_vertices[(i << ((dir + 2) % 3)) | (j << ((dir + 1) % 3))].bits());366 glTexCoord2fv()); 367 glVertex3fv()); 359 368 } 360 369 } … … 362 371 363 372 glBegin(GL_TRIANGLE_STRIP); 364 glNormal3fv( m_normals[2 * dir + 1].bits());373 glNormal3fv()); 365 374 for (int i = 0; i < 2; ++i) { 366 375 for (int j = 0; j < 2; ++j) { 367 glTexCoord2fv( m_texCoords[(j << 1) | i].bits());368 glVertex3fv( m_vertices[(1 << dir) | (i << ((dir + 1) % 3)) | (j << ((dir + 2) % 3))].bits());376 glTexCoord2fv()); 377 glVertex3fv()); 369 378 } 370 379 } … … 385 394 glMatrixMode(GL_PROJECTION); 386 395 glPopMatrix(); 396 397 387 398 388 399 ItemBase::paint(painter, option, widget);
Note:
See TracChangeset
for help on using the changeset viewer.