summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/network/torrent/mainwindow.cpp4
-rw-r--r--examples/opengl/hellogl_es2/glwidget.cpp2
-rw-r--r--examples/opengl/hellogl_es2/glwidget.h11
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp2
-rw-r--r--examples/opengl/opengl.pro8
-rw-r--r--examples/widgets/mainwindows/mainwindow/mainwindow.cpp13
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp4
-rw-r--r--examples/widgets/widgets/wiggly/dialog.cpp22
-rw-r--r--examples/widgets/widgets/wiggly/dialog.h4
-rw-r--r--examples/widgets/widgets/wiggly/main.cpp11
10 files changed, 49 insertions, 32 deletions
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 649dbb0a77..3ac7d9dfdd 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -173,6 +173,10 @@ MainWindow::MainWindow(QWidget *parent)
bottomBar->addWidget((uploadLimitLabel = new QLabel(tr("0 KB/s"))));
uploadLimitLabel->setFixedSize(QSize(fm.width(tr("99999 KB/s")), fm.lineSpacing()));
+#ifdef Q_OS_OSX
+ setUnifiedTitleAndToolBarOnMac(true);
+#endif
+
// Set up connections
connect(torrentView, SIGNAL(itemSelectionChanged()),
this, SLOT(setActionsEnabled()));
diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp
index 7267cfd124..733475d321 100644
--- a/examples/opengl/hellogl_es2/glwidget.cpp
+++ b/examples/opengl/hellogl_es2/glwidget.cpp
@@ -171,6 +171,8 @@ void GLWidget::paintTexturedCube()
void GLWidget::initializeGL ()
{
+ initializeOpenGLFunctions();
+
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
glGenTextures(1, &m_uiTexture);
diff --git a/examples/opengl/hellogl_es2/glwidget.h b/examples/opengl/hellogl_es2/glwidget.h
index 8ed86b1e01..00073aa047 100644
--- a/examples/opengl/hellogl_es2/glwidget.h
+++ b/examples/opengl/hellogl_es2/glwidget.h
@@ -42,15 +42,16 @@
#define GLWIDGET_H
#include <QGLWidget>
-#include <QtGui/qvector3d.h>
-#include <QtGui/qmatrix4x4.h>
-#include <QtOpenGL/qglshaderprogram.h>
+#include <QOpenGLFunctions>
+#include <QGLShaderProgram>
+#include <QVector3D>
+#include <QMatrix4x4>
#include <QTime>
#include <QVector>
class Bubble;
-class GLWidget : public QGLWidget {
-
+class GLWidget : public QGLWidget, protected QOpenGLFunctions
+{
Q_OBJECT
public:
GLWidget(QWidget *parent = 0);
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp
index 3b5971c0d3..b4dc4464ba 100644
--- a/examples/opengl/hellowindow/hellowindow.cpp
+++ b/examples/opengl/hellowindow/hellowindow.cpp
@@ -182,7 +182,7 @@ void Renderer::paintQtLogo()
m_program->enableAttributeArray(vertexAttr);
m_program->setAttributeArray(vertexAttr, vertices.constData());
m_program->setAttributeArray(normalAttr, normals.constData());
- glDrawArrays(GL_TRIANGLES, 0, vertices.size());
+ m_context->functions()->glDrawArrays(GL_TRIANGLES, 0, vertices.size());
m_program->disableAttributeArray(normalAttr);
m_program->disableAttributeArray(vertexAttr);
}
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index 7bc96234df..aea281ce5c 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -2,7 +2,11 @@ requires(qtHaveModule(opengl))
TEMPLATE = subdirs
-contains(QT_CONFIG, opengles2) {
+contains(QT_CONFIG, dynamicgl) {
+ SUBDIRS = hellowindow \
+ contextinfo \
+ hellogl_es2
+} else: contains(QT_CONFIG, opengles2){
SUBDIRS = hellogl_es2
} else {
SUBDIRS = 2dpainting \
@@ -14,7 +18,7 @@ contains(QT_CONFIG, opengles2) {
samplebuffers
}
-SUBDIRS += hellowindow \
+!contains(QT_CONFIG, dynamicgl): SUBDIRS += hellowindow \
paintedwindow \
contextinfo \
cube \
diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
index fe54f4569a..0a29edee74 100644
--- a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
+++ b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp
@@ -109,6 +109,10 @@ void MainWindow::actionTriggered(QAction *action)
void MainWindow::setupToolBar()
{
+#ifdef Q_OS_OSX
+ setUnifiedTitleAndToolBarOnMac(true);
+#endif
+
for (int i = 0; i < 3; ++i) {
ToolBar *tb = new ToolBar(QString::fromLatin1("Tool Bar %1").arg(i + 1), this);
toolBars.append(tb);
@@ -164,6 +168,15 @@ void MainWindow::setupMenuBar()
for (int i = 0; i < toolBars.count(); ++i)
toolBarMenu->addMenu(toolBars.at(i)->menu);
+#ifdef Q_OS_OSX
+ toolBarMenu->addSeparator();
+
+ action = toolBarMenu->addAction(tr("Unified"));
+ action->setCheckable(true);
+ action->setChecked(unifiedTitleAndToolBarOnMac());
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setUnifiedTitleAndToolBarOnMac(bool)));
+#endif
+
dockWidgetMenu = menuBar()->addMenu(tr("&Dock Widgets"));
}
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp
index 128924ef4e..2ff7a09969 100644
--- a/examples/widgets/richtext/textedit/textedit.cpp
+++ b/examples/widgets/richtext/textedit/textedit.cpp
@@ -78,6 +78,10 @@ const QString rsrcPath = ":/images/win";
TextEdit::TextEdit(QWidget *parent)
: QMainWindow(parent)
{
+#ifdef Q_OS_OSX
+ setUnifiedTitleAndToolBarOnMac(true);
+#endif
+
setToolButtonStyle(Qt::ToolButtonFollowStyle);
setupFileActions();
setupEditActions();
diff --git a/examples/widgets/widgets/wiggly/dialog.cpp b/examples/widgets/widgets/wiggly/dialog.cpp
index 1279d9d05b..3bb4f60d76 100644
--- a/examples/widgets/widgets/wiggly/dialog.cpp
+++ b/examples/widgets/widgets/wiggly/dialog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -38,32 +38,26 @@
**
****************************************************************************/
-#include <QtWidgets>
-#include <QtWidgets>
+#include <QLineEdit>
+#include <QVBoxLayout>
#include "dialog.h"
#include "wigglywidget.h"
//! [0]
-Dialog::Dialog(QWidget *parent, bool smallScreen)
+Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
WigglyWidget *wigglyWidget = new WigglyWidget;
QLineEdit *lineEdit = new QLineEdit;
- QVBoxLayout *layout = new QVBoxLayout;
+ QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(wigglyWidget);
layout->addWidget(lineEdit);
- setLayout(layout);
- connect(lineEdit, SIGNAL(textChanged(QString)),
- wigglyWidget, SLOT(setText(QString)));
- if (!smallScreen){
- lineEdit->setText(tr("Hello world!"));
- }
- else{
- lineEdit->setText(tr("Hello!"));
- }
+ connect(lineEdit, &QLineEdit::textChanged, wigglyWidget, &WigglyWidget::setText);
+ lineEdit->setText(tr("Hello world!"));
+
setWindowTitle(tr("Wiggly"));
resize(360, 145);
}
diff --git a/examples/widgets/widgets/wiggly/dialog.h b/examples/widgets/widgets/wiggly/dialog.h
index 7355a56887..885671c69e 100644
--- a/examples/widgets/widgets/wiggly/dialog.h
+++ b/examples/widgets/widgets/wiggly/dialog.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,7 +49,7 @@ class Dialog : public QDialog
Q_OBJECT
public:
- explicit Dialog(QWidget *parent = 0, bool smallScreen = false);
+ explicit Dialog(QWidget *parent = 0);
};
//! [0]
diff --git a/examples/widgets/widgets/wiggly/main.cpp b/examples/widgets/widgets/wiggly/main.cpp
index df5d5487bc..caf00eb748 100644
--- a/examples/widgets/widgets/wiggly/main.cpp
+++ b/examples/widgets/widgets/wiggly/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -45,14 +45,9 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- bool smallScreen = QApplication::arguments().contains("-small-screen");
+ Dialog dialog;
+ dialog.show();
- Dialog dialog(0, smallScreen);
-
- if (!smallScreen)
- dialog.show();
- else
- dialog.showFullScreen();
return app.exec();
}