Remove redundant #ifdef's from benchmarks
authorJason McDonald <jason.mcdonald@nokia.com>
Wed, 18 May 2011 07:55:57 +0000 (17:55 +1000)
committerJason McDonald <jason.mcdonald@nokia.com>
Thu, 19 May 2011 04:54:16 +0000 (14:54 +1000)
Preprocessor directives that refer to QT_VERSION's less than Qt 5 are
redundant in the qt5 modules.

Change-Id: Id3a9c5f0ba07b72d1c99e51c12a240570bf0d58e
Reviewed-by: Rohan McGovern
23 files changed:
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp
tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h
tests/benchmarks/gui/painting/qtbench/benchmarktests.h
tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp

index 2b1e87c..3993cc9 100644 (file)
@@ -84,10 +84,8 @@ bool AbstractItemContainer::event(QEvent *e)
 bool AbstractItemContainer::eventFilter(QObject *obj, QEvent *event)
 {
     if (event->type()==QEvent::GraphicsSceneResize && m_itemView) {
-#if (QT_VERSION >= 0x040600)
         const bool caching = m_itemView->listItemCaching();
         m_itemView->setListItemCaching(false);
-#endif
 
         QSizeF s = m_itemView->size();
         s.setWidth(s.width()-m_itemView->verticalScrollBar()->size().width());
@@ -96,9 +94,7 @@ bool AbstractItemContainer::eventFilter(QObject *obj, QEvent *event)
         m_itemView->updateViewContent();
         updateItemBuffer();
 
-#if (QT_VERSION >= 0x040600)
         m_itemView->setListItemCaching(caching);
-#endif
     }
 
     return QGraphicsWidget::eventFilter(obj, event);
@@ -373,7 +369,6 @@ void AbstractItemContainer::updateContent()
         m_items.at(i)->updateItemContents();
 }
 
-#if (QT_VERSION >= 0x040600)
 void AbstractItemContainer::setSubtreeCacheEnabled(bool enabled)
 {
     for (int i = 0; i <m_items.count(); ++i)
@@ -381,7 +376,6 @@ void AbstractItemContainer::setSubtreeCacheEnabled(bool enabled)
     if (m_prototype)
         m_prototype->setSubtreeCacheEnabled(enabled);
 }
-#endif
 
 void AbstractItemContainer::setTwoColumns(const bool enabled)
 {
index 249f7a7..495ef89 100644 (file)
@@ -74,10 +74,8 @@ public:
     virtual void setTwoColumns(const bool enabled);
     bool twoColumns();
 
-#if (QT_VERSION >= 0x040600)
     void setSubtreeCacheEnabled(const bool enabled);
     virtual void setListItemCaching(const bool enabled, const int index) = 0;
-#endif
 
 protected:
     virtual void adjustVisibleContainerSize(const QSizeF &size) = 0;
index 63ab2f9..b617a44 100644 (file)
@@ -415,10 +415,8 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy)
 
         for (int i = 0; i<itemsInContainer; ++i) {
             AbstractViewItem *changedItem = m_container->itemAt(i);
-            changedItem->setModelIndex(m_model->index(startRow+i,0));            
-#if (QT_VERSION >= 0x040600)
+            changedItem->setModelIndex(m_model->index(startRow+i,0));
             m_container->setListItemCaching(listItemCaching(), i);
-#endif
         }
 
         qreal diff = vPos-startRow*itemH;
index 2e286fb..a94d673 100644 (file)
@@ -76,10 +76,8 @@ public:
     void updateViewContent();
     virtual void scrollContentsBy(qreal dx, qreal dy);
 
-#if (QT_VERSION >= 0x040600)
     virtual bool listItemCaching() const = 0;
     virtual void setListItemCaching(bool enabled) = 0;
-#endif
 
 protected:
     virtual bool event(QEvent *e);
index 2787a2e..ff782bd 100644 (file)
@@ -106,12 +106,10 @@ void AbstractViewItem::themeChange()
     ; // No impl yet
 }
 
-#if (QT_VERSION >= 0x040600)
 /*virtual*/
 void AbstractViewItem::setSubtreeCacheEnabled(bool enabled)
 {
     Q_UNUSED(enabled)
     ; // No impl
 }
