diff options
Diffstat (limited to 'qtwinmigrate/examples/mfc/step5')
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/childview.cpp | 72 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/childview.h | 58 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/mainframe.cpp | 86 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/mainframe.h | 65 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/qtmfc.cpp | 51 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/qtmfc.rc | 1 | ||||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/res/QtMfc.ico | bin | 0 -> 1078 bytes | |||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/res/qtmfc.bmp | bin | 0 -> 3126 bytes | |||
-rw-r--r-- | qtwinmigrate/examples/mfc/step5/step5.pro | 7 |
9 files changed, 340 insertions, 0 deletions
diff --git a/qtwinmigrate/examples/mfc/step5/childview.cpp b/qtwinmigrate/examples/mfc/step5/childview.cpp new file mode 100644 index 0000000..dd6ada7 --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/childview.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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 a Qt Solutions component. +** +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + +// childview.cpp : implementation of the ChildView class +// + +#include "childview.h" + +#include <QtGui/QLabel> +#include <QtGui/QLineEdit> +#include <QtGui/QLayout> +#include <QtGui/QPainter> + +///////////////////////////////////////////////////////////////////////////// +// ChildView + +ChildView::ChildView(QWidget *parent) +: QWidget(parent) +{ + QWidget *widget = new QWidget(this); + QHBoxLayout *hbox = new QHBoxLayout(widget); + + QLabel *label = new QLabel("Enter text:", widget); + QLineEdit *edit = new QLineEdit(widget); + + hbox->addWidget(label); + hbox->addWidget(edit); + + widget->move(0, 0); + setBackgroundRole(QPalette::Base); +} + +void ChildView::paintEvent(QPaintEvent * /*e*/) +{ + QPainter painter(this); +} diff --git a/qtwinmigrate/examples/mfc/step5/childview.h b/qtwinmigrate/examples/mfc/step5/childview.h new file mode 100644 index 0000000..d50b5cf --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/childview.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 a Qt Solutions component. +** +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + +// childview.h : interface of the ChildView class +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef CHILDVIEW_H +#define CHILDVIEW_H + +#include <QtGui/QWidget> + +class ChildView : public QWidget +{ +public: + ChildView(QWidget *parent = 0); + +protected: + void paintEvent(QPaintEvent *); +}; + +#endif diff --git a/qtwinmigrate/examples/mfc/step5/mainframe.cpp b/qtwinmigrate/examples/mfc/step5/mainframe.cpp new file mode 100644 index 0000000..5bd9911 --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/mainframe.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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 a Qt Solutions component. +** +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + +#include <QtGui> + +#include "mainframe.h" +#include "childview.h" +#include "ui_optionsdialog.h" + +///////////////////////////////////////////////////////////////////////////// +// MainFrame + +MainFrame::MainFrame(QWidget *parent) +: QMainWindow(parent) +{ + QMenu *filePopup = menuBar()->addMenu("&File"); + filePopup->addAction("&Exit", this, SLOT(close())); + + QMenu *editPopup = menuBar()->addMenu("&Edit"); + editPopup->addAction("&Undo", 0, 0, Qt::CTRL + Qt::Key_Z); + editPopup->addSeparator(); + editPopup->addAction("Cu&t", 0, 0, Qt::CTRL + Qt::Key_X); + editPopup->addAction("&Copy", 0, 0, Qt::CTRL + Qt::Key_C); + editPopup->addAction("&Paste", 0, 0, Qt::CTRL + Qt::Key_V); + editPopup->addSeparator(); + editPopup->addAction("&Options...", this, SLOT(editOptions())); + + QMenu *helpPopup = menuBar()->addMenu("&Help"); + helpPopup->addAction("&About QtMfc...", this, SLOT(helpAbout()), Qt::CTRL + Qt::Key_F1); + + view = new ChildView(this); + setCentralWidget(view); + + statusBar(); +} + +void MainFrame::editOptions() +{ + QDialog *dialog = new QDialog(this); + dialog->setAttribute(Qt::WA_DeleteOnClose); + Ui::OptionsDialog ui; + ui.setupUi(dialog); + + dialog->show(); +} + +void MainFrame::helpAbout() +{ + QMessageBox::about(this, "About QtMfc", "QtMfc Version 1.0\nCopyright (C) 2003"); +} diff --git a/qtwinmigrate/examples/mfc/step5/mainframe.h b/qtwinmigrate/examples/mfc/step5/mainframe.h new file mode 100644 index 0000000..3db2f71 --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/mainframe.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 a Qt Solutions component. +** +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + +// mainframe.h : interface of the MainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef MAINFRAME_H +#define MAINFRAME_H + +#include <QtGui/QMainWindow> + +class ChildView; + +class MainFrame : public QMainWindow +{ + Q_OBJECT +public: + MainFrame(QWidget *parent = 0); + +protected Q_SLOTS: + void editOptions(); + void helpAbout(); + +private: + ChildView *view; +}; + +#endif diff --git a/qtwinmigrate/examples/mfc/step5/qtmfc.cpp b/qtwinmigrate/examples/mfc/step5/qtmfc.cpp new file mode 100644 index 0000000..54ea1cd --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/qtmfc.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** 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 a Qt Solutions component. +** +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +****************************************************************************/ + +#include <QtGui/QApplication> +#include "mainframe.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + MainFrame frame; + frame.show(); + + return app.exec(); +} diff --git a/qtwinmigrate/examples/mfc/step5/qtmfc.rc b/qtwinmigrate/examples/mfc/step5/qtmfc.rc new file mode 100644 index 0000000..210a1ef --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/qtmfc.rc @@ -0,0 +1 @@ +IDR_MAINFRAME ICON DISCARDABLE "res\\QtMfc.ico" diff --git a/qtwinmigrate/examples/mfc/step5/res/QtMfc.ico b/qtwinmigrate/examples/mfc/step5/res/QtMfc.ico Binary files differnew file mode 100644 index 0000000..7eef0bc --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/res/QtMfc.ico diff --git a/qtwinmigrate/examples/mfc/step5/res/qtmfc.bmp b/qtwinmigrate/examples/mfc/step5/res/qtmfc.bmp Binary files differnew file mode 100644 index 0000000..c329b17 --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/res/qtmfc.bmp diff --git a/qtwinmigrate/examples/mfc/step5/step5.pro b/qtwinmigrate/examples/mfc/step5/step5.pro new file mode 100644 index 0000000..a1b255f --- /dev/null +++ b/qtwinmigrate/examples/mfc/step5/step5.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +TARGET = QtMfc5 + +SOURCES += childview.cpp mainframe.cpp qtmfc.cpp +HEADERS += childview.h mainframe.h +FORMS += ../step4/optionsdialog.ui +RC_FILE = qtmfc.rc |