diff options
Diffstat (limited to 'demos')
31 files changed, 68 insertions, 39 deletions
diff --git a/demos/affine/main.cpp b/demos/affine/main.cpp index 85da546..e14dc6b 100644 --- a/demos/affine/main.cpp +++ b/demos/affine/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char **argv) QStyle *arthurStyle = new ArthurStyle(); xformWidget.setStyle(arthurStyle); - QList<QWidget *> widgets = qFindChildren<QWidget *>(&xformWidget); + QList<QWidget *> widgets = xformWidget.findChildren<QWidget *>(); foreach (QWidget *w, widgets) { w->setStyle(arthurStyle); w->setAttribute(Qt::WA_AcceptTouchEvents); diff --git a/demos/books/bookwindow.cpp b/demos/books/bookwindow.cpp index 089d5e0..c801283 100644 --- a/demos/books/bookwindow.cpp +++ b/demos/books/bookwindow.cpp @@ -64,7 +64,7 @@ BookWindow::BookWindow() model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->setTable("books"); - // Remeber the indexes of the columns + // Remember the indexes of the columns authorIdx = model->fieldIndex("author"); genreIdx = model->fieldIndex("genre"); diff --git a/demos/boxes/glbuffers.cpp b/demos/boxes/glbuffers.cpp index 694d05b..84ab26c 100644 --- a/demos/boxes/glbuffers.cpp +++ b/demos/boxes/glbuffers.cpp @@ -42,6 +42,16 @@ #include "glbuffers.h" #include <QtGui/qmatrix4x4.h> + +void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) +{ + const GLdouble ymax = zNear * tan(fovy * M_PI / 360.0); + const GLdouble ymin = -ymax; + const GLdouble xmin = ymin * aspect; + const GLdouble xmax = ymax * aspect; + glFrustum(xmin, xmax, ymin, ymax, zNear, zFar); +} + //============================================================================// // GLTexture // //============================================================================// diff --git a/demos/boxes/glbuffers.h b/demos/boxes/glbuffers.h index 67a4ea6..8c1e209 100644 --- a/demos/boxes/glbuffers.h +++ b/demos/boxes/glbuffers.h @@ -58,6 +58,8 @@ if (m_failed || !(assertion)) { returnStatement; \ } +void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); + QT_BEGIN_NAMESPACE class QMatrix4x4; QT_END_NAMESPACE diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp index 3aaf985..e3a5978 100644 --- a/demos/boxes/qtbox.cpp +++ b/demos/boxes/qtbox.cpp @@ -324,7 +324,7 @@ void QtBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixf(moveToRectMatrix); - gluPerspective(60.0, 1.0, 0.01, 10.0); + qgluPerspective(60.0, 1.0, 0.01, 10.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index 97953f2..d65af22 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -922,7 +922,7 @@ void Scene::drawBackground(QPainter *painter, const QRectF &) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); - gluPerspective(60.0, width / height, 0.01, 15.0); + qgluPerspective(60.0, width / height, 0.01, 15.0); glMatrixMode(GL_MODELVIEW); diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp index ed95d32..633307c 100644 --- a/demos/browser/browserapplication.cpp +++ b/demos/browser/browserapplication.cpp @@ -231,14 +231,14 @@ void BrowserApplication::loadSettings() QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); - standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); + standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); - fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); + fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); diff --git a/demos/browser/browsermainwindow.cpp b/demos/browser/browsermainwindow.cpp index 8c2ed89..50c2cf8 100644 --- a/demos/browser/browsermainwindow.cpp +++ b/demos/browser/browsermainwindow.cpp @@ -670,7 +670,7 @@ void BrowserMainWindow::slotPrivateBrowsing() " items are automatically removed from the Downloads window," \ " new cookies are not stored, current cookies can't be accessed," \ " site icons wont be stored, session wont be saved, " \ - " and searches are not addded to the pop-up menu in the Google search box." \ + " and searches are not added to the pop-up menu in the Google search box." \ " Until you close the window, you can still click the Back and Forward buttons" \ " to return to the webpages you have opened.").arg(title); diff --git a/demos/browser/cookiejar.cpp b/demos/browser/cookiejar.cpp index 835b61b..d318e3a 100644 --- a/demos/browser/cookiejar.cpp +++ b/demos/browser/cookiejar.cpp @@ -186,7 +186,7 @@ void CookieJar::save() if (cookies.at(i).isSessionCookie()) cookies.removeAt(i); } - cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QList<QNetworkCookie> >(cookies)); + cookieSettings.setValue(QLatin1String("cookies"), QVariant::fromValue<QList<QNetworkCookie> >(cookies)); cookieSettings.beginGroup(QLatin1String("Exceptions")); cookieSettings.setValue(QLatin1String("block"), m_exceptions_block); cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow); diff --git a/demos/browser/settings.cpp b/demos/browser/settings.cpp index 5ceca67..d83e6a4 100644 --- a/demos/browser/settings.cpp +++ b/demos/browser/settings.cpp @@ -121,8 +121,8 @@ void SettingsDialog::loadFromSettings() // Appearance settings.beginGroup(QLatin1String("websettings")); - fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); - standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); + fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); + standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); diff --git a/demos/browser/webview.cpp b/demos/browser/webview.cpp index 2f9b3e6..2cbd2f1 100644 --- a/demos/browser/webview.cpp +++ b/demos/browser/webview.cpp @@ -260,7 +260,7 @@ void WebView::setProgress(int progress) void WebView::loadFinished() { if (100 != m_progress) { - qWarning() << "Recieved finished signal while progress is still:" << progress() + qWarning() << "Received finished signal while progress is still:" << progress() << "Url:" << url(); } m_progress = 0; diff --git a/demos/composition/main.cpp b/demos/composition/main.cpp index aa8c139..a528dff 100644 --- a/demos/composition/main.cpp +++ b/demos/composition/main.cpp @@ -59,7 +59,7 @@ int main(int argc, char **argv) QStyle *arthurStyle = new ArthurStyle(); compWidget.setStyle(arthurStyle); - QList<QWidget *> widgets = qFindChildren<QWidget *>(&compWidget); + QList<QWidget *> widgets = compWidget.findChildren<QWidget *>(); foreach (QWidget *w, widgets) w->setStyle(arthurStyle); compWidget.show(); diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 46114f5..b1344af 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -208,17 +208,30 @@ Rectangle { Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0); Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2); + Connections { + target: startHeartbeatTimer + onRunningChanged: { + if (startHeartbeatTimer.running) + screen.state = "starting"; + else + screen.state = "running" + } + } + Connections { + target: heartbeat + onRunningChanged: if (!heartbeat.running) screen.state = ""; + } + + states: [ State { name: "starting" - when: startHeartbeatTimer.running PropertyChanges {target: progressIndicator; width: 200} PropertyChanges {target: title; opacity: 0} PropertyChanges {target: progressBar; opacity: 1} }, State { name: "running" - when: (heartbeat.running && !startHeartbeatTimer.running) PropertyChanges {target: progressIndicator; width: 200} PropertyChanges {target: title; opacity: 0} PropertyChanges {target: skull; row: 0; column: 0; } diff --git a/demos/deform/main.cpp b/demos/deform/main.cpp index bef075a..c5491b3 100644 --- a/demos/deform/main.cpp +++ b/demos/deform/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) QStyle *arthurStyle = new ArthurStyle(); deformWidget.setStyle(arthurStyle); - QList<QWidget *> widgets = qFindChildren<QWidget *>(&deformWidget); + QList<QWidget *> widgets = deformWidget.findChildren<QWidget *>(); foreach (QWidget *w, widgets) w->setStyle(arthurStyle); diff --git a/demos/deform/pathdeform.cpp b/demos/deform/pathdeform.cpp index 636d103..d6ac19e 100644 --- a/demos/deform/pathdeform.cpp +++ b/demos/deform/pathdeform.cpp @@ -297,7 +297,7 @@ void PathDeformWidget::setStyle( QStyle * style ) { m_controls->setStyle(style); - QList<QWidget *> widgets = qFindChildren<QWidget *>(m_controls); + QList<QWidget *> widgets = m_controls->findChildren<QWidget *>(); foreach (QWidget *w, widgets) w->setStyle(style); } diff --git a/demos/demos.pro b/demos/demos.pro index f359bd7..fdc1e4c 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -58,7 +58,7 @@ wince*:SUBDIRS += demos_sqlbrowser contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):!symbian:SUBDIRS += demos_browser contains(QT_CONFIG, declarative):SUBDIRS += demos_declarative -contains(QT_CONFIG, multimedia):SUBDIRS += demos_spectrum +contains(QT_CONFIG, multimedia):!static:SUBDIRS += demos_spectrum # install sources.files = README *.pro diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp index bd56f5a..a715f5e 100644 --- a/demos/embeddeddialogs/customproxy.cpp +++ b/demos/embeddeddialogs/customproxy.cpp @@ -113,7 +113,7 @@ QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &valu { if (change == ItemChildAddedChange || change == ItemChildRemovedChange) { if (change == ItemChildAddedChange) { - currentPopup = qVariantValue<QGraphicsItem *>(value); + currentPopup = qvariant_cast<QGraphicsItem *>(value); currentPopup->setCacheMode(ItemCoordinateCache); if (scene()) currentPopup->installSceneEventFilter(this); diff --git a/demos/gradients/main.cpp b/demos/gradients/main.cpp index 8291e85..6678fa2 100644 --- a/demos/gradients/main.cpp +++ b/demos/gradients/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char **argv) GradientWidget gradientWidget(0); QStyle *arthurStyle = new ArthurStyle(); gradientWidget.setStyle(arthurStyle); - QList<QWidget *> widgets = qFindChildren<QWidget *>(&gradientWidget); + QList<QWidget *> widgets = gradientWidget.findChildren<QWidget *>(); foreach (QWidget *w, widgets) { w->setStyle(arthurStyle); w->setAttribute(Qt::WA_AcceptTouchEvents); diff --git a/demos/interview/model.cpp b/demos/interview/model.cpp index 840bc60..88f200d 100644 --- a/demos/interview/model.cpp +++ b/demos/interview/model.cpp @@ -109,7 +109,7 @@ QVariant Model::headerData(int section, Qt::Orientation orientation, int role) c if (role == Qt::DisplayRole) return QString::number(section); if (role == Qt::DecorationRole) - return qVariantFromValue(services); + return QVariant::fromValue(services); return QAbstractItemModel::headerData(section, orientation, role); } diff --git a/demos/mainwindow/colorswatch.cpp b/demos/mainwindow/colorswatch.cpp index aab4f03..d4dbdca 100644 --- a/demos/mainwindow/colorswatch.cpp +++ b/demos/mainwindow/colorswatch.cpp @@ -454,7 +454,7 @@ void ColorSwatch::updateContextMenu() tabMenu->clear(); splitHMenu->clear(); splitVMenu->clear(); - QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow); + QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>(); foreach (ColorSwatch *dock, dock_list) { // if (!dock->isVisible() || dock->isFloating()) // continue; @@ -467,7 +467,7 @@ void ColorSwatch::updateContextMenu() void ColorSwatch::splitInto(QAction *action) { QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget()); - QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow); + QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>(); ColorSwatch *target = 0; foreach (ColorSwatch *dock, dock_list) { if (action->text() == dock->objectName()) { @@ -486,7 +486,7 @@ void ColorSwatch::splitInto(QAction *action) void ColorSwatch::tabInto(QAction *action) { QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget()); - QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow); + QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>(); ColorSwatch *target = 0; foreach (ColorSwatch *dock, dock_list) { if (action->text() == dock->objectName()) { diff --git a/demos/mainwindow/toolbar.cpp b/demos/mainwindow/toolbar.cpp index dd12419..a988d85 100644 --- a/demos/mainwindow/toolbar.cpp +++ b/demos/mainwindow/toolbar.cpp @@ -232,7 +232,7 @@ void ToolBar::updateMenu() void ToolBar::order() { QList<QAction *> ordered, actions1 = actions(), - actions2 = qFindChildren<QAction *>(this); + actions2 = findChildren<QAction *>(); while (!actions2.isEmpty()) { QAction *action = actions2.takeFirst(); if (!actions1.contains(action)) diff --git a/demos/pathstroke/main.cpp b/demos/pathstroke/main.cpp index 534b233..b10b2ea 100644 --- a/demos/pathstroke/main.cpp +++ b/demos/pathstroke/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char **argv) PathStrokeWidget pathStrokeWidget(smallScreen); QStyle *arthurStyle = new ArthurStyle(); pathStrokeWidget.setStyle(arthurStyle); - QList<QWidget *> widgets = qFindChildren<QWidget *>(&pathStrokeWidget); + QList<QWidget *> widgets = pathStrokeWidget.findChildren<QWidget *>(); foreach (QWidget *w, widgets) { w->setStyle(arthurStyle); w->setAttribute(Qt::WA_AcceptTouchEvents); diff --git a/demos/pathstroke/pathstroke.cpp b/demos/pathstroke/pathstroke.cpp index 257d02a..308c540 100644 --- a/demos/pathstroke/pathstroke.cpp +++ b/demos/pathstroke/pathstroke.cpp @@ -382,7 +382,7 @@ void PathStrokeWidget::setStyle( QStyle * style ) { m_controls->setStyle(style); - QList<QWidget *> widgets = qFindChildren<QWidget *>(m_controls); + QList<QWidget *> widgets = m_controls->findChildren<QWidget *>(); foreach (QWidget *w, widgets) w->setStyle(style); } diff --git a/demos/qtdemo/examplecontent.cpp b/demos/qtdemo/examplecontent.cpp index 19be3e0..65c078d 100644 --- a/demos/qtdemo/examplecontent.cpp +++ b/demos/qtdemo/examplecontent.cpp @@ -91,8 +91,8 @@ QString ExampleContent::loadDescription() if (paragraphs.length() < 1 && Colors::verbose) qDebug() << "- ExampleContent::loadDescription(): Could not load description:" << MenuManager::instance()->info[this->name]["docfile"]; - QString description = Colors::contentColor + - QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); + QString description = Colors::contentColor + QLatin1String(""); + //QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); // QTBUG-12522: If there is no description why show an error to the user when qDebug above communications the issue (if it is indeed an issue at all) when demos are built? for (int p = 0; p < int(paragraphs.length()); ++p) { description = this->extractTextFromParagraph(paragraphs.item(p)); if (this->isSummary(description)) { diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index 7168b57..5b851b4 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -313,7 +313,7 @@ void MenuManager::showDocInAssistant(const QString &name) // Send command through remote control even if the process // was started to activate assistant and bring it to front: QTextStream str(&this->assistantProcess); - str << "SetSource " << url << QLatin1Char('\0') << endl; + str << "SetSource " << url << QLatin1Char('\n') << endl; } void MenuManager::launchExample(const QString &name) @@ -449,7 +449,7 @@ void MenuManager::init(MainWindow *window) window->scene->setStickyFocus(true); window->setFocus(); }else{ - qDebug() << "Error intializing QML subsystem, Declarative examples will not work"; + qDebug() << "Error initializing QML subsystem, Declarative examples will not work"; } } diff --git a/demos/shared/arthurstyle.cpp b/demos/shared/arthurstyle.cpp index 4be9079..3a2a2cb 100644 --- a/demos/shared/arthurstyle.cpp +++ b/demos/shared/arthurstyle.cpp @@ -394,7 +394,7 @@ int ArthurStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWid void ArthurStyle::polish(QWidget *widget) { if (widget->layout() && qobject_cast<QGroupBox *>(widget)) { - if (qFindChildren<QGroupBox *>(widget).size() == 0) { + if (widget->findChildren<QGroupBox *>().size() == 0) { widget->layout()->setSpacing(0); widget->layout()->setMargin(12); } else { diff --git a/demos/shared/arthurwidgets.cpp b/demos/shared/arthurwidgets.cpp index 4182ff1..2eaf96b 100644 --- a/demos/shared/arthurwidgets.cpp +++ b/demos/shared/arthurwidgets.cpp @@ -313,7 +313,7 @@ void ArthurFrame::loadSourceFile(const QString &sourceFile) void ArthurFrame::showSource() { // Check for existing source - if (qFindChild<QTextBrowser *>(this)) + if (findChild<QTextBrowser *>()) return; QString contents; diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro index c9da205..6305af4 100644 --- a/demos/spectrum/3rdparty/fftreal/fftreal.pro +++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro @@ -1,5 +1,7 @@ include(../../spectrum.pri) +static: error(This library cannot be built for static linkage) + TEMPLATE = lib TARGET = fftreal diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 1b419db..4fe8b6d 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -1,5 +1,7 @@ include(../spectrum.pri) +static: error(This application cannot be statically linked to the fftreal library) + TEMPLATE = app TARGET = spectrum diff --git a/demos/spectrum/app/settingsdialog.cpp b/demos/spectrum/app/settingsdialog.cpp index b5e8459..1f125c9 100644 --- a/demos/spectrum/app/settingsdialog.cpp +++ b/demos/spectrum/app/settingsdialog.cpp @@ -65,13 +65,13 @@ SettingsDialog::SettingsDialog( QAudioDeviceInfo device; foreach (device, availableInputDevices) m_inputDeviceComboBox->addItem(device.deviceName(), - qVariantFromValue(device)); + QVariant::fromValue(device)); foreach (device, availableOutputDevices) m_outputDeviceComboBox->addItem(device.deviceName(), - qVariantFromValue(device)); + QVariant::fromValue(device)); - m_windowFunctionComboBox->addItem(tr("None"), qVariantFromValue(int(NoWindow))); - m_windowFunctionComboBox->addItem("Hann", qVariantFromValue(int(HannWindow))); + m_windowFunctionComboBox->addItem(tr("None"), QVariant::fromValue(int(NoWindow))); + m_windowFunctionComboBox->addItem("Hann", QVariant::fromValue(int(HannWindow))); m_windowFunctionComboBox->setCurrentIndex(m_windowFunction); // Initialize default devices diff --git a/demos/spreadsheet/spreadsheetitem.cpp b/demos/spreadsheet/spreadsheetitem.cpp index e1f0143..93c82a0 100644 --- a/demos/spreadsheet/spreadsheetitem.cpp +++ b/demos/spreadsheet/spreadsheetitem.cpp @@ -72,10 +72,10 @@ QVariant SpreadSheetItem::data(int role) const if (role == Qt::TextColorRole) { if (!isNumber) - return qVariantFromValue(QColor(Qt::black)); + return QVariant::fromValue(QColor(Qt::black)); else if (number < 0) - return qVariantFromValue(QColor(Qt::red)); - return qVariantFromValue(QColor(Qt::blue)); + return QVariant::fromValue(QColor(Qt::red)); + return QVariant::fromValue(QColor(Qt::blue)); } if (role == Qt::TextAlignmentRole) |