-#endif
 
index 1eace4e..a4a3c47 100644 (file)
@@ -69,9 +69,7 @@ public:
     virtual void updateItemContents();
     virtual void themeChange();
 
-#if (QT_VERSION >= 0x040600)
     virtual void setSubtreeCacheEnabled(bool enabled);
-#endif
 
     virtual QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
 
index 718c1b8..93c3d8a 100644 (file)
 
 #include <QtGui>
 #include <QSvgRenderer>
-
-#if (QT_VERSION >= 0x040600)
 #include <QGraphicsEffect>
-#endif
 
 #include "iconitem.h"
 
@@ -52,9 +49,7 @@ IconItem::IconItem(const QString &filename, QGraphicsItem *parent)
   : GvbWidget(parent)
   , m_filename(filename)
   , m_rotation(0.0)
-#if (QT_VERSION >= 0x040600)
   , m_opacityEffect(0)
-#endif
   , m_smoothTransformation(false)
 {
     setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
@@ -140,7 +135,6 @@ void IconItem::setFileName(const QString &filename)
     }
 }
 
-#if (QT_VERSION >= 0x040600)
 void IconItem::setOpacityEffectEnabled(const bool enable)
 {
     if (!m_opacityEffect)
@@ -166,4 +160,3 @@ bool IconItem::isOpacityEffectEnabled() const
 
     return false;
 }
-#endif
index ea9e9a5..29fafb7 100644 (file)
@@ -46,9 +46,7 @@
 
 #include "gvbwidget.h"
 
-#if (QT_VERSION >= 0x040600)
 class QGraphicsOpacityEffect;
-#endif
 class QPainter;
 
 class IconItem : public GvbWidget
@@ -64,10 +62,9 @@ public:
     QString fileName() const;
     void setFileName(const QString &filename);
 
-#if (QT_VERSION >= 0x040600)
     void setOpacityEffectEnabled(const bool enable);
     bool isOpacityEffectEnabled() const;
-#endif
+
     void setRotation(const qreal rotation) { m_rotation = rotation; }
     qreal rotation() const { return m_rotation; }
 
@@ -87,9 +84,7 @@ private:
     QString m_filename;
     QPixmap m_pixmap;
     qreal m_rotation;
-#if (QT_VERSION >= 0x040600)
     QGraphicsOpacityEffect *m_opacityEffect;
-#endif
     bool m_smoothTransformation;
 };
 
index 06c7b14..d5cd877 100644 (file)
@@ -161,10 +161,8 @@ void ItemRecyclingList::themeChange()
             // Update icons
             item->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon));
-#if (QT_VERSION >= 0x040600)
             item->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon));
-#endif
             item->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon));
         }
@@ -208,25 +206,17 @@ void ItemRecyclingList::keyPressEvent(QKeyEvent *event)
 
 bool ItemRecyclingList::listItemCaching() const
 {
-#if (QT_VERSION >= 0x040600)
     ListItemContainer *container =
         static_cast<ListItemContainer *>(m_container);
 
     return container->listItemCaching();
-#else
-    return false;
-#endif
 }
 
 void ItemRecyclingList::setListItemCaching(bool enabled)
 {
-#if (QT_VERSION >= 0x040600)
     ListItemContainer *container =
         static_cast<ListItemContainer *>(m_container);
     container->setListItemCaching(enabled);
-#else
-    Q_UNUSED(enabled)
-#endif
 }
 
 void ItemRecyclingList::updateListItemBackgrounds(int index)
@@ -255,17 +245,13 @@ void ItemRecyclingList::setTwoColumns(const bool enabled)
     if (twoColumns() == enabled)
         return;
 
-#if (QT_VERSION >= 0x040600)
     const bool caching = listItemCaching();
     setListItemCaching(false);
-#endif
 
     m_container->setTwoColumns(enabled);
     refreshContainerGeometry();
 
-#if (QT_VERSION >= 0x040600)
     setListItemCaching(caching);
-#endif
 }
 
 bool ItemRecyclingList::twoColumns()
index 9798fe5..1c19d2c 100644 (file)
@@ -51,10 +51,8 @@ public:
     virtual ~ItemRecyclingListView();
     void setCurrentRow(const int row);
     int rows() const;
