Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/shared/qtpropertybrowser/qtpropertymanager.cpp

    r651 r769  
    13921392
    13931393// QtBoolPropertyManager
    1394 
    1395 class QtBoolPropertyManagerPrivate
    1396 {
    1397     QtBoolPropertyManager *q_ptr;
    1398     Q_DECLARE_PUBLIC(QtBoolPropertyManager)
    1399 public:
    1400 
    1401     QMap<const QtProperty *, bool> m_values;
    1402 };
    1403 
    1404 /*!
    1405     \class QtBoolPropertyManager
    1406     \internal
    1407     \inmodule QtDesigner
    1408     \since 4.4
    1409 
    1410     \brief The QtBoolPropertyManager class provides and manages boolean properties.
    1411 
    1412     The property's value can be retrieved using the value() function,
    1413     and set using the setValue() slot.
    1414 
    1415     In addition, QtBoolPropertyManager provides the valueChanged() signal
    1416     which is emitted whenever a property created by this manager
    1417     changes.
    1418 
    1419     \sa QtAbstractPropertyManager, QtCheckBoxFactory
    1420 */
    1421 
    1422 /*!
    1423     \fn void QtBoolPropertyManager::valueChanged(QtProperty *property, bool value)
    1424 
    1425     This signal is emitted whenever a property created by this manager
    1426     changes its value, passing a pointer to the \a property and the
    1427     new \a value as parameters.
    1428 */
    1429 
    1430 /*!
    1431     Creates a manager with the given \a parent.
    1432 */
    1433 QtBoolPropertyManager::QtBoolPropertyManager(QObject *parent)
    1434     : QtAbstractPropertyManager(parent), d_ptr(new QtBoolPropertyManagerPrivate)
    1435 {
    1436     d_ptr->q_ptr = this;
    1437 }
    1438 
    1439 /*!
    1440     Destroys this manager, and all the properties it has created.
    1441 */
    1442 QtBoolPropertyManager::~QtBoolPropertyManager()
    1443 {
    1444     clear();
    1445 }
    1446 
    1447 /*!
    1448     Returns the given \a property's value.
    1449 
    1450     If the given \a property is not managed by \e this manager, this
    1451     function returns false.
    1452 
    1453     \sa setValue()
    1454 */
    1455 bool QtBoolPropertyManager::value(const QtProperty *property) const
    1456 {
    1457     return d_ptr->m_values.value(property, false);
    1458 }
    1459 
    1460 /*!
    1461     \reimp
    1462 */
    1463 QString QtBoolPropertyManager::valueText(const QtProperty *property) const
    1464 {
    1465     const QMap<const QtProperty *, bool>::const_iterator it = d_ptr->m_values.constFind(property);
    1466     if (it == d_ptr->m_values.constEnd())
    1467         return QString();
    1468 
    1469     static const QString trueText = tr("True");
    1470     static const QString falseText = tr("False");
    1471     return it.value() ? trueText : falseText;
    1472 }
    1473 
    1474 // Return an icon containing a check box indicator
     1394//     Return an icon containing a check box indicator
    14751395static QIcon drawCheckBox(bool value)
    14761396{
     
    15021422}
    15031423
     1424class QtBoolPropertyManagerPrivate
     1425{
     1426    QtBoolPropertyManager *q_ptr;
     1427    Q_DECLARE_PUBLIC(QtBoolPropertyManager)
     1428public:
     1429    QtBoolPropertyManagerPrivate();
     1430
     1431    QMap<const QtProperty *, bool> m_values;
     1432    const QIcon m_checkedIcon;
     1433    const QIcon m_uncheckedIcon;
     1434};
     1435
     1436QtBoolPropertyManagerPrivate::QtBoolPropertyManagerPrivate() :
     1437    m_checkedIcon(drawCheckBox(true)),
     1438    m_uncheckedIcon(drawCheckBox(false))
     1439{
     1440}
     1441
     1442/*!
     1443    \class QtBoolPropertyManager
     1444    \internal
     1445    \inmodule QtDesigner
     1446    \since 4.4
     1447
     1448    \brief The QtBoolPropertyManager class provides and manages boolean properties.
     1449
     1450    The property's value can be retrieved using the value() function,
     1451    and set using the setValue() slot.
     1452
     1453    In addition, QtBoolPropertyManager provides the valueChanged() signal
     1454    which is emitted whenever a property created by this manager
     1455    changes.
     1456
     1457    \sa QtAbstractPropertyManager, QtCheckBoxFactory
     1458*/
     1459
     1460/*!
     1461    \fn void QtBoolPropertyManager::valueChanged(QtProperty *property, bool value)
     1462
     1463    This signal is emitted whenever a property created by this manager
     1464    changes its value, passing a pointer to the \a property and the
     1465    new \a value as parameters.
     1466*/
     1467
     1468/*!
     1469    Creates a manager with the given \a parent.
     1470*/
     1471QtBoolPropertyManager::QtBoolPropertyManager(QObject *parent)
     1472    : QtAbstractPropertyManager(parent), d_ptr(new QtBoolPropertyManagerPrivate)
     1473{
     1474    d_ptr->q_ptr = this;
     1475}
     1476
     1477/*!
     1478    Destroys this manager, and all the properties it has created.
     1479*/
     1480QtBoolPropertyManager::~QtBoolPropertyManager()
     1481{
     1482    clear();
     1483}
     1484
     1485/*!
     1486    Returns the given \a property's value.
     1487
     1488    If the given \a property is not managed by \e this manager, this
     1489    function returns false.
     1490
     1491    \sa setValue()
     1492*/
     1493bool QtBoolPropertyManager::value(const QtProperty *property) const
     1494{
     1495    return d_ptr->m_values.value(property, false);
     1496}
     1497
     1498/*!
     1499    \reimp
     1500*/
     1501QString QtBoolPropertyManager::valueText(const QtProperty *property) const
     1502{
     1503    const QMap<const QtProperty *, bool>::const_iterator it = d_ptr->m_values.constFind(property);
     1504    if (it == d_ptr->m_values.constEnd())
     1505        return QString();
     1506
     1507    static const QString trueText = tr("True");
     1508    static const QString falseText = tr("False");
     1509    return it.value() ? trueText : falseText;
     1510}
     1511
    15041512/*!
    15051513    \reimp
     
    15111519        return QIcon();
    15121520
    1513     static const QIcon checkedIcon = drawCheckBox(true);
    1514     static const QIcon uncheckedIcon = drawCheckBox(false);
    1515     return it.value() ? checkedIcon : uncheckedIcon;
     1521    return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon;
    15161522}
    15171523
     
    62886294// QtCursorPropertyManager
    62896295
    6290 Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase)
     6296// Make sure icons are removed as soon as QApplication is destroyed, otherwise,
     6297// handles are leaked on X11.
     6298static void clearCursorDatabase();
     6299Q_GLOBAL_STATIC_WITH_INITIALIZER(QtCursorDatabase, cursorDatabase, qAddPostRoutine(clearCursorDatabase))
     6300
     6301static void clearCursorDatabase()
     6302{
     6303    cursorDatabase()->clear();
     6304}
    62916305
    62926306class QtCursorPropertyManagerPrivate
Note: See TracChangeset for help on using the changeset viewer.