aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-09-18 12:07:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 10:24:54 +0200
commit24d45304aa363c9a08f7157d549cb37c07212108 (patch)
treef50b6e671f19d663dcd5ce4b18a57479a760b2d8 /examples
parent1ef71fcdb15ac0b93751142629b4a2d1ab1e73c8 (diff)
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 <gabriel.dedietrich@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/embeddedqwindow/main.mm5
-rw-r--r--examples/examples.pro5
-rw-r--r--examples/macfunctions/main.cpp10
-rw-r--r--examples/macpasteboardmime/macpasteboardmime.pro2
-rw-r--r--examples/macunifiedtoolbar/macunifiedtoolbar.pro20
-rw-r--r--examples/macunifiedtoolbar/macunifiedtoolbar.qrc5
-rw-r--r--examples/macunifiedtoolbar/main.cpp52
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.cpp101
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.h65
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.ui209
-rw-r--r--examples/macunifiedtoolbar/qtlogo.icnsbin129539 -> 0 bytes
-rw-r--r--examples/macunifiedtoolbar/qtlogo.pngbin1478 -> 0 bytes
-rw-r--r--examples/macunifiedtoolbar/window.cpp140
-rw-r--r--examples/macunifiedtoolbar/window.h72
-rw-r--r--examples/macunifiedtoolbar/window.ui151
-rw-r--r--examples/qmaccocoaviewcontainer/main.mm67
-rw-r--r--examples/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro7
-rw-r--r--examples/qmacnativewidget/main.mm137
-rw-r--r--examples/qmacnativewidget/qmacnativewidget.pro7
19 files changed, 6 insertions, 1049 deletions
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 <Cocoa/Cocoa.h>
+
#include "window.h"
#include <QtGui>
#include <qpa/qplatformnativeinterface.h>
-#include <Cocoa/Cocoa.h>
-
-
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 <QApplication>
+#include <QGuiApplication>
#include <QMenu>
#include <QPixmap>
#include <QWidget>
@@ -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 @@
-<RCC>
- <qresource prefix="/">
- <file>qtlogo.png</file>
- </qresource>
-</RCC>
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 <QApplication>
-#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 <QMacNativeToolBar>
-#include <QTimer>
-
-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<QAction*>(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 <QMainWindow>
-#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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PreferencesWindow</class>
- <widget class="QMainWindow" name="PreferencesWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Preferences</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="useNativeToolbarCheckBox">
- <property name="text">
- <string>Use native NSToolbar</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QStackedWidget" name="stackedWidget">
- <widget class="QWidget" name="generalPage">
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="generalLabel">
- <property name="text">
- <string>General preferences would go here</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="networkPage">
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="networkLabel">
- <property name="text">
- <string>Network preferences would go here</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="advancedPage">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="advancedLabel">
- <property name="text">
- <string>Advanced preferences would go here</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QToolBar" name="toolBar">
- <property name="movable">
- <bool>false</bool>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- <property name="floatable">
- <bool>false</bool>
- </property>
- <attribute name="toolBarArea">
- <enum>TopToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- <addaction name="actionGeneral"/>
- <addaction name="actionNetwork"/>
- <addaction name="actionAdvanced"/>
- </widget>
- <action name="actionGeneral">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="icon">
- <iconset resource="macunifiedtoolbar.qrc">
- <normaloff>:/qtlogo.png</normaloff>:/qtlogo.png</iconset>
- </property>
- <property name="text">
- <string>General</string>
- </property>
- </action>
- <action name="actionNetwork">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="icon">
- <iconset resource="macunifiedtoolbar.qrc">
- <normaloff>:/qtlogo.png</normaloff>:/qtlogo.png</iconset>
- </property>
- <property name="text">
- <string>Network</string>
- </property>
- </action>
- <action name="actionAdvanced">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="icon">
- <iconset resource="macunifiedtoolbar.qrc">
- <normaloff>:/qtlogo.png</normaloff>:/qtlogo.png</iconset>
- </property>
- <property name="text">
- <string>Advanced</string>
- </property>
- </action>
- </widget>
- <resources>
- <include location="macunifiedtoolbar.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>actionGeneral</sender>
- <signal>triggered()</signal>
- <receiver>PreferencesWindow</receiver>
- <slot>toolbarItemTriggered()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>399</x>
- <y>299</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionNetwork</sender>
- <signal>triggered()</signal>
- <receiver>PreferencesWindow</receiver>
- <slot>toolbarItemTriggered()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>399</x>
- <y>299</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionAdvanced</sender>
- <signal>triggered()</signal>
- <receiver>PreferencesWindow</receiver>
- <slot>toolbarItemTriggered()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>399</x>
- <y>299</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>useNativeToolbarCheckBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>PreferencesWindow</receiver>
- <slot>useNativeToolBarToggled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>61</x>
- <y>87</y>
- </hint>
- <hint type="destinationlabel">
- <x>199</x>
- <y>149</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>toolbarItemTriggered()</slot>
- <slot>useNativeToolBarToggled(bool)</slot>
- </slots>
-</ui>
diff --git a/examples/macunifiedtoolbar/qtlogo.icns b/examples/macunifiedtoolbar/qtlogo.icns
deleted file mode 100644
index def5f0e..0000000
--- a/examples/macunifiedtoolbar/qtlogo.icns
+++ /dev/null
Binary files differ
diff --git a/examples/macunifiedtoolbar/qtlogo.png b/examples/macunifiedtoolbar/qtlogo.png
deleted file mode 100644
index d75936b..0000000
--- a/examples/macunifiedtoolbar/qtlogo.png
+++ /dev/null
Binary files 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 <QMacNativeToolBar>
-#include <QDesktopWidget>
-#include <QMenuBar>
-#include <QTimer>
-
-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<Qt::ToolButtonStyle>(toolButtonStyle));
-}
-
-void Window::displayModeChanged(Qt::ToolButtonStyle toolButtonStyle)
-{
- ui->displayModeComboBox->setCurrentIndex(toolButtonStyle);
-}
-
-void Window::changeSizeMode(int sizeMode)
-{
- d->toolBar->setIconSize(static_cast<QMacToolButton::IconSize>(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 <QWidget>
-#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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Window</class>
- <widget class="QWidget" name="Window">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>265</width>
- <height>173</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Qt Mac Toolbar Example</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::FieldsStayAtSizeHint</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="displayModeLabel">
- <property name="text">
- <string>Display mode:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="displayModeComboBox">
- <item>
- <property name="text">
- <string>IconOnly</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>TextOnly</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>TextBesideIcon</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>TextUnderIcon</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>FollowStyle</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="sizeModeLabel">
- <property name="text">
- <string>Size mode:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="sizeModeComboBox">
- <item>
- <property name="text">
- <string>Default</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Regular</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Small</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QCheckBox" name="visibleCheckBox">
- <property name="text">
- <string>Visible</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QCheckBox" name="showsBaselineSeparatorCheckBox">
- <property name="text">
- <string>Shows baseline separator</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="QCheckBox" name="allowsUserCustomizationCheckBox">
- <property name="text">
- <string>Allows user customization</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QPushButton" name="showCustomizationSheetPushButton">
- <property name="text">
- <string>Show customization sheet</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>displayModeComboBox</sender>
- <signal>currentIndexChanged(int)</signal>
- <receiver>Window</receiver>
- <slot>changeDisplayMode(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>337</x>
- <y>22</y>
- </hint>
- <hint type="destinationlabel">
- <x>288</x>
- <y>149</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sizeModeComboBox</sender>
- <signal>currentIndexChanged(int)</signal>
- <receiver>Window</receiver>
- <slot>changeSizeMode(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>158</x>
- <y>52</y>
- </hint>
- <hint type="destinationlabel">
- <x>132</x>
- <y>86</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>changeDisplayMode(int)</slot>
- <slot>changeSizeMode(int)</slot>
- </slots>
-</ui>
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 <QtWidgets>
-#include <Cocoa/Cocoa.h>
-#include <QMacCocoaViewContainer>
-
-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 <QApplication>
-#include <QDebug>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QPainter>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <Cocoa/Cocoa.h>
-#include <qmacnativewidget.h>
-
-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