-#if (QT_VERSION >= 0x040600)
     virtual bool listItemCaching() const = 0;
     virtual void setListItemCaching(bool enabled) = 0;
-#endif
 
 protected:
     void rowsInserted(const QModelIndex &parent, int start, int end);
index ad73ca9..25acb02 100644 (file)
@@ -50,10 +50,8 @@ Label::Label(const QString& text, QGraphicsItem *parent)
     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     setContentsMargins(0, 0, 0, 0);
     setText(text);
-#if QT_VERSION >= 0x040600
     // This flag was introduced in Qt 4.6.
     setFlag(QGraphicsItem::ItemHasNoContents, true);
-#endif
 }
 
 Label::~Label()
index e9ce6fb..4d8ccbf 100644 (file)
@@ -175,18 +175,14 @@ QVariant ListItem::data(int role) const
         data.icons[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->fileName();
         data.iconRotations[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->rotation();
         data.iconSmoothTransformations[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->isSmoothTransformationEnabled();
-#if (QT_VERSION >= 0x040600)
         data.iconOpacityEffets[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->isOpacityEffectEnabled();
-#endif
     }
 
     if (icon(ListItem::RightIcon)) {
         data.icons[ListItem::RightIcon] = icon(ListItem::RightIcon)->fileName();
         data.iconRotations[ListItem::RightIcon] = icon(ListItem::RightIcon)->rotation();
         data.iconSmoothTransformations[ListItem::RightIcon] = icon(ListItem::RightIcon)->isSmoothTransformationEnabled();
-#if (QT_VERSION >= 0x040600)
         data.iconOpacityEffets[ListItem::RightIcon] = icon(ListItem::RightIcon)->isOpacityEffectEnabled();
-#endif
     }
 
     data.borderPen = m_borderPen;
@@ -226,17 +222,13 @@ void ListItem::setData(const QVariant &value, int role)
     if (icon(ListItem::LeftIcon)) {
         icon(ListItem::LeftIcon)->setRotation(data.iconRotations[ListItem::LeftIcon]);
         icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(data.iconSmoothTransformations[ListItem::LeftIcon]);
-#if (QT_VERSION >= 0x040600)
         icon(ListItem::LeftIcon)->setOpacityEffectEnabled(data.iconOpacityEffets[ListItem::LeftIcon]);
-#endif
     }
 
     if (icon(ListItem::RightIcon)) {
         icon(ListItem::RightIcon)->setRotation(data.iconRotations[ListItem::RightIcon]);
         icon(ListItem::RightIcon)->setSmoothTransformationEnabled(data.iconSmoothTransformations[ListItem::RightIcon]);
-#if (QT_VERSION >= 0x040600)
         icon(ListItem::RightIcon)->setOpacityEffectEnabled(data.iconOpacityEffets[ListItem::RightIcon]);
-#endif
     }
 
     m_borderPen = data.borderPen;
index 6633bd1..323814e 100644 (file)
 #include "abstractviewitem.h"
 
 #include "recycledlistitem.h"
-
-#if (QT_VERSION >= 0x040600)
 #include "listitemcache.h"
 #include "itemrecyclinglist.h"
-#endif
 
 ListItemContainer::ListItemContainer(int bufferSize, ItemRecyclingList *view, QGraphicsWidget *parent)
     : AbstractItemContainer(bufferSize, parent)
     , m_view(view)
     , m_layout(new QGraphicsLinearLayout(Qt::Vertical))
-#if (QT_VERSION >= 0x040600)
     , m_listItemCaching(false)
-#endif
 {
     setContentsMargins(0,0,0,0);    
     m_layout->setContentsMargins(0,0,0,0);
@@ -70,9 +65,7 @@ ListItemContainer::ListItemContainer(int bufferSize, ItemRecyclingList *view, QG
 /*virtual*/
 ListItemContainer::~ListItemContainer()
 {
-#if (QT_VERSION >= 0x040600)
     setListItemCaching(false);
-#endif
     for (int i = 0; i < m_items.count(); ++i) {
         m_layout->removeItem(m_items.at(i));
         m_items.at(i)->setParentItem(0);
@@ -81,7 +74,6 @@ ListItemContainer::~ListItemContainer()
     m_items.clear();
 }
 
-#if (QT_VERSION >= 0x040600)
 bool ListItemContainer::listItemCaching() const
 {
     return m_listItemCaching;
@@ -99,7 +91,6 @@ void ListItemContainer::setListItemCaching(const bool enabled)
     for (int i = 0; i < itemCount; ++i)
         setListItemCaching(enabled, i);
 }
-#endif
 
 /*virtual*/
 void ListItemContainer::adjustVisibleContainerSize(const QSizeF &size)
@@ -112,9 +103,7 @@ void ListItemContainer::addItemToVisibleLayout(int index, AbstractViewItem *item
 {
     m_layout->insertItem(index,item);
 
-#if (QT_VERSION >= 0x040600)    
     setListItemCaching(m_listItemCaching, index);
-#endif
 }
 
 /*virtual*/
@@ -122,7 +111,6 @@ void ListItemContainer::removeItemFromVisibleLayout(AbstractViewItem *item)
 {
     m_layout->removeItem(item);
 
-#if (QT_VERSION >= 0x040600)
     RecycledListItem *recycledItem = static_cast<RecycledListItem*>(item);
 
     if (!recycledItem)
@@ -131,7 +119,6 @@ void ListItemContainer::removeItemFromVisibleLayout(AbstractViewItem *item)
     ListItem *listItem = recycledItem->item();
 
     setListItemCaching(false, listItem);
-#endif
 }
 
 /*virtual*/
@@ -168,7 +155,6 @@ int ListItemContainer::maxItemCountInItemBuffer() const
     return count;
 }
 
-#if (QT_VERSION >= 0x040600)
 void ListItemContainer::setListItemCaching(const bool enabled, const int index)
 {
     RecycledListItem *recycledItem = static_cast<RecycledListItem*>(m_layout->itemAt(index));
@@ -198,8 +184,6 @@ void ListItemContainer::setListItemCaching(const bool enabled, ListItem *listIte
         listItem->setGraphicsEffect(cache);
     }
 }
-#endif
-
 
 void ListItemContainer::setTwoColumns(const bool twoColumns)
 {
index 80d6d25..ccbb762 100644 (file)
@@ -63,11 +63,9 @@ public:
 
     virtual void setTwoColumns(const bool twoColumns);
 
-#if (QT_VERSION >= 0x040600)
     bool listItemCaching() const;
     void setListItemCaching(const bool enabled);
     virtual void setListItemCaching(const bool enabled, const int index);
-#endif
 
 protected:
 
@@ -82,11 +80,9 @@ private:
 
     ItemRecyclingList *m_view;
     QGraphicsLinearLayout *m_layout;
-#if (QT_VERSION >= 0x040600)
+
     void setListItemCaching(const bool enabled, ListItem *listItem);
     bool m_listItemCaching;
-#endif
 };
 
-
 #endif // LISTITEMCONTAINER_H
index bf9369c..ff46ec8 100644 (file)
@@ -109,7 +109,6 @@ ScrollBar* ListWidget::verticalScrollBar() const
     return 0;
 }
 
-#if (QT_VERSION >= 0x040600)
 bool ListWidget::listItemCaching() const
 {
     return m_listView->listItemCaching();
@@ -119,7 +118,6 @@ void ListWidget::setListItemCaching(bool enable)
 {
     m_listView->setListItemCaching(enable);
 }
-#endif
 
 void ListWidget::setTwoColumns(const bool twoColumns)
 {
index bcc1587..78e4faa 100644 (file)
@@ -64,10 +64,8 @@ public:
     QGraphicsWidget* takeItem(int row);
     QGraphicsWidget* itemAt(int row);
     int itemCount() const;
-#if (QT_VERSION >= 0x040600)
     bool listItemCaching() const;
     void setListItemCaching(bool enable);
-#endif
     ScrollBar* verticalScrollBar() const;
 
     void setTwoColumns(const bool twoColumns);
index 3e3f5bb..e1d6b61 100644 (file)
@@ -102,20 +102,12 @@ ScrollBar* SimpleList::verticalScrollBar() const
 
 bool SimpleList::listItemCaching() const
 {
-#if (QT_VERSION >= 0x040600)
     return m_list->listItemCaching();
-#else
-    return false;
-#endif
 }
 
 void SimpleList::setListItemCaching(bool enable)
 {
-#if (QT_VERSION >= 0x040600)
     m_list->setListItemCaching(enable);
-#else
-    Q_UNUSED(enable)
-#endif
 }
 
 void SimpleList::keyPressEvent(QKeyEvent *event)
index 3f2fb8b..a62f742 100644 (file)
@@ -46,9 +46,7 @@
 #include "simplelistview.h"
 #include "scrollbar.h"
 #include "listitem.h"
-#if (QT_VERSION >= 0x040600)
 #include "listitemcache.h"
-#endif
 #include "theme.h"
 
 class SimpleListViewPrivate
@@ -62,9 +60,7 @@ public:
         , m_layout(0)
         , m_twoColumns(false)
         , q_ptr(button)
-#if (QT_VERSION >= 0x040600)
         , m_listItemCaching(false)
-#endif
     {
         Q_Q(SimpleListView);
 
@@ -99,10 +95,9 @@ public:
         if (!m_content)
             return;
 
-#if (QT_VERSION >= 0x040600)
         const bool caching = q->listItemCaching();
         q->setListItemCaching(false);
-#endif
+
         m_content->resize(q->viewport()->size().width(),
                         m_layout->preferredHeight());
         const bool clip = 
@@ -112,9 +107,7 @@ public:
         q->viewport()->setFlag(
                 QGraphicsItem::ItemClipsChildrenToShape, clip);
 
-#if (QT_VERSION >= 0x040600)
         q->setListItemCaching(caching);
-#endif
     }
 
     void resizeScrollBars()
@@ -161,12 +154,11 @@ public:
 
     void updateListContents()
     {
-#if (QT_VERSION >= 0x040600)
         Q_Q(SimpleListView);
 
         const bool caching = q->listItemCaching();
         q->setListItemCaching(false);
-#endif
+
         const QString defaultIcon = Theme::p()->pixmapPath()+"contact_default_icon.svg";
         const int itemCount = m_layout->count();
     
@@ -209,26 +201,21 @@ public:
             // Update icons
             item->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon));
-#if (QT_VERSION >= 0x040600)
             item->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon));
-#endif
             item->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon));
             item->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon));
         }
