tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Designer of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    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 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "q3toolbar_extrainfo.h"
       
    43 
       
    44 #include <QtDesigner/QDesignerIconCacheInterface>
       
    45 #include <QtDesigner/QDesignerFormEditorInterface>
       
    46 #include <QtDesigner/private/ui4_p.h>
       
    47 
       
    48 #include <Qt3Support/Q3ToolBar>
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me
       
    53 {
       
    54     QHash<QString, DomProperty *> map;
       
    55 
       
    56     for (int i=0; i<properties.size(); ++i) {
       
    57         DomProperty *p = properties.at(i);
       
    58         map.insert(p->attributeName(), p);
       
    59     }
       
    60 
       
    61     return map;
       
    62 }
       
    63 
       
    64 Q3ToolBarExtraInfo::Q3ToolBarExtraInfo(Q3ToolBar *widget, QDesignerFormEditorInterface *core, QObject *parent)
       
    65     : QObject(parent), m_widget(widget), m_core(core)
       
    66 {}
       
    67 
       
    68 QWidget *Q3ToolBarExtraInfo::widget() const
       
    69 { return m_widget; }
       
    70 
       
    71 QDesignerFormEditorInterface *Q3ToolBarExtraInfo::core() const
       
    72 { return m_core; }
       
    73 
       
    74 bool Q3ToolBarExtraInfo::saveUiExtraInfo(DomUI *ui)
       
    75 { Q_UNUSED(ui); return false; }
       
    76 
       
    77 bool Q3ToolBarExtraInfo::loadUiExtraInfo(DomUI *ui)
       
    78 { Q_UNUSED(ui); return false; }
       
    79 
       
    80 
       
    81 bool Q3ToolBarExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
       
    82 {
       
    83     Q_UNUSED(ui_widget);
       
    84     return true;
       
    85 }
       
    86 
       
    87 bool Q3ToolBarExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget)
       
    88 {
       
    89     Q_UNUSED(ui_widget);
       
    90     return true;
       
    91 }
       
    92 
       
    93 Q3ToolBarExtraInfoFactory::Q3ToolBarExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent)
       
    94     : QExtensionFactory(parent), m_core(core)
       
    95 {}
       
    96 
       
    97 QObject *Q3ToolBarExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
       
    98 {
       
    99     if (iid != Q_TYPEID(QDesignerExtraInfoExtension))
       
   100         return 0;
       
   101 
       
   102     if (Q3ToolBar *w = qobject_cast<Q3ToolBar*>(object))
       
   103         return new Q3ToolBarExtraInfo(w, m_core, parent);
       
   104 
       
   105     return 0;
       
   106 }
       
   107 
       
   108 QT_END_NAMESPACE