From 9bdda0cd5ef842cb098a40d1d4e4701008f4cbda Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 30 Jun 2016 02:44:25 +0000 Subject: [PATCH] fix some compiler warnings Signed-off-by: Ivailo Monev --- src/core/tools/qscopedpointer.h | 6 ++++-- .../propertyeditor/designerpropertymanager.cpp | 5 ++--- .../propertyeditor/designerpropertymanager.h | 3 +-- .../components/propertyeditor/paletteeditor.cpp | 23 ++++++++++------------ .../components/propertyeditor/paletteeditor.h | 14 +++++-------- .../propertyeditor/paletteeditorbutton.cpp | 5 ++--- .../propertyeditor/paletteeditorbutton.h | 3 +-- .../components/propertyeditor/propertyeditor.cpp | 2 +- .../components/taskmenu/itemlisteditor.cpp | 2 +- src/designer/shared/actioneditor.cpp | 2 ++ src/designer/shared/actioneditor_p.h | 2 ++ src/designer/shared/layout.cpp | 2 -- src/designer/shared/qlayout_widget.cpp | 9 --------- src/gui/painting/qoutlinemapper.cpp | 5 ----- src/gui/styles/qplastiquestyle.cpp | 12 +++++------ src/gui/text/qfontdatabase.h | 2 +- src/gui/text/qfontdatabase_x11.h | 6 +++--- src/gui/text/qfontengine_ft_p.h | 3 ++- src/gui/text/qfontengine_x11.cpp | 6 +++--- src/gui/text/qfontengine_x11_p.h | 3 +-- src/shared/qtpropertybrowser/qtvariantproperty.cpp | 1 - 21 files changed, 47 insertions(+), 69 deletions(-) diff --git a/src/core/tools/qscopedpointer.h b/src/core/tools/qscopedpointer.h index 085b12743..11338abfa 100644 --- a/src/core/tools/qscopedpointer.h +++ b/src/core/tools/qscopedpointer.h @@ -48,8 +48,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE template -struct QScopedPointerDeleter +class QScopedPointerDeleter { +public: static inline void cleanup(T *pointer) { // Enforce a complete type. @@ -63,8 +64,9 @@ struct QScopedPointerDeleter }; template -struct QScopedPointerArrayDeleter +class QScopedPointerArrayDeleter { +public: static inline void cleanup(T *pointer) { // Enforce a complete type. diff --git a/src/designer/components/propertyeditor/designerpropertymanager.cpp b/src/designer/components/propertyeditor/designerpropertymanager.cpp index 48bb1dbd4..cf55b10df 100644 --- a/src/designer/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/components/propertyeditor/designerpropertymanager.cpp @@ -711,10 +711,9 @@ void ResetWidget::slotClicked() // ------------ DesignerPropertyManager: -DesignerPropertyManager::DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent) : +DesignerPropertyManager::DesignerPropertyManager(QObject *parent) : QtVariantPropertyManager(parent), m_changingSubValue(false), - m_core(core), m_sourceOfChange(0) { connect(this, SIGNAL(valueChanged(QtProperty*,QVariant)), this, SLOT(slotValueChanged(QtProperty*,QVariant))); @@ -2438,7 +2437,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, } break; case QVariant::Palette: { - PaletteEditorButton *ed = new PaletteEditorButton(m_core, qvariant_cast(manager->value(property)), parent); + PaletteEditorButton *ed = new PaletteEditorButton(qvariant_cast(manager->value(property)), parent); ed->setSuperPalette(qvariant_cast(manager->attributeValue(property, QLatin1String(superPaletteAttributeC)))); m_palettePropertyToEditors[property].append(ed); m_editorToPaletteProperty[ed] = property; diff --git a/src/designer/components/propertyeditor/designerpropertymanager.h b/src/designer/components/propertyeditor/designerpropertymanager.h index b521a59d5..370303f9f 100644 --- a/src/designer/components/propertyeditor/designerpropertymanager.h +++ b/src/designer/components/propertyeditor/designerpropertymanager.h @@ -102,7 +102,7 @@ class DesignerPropertyManager : public QtVariantPropertyManager { Q_OBJECT public: - explicit DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit DesignerPropertyManager(QObject *parent = 0); ~DesignerPropertyManager(); virtual QStringList attributes(int propertyType) const; @@ -231,7 +231,6 @@ private: QMap m_defaultIcons; bool m_changingSubValue; - QDesignerFormEditorInterface *m_core; QObject *m_object; diff --git a/src/designer/components/propertyeditor/paletteeditor.cpp b/src/designer/components/propertyeditor/paletteeditor.cpp index a0e3f358a..f2fcf1a7b 100644 --- a/src/designer/components/propertyeditor/paletteeditor.cpp +++ b/src/designer/components/propertyeditor/paletteeditor.cpp @@ -61,21 +61,20 @@ namespace qdesigner_internal { enum { BrushRole = 33 }; -PaletteEditor::PaletteEditor(QDesignerFormEditorInterface *core, QWidget *parent) : +PaletteEditor::PaletteEditor(QWidget *parent) : QDialog(parent), m_currentColorGroup(QPalette::Active), m_paletteModel(new PaletteModel(this)), m_modelUpdated(false), m_paletteUpdated(false), - m_compute(true), - m_core(core) + m_compute(true) { ui.setupUi(this); ui.paletteView->setModel(m_paletteModel); updatePreviewPalette(); updateStyledButton(); ui.paletteView->setModel(m_paletteModel); - ColorDelegate *delegate = new ColorDelegate(core, this); + ColorDelegate *delegate = new ColorDelegate(this); ui.paletteView->setItemDelegate(delegate); ui.paletteView->setEditTriggers(QAbstractItemView::AllEditTriggers); connect(m_paletteModel, SIGNAL(paletteChanged(QPalette)), @@ -214,10 +213,10 @@ void PaletteEditor::updateStyledButton() ui.buildButton->setColor(palette().color(QPalette::Active, QPalette::Button)); } -QPalette PaletteEditor::getPalette(QDesignerFormEditorInterface *core, QWidget* parent, const QPalette &init, +QPalette PaletteEditor::getPalette(QWidget* parent, const QPalette &init, const QPalette &parentPal, int *ok) { - PaletteEditor dlg(core, parent); + PaletteEditor dlg(parent); QPalette parentPalette(parentPal); uint mask = init.resolve(); for (int i = 0; i < (int)QPalette::NColorRoles; i++) { @@ -417,11 +416,10 @@ int PaletteModel::groupToColumn(QPalette::ColorGroup group) const ////////////////////////// -BrushEditor::BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent) : +BrushEditor::BrushEditor(QWidget *parent) : QWidget(parent), m_button(new QtColorButton(this)), - m_changed(false), - m_core(core) + m_changed(false) { QLayout *layout = new QHBoxLayout(this); layout->setMargin(0); @@ -504,9 +502,8 @@ void RoleEditor::emitResetProperty() } ////////////////////////// -ColorDelegate::ColorDelegate(QDesignerFormEditorInterface *core, QObject *parent) : - QItemDelegate(parent), - m_core(core) +ColorDelegate::ColorDelegate(QObject *parent) : + QItemDelegate(parent) { } @@ -521,7 +518,7 @@ QWidget *ColorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem //editor->installEventFilter(const_cast(this)); ed = editor; } else { - BrushEditor *editor = new BrushEditor(m_core, parent); + BrushEditor *editor = new BrushEditor(parent); connect(editor, SIGNAL(changed(QWidget*)), this, SIGNAL(commitData(QWidget*))); editor->setFocusPolicy(Qt::NoFocus); editor->installEventFilter(const_cast(this)); diff --git a/src/designer/components/propertyeditor/paletteeditor.h b/src/designer/components/propertyeditor/paletteeditor.h index c752093a3..cdd7ca6f5 100644 --- a/src/designer/components/propertyeditor/paletteeditor.h +++ b/src/designer/components/propertyeditor/paletteeditor.h @@ -60,8 +60,8 @@ class PaletteEditor: public QDialog public: virtual ~PaletteEditor(); - static QPalette getPalette(QDesignerFormEditorInterface *core, - QWidget* parent, const QPalette &init = QPalette(), + static QPalette getPalette( QWidget* parent, + const QPalette &init = QPalette(), const QPalette &parentPal = QPalette(), int *result = 0); QPalette palette() const; @@ -82,7 +82,7 @@ private slots: protected: private: - PaletteEditor(QDesignerFormEditorInterface *core, QWidget *parent); + PaletteEditor(QWidget *parent); void buildPalette(); void updatePreviewPalette(); @@ -99,7 +99,6 @@ private: bool m_modelUpdated; bool m_paletteUpdated; bool m_compute; - QDesignerFormEditorInterface *m_core; }; @@ -140,7 +139,7 @@ class BrushEditor : public QWidget { Q_OBJECT public: - explicit BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit BrushEditor(QWidget *parent = 0); void setBrush(const QBrush &brush); QBrush brush() const; @@ -152,7 +151,6 @@ private slots: private: QtColorButton *m_button; bool m_changed; - QDesignerFormEditorInterface *m_core; }; class RoleEditor : public QWidget @@ -178,7 +176,7 @@ class ColorDelegate : public QItemDelegate Q_OBJECT public: - explicit ColorDelegate(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit ColorDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -193,8 +191,6 @@ public: virtual void paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const; virtual QSize sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const; -private: - QDesignerFormEditorInterface *m_core; }; } // namespace qdesigner_internal diff --git a/src/designer/components/propertyeditor/paletteeditorbutton.cpp b/src/designer/components/propertyeditor/paletteeditorbutton.cpp index b0437aeff..13f3b34bd 100644 --- a/src/designer/components/propertyeditor/paletteeditorbutton.cpp +++ b/src/designer/components/propertyeditor/paletteeditorbutton.cpp @@ -48,11 +48,10 @@ QT_BEGIN_NAMESPACE using namespace qdesigner_internal; -PaletteEditorButton::PaletteEditorButton(QDesignerFormEditorInterface *core, const QPalette &palette, QWidget *parent) +PaletteEditorButton::PaletteEditorButton(const QPalette &palette, QWidget *parent) : QToolButton(parent), m_palette(palette) { - m_core = core; setFocusPolicy(Qt::NoFocus); setText(tr("Change Palette")); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); @@ -78,7 +77,7 @@ void PaletteEditorButton::showPaletteEditor() { int result; QPalette p = QPalette(); - QPalette pal = PaletteEditor::getPalette(m_core, 0, m_palette, m_superPalette, &result); + QPalette pal = PaletteEditor::getPalette(0, m_palette, m_superPalette, &result); if (result == QDialog::Accepted) { m_palette = pal; emit paletteChanged(m_palette); diff --git a/src/designer/components/propertyeditor/paletteeditorbutton.h b/src/designer/components/propertyeditor/paletteeditorbutton.h index 21285d4fd..a4d59af86 100644 --- a/src/designer/components/propertyeditor/paletteeditorbutton.h +++ b/src/designer/components/propertyeditor/paletteeditorbutton.h @@ -57,7 +57,7 @@ class QT_PROPERTYEDITOR_EXPORT PaletteEditorButton: public QToolButton { Q_OBJECT public: - PaletteEditorButton(QDesignerFormEditorInterface *core, const QPalette &palette, QWidget *parent = 0); + PaletteEditorButton(const QPalette &palette, QWidget *parent = 0); virtual ~PaletteEditorButton(); void setSuperPalette(const QPalette &palette); @@ -76,7 +76,6 @@ private slots: private: QPalette m_palette; QPalette m_superPalette; - QDesignerFormEditorInterface *m_core; }; } // namespace qdesigner_internal diff --git a/src/designer/components/propertyeditor/propertyeditor.cpp b/src/designer/components/propertyeditor/propertyeditor.cpp index 4ae988803..7f65fa6c7 100644 --- a/src/designer/components/propertyeditor/propertyeditor.cpp +++ b/src/designer/components/propertyeditor/propertyeditor.cpp @@ -222,7 +222,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare m_propertySheet(0), m_currentBrowser(0), m_treeBrowser(0), - m_propertyManager(new DesignerPropertyManager(m_core, this)), + m_propertyManager(new DesignerPropertyManager(this)), m_dynamicGroup(0), m_updatingBrowser(false), m_stackedWidget(new QStackedWidget), diff --git a/src/designer/components/taskmenu/itemlisteditor.cpp b/src/designer/components/taskmenu/itemlisteditor.cpp index 6c0995f39..3ec04a686 100644 --- a/src/designer/components/taskmenu/itemlisteditor.cpp +++ b/src/designer/components/taskmenu/itemlisteditor.cpp @@ -85,7 +85,7 @@ AbstractItemEditor::AbstractItemEditor(QDesignerFormWindowInterface *form, QWidg m_updatingBrowser(false) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - m_propertyManager = new DesignerPropertyManager(form->core(), this); + m_propertyManager = new DesignerPropertyManager(this); m_editorFactory = new DesignerEditorFactory(form->core(), this); m_editorFactory->setSpacing(0); m_propertyBrowser = new ItemPropertyBrowser; diff --git a/src/designer/shared/actioneditor.cpp b/src/designer/shared/actioneditor.cpp index 882b58b3f..f372ba550 100644 --- a/src/designer/shared/actioneditor.cpp +++ b/src/designer/shared/actioneditor.cpp @@ -118,7 +118,9 @@ public: ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerActionEditorInterface(parent, flags), m_core(core), +#if 0 // ### implement me m_actionGroups(0), +#endif m_actionView(new ActionView), m_actionNew(new QAction(tr("New..."), this)), m_actionEdit(new QAction(tr("Edit..."), this)), diff --git a/src/designer/shared/actioneditor_p.h b/src/designer/shared/actioneditor_p.h index 5a7e1ab23..cbee1f675 100644 --- a/src/designer/shared/actioneditor_p.h +++ b/src/designer/shared/actioneditor_p.h @@ -139,7 +139,9 @@ private: QDesignerFormEditorInterface *m_core; QPointer m_formWindow; +#if 0 // ### implement me QListWidget *m_actionGroups; +#endif ActionView *m_actionView; diff --git a/src/designer/shared/layout.cpp b/src/designer/shared/layout.cpp index bd93ca085..6f88bd3ed 100644 --- a/src/designer/shared/layout.cpp +++ b/src/designer/shared/layout.cpp @@ -697,8 +697,6 @@ QDebug Grid::debug(QDebug str) const return str; } -static inline QDebug operator<<(QDebug str, const Grid &g) { return g.debug(str); } - void Grid::setCells(const QRect &c, QWidget* w) { const int bottom = c.top() + c.height(); diff --git a/src/designer/shared/qlayout_widget.cpp b/src/designer/shared/qlayout_widget.cpp index e7700307b..f54d8fc9c 100644 --- a/src/designer/shared/qlayout_widget.cpp +++ b/src/designer/shared/qlayout_widget.cpp @@ -110,14 +110,6 @@ inline void getGridItemPosition(QFormLayout *formLayout, int index, int *row, in qdesigner_internal::getFormLayoutItemPosition(formLayout, index, row, column, rowspan, colspan); } -QRect gridItemInfo(const QFormLayout *form, int index) -{ - int row; - int column; - int colspan; - qdesigner_internal::getFormLayoutItemPosition(form, index, &row, &column, 0, &colspan); - return QRect(column, row, colspan, 1); -} } // namespace anonymous QT_BEGIN_NAMESPACE @@ -160,7 +152,6 @@ static QDebug debugGridLikeLayout(QDebug str, const GridLikeLayout &gl) } static inline QDebug operator<<(QDebug str, const QGridLayout &gl) { return debugGridLikeLayout(str, gl); } -static inline QDebug operator<<(QDebug str, const QFormLayout &fl) { return debugGridLikeLayout(str, fl); } static inline bool isEmptyFormLayoutRow(const QFormLayout *fl, int row) { diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index ec5ddc816..3fb3329d8 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -47,13 +47,8 @@ QT_BEGIN_NAMESPACE -static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; - #define qreal_to_fixed_26_6(f) (int(f * 64)) - - - static const QRectF boundingRect(const QPointF *points, int pointCount) { const QPointF *e = points; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 5de790ad1..43ae6d5b2 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -926,17 +926,17 @@ static QString elliditide(const QString &text, const QFontMetrics &fontMetrics, QString rightHalf = title.mid(leftHalf.size() + 1); while (!leftHalf.isEmpty() && !rightHalf.isEmpty()) { leftHalf.chop(1); - int width = fontMetrics.width(leftHalf + ellipsis + rightHalf); - if (width < rect.width()) { + int fontwidth = fontMetrics.width(leftHalf + ellipsis + rightHalf); + if (fontwidth < rect.width()) { title = leftHalf + ellipsis + rightHalf; - width = width; + width = fontwidth; break; } rightHalf.remove(0, 1); - width = fontMetrics.width(leftHalf + ellipsis + rightHalf); - if (width < rect.width()) { + fontwidth = fontMetrics.width(leftHalf + ellipsis + rightHalf); + if (fontwidth < rect.width()) { title = leftHalf + ellipsis + rightHalf; - width = width; + width = fontwidth; break; } } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index 433ef6d9d..d4725177e 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -152,7 +152,7 @@ private: static QString resolveFontFamilyAlias(const QString &family); static void load(const QFontPrivate *d, int script); #ifdef Q_WS_X11 - static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1); + static QFontEngine *loadXlfd(int script, const QFontDef &request, int force_encoding_id = -1); #endif friend struct QFontDef; diff --git a/src/gui/text/qfontdatabase_x11.h b/src/gui/text/qfontdatabase_x11.h index 193ee8e5d..6e8a4aee8 100644 --- a/src/gui/text/qfontdatabase_x11.h +++ b/src/gui/text/qfontdatabase_x11.h @@ -1791,7 +1791,7 @@ static QFontEngine *loadRaw(const QFontPrivate *fp, const QFontDef &request) return fe; } -QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id) +QFontEngine *QFontDatabase::loadXlfd(int script, const QFontDef &request, int force_encoding_id) { QMutexLocker locker(fontDatabaseMutex()); @@ -1900,7 +1900,7 @@ QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &req } #endif - fe = new QFontEngineMultiXLFD(request, encodings, screen); + fe = new QFontEngineMultiXLFD(request, encodings); } return fe; } @@ -1974,7 +1974,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) fe = loadFc(d, script, req); #endif } else if (mainThread && qt_is_gui_used) { - fe = loadXlfd(d->screen, script, req); + fe = loadXlfd(script, req); } if (!fe) { fe = new QFontEngineBox(req.pixelSize); diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index e832f90ee..ec66f47e1 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -80,8 +80,9 @@ class QFontEngineFTRawFont; * This struct represents one font file on disk (like Arial.ttf) and is shared between all the font engines * that show this font file (at different pixel sizes). */ -struct QFreetypeFace +class QFreetypeFace { +public: void computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing); QFontEngine::Properties properties() const; bool getSfntTable(uint tag, uchar *buffer, uint *length) const; diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index ffe4607c5..9dab40e8b 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -105,8 +105,8 @@ QT_BEGIN_NAMESPACE // Multi XLFD engine // ------------------------------------------------------------------ -QFontEngineMultiXLFD::QFontEngineMultiXLFD(const QFontDef &r, const QList &l, int s) - : QFontEngineMulti(l.size()), encodings(l), screen(s), request(r) +QFontEngineMultiXLFD::QFontEngineMultiXLFD(const QFontDef &r, const QList &l) + : QFontEngineMulti(l.size()), encodings(l), request(r) { loadEngine(0); fontDef = engines[0]->fontDef; @@ -120,7 +120,7 @@ void QFontEngineMultiXLFD::loadEngine(int at) Q_ASSERT(at < engines.size()); Q_ASSERT(engines.at(at) == 0); const int encoding = encodings.at(at); - QFontEngine *fontEngine = QFontDatabase::loadXlfd(0, QUnicodeTables::Common, request, encoding); + QFontEngine *fontEngine = QFontDatabase::loadXlfd(QUnicodeTables::Common, request, encoding); Q_ASSERT(fontEngine != 0); fontEngine->ref.ref(); engines[at] = fontEngine; diff --git a/src/gui/text/qfontengine_x11_p.h b/src/gui/text/qfontengine_x11_p.h index fcf7ae885..669402330 100644 --- a/src/gui/text/qfontengine_x11_p.h +++ b/src/gui/text/qfontengine_x11_p.h @@ -65,14 +65,13 @@ class QFreetypeFace; class QFontEngineMultiXLFD : public QFontEngineMulti { public: - QFontEngineMultiXLFD(const QFontDef &r, const QList &l, int s); + QFontEngineMultiXLFD(const QFontDef &r, const QList &l); ~QFontEngineMultiXLFD(); void loadEngine(int at); private: QList encodings; - int screen; QFontDef request; }; diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp index 947822146..f065de7d6 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -140,7 +140,6 @@ static QtProperty *wrappedProperty(QtProperty *property) class QtVariantPropertyPrivate { - QtVariantProperty *q_ptr; public: QtVariantPropertyPrivate(QtVariantPropertyManager *m) : manager(m) {} -- 2.11.0