-#if (QT_VERSION >= 0x040600)
         q->setListItemCaching(caching);
-#endif
     }
 
     void updateListItemBackgrounds(int index)
     {
-#if (QT_VERSION >= 0x040600)
         Q_Q(SimpleListView);
 
         const bool caching = q->listItemCaching();
         q->setListItemCaching(false);
-#endif
+
         const int itemCount = m_layout->count();
 
         for (int i=index; i<itemCount; ++i) {
@@ -243,9 +230,7 @@ public:
             }
         }
 
-#if (QT_VERSION >= 0x040600)
         q->setListItemCaching(caching);
-#endif
     }
 
     void setTwoColumns(const bool twoColumns)
@@ -256,10 +241,9 @@ public:
         Q_Q(SimpleListView);
         m_twoColumns = twoColumns;
 
-#if (QT_VERSION >= 0x040600)
         bool cache = q->listItemCaching();
         q->setListItemCaching(false);
-#endif
+
         QList<QGraphicsLayoutItem *> moveditems;
         if(twoColumns) {
             int half = m_layout->count()/2;
@@ -293,9 +277,7 @@ public:
         resizeContents(q->size());
         resizeScrollBars();
 
-#if (QT_VERSION >= 0x040600)
         q->setListItemCaching(cache);
-#endif
     }
 
     bool twoColumns()
