Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/boxes/qtbox.cpp

    r2 r561  
    22**
    33** 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])
    56**
    67** This file is part of the demonstration applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    123123
    124124    foreach (QGraphicsItem *item, selected) {
    125         ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
     125        ItemBase *itemBase = _cast<ItemBase *>(item);
    126126        if (itemBase)
    127127            scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y()));
     
    138138
    139139    foreach (QGraphicsItem *item, selected) {
    140         ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
     140        ItemBase *itemBase = _cast<ItemBase *>(item);
    141141        if (itemBase)
    142142            delete itemBase;
     
    153153
    154154    foreach (QGraphicsItem *item, selected) {
    155         ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
     155        ItemBase *itemBase = _cast<ItemBase *>(item);
    156156        if (itemBase) {
    157157            itemBase->prepareGeometryChange();
     
    172172
    173173    foreach (QGraphicsItem *item, selected) {
    174         ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
     174        ItemBase *itemBase = _cast<ItemBase *>(item);
    175175        if (itemBase) {
    176176            itemBase->prepareGeometryChange();
     
    258258}
    259259
     260
     261
     262
     263
     264
     265
    260266bool ItemBase::isInResizeArea(const QPointF &pos)
    261267{
     
    270276{
    271277    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);
    275281    }
    276282    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);
    285292}
    286293
     
    313320    };
    314321
     322
     323
    315324    glMatrixMode(GL_PROJECTION);
    316325    glPushMatrix();
     
    352361
    353362        glBegin(GL_TRIANGLE_STRIP);
    354         glNormal3fv(m_normals[2 * dir + 0].bits());
     363        glNormal3fv());
    355364        for (int i = 0; i < 2; ++i) {
    356365            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());
    359368            }
    360369        }
     
    362371
    363372        glBegin(GL_TRIANGLE_STRIP);
    364         glNormal3fv(m_normals[2 * dir + 1].bits());
     373        glNormal3fv());
    365374        for (int i = 0; i < 2; ++i) {
    366375            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());
    369378            }
    370379        }
     
    385394    glMatrixMode(GL_PROJECTION);
    386395    glPopMatrix();
     396
     397
    387398
    388399    ItemBase::paint(painter, option, widget);
Note: See TracChangeset for help on using the changeset viewer.