diff options
author | Boris Moiseev <cyberbobs@gmail.com> | 2010-10-06 15:51:30 +0200 |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-10-06 15:51:30 +0200 |
commit | 0ece9b7f45e2cda9dfeb8dbab9b51ad39433c07e (patch) | |
tree | 58d8018b25fab948ac421bea08e82b05828e5f65 /tools/qtconfig | |
parent | 9754c200aa325614e05e6b00e3adedbdda1d161a (diff) | |
download | qt4-tools-0ece9b7f45e2cda9dfeb8dbab9b51ad39433c07e.tar.gz |
Refactored PreviewWidget in qtconfig
Removed the legacy code and behavior. Now this part of qtconfig doesn't
need the qt3support module to be built.
Merge-request: 2286
Reviewed-by: Benjamin Poulain <benjamin.poulain@nokia.com>
Diffstat (limited to 'tools/qtconfig')
-rw-r--r-- | tools/qtconfig/main.cpp | 1 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.cpp | 15 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.h | 12 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.ui | 268 | ||||
-rw-r--r-- | tools/qtconfig/previewwidgetbase.cpp | 88 | ||||
-rw-r--r-- | tools/qtconfig/previewwidgetbase.h | 68 | ||||
-rw-r--r-- | tools/qtconfig/previewwidgetbase.ui | 340 | ||||
-rw-r--r-- | tools/qtconfig/qtconfig.pro | 6 |
8 files changed, 285 insertions, 513 deletions
diff --git a/tools/qtconfig/main.cpp b/tools/qtconfig/main.cpp index 928cf01ded..47b099467c 100644 --- a/tools/qtconfig/main.cpp +++ b/tools/qtconfig/main.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "ui_previewwidgetbase.h" #include "mainwindow.h" #include <QApplication> #include <QLibraryInfo> diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp index 757b4480e8..9fa959117f 100644 --- a/tools/qtconfig/previewwidget.cpp +++ b/tools/qtconfig/previewwidget.cpp @@ -44,15 +44,16 @@ QT_BEGIN_NAMESPACE -PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) - : PreviewWidgetBase( parent, name ) +PreviewWidget::PreviewWidget(QWidget *parent) + : QWidget(parent) { + setupUi(this); + // install event filter on child widgets - QObjectList l = queryList("QWidget"); - for (int i = 0; i < l.size(); ++i) { - QObject * obj = l.at(i); - obj->installEventFilter(this); - ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus); + QList<QWidget*> l = findChildren<QWidget*>(); + foreach(QWidget* w, l) { + w->installEventFilter(this); + w->setFocusPolicy(Qt::NoFocus); } } diff --git a/tools/qtconfig/previewwidget.h b/tools/qtconfig/previewwidget.h index 37e9cba8a7..ee5ae02c90 100644 --- a/tools/qtconfig/previewwidget.h +++ b/tools/qtconfig/previewwidget.h @@ -42,21 +42,21 @@ #ifndef PREVIEWWIDGET_H #define PREVIEWWIDGET_H -#include "previewwidgetbase.h" +#include "ui_previewwidget.h" QT_BEGIN_NAMESPACE -class PreviewWidget : public PreviewWidgetBase +class PreviewWidget : public QWidget, public Ui::PreviewWidget { Q_OBJECT public: - PreviewWidget( QWidget *parent = 0, const char *name = 0 ); + PreviewWidget(QWidget* parent = 0); - void closeEvent(QCloseEvent *); - bool eventFilter(QObject *, QEvent *); + void closeEvent(QCloseEvent*); + bool eventFilter(QObject*, QEvent*); }; QT_END_NAMESPACE -#endif +#endif // PREVIEWWIDGET_H diff --git a/tools/qtconfig/previewwidget.ui b/tools/qtconfig/previewwidget.ui new file mode 100644 index 0000000000..12de30dbca --- /dev/null +++ b/tools/qtconfig/previewwidget.ui @@ -0,0 +1,268 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <class>PreviewWidget</class> + <widget class="QWidget" name="PreviewWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>414</width> + <height>318</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Preview Window</string> + </property> + <layout class="QVBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <layout class="QHBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="GroupBox1"> + <property name="title"> + <string>GroupBox</string> + </property> + <layout class="QVBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="RadioButton1"> + <property name="text"> + <string>RadioButton1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton2"> + <property name="text"> + <string>RadioButton2</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton3"> + <property name="text"> + <string>RadioButton3</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox2"> + <property name="title"> + <string>GroupBox2</string> + </property> + <layout class="QVBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QCheckBox" name="CheckBox1"> + <property name="text"> + <string>CheckBox1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="CheckBox2"> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QProgressBar" name="ProgressBar1"> + <property name="value"> + <number>50</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLineEdit" name="LineEdit1"> + <property name="text"> + <string>LineEdit</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="ComboBox1"> + <item> + <property name="text"> + <string>ComboBox</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="unnamed"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="SpinBox1"/> + </item> + <item> + <widget class="QPushButton" name="PushButton1"> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollBar" name="ScrollBar1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="Slider1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="textView"> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>50</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="text" stdset="0"> + <string><p> +<a href="http://qt.nokia.com">http://qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="Spacer2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tools/qtconfig/previewwidgetbase.cpp b/tools/qtconfig/previewwidgetbase.cpp deleted file mode 100644 index 9234b6f0df..0000000000 --- a/tools/qtconfig/previewwidgetbase.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "previewwidgetbase.h" - -#include <QVariant> - -QT_BEGIN_NAMESPACE - -/* - * Constructs a PreviewWidgetBase as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - */ -PreviewWidgetBase::PreviewWidgetBase(QWidget* parent, const char* name, Qt::WindowFlags fl) - : QWidget(parent, name, fl) -{ - setupUi(this); - - - // signals and slots connections - init(); -} - -/* - * Destroys the object and frees any allocated resources - */ -PreviewWidgetBase::~PreviewWidgetBase() -{ - destroy(); - // no need to delete child widgets, Qt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void PreviewWidgetBase::languageChange() -{ - retranslateUi(this); -} - -void PreviewWidgetBase::init() -{ -} - -void PreviewWidgetBase::destroy() -{ -} - -QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidgetbase.h b/tools/qtconfig/previewwidgetbase.h deleted file mode 100644 index 829415e748..0000000000 --- a/tools/qtconfig/previewwidgetbase.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PREVIEWWIDGETBASE_H -#define PREVIEWWIDGETBASE_H - -#include "ui_previewwidgetbase.h" -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class PreviewWidgetBase : public QWidget, public Ui::PreviewWidgetBase -{ - Q_OBJECT - -public: - PreviewWidgetBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0); - ~PreviewWidgetBase(); - -protected slots: - virtual void languageChange(); - - virtual void init(); - virtual void destroy(); - -}; - -QT_END_NAMESPACE - -#endif // PREVIEWWIDGETBASE_H diff --git a/tools/qtconfig/previewwidgetbase.ui b/tools/qtconfig/previewwidgetbase.ui deleted file mode 100644 index 701bf84263..0000000000 --- a/tools/qtconfig/previewwidgetbase.ui +++ /dev/null @@ -1,340 +0,0 @@ -<ui version="4.0" stdsetdef="1" > - <author></author> - <comment>********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -*********************************************************************</comment> - <exportmacro></exportmacro> - <class>PreviewWidgetBase</class> - <widget class="QWidget" name="PreviewWidgetBase" > - <property name="objectName" > - <string notr="true" >PreviewWidgetBase</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>378</width> - <height>236</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle" > - <string>Preview Window</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="Q3ButtonGroup" name="ButtonGroup1" > - <property name="objectName" > - <string notr="true" >ButtonGroup1</string> - </property> - <property name="title" > - <string>ButtonGroup</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QRadioButton" name="RadioButton1" > - <property name="objectName" > - <string notr="true" >RadioButton1</string> - </property> - <property name="text" > - <string>RadioButton1</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="RadioButton2" > - <property name="objectName" > - <string notr="true" >RadioButton2</string> - </property> - <property name="text" > - <string>RadioButton2</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="RadioButton3" > - <property name="objectName" > - <string notr="true" >RadioButton3</string> - </property> - <property name="text" > - <string>RadioButton3</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Q3ButtonGroup" name="ButtonGroup2" > - <property name="objectName" > - <string notr="true" >ButtonGroup2</string> - </property> - <property name="title" > - <string>ButtonGroup2</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>11</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="CheckBox1" > - <property name="objectName" > - <string notr="true" >CheckBox1</string> - </property> - <property name="text" > - <string>CheckBox1</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="CheckBox2" > - <property name="objectName" > - <string notr="true" >CheckBox2</string> - </property> - <property name="text" > - <string>CheckBox2</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QProgressBar" name="ProgressBar1" > - <property name="objectName" > - <string notr="true" >ProgressBar1</string> - </property> - <property name="value" > - <number>50</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLineEdit" name="LineEdit1" > - <property name="objectName" > - <string notr="true" >LineEdit1</string> - </property> - <property name="text" > - <string>LineEdit</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="ComboBox1" > - <property name="objectName" > - <string notr="true" >ComboBox1</string> - </property> - <item> - <property name="text" > - <string>ComboBox</string> - </property> - </item> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" >unnamed</string> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QSpinBox" name="SpinBox1" > - <property name="objectName" > - <string notr="true" >SpinBox1</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="PushButton1" > - <property name="objectName" > - <string notr="true" >PushButton1</string> - </property> - <property name="text" > - <string>PushButton</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QScrollBar" name="ScrollBar1" > - <property name="objectName" > - <string notr="true" >ScrollBar1</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="Slider1" > - <property name="objectName" > - <string notr="true" >Slider1</string> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="textView" > - <property name="objectName" > - <string notr="true" >textView</string> - </property> - <property name="maximumSize" > - <size> - <width>32767</width> - <height>50</height> - </size> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="text" > - <string><p> -<a href="http://qt.nokia.com">http://qt.nokia.com</a> -</p> -<p> -<a href="http://www.kde.org">http://www.kde.org</a> -</p></string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="Spacer2" > - <property name="sizeHint" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="sizeType" > - <enum>Expanding</enum> - </property> - <property name="orientation" > - <enum>Vertical</enum> - </property> - </spacer> - </item> - </layout> - </widget> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> -</ui> diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index d1fd32020d..b0f2563c67 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -14,11 +14,11 @@ contains(QT_CONFIG, phonon) { DEFINES += HAVE_PHONON } SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \ - mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp + mainwindowbase.cpp paletteeditoradvancedbase.cpp HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h \ - mainwindowbase.h paletteeditoradvancedbase.h previewwidgetbase.h + mainwindowbase.h paletteeditoradvancedbase.h -FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui +FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidget.ui RESOURCES = qtconfig.qrc PROJECTNAME = Qt Configuration |