@@ -307,9 +289,7 @@ public:
     QGraphicsGridLayout *m_layout;
     bool m_twoColumns;
     SimpleListView *q_ptr;
-#if (QT_VERSION >= 0x040600)
     bool m_listItemCaching;
-#endif
 };
 
 SimpleListView::SimpleListView(QGraphicsWidget *parent) 
@@ -361,11 +341,9 @@ void SimpleListView::insertItem(int index, QGraphicsWidget *item)
         d->m_layout->addItem(moveditems.at(i), d->m_layout->count(), 0);
     }
 
-#if (QT_VERSION >= 0x040600)
     ListItemCache *cache = new ListItemCache;
     item->setGraphicsEffect(cache);
     cache->setEnabled(listItemCaching());
-#endif
 
     d->resizeScrollBars();
     d->updateListItemBackgrounds(index);
@@ -416,7 +394,6 @@ int SimpleListView::itemCount()
     return d->m_layout->count();
 }
 
-#if (QT_VERSION >= 0x040600)
 bool SimpleListView::listItemCaching() const
 {
     Q_D(const SimpleListView);
@@ -439,7 +416,6 @@ void SimpleListView::setListItemCaching(bool enabled)
         cache->setEnabled(enabled);
     }
 }
-#endif
 
 void SimpleListView::scrollContentsBy(qreal dx, qreal dy)
 {
index e2fcfff..c119309 100644 (file)
@@ -72,10 +72,8 @@ public:
 public slots:
 
     void themeChange();
-#if (QT_VERSION >= 0x040600)
     bool listItemCaching() const;
     void setListItemCaching(bool enabled);
-#endif
 
 protected:
 
index 06baf77..970bc9f 100644 (file)
@@ -60,9 +60,7 @@ Theme::Theme(QObject *parent)
   , m_listItemBackgroundOpacityOdd()
   , m_listItemBorderPen(QPen())
   , m_listItemRounding()
-#if (QT_VERSION >= 0x040600)
   , m_iconOpacityEffectEnabled()
-#endif
   , m_iconRotation()
   , m_iconSmoothTransformation()
 {
@@ -156,10 +154,9 @@ void Theme::setBlueTheme()
     m_listItemBorderPen = QPen(Qt::NoPen);
     m_listItemRounding = QSize(0.0, 0.0);
 
-#if (QT_VERSION >= 0x040600)
     m_iconOpacityEffectEnabled[ListItem::LeftIcon] = false;
     m_iconOpacityEffectEnabled[ListItem::RightIcon] = false;
-#endif
+
     m_iconRotation[ListItem::LeftIcon] =  0.0;
     m_iconRotation[ListItem::RightIcon] = 0.0;
 
@@ -207,10 +204,9 @@ void Theme::setLimeTheme()
     m_listItemBorderPen = QPen(QColor(0,0,0,55), 3, Qt::SolidLine);
     m_listItemRounding = QSize(12.0, 12.0);
 
-#if (QT_VERSION >= 0x040600)
     m_iconOpacityEffectEnabled[ListItem::LeftIcon] = true;
     m_iconOpacityEffectEnabled[ListItem::RightIcon] = false;
-#endif
+
     m_iconRotation[ListItem::LeftIcon] = -4.0;
     m_iconRotation[ListItem::RightIcon] = 0.0;
 
index 04972b7..414a741 100644 (file)
@@ -93,9 +93,8 @@ public:
     QPen listItemBorderPen() const { return m_listItemBorderPen; }
     QSize listItemRounding() const { return m_listItemRounding; }
 
-#if (QT_VERSION >= 0x040600)
     bool isIconOpacityEffectEnabled(const ListItem::IconItemPos iconPos) const { return m_iconOpacityEffectEnabled[iconPos]; }
-#endif
+
     qreal iconRotation(const ListItem::IconItemPos iconPos) const { return m_iconRotation[iconPos]; }
     bool isIconSmoothTransformationEnabled(const ListItem::IconItemPos iconPos) const { return m_iconSmoothTransformation[iconPos]; }
 
@@ -124,9 +123,7 @@ private:
     QPen m_listItemBorderPen;
     QSize m_listItemRounding;
 
-#if (QT_VERSION >= 0x040600)
     QHash<ListItem::IconItemPos, bool> m_iconOpacityEffectEnabled;
-#endif
     QHash<ListItem::IconItemPos, qreal> m_iconRotation;
     QHash<ListItem::IconItemPos, bool> m_iconSmoothTransformation;
 };
index f5bc717..c20cbfa 100644 (file)
 #include <QTextLayout>
 #include <QFontMetrics>
 #include <QDebug>
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
-#  include <QStaticText>
-#endif
+#include <QStaticText>
 
 class Benchmark
 {
@@ -472,13 +469,10 @@ public:
         PainterQPointMode,
         LayoutMode,
         DocumentMode,
-        PixmapMode
-
-#if QT_VERSION >= 0x040700
-        , StaticTextMode,
+        PixmapMode,
+        StaticTextMode,
         StaticTextWithMaximumSizeMode,
         StaticTextBackendOptimizations
-#endif
     };
 
     DrawText(const QString &text, Mode mode)
@@ -487,12 +481,8 @@ public:
     }
 
     virtual void begin(QPainter *p, int iterations) {
-#if QT_VERSION >= 0x040700
         m_staticTexts.clear();
         m_currentStaticText = 0;
-#else
-        Q_UNUSED(iterations);
-#endif
         m_pixmaps.clear();
         m_currentPixmap = 0;
         QRect m_bounds = QRect(0,0,p->device()->width(), p->device()->height());
@@ -536,7 +526,6 @@ public:
             m_size = m_layout.boundingRect().toRect().size();
             break; }
 
