From 24d45304aa363c9a08f7157d549cb37c07212108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 18 Sep 2013 12:07:45 +0200 Subject: Remove QtWidgets dependencies from QtMacExtras. This makes it possible to use QtMacExtras from other modules without adding a QtWidgets dependency. It also makes it possible to use QtMacExtras from QtWidgets. Widget-related classes and functions will be added to QtWidgets. Specifics: Make QMacNativeToolBar private, for use by QMainWindow:: setUnifiedTitleAndToolBarOnMac(). Remove the QAction based APIs. Remove the example. We can make QMacNativeToolBar public again when the API is ready and documented. Remove misc functions: toNSMenu, setDockMenu, isMainWindow. Make toCfSTring/Url private pending inclusion into QtCore. Change-Id: Ic55e78d8ef923149c23884f6589732f7dfb94153 Reviewed-by: Gabriel de Dietrich --- examples/embeddedqwindow/main.mm | 5 +- examples/examples.pro | 5 +- examples/macfunctions/main.cpp | 10 +- examples/macpasteboardmime/macpasteboardmime.pro | 2 +- examples/macunifiedtoolbar/macunifiedtoolbar.pro | 20 -- examples/macunifiedtoolbar/macunifiedtoolbar.qrc | 5 - examples/macunifiedtoolbar/main.cpp | 52 ----- examples/macunifiedtoolbar/preferenceswindow.cpp | 101 ---------- examples/macunifiedtoolbar/preferenceswindow.h | 65 ------- examples/macunifiedtoolbar/preferenceswindow.ui | 209 --------------------- examples/macunifiedtoolbar/qtlogo.icns | Bin 129539 -> 0 bytes examples/macunifiedtoolbar/qtlogo.png | Bin 1478 -> 0 bytes examples/macunifiedtoolbar/window.cpp | 140 -------------- examples/macunifiedtoolbar/window.h | 72 ------- examples/macunifiedtoolbar/window.ui | 151 --------------- examples/qmaccocoaviewcontainer/main.mm | 67 ------- .../qmaccocoaviewcontainer.pro | 7 - examples/qmacnativewidget/main.mm | 137 -------------- examples/qmacnativewidget/qmacnativewidget.pro | 7 - 19 files changed, 6 insertions(+), 1049 deletions(-) delete mode 100644 examples/macunifiedtoolbar/macunifiedtoolbar.pro delete mode 100644 examples/macunifiedtoolbar/macunifiedtoolbar.qrc delete mode 100644 examples/macunifiedtoolbar/main.cpp delete mode 100644 examples/macunifiedtoolbar/preferenceswindow.cpp delete mode 100644 examples/macunifiedtoolbar/preferenceswindow.h delete mode 100644 examples/macunifiedtoolbar/preferenceswindow.ui delete mode 100644 examples/macunifiedtoolbar/qtlogo.icns delete mode 100644 examples/macunifiedtoolbar/qtlogo.png delete mode 100644 examples/macunifiedtoolbar/window.cpp delete mode 100644 examples/macunifiedtoolbar/window.h delete mode 100644 examples/macunifiedtoolbar/window.ui delete mode 100644 examples/qmaccocoaviewcontainer/main.mm delete mode 100644 examples/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro delete mode 100644 examples/qmacnativewidget/main.mm delete mode 100644 examples/qmacnativewidget/qmacnativewidget.pro (limited to 'examples') diff --git a/examples/embeddedqwindow/main.mm b/examples/embeddedqwindow/main.mm index 810d789..f24533b 100644 --- a/examples/embeddedqwindow/main.mm +++ b/examples/embeddedqwindow/main.mm @@ -39,15 +39,14 @@ ** ****************************************************************************/ +#include + #include "window.h" #include #include -#include - - NSView *getEmbeddableView(QWindow *qtWindow) { // Make sure the platform window is created diff --git a/examples/examples.pro b/examples/examples.pro index 891e3d6..8fe1d13 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -2,7 +2,4 @@ TEMPLATE = subdirs mac:SUBDIRS = macfunctions mac:!ios:SUBDIRS += embeddedqwindow \ - macpasteboardmime \ - macunifiedtoolbar \ - qmaccocoaviewcontainer \ - qmacnativewidget \ + macpasteboardmime diff --git a/examples/macfunctions/main.cpp b/examples/macfunctions/main.cpp index de77b08..a1563ba 100644 --- a/examples/macfunctions/main.cpp +++ b/examples/macfunctions/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ -#include +#include #include #include #include @@ -48,17 +48,11 @@ int main(int argc, char **argv) { - QApplication app(argc, argv); + QGuiApplication app(argc, argv); QWidget widget; widget.show(); - // Dock menu - QMenu menu; - menu.addAction("Item 1"); - menu.addAction("Item 2"); - QtMac::setDockMenu(&menu); - // Pixmap <-> CGImage conversion QPixmap pixmap(":qtlogo.png"); CGImageRef cgImage = QtMac::toCGImageRef(pixmap); diff --git a/examples/macpasteboardmime/macpasteboardmime.pro b/examples/macpasteboardmime/macpasteboardmime.pro index 9869637..3ce4cd4 100644 --- a/examples/macpasteboardmime/macpasteboardmime.pro +++ b/examples/macpasteboardmime/macpasteboardmime.pro @@ -1,4 +1,4 @@ -QT += macextras +QT += macextras widgets SOURCES += main.cpp diff --git a/examples/macunifiedtoolbar/macunifiedtoolbar.pro b/examples/macunifiedtoolbar/macunifiedtoolbar.pro deleted file mode 100644 index c13f714..0000000 --- a/examples/macunifiedtoolbar/macunifiedtoolbar.pro +++ /dev/null @@ -1,20 +0,0 @@ -QT += core gui macextras -greaterThan(QT_MAJOR_VERSION, 4):QT += widgets - -SOURCES += \ - main.cpp \ - preferenceswindow.cpp \ - window.cpp - -HEADERS += \ - preferenceswindow.h \ - window.h - -FORMS += \ - preferenceswindow.ui \ - window.ui - -RESOURCES += \ - macunifiedtoolbar.qrc - -ICON = qtlogo.icns diff --git a/examples/macunifiedtoolbar/macunifiedtoolbar.qrc b/examples/macunifiedtoolbar/macunifiedtoolbar.qrc deleted file mode 100644 index 04a9419..0000000 --- a/examples/macunifiedtoolbar/macunifiedtoolbar.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qtlogo.png - - diff --git a/examples/macunifiedtoolbar/main.cpp b/examples/macunifiedtoolbar/main.cpp deleted file mode 100644 index 9b764c7..0000000 --- a/examples/macunifiedtoolbar/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "window.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - Window window; - window.show(); - return app.exec(); -} - diff --git a/examples/macunifiedtoolbar/preferenceswindow.cpp b/examples/macunifiedtoolbar/preferenceswindow.cpp deleted file mode 100644 index 4991023..0000000 --- a/examples/macunifiedtoolbar/preferenceswindow.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "preferenceswindow.h" -#include -#include - -PreferencesWindow::PreferencesWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::PreferencesWindow) -{ - ui->setupUi(this); - - // Ensure we can only select one 'tab' at a time - QActionGroup *items = new QActionGroup(this); - foreach (QAction *action, ui->toolBar->actions()) - items->addAction(action); - - // This single line of code is all that's needed to transform a QToolBar into a native toolbar! - QtMac::setNativeToolBar(ui->toolBar, ui->useNativeToolbarCheckBox->isChecked()); - - QTimer::singleShot(0, this, SLOT(pack())); -} - -PreferencesWindow::~PreferencesWindow() -{ - delete ui; -} - -void PreferencesWindow::toolbarItemTriggered() -{ - QAction *action = qobject_cast(sender()); - if (action) - { - setWindowTitle(action->text()); - } - - if (sender() == ui->actionGeneral) - { - ui->stackedWidget->setCurrentWidget(ui->generalPage); - } - else if (sender() == ui->actionNetwork) - { - ui->stackedWidget->setCurrentWidget(ui->networkPage); - } - else if (sender() == ui->actionAdvanced) - { - ui->stackedWidget->setCurrentWidget(ui->advancedPage); - } - - QTimer::singleShot(0, this, SLOT(pack())); -} - -void PreferencesWindow::useNativeToolBarToggled(bool on) -{ - QtMac::setNativeToolBar(ui->toolBar, on); - QTimer::singleShot(0, this, SLOT(pack())); -} - -void PreferencesWindow::pack() -{ - resize(QSize()); -} diff --git a/examples/macunifiedtoolbar/preferenceswindow.h b/examples/macunifiedtoolbar/preferenceswindow.h deleted file mode 100644 index 0accb83..0000000 --- a/examples/macunifiedtoolbar/preferenceswindow.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PREFERENCESWINDOW_H -#define PREFERENCESWINDOW_H - -#include -#include "ui_preferenceswindow.h" - -class PreferencesWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit PreferencesWindow(QWidget *parent = 0); - ~PreferencesWindow(); - -private slots: - void toolbarItemTriggered(); - void useNativeToolBarToggled(bool); - void pack(); - -private: - Ui::PreferencesWindow *ui; -}; - -#endif // PREFERENCESWINDOW_H diff --git a/examples/macunifiedtoolbar/preferenceswindow.ui b/examples/macunifiedtoolbar/preferenceswindow.ui deleted file mode 100644 index 7f3ef00..0000000 --- a/examples/macunifiedtoolbar/preferenceswindow.ui +++ /dev/null @@ -1,209 +0,0 @@ - - - PreferencesWindow - - - - 0 - 0 - 400 - 300 - - - - Preferences - - - - - - - Use native NSToolbar - - - true - - - - - - - - - - - General preferences would go here - - - Qt::AlignCenter - - - - - - - - - - - Network preferences would go here - - - Qt::AlignCenter - - - - - - - - - - - Advanced preferences would go here - - - Qt::AlignCenter - - - - - - - - - - - - false - - - Qt::ToolButtonTextUnderIcon - - - false - - - TopToolBarArea - - - false - - - - - - - - true - - - true - - - - :/qtlogo.png:/qtlogo.png - - - General - - - - - true - - - - :/qtlogo.png:/qtlogo.png - - - Network - - - - - true - - - - :/qtlogo.png:/qtlogo.png - - - Advanced - - - - - - - - - actionGeneral - triggered() - PreferencesWindow - toolbarItemTriggered() - - - -1 - -1 - - - 399 - 299 - - - - - actionNetwork - triggered() - PreferencesWindow - toolbarItemTriggered() - - - -1 - -1 - - - 399 - 299 - - - - - actionAdvanced - triggered() - PreferencesWindow - toolbarItemTriggered() - - - -1 - -1 - - - 399 - 299 - - - - - useNativeToolbarCheckBox - toggled(bool) - PreferencesWindow - useNativeToolBarToggled(bool) - - - 61 - 87 - - - 199 - 149 - - - - - - toolbarItemTriggered() - useNativeToolBarToggled(bool) - - diff --git a/examples/macunifiedtoolbar/qtlogo.icns b/examples/macunifiedtoolbar/qtlogo.icns deleted file mode 100644 index def5f0e..0000000 Binary files a/examples/macunifiedtoolbar/qtlogo.icns and /dev/null differ diff --git a/examples/macunifiedtoolbar/qtlogo.png b/examples/macunifiedtoolbar/qtlogo.png deleted file mode 100644 index d75936b..0000000 Binary files a/examples/macunifiedtoolbar/qtlogo.png and /dev/null differ diff --git a/examples/macunifiedtoolbar/window.cpp b/examples/macunifiedtoolbar/window.cpp deleted file mode 100644 index dde27e3..0000000 --- a/examples/macunifiedtoolbar/window.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "window.h" -#include "preferenceswindow.h" -#include -#include -#include -#include - -class WindowPrivate -{ -public: - PreferencesWindow *preferencesWindow; - QMenuBar *mainMenuBar; - QMacNativeToolBar *toolBar; -}; - -Window::Window(QWidget *parent) : - QWidget(parent), - d(new WindowPrivate), - ui(new Ui::Window) -{ - ui->setupUi(this); - - d->preferencesWindow = new PreferencesWindow(); - - d->mainMenuBar = new QMenuBar(); - QMenu *toolsMenu = d->mainMenuBar->addMenu("Tools"); - toolsMenu->addAction("Options", d->preferencesWindow, SLOT(show())); - - d->toolBar = new QMacNativeToolBar(this); - d->toolBar->addAction(QIcon(":/qtlogo.png"), "Hello"); - d->toolBar->addAction(QIcon(":/qtlogo.png"), "World"); - d->toolBar->addStandardItem(QMacToolButton::FlexibleSpace); - d->toolBar->addStandardItem(QMacToolButton::ShowColors); - d->toolBar->addStandardItem(QMacToolButton::ShowFonts); - d->toolBar->addStandardItem(QMacToolButton::PrintItem); - - d->toolBar->addAllowedAction(QIcon(":/qtlogo.png"), "Extra Button 1"); - d->toolBar->addAllowedAction(QIcon(":/qtlogo.png"), "Extra Button 2"); - - d->toolBar->showInWindowForWidget(this); - - connect(d->toolBar, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), SLOT(displayModeChanged(Qt::ToolButtonStyle))); - ui->displayModeComboBox->setCurrentIndex(d->toolBar->toolButtonStyle()); - - connect(d->toolBar, SIGNAL(iconSizeChanged(QMacToolButton::IconSize)), SLOT(sizeModeChanged(QMacToolButton::IconSize))); - ui->sizeModeComboBox->setCurrentIndex(d->toolBar->iconSizeType()); - - connect(ui->visibleCheckBox, SIGNAL(clicked(bool)), d->toolBar, SLOT(setVisible(bool))); - connect(d->toolBar, SIGNAL(visibilityChanged(bool)), ui->visibleCheckBox, SLOT(setChecked(bool))); - ui->visibleCheckBox->setChecked(d->toolBar->isVisible()); - - connect(ui->showsBaselineSeparatorCheckBox, SIGNAL(clicked(bool)), d->toolBar, SLOT(setShowsBaselineSeparator(bool))); - connect(d->toolBar, SIGNAL(showsBaselineSeparatorChanged(bool)), ui->showsBaselineSeparatorCheckBox, SLOT(setChecked(bool))); - ui->showsBaselineSeparatorCheckBox->setChecked(d->toolBar->showsBaselineSeparator()); - - connect(ui->allowsUserCustomizationCheckBox, SIGNAL(clicked(bool)), d->toolBar, SLOT(setAllowsUserCustomization(bool))); - connect(d->toolBar, SIGNAL(allowsUserCustomizationChanged(bool)), ui->allowsUserCustomizationCheckBox, SLOT(setChecked(bool))); - ui->allowsUserCustomizationCheckBox->setChecked(d->toolBar->allowsUserCustomization()); - - connect(ui->showCustomizationSheetPushButton, SIGNAL(clicked()), d->toolBar, SLOT(showCustomizationSheet())); - connect(d->toolBar, SIGNAL(allowsUserCustomizationChanged(bool)), ui->showCustomizationSheetPushButton, SLOT(setEnabled(bool))); - ui->showCustomizationSheetPushButton->setEnabled(d->toolBar->allowsUserCustomization()); - - QTimer::singleShot(0, this, SLOT(positionWindow())); -} - -Window::~Window() -{ - delete ui; - delete d->mainMenuBar; - delete d->preferencesWindow; - delete d; -} - -void Window::changeDisplayMode(int toolButtonStyle) -{ - d->toolBar->setToolButtonStyle(static_cast(toolButtonStyle)); -} - -void Window::displayModeChanged(Qt::ToolButtonStyle toolButtonStyle) -{ - ui->displayModeComboBox->setCurrentIndex(toolButtonStyle); -} - -void Window::changeSizeMode(int sizeMode) -{ - d->toolBar->setIconSize(static_cast(sizeMode)); -} - -void Window::sizeModeChanged(QMacToolButton::IconSize size) -{ - ui->sizeModeComboBox->setCurrentIndex(size); -} - -void Window::positionWindow() -{ - resize(QSize()); - setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), qApp->desktop()->availableGeometry())); -} diff --git a/examples/macunifiedtoolbar/window.h b/examples/macunifiedtoolbar/window.h deleted file mode 100644 index 7f0dc54..0000000 --- a/examples/macunifiedtoolbar/window.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WINDOW_H -#define WINDOW_H - -#include -#include "qmactoolbutton.h" -#include "ui_window.h" - -class WindowPrivate; -class Window : public QWidget -{ - Q_OBJECT - -public: - explicit Window(QWidget *parent = 0); - ~Window(); - -private slots: - void changeDisplayMode(int); - void displayModeChanged(Qt::ToolButtonStyle); - - void changeSizeMode(int); - void sizeModeChanged(QMacToolButton::IconSize); - - void positionWindow(); - -private: - WindowPrivate *d; - Ui::Window *ui; -}; - -#endif // WINDOW_H diff --git a/examples/macunifiedtoolbar/window.ui b/examples/macunifiedtoolbar/window.ui deleted file mode 100644 index 90081a0..0000000 --- a/examples/macunifiedtoolbar/window.ui +++ /dev/null @@ -1,151 +0,0 @@ - - - Window - - - - 0 - 0 - 265 - 173 - - - - Qt Mac Toolbar Example - - - - QFormLayout::FieldsStayAtSizeHint - - - - - Display mode: - - - - - - - - IconOnly - - - - - TextOnly - - - - - TextBesideIcon - - - - - TextUnderIcon - - - - - FollowStyle - - - - - - - - Size mode: - - - - - - - - Default - - - - - Regular - - - - - Small - - - - - - - - Visible - - - - - - - Shows baseline separator - - - - - - - Allows user customization - - - - - - - Show customization sheet - - - - - - - - - displayModeComboBox - currentIndexChanged(int) - Window - changeDisplayMode(int) - - - 337 - 22 - - - 288 - 149 - - - - - sizeModeComboBox - currentIndexChanged(int) - Window - changeSizeMode(int) - - - 158 - 52 - - - 132 - 86 - - - - - - changeDisplayMode(int) - changeSizeMode(int) - - diff --git a/examples/qmaccocoaviewcontainer/main.mm b/examples/qmaccocoaviewcontainer/main.mm deleted file mode 100644 index e8ebc23..0000000 --- a/examples/qmaccocoaviewcontainer/main.mm +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -class WindowWidget : public QWidget -{ -public: - WindowWidget() - { - QMacCocoaViewContainer *cocoaViewContainer = new QMacCocoaViewContainer(0, this); - cocoaViewContainer->move(100, 100); - cocoaViewContainer->resize(300, 300); - NSTextView *text = [[NSTextView alloc] initWithFrame : NSMakeRect(0, 0, 300, 300)]; - cocoaViewContainer->setCocoaView(text); - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - WindowWidget widget; - widget.show(); - - return app.exec(); -} diff --git a/examples/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro b/examples/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro deleted file mode 100644 index 47b5de1..0000000 --- a/examples/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app - -OBJECTIVE_SOURCES += main.mm -LIBS += -framework Cocoa - -QT += gui widgets macextras - diff --git a/examples/qmacnativewidget/main.mm b/examples/qmacnativewidget/main.mm deleted file mode 100644 index 22d0957..0000000 --- a/examples/qmacnativewidget/main.mm +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class RedWidget : public QWidget -{ -public: - RedWidget() { - - } - - void resizeEvent(QResizeEvent *) - { - qDebug() << "RedWidget::resize" << size(); - } - - void paintEvent(QPaintEvent *event) - { - QPainter p(this); - Q_UNUSED(event); - QRect rect(QPoint(0, 0), size()); - qDebug() << "Painting geometry" << rect; - p.fillRect(rect, QColor(133, 50, 50)); - } -}; - -@interface WindowCreator : NSObject {} -- (void)createWindow; -@end - -@implementation WindowCreator -- (void)createWindow { - - // Create the NSWindow - NSRect frame = NSMakeRect(500, 500, 500, 500); - NSWindow* window = [[NSWindow alloc] initWithContentRect:frame - styleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask - backing:NSBackingStoreBuffered - defer:NO]; - [window setTitle:@"NSWindow"]; - - // Create widget hierarchy with QPushButton and QLineEdit - QMacNativeWidget *nativeWidget = new QMacNativeWidget(); - - QHBoxLayout *hlayout = new QHBoxLayout(); - hlayout->addWidget(new QPushButton("Push", nativeWidget)); - hlayout->addWidget(new QLineEdit); - - QVBoxLayout *vlayout = new QVBoxLayout(); - vlayout->addLayout(hlayout); - - //RedWidget * redWidget = new RedWidget; - //vlayout->addWidget(redWidget); - - nativeWidget->setLayout(vlayout); - - // Get the NSView for QMacNativeWidget and set it as the content view for the NSWindow - [window setContentView:nativeWidget->nativeView()]; - - // show() must be called on nativeWiget to get the widgets int he correct state. - nativeWidget->show(); - - // Show the NSWindow - [window makeKeyAndOrderFront:NSApp]; -} -@end - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - // Start Cocoa. Create NSApplicaiton. - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - - // Schedule call to create the UI using a zero timer. - WindowCreator *windowCreator= [WindowCreator alloc]; - [NSTimer scheduledTimerWithTimeInterval:0 target:windowCreator selector:@selector(createWindow) userInfo:nil repeats:NO]; - - // Stare the Cocoa event loop. - [(NSApplication *)NSApp run]; - [NSApp release]; - [pool release]; - exit(0); - return 0; -} - - - diff --git a/examples/qmacnativewidget/qmacnativewidget.pro b/examples/qmacnativewidget/qmacnativewidget.pro deleted file mode 100644 index df5f825..0000000 --- a/examples/qmacnativewidget/qmacnativewidget.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app - -OBJECTIVE_SOURCES += main.mm -LIBS += -framework Cocoa - -QT += gui widgets macextras -QT += widgets-private gui-private core-private -- cgit v1.2.3