changeset 616:d632a1e87018 qt5

Build fixes for Qt5
author Chris Cannam
date Mon, 11 Mar 2013 14:23:52 +0000
parents 156a120345ae
children 0b9960f0f0bc
files layer/Colour3DPlotLayer.cpp layer/SpectrogramLayer.cpp layer/TimeValueLayer.cpp svgui.pro view/Pane.cpp widgets/AudioDial.cpp widgets/InteractiveFileFinder.cpp widgets/KeyReference.cpp widgets/LayerTree.cpp widgets/LayerTreeDialog.cpp widgets/ListInputDialog.cpp widgets/ListInputDialog.h widgets/Thumbwheel.cpp widgets/TipDialog.cpp widgets/TipDialog.h
diffstat 15 files changed, 35 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -952,13 +952,13 @@
     if (!m_cache) {
         m_cache = new QImage
             (cacheWidth, cacheHeight, QImage::Format_Indexed8);
-        m_cache->setNumColors(256);
+// No longer exists in Qt5:        m_cache->setNumColors(256);
         m_cache->fill(0);
         if (!m_normalizeVisibleArea) {
             m_peaksCache = new QImage
                 (cacheWidth / m_peakResolution + 1, cacheHeight,
                  QImage::Format_Indexed8);
-            m_peaksCache->setNumColors(256);
+// No longer exists in Qt5:            m_peaksCache->setNumColors(256);
             m_peaksCache->fill(0);
         } else if (m_peaksCache) {
             delete m_peaksCache;
--- a/layer/SpectrogramLayer.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/layer/SpectrogramLayer.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -2293,7 +2293,7 @@
         if (m_colourScale == PhaseColourScale) usePeaksCache = false;
     }
 
-    m_drawBuffer.setNumColors(256);
+// No longer exists in Qt5:    m_drawBuffer.setNumColors(256);
     for (int pixel = 0; pixel < 256; ++pixel) {
         m_drawBuffer.setColor(pixel, m_palette.getColour(pixel).rgb());
     }
--- a/layer/TimeValueLayer.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/layer/TimeValueLayer.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -1791,7 +1791,7 @@
 
             if (generation == Labeller::ValueFromCyclicalCounter ||
                 generation == Labeller::ValueFromTwoLevelCounter) {
-                int cycleSize = QInputDialog::getInteger
+                int cycleSize = QInputDialog::getInt
                     (0, tr("Select cycle size"),
                      tr("Cycle size:"), 4, 2, 16, 1);
                 labeller.setCounterCycleSize(cycleSize);
--- a/svgui.pro	Fri Nov 16 17:14:12 2012 +0000
+++ b/svgui.pro	Mon Mar 11 14:23:52 2013 +0000
@@ -4,7 +4,7 @@
 include(config.pri)
 
 CONFIG += staticlib qt thread warn_on stl rtti exceptions
-QT += network xml gui
+QT += network xml gui widgets
 
 TARGET = svgui
 
--- a/view/Pane.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/view/Pane.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -35,6 +35,7 @@
 #include <QDropEvent>
 #include <QCursor>
 #include <QTextStream>
+#include <QMimeData>
 
 #include <iostream>
 #include <cmath>
@@ -1507,7 +1508,8 @@
 
 //    std::cerr << "mouseMoveEvent" << std::endl;
 
-    updateContextHelp(&e->pos());
+    QPoint pos = e->pos();
+    updateContextHelp(&pos);
 
     if (m_navigating && m_clickedInRange && !m_releasing) {
 
@@ -2260,7 +2262,8 @@
               << ", possibleActions: " << e->possibleActions()
               << ", proposedAction: " << e->proposedAction() << std::endl;
     
-    if (e->provides("text/uri-list") || e->provides("text/plain")) {
+    if (e->mimeData()->hasFormat("text/uri-list") ||
+        e->mimeData()->hasFormat("text/plain")) {
 
         if (e->proposedAction() & Qt::CopyAction) {
             e->acceptProposedAction();
@@ -2277,7 +2280,8 @@
     std::cerr << "dropEvent: text: \"" << e->mimeData()->text().toStdString()
               << "\"" << std::endl;
 
-    if (e->provides("text/uri-list") || e->provides("text/plain")) {
+    if (e->mimeData()->hasFormat("text/uri-list") || 
+        e->mimeData()->hasFormat("text/plain")) {
 
         if (e->proposedAction() & Qt::CopyAction) {
             e->acceptProposedAction();
@@ -2286,16 +2290,16 @@
             e->accept();
         }
 
-        if (e->provides("text/uri-list")) {
-
-            SVDEBUG << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << endl;
+        if (e->mimeData()->hasFormat("text/uri-list")) {
+
+            SVDEBUG << "accepting... data is \"" << e->mimeData()->data("text/uri-list").data() << "\"" << endl;
             emit dropAccepted(QString::fromLocal8Bit
-                              (e->encodedData("text/uri-list").data())
+                              (e->mimeData()->data("text/uri-list").data())
                               .split(QRegExp("[\\r\\n]+"), 
                                      QString::SkipEmptyParts));
         } else {
             emit dropAccepted(QString::fromLocal8Bit
-                              (e->encodedData("text/plain").data()));
+                              (e->mimeData()->data("text/plain").data()));
         }
     }
 }
--- a/widgets/AudioDial.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/AudioDial.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -510,7 +510,7 @@
         
     } else {
         
-        int newPosition = QInputDialog::getInteger
+        int newPosition = QInputDialog::getInt
             (this,
              tr("Enter new value"),
              tr("Enter a new value from %1 to %2:")
--- a/widgets/InteractiveFileFinder.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/InteractiveFileFinder.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -130,7 +130,7 @@
     // Use our own QFileDialog just for symmetry with getSaveFileName below
 
     QFileDialog dialog;
-    dialog.setFilters(filter.split('\n'));
+    dialog.setNameFilters(filter.split('\n'));
     dialog.setWindowTitle(title);
     dialog.setDirectory(lastPath);
 
@@ -254,7 +254,7 @@
     // need to adjust the file extension based on the selected filter
 
     QFileDialog dialog;
-    dialog.setFilters(filter.split('\n'));
+    dialog.setNameFilters(filter.split('\n'));
     dialog.setWindowTitle(title);
     dialog.setDirectory(lastPath);
 
@@ -289,7 +289,7 @@
         if ((type == LayerFile || type == LayerFileNoMidi)
             && fi.suffix() == "") {
             QString expectedExtension;
-            QString selectedFilter = dialog.selectedFilter();
+            QString selectedFilter = dialog.selectedNameFilter();
             if (selectedFilter.contains(".svl")) {
                 expectedExtension = "svl";
             } else if (selectedFilter.contains(".txt")) {
--- a/widgets/KeyReference.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/KeyReference.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -49,7 +49,7 @@
     QString name = action->text();
     if (overrideName != "") name = overrideName;
 
-    QString shortcut = action->shortcut();
+    QString shortcut = action->shortcut().toString();
     QString tip = action->statusTip();
 
     registerShortcut(name, shortcut, tip);
--- a/widgets/LayerTree.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/LayerTree.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -238,7 +238,7 @@
 {
     if (!parent.isValid()) {
         if (row >= m_models.size()) return QModelIndex();
-	return createIndex(row, column, 0);
+	return createIndex(row, column, (void *)0);
     }
 
     return QModelIndex();
--- a/widgets/LayerTreeDialog.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/LayerTreeDialog.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -51,7 +51,7 @@
     subgrid->addWidget(m_modelView);
 
     m_modelView->verticalHeader()->hide();
-    m_modelView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
+    m_modelView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
     m_modelView->setShowGrid(false);
 
     m_modelModel = new ModelMetadataModel(m_paneStack, true);
@@ -69,7 +69,7 @@
     subgrid->setMargin(5);
 
     m_layerView = new QTreeView;
-    m_layerView->header()->setResizeMode(QHeaderView::ResizeToContents);
+    m_layerView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
     subgrid->addWidget(m_layerView);
 
     m_layerModel = new LayerTreeModel(m_paneStack);
--- a/widgets/ListInputDialog.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/ListInputDialog.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -25,8 +25,8 @@
 
 ListInputDialog::ListInputDialog(QWidget *parent, const QString &title,
 				 const QString &labelText, const QStringList &list,
-				 int current, Qt::WFlags f) :
-    QDialog(parent, f),
+				 int current) :
+    QDialog(parent),
     m_strings(list)
 {
     setWindowTitle(title);
@@ -89,9 +89,9 @@
 QString
 ListInputDialog::getItem(QWidget *parent, const QString &title,
                          const QString &label, const QStringList &list,
-                         int current, bool *ok, Qt::WFlags f)
+                         int current, bool *ok)
 {
-    ListInputDialog dialog(parent, title, label, list, current, f);
+    ListInputDialog dialog(parent, title, label, list, current);
     
     bool accepted = (dialog.exec() == QDialog::Accepted);
     if (ok) *ok = accepted;
--- a/widgets/ListInputDialog.h	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/ListInputDialog.h	Mon Mar 11 14:23:52 2013 +0000
@@ -37,7 +37,7 @@
 public:
     ListInputDialog(QWidget *parent, const QString &title,
                     const QString &label, const QStringList &list,
-                    int current = 0, Qt::WFlags f = 0);
+                    int current = 0);
     virtual ~ListInputDialog();
 
     void setItemAvailability(int item, bool available);
@@ -47,7 +47,7 @@
     
     static QString getItem(QWidget *parent, const QString &title,
                            const QString &label, const QStringList &list,
-                           int current = 0, bool *ok = 0, Qt::WFlags f = 0);
+                           int current = 0, bool *ok = 0);
 
 protected:
     QStringList m_strings;
--- a/widgets/Thumbwheel.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/Thumbwheel.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -373,7 +373,7 @@
         
     } else {
         
-        int newValue = QInputDialog::getInteger
+        int newValue = QInputDialog::getInt
             (this,
              tr("Enter new value"),
              tr("Enter a new value from %1 to %2:")
--- a/widgets/TipDialog.cpp	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/TipDialog.cpp	Mon Mar 11 14:23:52 2013 +0000
@@ -28,8 +28,8 @@
 
 #include <iostream>
 
-TipDialog::TipDialog(QWidget *parent, Qt::WFlags flags) :
-    QDialog(parent, flags),
+TipDialog::TipDialog(QWidget *parent) :
+    QDialog(parent),
     m_tipNumber(0),
     m_label(0),
     m_caption(tr("Tip of the Day"))
--- a/widgets/TipDialog.h	Fri Nov 16 17:14:12 2012 +0000
+++ b/widgets/TipDialog.h	Mon Mar 11 14:23:52 2013 +0000
@@ -32,7 +32,7 @@
     Q_OBJECT
 
 public:
-    TipDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
+    TipDialog(QWidget *parent = 0);
     virtual ~TipDialog();
 
     bool isOK() { return !m_tips.empty(); }