-#if QT_VERSION >= 0x040700
         case StaticTextWithMaximumSizeMode: {
             QStaticText staticText;
             m_size = (p->boundingRect(m_bounds, 0, m_text)).size();
@@ -570,8 +559,6 @@ public:
 
             break;
         }
-#endif
-
         case PainterQPointMode: {
             QFontMetrics fm(p->font());
             m_size = QSize(fm.width(m_text, m_text.length()), fm.height());
@@ -602,8 +589,6 @@ public:
         case LayoutMode:
             m_layout.draw(p, rect.topLeft());
             break;
-
-#if QT_VERSION >= 0x040700
         case StaticTextWithMaximumSizeMode:
         case StaticTextMode:
             p->drawStaticText(rect.topLeft(), m_staticTexts.at(0));
@@ -612,7 +597,6 @@ public:
             p->drawStaticText(rect.topLeft(), m_staticTexts.at(m_currentStaticText));
             m_currentStaticText = (m_currentStaticText + 1) % m_staticTexts.size();
             break;
-#endif
         }
     }
 
@@ -628,12 +612,9 @@ public:
         case LayoutMode: type = "layout.draw()"; break;
         case DocumentMode: type = "doc.drawContents()"; break;
         case PixmapMode: type = "pixmap cached text"; break;
-
-#if QT_VERSION >= 0x040700
         case StaticTextMode: type = "drawStaticText()"; break;
         case StaticTextWithMaximumSizeMode: type = "drawStaticText() w/ maxsize"; break;
         case StaticTextBackendOptimizations: type = "drawStaticText() w/ backend optimizations"; break;
-#endif
         }
 
         return QString::fromLatin1("%3, len=%1, lines=%2")
@@ -651,15 +632,10 @@ private:
     QList<QPixmap> m_pixmaps;
     int m_currentPixmap;
 
-#if QT_VERSION >= 0x040700
     int m_currentStaticText;
     QList<QStaticText> m_staticTexts;
-#endif
 };
 
-
-
-
 class ClippedDrawRectBenchmark : public Benchmark
 {
 public:
index d8082cc..a616107 100644 (file)
@@ -213,7 +213,6 @@ void tst_QtBench::qtBench_data()
     benchmarks << (new DrawText(longString, DrawText::PixmapMode));
     benchmarks << (new DrawText(superLongString, DrawText::PixmapMode));
 
-#if QT_VERSION >= 0x040700
     benchmarks << (new DrawText(shortString, DrawText::StaticTextMode));
     benchmarks << (new DrawText(middleString, DrawText::StaticTextMode));
     benchmarks << (new DrawText(longString, DrawText::StaticTextMode));
@@ -228,7 +227,6 @@ void tst_QtBench::qtBench_data()
     benchmarks << (new DrawText(middleString, DrawText::StaticTextBackendOptimizations));
     benchmarks << (new DrawText(longString, DrawText::StaticTextBackendOptimizations));
     benchmarks << (new DrawText(superLongString, DrawText::StaticTextBackendOptimizations));
-#endif
 
     foreach (Benchmark *benchmark, benchmarks)
         QTest::newRow(qPrintable(benchmark->name())) << reinterpret_cast<void *>(benchmark);