diff options
Diffstat (limited to 'tests/benchmarks')
61 files changed, 409 insertions, 424 deletions
diff --git a/tests/benchmarks/README b/tests/benchmarks/README index d437299fee..8d017cd9a7 100644 --- a/tests/benchmarks/README +++ b/tests/benchmarks/README @@ -2,7 +2,7 @@ The most reliable way of running benchmarks is to do it in an otherwise idle system. On a busy system, the results will vary according to the other tasks demanding attention in the system. -We have managed to obtain quite reliable results by doing the following on +We have managed to obtain quite reliable results by doing the following on Linux (and you need root): - switching the scheduler to a Real-Time mode @@ -10,23 +10,23 @@ Linux (and you need root): - disabling the other thread of the same core This should work rather well for CPU-intensive tasks. A task that is in Real- -Time mode will simply not be preempted by the OS. But if you make OS syscalls, -especially I/O ones, your task will be de-scheduled. Note that this includes -page faults, so if you can, make sure your benchmark's warmup code paths touch +Time mode will simply not be preempted by the OS. But if you make OS syscalls, +especially I/O ones, your task will be de-scheduled. Note that this includes +page faults, so if you can, make sure your benchmark's warmup code paths touch most of the data. -To do this you need a tool called schedtool (package schedtool), from +To do this you need a tool called schedtool (package schedtool), from http://freequaos.host.sk/schedtool/ From this point on, we are using CPU0 for all tasks: -If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you -have to disable the other thread of the same core as CPU0. To discover which +If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you +have to disable the other thread of the same core as CPU0. To discover which one it is: $ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list -This will print something like 0,4, meaning that CPUs 0 and 4 are sibling +This will print something like 0,4, meaning that CPUs 0 and 4 are sibling threads on the same core. So we'll turn CPU 4 off: (as root) @@ -34,7 +34,7 @@ threads on the same core. So we'll turn CPU 4 off: To turn it back on, echo 1 into the same file. -To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the +To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the following: (as root) @@ -43,38 +43,38 @@ following: For example: # schedtool -F -p 10 -a 1 -e ./tst_bench_qstring -tickcounter -Warning: if your task livelocks or takes far too long to complete, your system -may be unusable for a long time, especially if you don't have other cores to +Warning: if your task livelocks or takes far too long to complete, your system +may be unusable for a long time, especially if you don't have other cores to run stuff on. To prevent that, run it before schedtool and time it. -You can also limit the CPU time that the task is allowed to take. Run in the +You can also limit the CPU time that the task is allowed to take. Run in the same shell as you'll run schedtool: $ ulimit -s 300 To limit to 300 seconds (5 minutes) -If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU +If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU time (5 minutes running at 100%). -If your app is multithreaded, you may want to give it more CPUs, like CPU0 and +If your app is multithreaded, you may want to give it more CPUs, like CPU0 and CPU1 with -a 3 (it's a bitmask). -For best results, you should disable ALL other cores and threads of the same -processor. The new Core-i7 have one processor with 4 cores, -each core can run 2 threads; the older Mac Pros have two processors with 4 -cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the +For best results, you should disable ALL other cores and threads of the same +processor. The new Core-i7 have one processor with 4 cores, +each core can run 2 threads; the older Mac Pros have two processors with 4 +cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the Core-i7, you'll need to disable all other CPUs. -However, disabling just the sibling thread seems to produce very reliable -results for me already, with variance often below 0.5% (even though there are +However, disabling just the sibling thread seems to produce very reliable +results for me already, with variance often below 0.5% (even though there are some measurable spikes). Other things to try: -Running the benchmark with highest priority, i.e. "sudo nice -19" -usually produces stable results on some machines. If the benchmark also -involves displaying something on the screen (on X11), running it with -"-sync" is a must. Though, in that case the "real" cost is not correct, +Running the benchmark with highest priority, i.e. "sudo nice -19" +usually produces stable results on some machines. If the benchmark also +involves displaying something on the screen (on X11), running it with +"-sync" is a must. Though, in that case the "real" cost is not correct, but it is useful to discover regressions. Also; not many people know about ionice (1) diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp index 9a82711b84..37f52a3dce 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp +++ b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp @@ -123,14 +123,14 @@ private slots: for (int i=0;i<1000;i++) { if ((i % 10) == 0) QVERIFY(fs.createDirectory(QString("%1/directory%2").arg(musicprefix).arg(i/10))); - qint64 size = fs.createFileWithContent(QString("%1/directory%2/file%3").arg(musicprefix).arg(i/10).arg(i)); + qint64 size = fs.createFileWithContent(QString("%1/directory%2/file%3").arg(musicprefix).arg(i/10).arg(i)); QVERIFY(size > 0); musicsize += size; } //Use case: photos - 1000 files in 1 directory QVERIFY(fs.createDirectory(photoprefix)); for (int i=0;i<1000;i++) { - qint64 size = fs.createFileWithContent(QString("%1/file%2").arg(photoprefix).arg(i)); + qint64 size = fs.createFileWithContent(QString("%1/file%2").arg(photoprefix).arg(i)); QVERIFY(size > 0); photosize += size; } @@ -141,7 +141,7 @@ private slots: QVERIFY(fs.createDirectory(QString("%1/directory%2").arg(sourceprefix).arg(i/100))); if ((i % 10) == 0) QVERIFY(fs.createDirectory(QString("%1/directory%2/subdirectory%3").arg(sourceprefix).arg(i/100).arg(i/10))); - qint64 size = fs.createFileWithContent(QString("%1/directory%2/subdirectory%3/file%4").arg(sourceprefix).arg(i/100).arg(i/10).arg(i)); + qint64 size = fs.createFileWithContent(QString("%1/directory%2/subdirectory%3/file%4").arg(sourceprefix).arg(i/100).arg(i/10).arg(i)); QVERIFY(size > 0); sourcesize += size; } diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index 598153e3ce..bb4a921fc7 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -368,7 +368,7 @@ bool QFileSystemIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo // If we're doing flat iteration, we're done. if (!(iteratorFlags & QFileSystemIterator::Subdirectories)) return false; - + // Never follow non-directory entries if (!fileInfo.isDir()) return false; @@ -378,7 +378,7 @@ bool QFileSystemIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String("..")) return false; - + // Check symlinks if (fileInfo.isSymLink() && !(iteratorFlags & QFileSystemIterator::FollowSymlinks)) { // Follow symlinks only if FollowSymlinks was passed @@ -388,10 +388,10 @@ bool QFileSystemIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo // Stop link loops if (visitedLinks.contains(fileInfo.canonicalFilePath())) return false; - + return true; } - + /*! \internal @@ -454,7 +454,7 @@ bool QFileSystemIteratorPrivate::matchesFilters(const QAbstractFileEngineIterato return false; } #endif - + bool dotOrDotDot = (fileName == QLatin1String(".") || fileName == QLatin1String("..")); if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) return false; @@ -495,7 +495,7 @@ bool QFileSystemIteratorPrivate::matchesFilters(const QAbstractFileEngineIterato || (!fi.exists() && fi.isSymLink()))) { return false; } - + return true; } #endif @@ -608,7 +608,7 @@ bool QFileSystemIterator::atEnd() const This function is provided for the convenience when iterating single directories. For recursive iteration, you should call filePath() or fileInfo() instead. - + \sa filePath(), fileInfo() */ QString QFileSystemIterator::fileName() const diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 4eb123f00c..ef5fd36254 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -184,9 +184,9 @@ void tst_qfile::readBigFile_QFSFileEngine() QSKIP("This test requires -developer-build."); #endif } -void tst_qfile::readBigFile_posix() -{ - readBigFile(); +void tst_qfile::readBigFile_posix() +{ + readBigFile(); } void tst_qfile::readBigFile_Win32() { readBigFile(); } @@ -509,13 +509,13 @@ void tst_qfile::readSmallFiles_QFSFileEngine() QSKIP("This test requires -developer-build."); #endif } -void tst_qfile::readSmallFiles_posix() +void tst_qfile::readSmallFiles_posix() { - readSmallFiles(); + readSmallFiles(); } -void tst_qfile::readSmallFiles_Win32() -{ - readSmallFiles(); +void tst_qfile::readSmallFiles_Win32() +{ + readSmallFiles(); } void tst_qfile::readSmallFiles_QFile_data() diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp index e4511f4935..d2275ddb92 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp @@ -52,7 +52,7 @@ private slots: void lookup(); }; -template <typename T> +template <typename T> void testInsert(int size) { T container; @@ -69,7 +69,7 @@ void tst_associative_containers::insert_data() QTest::addColumn<int>("size"); for (int size = 10; size < 20000; size += 100) { - + const QByteArray sizeString = QByteArray::number(size); QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size; @@ -86,9 +86,9 @@ void tst_associative_containers::insert() QMap<int, int> testMap; if (useHash) { - testInsert<QHash<int, int> >(size); + testInsert<QHash<int, int> >(size); } else { - testInsert<QMap<int, int> >(size); + testInsert<QMap<int, int> >(size); } } @@ -101,7 +101,7 @@ void tst_associative_containers::lookup_data() QTest::addColumn<int>("size"); for (int size = 10; size < 20000; size += 100) { - + const QByteArray sizeString = QByteArray::number(size); QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size; @@ -109,11 +109,11 @@ void tst_associative_containers::lookup_data() } } -template <typename T> +template <typename T> void testLookup(int size) { T container; - + for (int i = 0; i < size; ++i) container.insert(i, i); @@ -122,7 +122,7 @@ void testLookup(int size) QBENCHMARK { for (int i = 0; i < size; ++i) val = container.value(i); - + } } diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp index a34888ab13..3f8ebbecc5 100644 --- a/tests/benchmarks/corelib/tools/qregexp/main.cpp +++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp @@ -139,13 +139,13 @@ void tst_qregexp::escape_data() QTest::newRow("escape 0") << "Hello world" << "Hello world"; QTest::newRow("escape 1") << "(Hello world)" << "\\(Hello world\\)"; - { + { QString s; for (int i = 0; i < 10; ++i) s += "(escape)"; QTest::newRow("escape 10") << s << QRegExp::escape(s); } - { + { QString s; for (int i = 0; i < 100; ++i) s += "(escape)"; @@ -242,7 +242,7 @@ void tst_qregexp::escape_new2() *quotedData = c; ++quotedData; } - quoted.resize(pattern.size() + escaped); + quoted.resize(pattern.size() + escaped); verify(quoted, expected); } @@ -329,7 +329,7 @@ void tst_qregexp::escape_new4() const QLatin1Char backslash('\\'); QString quoted(n * 2, backslash); QChar *quotedData = quoted.data(); - for (int j = 0; j != i; ++j) + for (int j = 0; j != i; ++j) *quotedData++ = *patternData++; int escaped = 0; for (; i != n; ++i) { @@ -342,7 +342,7 @@ void tst_qregexp::escape_new4() ++quotedData; ++patternData; } - quoted.resize(n + escaped); + quoted.resize(n + escaped); verify(quoted, expected); // "return quoted" } diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp index 3c6defb572..f7325f7998 100644 --- a/tests/benchmarks/corelib/tools/qvector/main.cpp +++ b/tests/benchmarks/corelib/tools/qvector/main.cpp @@ -83,7 +83,7 @@ qvector_const_read_access: xorl %eax, %eax .L183: ! fldl s -! faddl 16(%edx,%eax,8) +! faddl 16(%edx,%eax,8) ! addl $1, %eax ! cmpl $10000, %eax ! fstpl s diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h index 3f0d72a231..f358909eb1 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -100,7 +100,7 @@ public: static T *fromBase(void *d) { return (T*)((char*)d + offsetOfTypedData()); } - inline QRawVector() + inline QRawVector() { m_begin = fromBase(0); m_alloc = m_size = 0; realloc(m_size, m_alloc, true); } explicit QRawVector(int size); QRawVector(int size, const T &t); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp index 5e4b1e3a2f..e9204e3282 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp @@ -259,7 +259,7 @@ void AbstractItemContainer::updateItemBuffer() QModelIndex index; if (m_items.count() > 0) index = m_items.last()->modelIndex(); - while (m_items.count() < maxCount) { + while (m_items.count() < maxCount) { index = m_itemView->nextIndex(index); if (!index.isValid()) @@ -311,7 +311,7 @@ void AbstractItemContainer::insertItem(int pos, const QModelIndex &index) item = m_prototype->newItemInstance(); if (item) { - item->setModel(m_itemView->model()); + item->setModel(m_itemView->model()); item->setModelIndex(index); item->setTwoColumns(m_twoColumns); m_items.insert(pos, item); @@ -335,7 +335,7 @@ void AbstractItemContainer::findFirstAndLastVisibleBufferIndex(int &firstVisible lastVisibleBufferIndex = -1; int count = m_items.count(); - for (int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { if (itemVisibleInView(m_items.at(i), viewRect, fullyVisible)) { if (firstVisibleBufferIndex == -1) firstVisibleBufferIndex = i; @@ -359,13 +359,13 @@ int AbstractItemContainer::maxItemCountInItemBuffer() const void AbstractItemContainer::themeChange() { - for (int i = 0; i <m_items.count(); ++i) + for (int i = 0; i <m_items.count(); ++i) m_items.at(i)->themeChange(); } -void AbstractItemContainer::updateContent() +void AbstractItemContainer::updateContent() { - for (int i = 0; i <m_items.count(); ++i) + for (int i = 0; i <m_items.count(); ++i) m_items.at(i)->updateItemContents(); } @@ -389,7 +389,7 @@ void AbstractItemContainer::setTwoColumns(const bool enabled) } bool AbstractItemContainer::twoColumns() -{ +{ return m_twoColumns; } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp index 06fd5d9754..779b99a0c5 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp @@ -63,8 +63,8 @@ AbstractItemView::~AbstractItemView() /*virtual*/ void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype) -{ - if( m_model == model || !model) +{ + if (m_model == model || !model) return; if (m_model) { @@ -236,7 +236,7 @@ void AbstractItemView::currentIndexChanged(const QModelIndex ¤t, const QMo /*virtual*/ void AbstractItemView::currentSelectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) + const QItemSelection &deselected) { Q_UNUSED(selected) Q_UNUSED(deselected) @@ -260,7 +260,6 @@ void AbstractItemView::rowsAboutToBeInserted(const QModelIndex &index, int start // TODO implement } - /*virtual*/ void AbstractItemView::rowsAboutToBeRemoved(const QModelIndex &index,int start, int end) { @@ -346,7 +345,7 @@ bool AbstractItemView::event(QEvent *e) m_container->resize(this->size().width()-verticalScrollBar()->size().width(), m_container->preferredHeight()); - if(verticalScrollBar()->sliderPosition() > verticalScrollBar()->sliderSize()) + if (verticalScrollBar()->sliderPosition() > verticalScrollBar()->sliderSize()) verticalScrollBar()->setSliderPosition(verticalScrollBar()->sliderSize()); result = true; @@ -371,7 +370,7 @@ void AbstractItemView::refreshContainerGeometry() ScrollBar *sb = verticalScrollBar(); if (sb) { - AbstractViewItem *item = m_container->itemAt(0); + AbstractViewItem *item = m_container->itemAt(0); if (item) { qreal oneItemH = item->size().height(); sb->setSliderSize(oneItemH*m_model->rowCount(m_rootIndex)-size().height()); @@ -394,10 +393,9 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy) qreal itemH = 1; AbstractViewItem *item = m_container->itemAt(0); - if(item && item->size().height() > 1) { + if (item && item->size().height() > 1) { itemH = item->size().height(); - } - else if(item && item->preferredHeight() > 1) { + } else if (item && item->preferredHeight() > 1) { itemH = item->preferredHeight(); } @@ -407,8 +405,7 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy) if ((vpy+m_container->size().height()-dy > pos().y()+size().height()) && (qAbs(dy) < itemH) && (vpy-dy <= 0)) { m_container->setPos(vpx, vpy-dy); - } - else { + } else { qreal vPos = verticalScrollBar()->sliderPosition(); int startRow = m_model->index(vPos/itemH, 0).row(); int itemsInContainer = m_container->itemCount(); @@ -428,13 +425,13 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy) } } -void AbstractItemView::changeTheme() +void AbstractItemView::changeTheme() { if (m_container) m_container->themeChange(); } -void AbstractItemView::updateViewContent() +void AbstractItemView::updateViewContent() { if (m_container) m_container->updateContent(); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp index c904cb520b..bdd18e234f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp @@ -54,11 +54,11 @@ AbstractScrollArea::AbstractScrollArea(QGraphicsWidget *parent) , m_prevVerticalValue(0.0) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setContentsMargins(0, 0, 0, 0); + setContentsMargins(0, 0, 0, 0); m_horizontalScrollBar = new ScrollBar(Qt::Horizontal, this); m_horizontalScrollBar->hide(); - m_horizontalScrollBar->setContentsMargins(0, 0, 0, 0); + m_horizontalScrollBar->setContentsMargins(0, 0, 0, 0); m_horizontalScrollBarPolicy = Qt::ScrollBarAsNeeded; m_horizontalScrollBar->setZValue(zValue()+1); // Raise scroll bar to top m_horizontalScrollBar->setVisible(false); @@ -70,7 +70,7 @@ AbstractScrollArea::AbstractScrollArea(QGraphicsWidget *parent) m_verticalScrollBar = new ScrollBar(Qt::Vertical, this); m_verticalScrollBar->hide(); - m_verticalScrollBar->setContentsMargins(0, 0, 0, 0); + m_verticalScrollBar->setContentsMargins(0, 0, 0, 0); m_verticalScrollBarPolicy = Qt::ScrollBarAsNeeded; m_verticalScrollBar->setZValue(zValue()+1); // Raise scroll bar to top m_verticalScrollBar->setVisible(false); @@ -153,8 +153,8 @@ bool AbstractScrollArea::event(QEvent *e) { if (e->type() == QEvent::ApplicationLayoutDirectionChange || e->type() == QEvent::LayoutDirectionChange) { - } else if (e->type() == QEvent::GraphicsSceneResize) { - QGraphicsSceneResizeEvent *event = + } else if (e->type() == QEvent::GraphicsSceneResize) { + QGraphicsSceneResizeEvent *event = static_cast<QGraphicsSceneResizeEvent*>(e); QSizeF newSize = event->newSize(); @@ -186,7 +186,7 @@ void AbstractScrollArea::scrollContentsBy(qreal dx, qreal dy) void AbstractScrollArea::verticalScrollStart() { - m_prevVerticalValue = m_verticalScrollBar->sliderPosition(); + m_prevVerticalValue = m_verticalScrollBar->sliderPosition(); } void AbstractScrollArea::verticalScroll(qreal value) @@ -200,7 +200,7 @@ void AbstractScrollArea::verticalScroll(qreal value) void AbstractScrollArea::horizontalScrollStart() { - m_prevHorizontalValue = m_horizontalScrollBar->sliderPosition(); + m_prevHorizontalValue = m_horizontalScrollBar->sliderPosition(); } void AbstractScrollArea::horizontalScroll(qreal value) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h index 8f90277994..b4c32bf668 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h @@ -90,8 +90,8 @@ private: void adjustScrollBars(); QGraphicsWidget *m_viewport; - ScrollBar *m_horizontalScrollBar; - ScrollBar *m_verticalScrollBar; + ScrollBar *m_horizontalScrollBar; + ScrollBar *m_verticalScrollBar; Qt::ScrollBarPolicy m_verticalScrollBarPolicy; Qt::ScrollBarPolicy m_horizontalScrollBarPolicy; qreal m_prevHorizontalValue; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp index 04626c4855..c4e10a36c6 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp @@ -59,7 +59,6 @@ BackgroundItem::BackgroundItem(const QString &filename, QGraphicsWidget *parent) BackgroundItem::~BackgroundItem() { - } void BackgroundItem::resizeEvent(QGraphicsSceneResizeEvent *event) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h index a637a50408..38a176e73d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h @@ -51,19 +51,19 @@ class QGraphicsWidget; class BackgroundItem : public GvbWidget { Q_OBJECT - + public: BackgroundItem(const QString &filename, QGraphicsWidget *parent=0); ~BackgroundItem(); - + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void resizeEvent(QGraphicsSceneResizeEvent *event); - + public slots: void themeChange(); - + private: QPixmap m_background; QString m_fileName; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp index 37d2318746..8ca4307c8b 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp @@ -50,7 +50,7 @@ class ButtonPrivate { public: - ButtonPrivate(Button *button) + ButtonPrivate(Button *button) : down(false) , q_ptr(button) { @@ -65,7 +65,7 @@ public: Button::Button(const QString &text, QGraphicsItem *parent, QSizeF minimumSize) : QGraphicsWidget(parent) , d_ptr(new ButtonPrivate(this)), m_background(), m_selected(false) -{ +{ Q_D(Button); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); //setCacheMode(QGraphicsItem::ItemCoordinateCache); @@ -105,13 +105,13 @@ QString Button::text() return d->textItem->text(); } -void Button::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, +void Button::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(widget); Q_UNUSED(option); - + if(!m_background.isNull()) painter->drawPixmap(QPoint(), m_background); if(m_selected) { @@ -121,8 +121,8 @@ void Button::paint(QPainter *painter, } } -QSizeF Button::sizeHint(Qt::SizeHint which, - const QSizeF &constraint) const +QSizeF Button::sizeHint(Qt::SizeHint which, + const QSizeF &constraint) const { Q_D(const Button); @@ -146,7 +146,7 @@ QSizeF Button::sizeHint(Qt::SizeHint which, void Button::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(Button); - + if (event->button() != Qt::LeftButton || !sceneBoundingRect().contains(event->scenePos())) return; @@ -162,7 +162,7 @@ void Button::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(Button); - if (!d->down || event->button() != Qt::LeftButton) + if (!d->down || event->button() != Qt::LeftButton) return; d->down = false; @@ -184,11 +184,11 @@ void Button::resizeEvent(QGraphicsSceneResizeEvent *event) { Q_D(Button); QGraphicsWidget::resizeEvent(event); - + QRectF rect = d->textItem->boundingRect(); QRectF buttonrect = this->boundingRect(); d->textItem->setPos((buttonrect.width() - rect.width())/2, (buttonrect.height() - rect.height())/2 ); - + QSize currentSize = buttonrect.size().toSize(); if( m_background.size() != currentSize && (currentSize.width() > 0 && currentSize.height() > 0) ) { m_background = Theme::p()->pixmap("status_field_middle.svg", buttonrect.size().toSize()); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h index 14ffb15626..8641d8a9b6 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h @@ -47,7 +47,7 @@ class ButtonPrivate; class QTextDocument; -class QPixmap; +class QPixmap; class QFont; class Button : public QGraphicsWidget @@ -73,7 +73,7 @@ public slots: QString text(); public: - + void setBackground(QPixmap& background); bool isDown(); void select(bool select){m_selected = select;} @@ -81,9 +81,9 @@ public: private: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp index d98beefea6..06dea1b864 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp @@ -127,7 +127,7 @@ bool readSettingsFromCommandLine(int argc, char *argv[], argv[i] = 0; i++; argv[i] = 0; - } + } } if (!argv[i]) @@ -160,7 +160,7 @@ bool readSettingsFromCommandLine(int argc, char *argv[], argv[i] = 0; i++; argv[i] = 0; - } + } } else if (strcmp(argv[i], "-subtree-cache") == 0) { options |= Settings::UseListItemCache; argv[i] = 0; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h index 20d3706e9c..16525487da 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h @@ -44,7 +44,7 @@ #include "settings.h" -bool readSettingsFromCommandLine(int argc, +bool readSettingsFromCommandLine(int argc, char *argv[], Settings& settings); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp index 86fc78d3f7..259e94aa2f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp @@ -51,19 +51,19 @@ DummyDataGenerator::DummyDataGenerator() : m_isMale(false) while (!countryCodeFile.atEnd()) { m_countryCodes << QString(countryCodeFile.readLine()).remove("\n"); } - + QFile firstNameFFile(":/contact/firstnamesF.txt"); firstNameFFile.open(QIODevice::ReadOnly); while (!firstNameFFile.atEnd()) { m_firstNamesF << QString(firstNameFFile.readLine()).remove("\n"); } - + QFile firstNameMFile(":/contact/firstnamesM.txt"); firstNameMFile.open(QIODevice::ReadOnly); while (!firstNameMFile.atEnd()) { m_firstNamesM << QString(firstNameMFile.readLine()).remove("\n"); } - + QFile lastNameFile(":/contact/lastnames.txt"); lastNameFile.open(QIODevice::ReadOnly); while (!lastNameFile.atEnd()) { @@ -74,7 +74,6 @@ DummyDataGenerator::DummyDataGenerator() : m_isMale(false) DummyDataGenerator::~DummyDataGenerator() { - } void DummyDataGenerator::Reset() @@ -89,7 +88,7 @@ QString DummyDataGenerator::randomPhoneNumber(QString indexNumber) QString areaCode = QString::number(index) + QString("0").repeated(2-QString::number(index).length()); QString beginNumber = QString::number(555-index*2); QString endNumber = QString("0").repeated(4-indexNumber.length()) + indexNumber; - + return countryCode +" " + areaCode +" " + beginNumber +" " + endNumber; } @@ -116,14 +115,14 @@ QString DummyDataGenerator::randomIconItem() QString avatar = Theme::p()->pixmapPath() + "contact_default_icon.svg"; if (qrand()%4) { int randVal = 1+qrand()%25; - - if(m_isMale && randVal > 15) { - randVal -= 15; + + if (m_isMale && randVal > 15) { + randVal -= 15; } - if(!m_isMale && randVal <= 10) { + if (!m_isMale && randVal <= 10) { randVal += 10; } - + avatar = QString(":/avatars/avatar_%1.png").arg(randVal, 3, 10, QChar('0')); } return avatar; @@ -131,8 +130,7 @@ QString DummyDataGenerator::randomIconItem() QString DummyDataGenerator::randomStatusItem() { - switch ( qrand()%3 ) - { + switch (qrand()%3) { case 0: return Theme::p()->pixmapPath() + "contact_status_online.svg"; case 1: return Theme::p()->pixmapPath() + "contact_status_offline.svg"; case 2: return Theme::p()->pixmapPath() + "contact_status_idle.svg"; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h index 5e64357919..9f418390f0 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h @@ -51,7 +51,7 @@ class DummyDataGenerator : public QObject public: DummyDataGenerator(); ~DummyDataGenerator(); - + public: void Reset(); QString randomPhoneNumber(QString indexNumber); @@ -60,7 +60,7 @@ public: QString randomName(); QString randomIconItem(); QString randomStatusItem(); - + private: QStringList m_countryCodes; QStringList m_firstNamesF; @@ -69,4 +69,4 @@ private: bool m_isMale; }; -#endif // __DUMMYDATAGEN_H__ +#endif // __DUMMYDATAGEN_H__ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h index 8348d429b5..5d23c55102 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h @@ -44,7 +44,7 @@ #include <QGraphicsWidget> -class GvbWidget : public QGraphicsWidget +class GvbWidget : public QGraphicsWidget { Q_OBJECT diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp index 13713940c8..d68d7f799f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp @@ -45,7 +45,7 @@ #include "iconitem.h" -IconItem::IconItem(const QString &filename, QGraphicsItem *parent) +IconItem::IconItem(const QString &filename, QGraphicsItem *parent) : GvbWidget(parent) , m_filename(filename) , m_rotation(0.0) @@ -79,7 +79,7 @@ void IconItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->drawPixmap(0,0, m_pixmap); } -QSizeF IconItem::sizeHint(Qt::SizeHint which, +QSizeF IconItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { switch (which) @@ -144,7 +144,7 @@ void IconItem::setOpacityEffectEnabled(const bool enable) gradient.setColorAt(0.0, QColor(0,0,0, 255)); gradient.setColorAt(0.46, QColor(0,0,0, 255)); gradient.setColorAt(0.62, QColor(0,0,0, 0)); - + m_opacityEffect = new QGraphicsOpacityEffect; m_opacityEffect->setOpacityMask(gradient); m_opacityEffect->setOpacity(1.0); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h index 7d4510479b..9d1fb168de 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h @@ -74,7 +74,7 @@ public: private: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*widget = 0*/); - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; private: diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp index 1856d74500..fc6d5683ee 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp @@ -52,7 +52,7 @@ ItemRecyclingList::ItemRecyclingList(const int itemBuffer, QGraphicsWidget * parent) : ItemRecyclingListView(parent), m_listModel(new ListModel(this)) -{ +{ ListItemContainer *container = new ListItemContainer(itemBuffer, this, this); container->setParentItem(this); ItemRecyclingListView::setContainer(container); @@ -153,7 +153,7 @@ void ItemRecyclingList::themeChange() item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushEven()); item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityEven()); } - + // Update borders item->setBorderPen(Theme::p()->listItemBorderPen()); item->setRounding(Theme::p()->listItemRounding()); @@ -177,7 +177,7 @@ void ItemRecyclingList::keyPressEvent(QKeyEvent *event) static qreal step = 0.0; static bool repeat = false; int interval = keyPressInterval.elapsed(); - + ScrollBar* sb = verticalScrollBar(); qreal currentValue = sb->sliderPosition(); @@ -193,11 +193,11 @@ void ItemRecyclingList::keyPressEvent(QKeyEvent *event) step = m_listModel->item(0)->size().height(); repeat = false; } - + if(event->key() == Qt::Key_Up ) { //Up Arrow sb->setSliderPosition(currentValue - step); } - + if(event->key() == Qt::Key_Down ) { //Down Arrow sb->setSliderPosition(currentValue + step); } @@ -255,7 +255,7 @@ void ItemRecyclingList::setTwoColumns(const bool enabled) } bool ItemRecyclingList::twoColumns() -{ +{ return m_container->twoColumns(); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h index f865740632..b86fe345f4 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h @@ -59,7 +59,7 @@ public: virtual ~ItemRecyclingList(); virtual void insertItem(int index, RecycledListItem *item); - virtual void addItem(RecycledListItem *item); + virtual void addItem(RecycledListItem *item); virtual void clear(); virtual AbstractViewItem *takeItem(const int row); virtual void setItemPrototype(AbstractViewItem* prototype); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp index bc45f11df0..847b55237d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp @@ -43,7 +43,7 @@ #include "label.h" -Label::Label(const QString& text, QGraphicsItem *parent) +Label::Label(const QString &text, QGraphicsItem *parent) : GvbWidget(parent) { m_textItem = new QGraphicsSimpleTextItem(this); @@ -58,8 +58,8 @@ Label::~Label() { } -void Label::setText(const QString& text) -{ +void Label::setText(const QString &text) +{ m_textItem->setText(text); prepareGeometryChange(); } @@ -74,22 +74,20 @@ void Label::setFont(const QFont font) m_textItem->setFont(font); } -void Label::resizeEvent(QGraphicsSceneResizeEvent *event) +void Label::resizeEvent(QGraphicsSceneResizeEvent *event) { GvbWidget::resizeEvent(event); } QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { - switch (which) - { + switch (which) { case Qt::MinimumSize: // fall thru - case Qt::PreferredSize: - { + case Qt::PreferredSize: { QFontMetricsF fm(m_textItem->font()); return QSizeF(fm.width(m_textItem->text()), fm.height()); - } + } default: return GvbWidget::sizeHint(which, constraint); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h index e5c83ab3b0..74ffc39d37 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h @@ -65,7 +65,7 @@ public: private: void resizeEvent(QGraphicsSceneResizeEvent *event); - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; private: diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp index 27ce0a2919..222e4eea50 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp @@ -64,25 +64,25 @@ struct ItemData Q_DECLARE_METATYPE(ItemData); ListItem::ListItem(QGraphicsWidget *parent) - : GvbWidget(parent), - m_txtlayout(new QGraphicsGridLayout()), - m_layout(new QGraphicsLinearLayout(Qt::Horizontal)), - m_liconlayout(new QGraphicsLinearLayout(Qt::Horizontal)), - m_riconlayout(new QGraphicsLinearLayout(Qt::Horizontal)) - ,m_fonts() - ,m_borderPen(Qt::NoPen) - ,m_backgroundBrush(QBrush()) - ,m_backgroundOpacity(1.0) - ,m_rounding(0.0, 0.0) -{ + : GvbWidget(parent) + , m_txtlayout(new QGraphicsGridLayout()) + , m_layout(new QGraphicsLinearLayout(Qt::Horizontal)) + , m_liconlayout(new QGraphicsLinearLayout(Qt::Horizontal)) + , m_riconlayout(new QGraphicsLinearLayout(Qt::Horizontal)) + , m_fonts() + , m_borderPen(Qt::NoPen) + , m_backgroundBrush(QBrush()) + , m_backgroundOpacity(1.0) + , m_rounding(0.0, 0.0) +{ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setContentsMargins(0,4,4,0); - m_layout->setContentsMargins(0,0,0,0); + m_layout->setContentsMargins(0,0,0,0); m_txtlayout->setContentsMargins(0,8,0,8); m_liconlayout->setContentsMargins(8,8,8,8); m_riconlayout->setContentsMargins(0,8,4,8); - + m_layout->insertItem(0, m_liconlayout); m_layout->insertItem(1, m_txtlayout); m_layout->insertItem(2, m_riconlayout); @@ -95,47 +95,44 @@ ListItem::ListItem(QGraphicsWidget *parent) setLayout(m_layout); } -ListItem::~ListItem() +ListItem::~ListItem() { - if ( !m_liconlayout->parentLayoutItem() ) + if (!m_liconlayout->parentLayoutItem()) delete m_liconlayout; - if ( !m_riconlayout->parentLayoutItem() ) + if (!m_riconlayout->parentLayoutItem()) delete m_riconlayout; } -void ListItem::setIcon( IconItem *iconItem, const IconItemPos iconPos ) +void ListItem::setIcon(IconItem *iconItem, const IconItemPos iconPos) { if (iconPos == LeftIcon) { if (m_liconlayout->count() > 0 && m_liconlayout->itemAt(0)) { delete m_liconlayout->itemAt(0); - m_liconlayout->addItem( iconItem ); + m_liconlayout->addItem(iconItem); + } else { + m_liconlayout->addItem(iconItem); } - else { - m_liconlayout->addItem( iconItem ); - } - m_liconlayout->itemAt(0)->setMaximumSize(58,58); - } - else if (iconPos == RightIcon) { + m_liconlayout->itemAt(0)->setMaximumSize(58, 58); + } else if (iconPos == RightIcon) { if (m_riconlayout->count() > 0 && m_riconlayout->itemAt(0)) { delete m_riconlayout->itemAt(0); - m_riconlayout->addItem( iconItem ); + m_riconlayout->addItem(iconItem); + } else { + m_riconlayout->addItem(iconItem); } - else { - m_riconlayout->addItem( iconItem ); - } - m_riconlayout->itemAt(0)->setMaximumSize(22,22); + m_riconlayout->itemAt(0)->setMaximumSize(22, 22); } m_layout->invalidate(); } -IconItem* ListItem::icon( const IconItemPos iconPos ) const +IconItem* ListItem::icon(const IconItemPos iconPos) const { QGraphicsLayoutItem* item = 0; if (iconPos == LeftIcon && m_liconlayout->count() > 0) { item = m_liconlayout->itemAt(0); - } + } else if (iconPos == RightIcon && m_riconlayout->count() > 0) { item = m_riconlayout->itemAt(0); } @@ -203,13 +200,13 @@ void ListItem::setData(const QVariant &value, int role) ItemData data = value.value<ItemData>(); QList<ListItem::TextPos> textkeys = data.texts.keys(); - for( int i = 0; i<textkeys.count(); ++i) { - setText(data.texts[textkeys.at(i)],textkeys.at(i)); + for (int i = 0; i<textkeys.count(); ++i) { + setText(data.texts[textkeys.at(i)], textkeys.at(i)); setFont(data.fonts[textkeys.at(i)], textkeys.at(i)); } QList<ListItem::IconItemPos> iconkeys = data.icons.keys(); - for( int i = 0; i<iconkeys.count(); ++i) { + for (int i = 0; i<iconkeys.count(); ++i) { IconItem *iconItem = icon(iconkeys.at(i)); if (iconItem) iconItem->setFileName(data.icons[iconkeys.at(i)]); @@ -249,8 +246,7 @@ void ListItem::setText(const QString str, const TextPos position) m_txtlayout->addItem(label, position, 0); if (m_fonts.contains(position)) label->setFont(m_fonts[position]); - } - else { + } else { Label *titem = static_cast<Label *>(item); titem->setText(str); } @@ -290,14 +286,12 @@ void ListItem::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option QRectF r = rect(); r.adjust(penWidth, penWidth, -penWidth, -penWidth); - if (m_borderPen != Qt::NoPen) - { + if (m_borderPen != Qt::NoPen) { painter->setPen(m_borderPen); painter->drawRoundedRect(r, m_rounding.width(), m_rounding.height()); } - if (m_backgroundBrush != Qt::NoBrush) - { + if (m_backgroundBrush != Qt::NoBrush) { painter->setPen(Qt::NoPen); painter->setBrush(m_backgroundBrush); painter->setOpacity(m_backgroundOpacity); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp index 451f1f8031..a1fa8df047 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp @@ -53,7 +53,7 @@ ListItemCache::~ListItemCache() QPixmapCache::remove(m_cacheKey); } -void ListItemCache::draw(QPainter * painter) +void ListItemCache::draw(QPainter * painter) { QRectF irect = sourceBoundingRect(Qt::LogicalCoordinates); QRectF vrect = painter->clipPath().boundingRect(); @@ -80,7 +80,7 @@ void ListItemCache::draw(QPainter * painter) //qDebug() << "ListItemCache: blitting" << m_visibleRect; painter->drawPixmap(0, 0, pixmap); - } + } } void ListItemCache::sourceChanged(ChangeFlags) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h index a7b36c95c6..3e9153ce53 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h @@ -45,7 +45,7 @@ #include <QGraphicsEffect> #include <QPixmapCache> -class ListItemCache : public QGraphicsEffect +class ListItemCache : public QGraphicsEffect { Q_OBJECT diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp index 0b787f077d..91dba0bc7d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp @@ -56,7 +56,7 @@ ListItemContainer::ListItemContainer(int bufferSize, ItemRecyclingList *view, QG , m_layout(new QGraphicsLinearLayout(Qt::Vertical)) , m_listItemCaching(false) { - setContentsMargins(0,0,0,0); + setContentsMargins(0,0,0,0); m_layout->setContentsMargins(0,0,0,0); m_layout->setSpacing(0); setLayout(m_layout); @@ -80,13 +80,13 @@ bool ListItemContainer::listItemCaching() const } void ListItemContainer::setListItemCaching(const bool enabled) -{ +{ if (m_listItemCaching == enabled) return; m_listItemCaching = enabled; - const int itemCount = m_layout->count(); + const int itemCount = m_layout->count(); for (int i = 0; i < itemCount; ++i) setListItemCaching(enabled, i); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp index 95eadeece1..f219402aca 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp @@ -106,7 +106,7 @@ void ListModel::insert(int row, RecycledListItem *item) { if (item) item->setModel(this); - if (!item || m_items.contains(item) ) { + if (!item || m_items.contains(item) ) { return; } if (row < 0) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp index 1cce930d09..1626e1c5d3 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp @@ -47,14 +47,14 @@ ListWidget::ListWidget(QGraphicsWidget * parent) : GvbWidget(parent), - m_layout(new QGraphicsLinearLayout(Qt::Vertical)), + m_layout(new QGraphicsLinearLayout(Qt::Vertical)), m_listView(new SimpleListView(this)) -{ +{ //listView->setViewport(listView->content()); //listView->content()->setParentItem(listView); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setContentsMargins(0,0,0,0); - m_layout->setContentsMargins(0,0,0,0); + m_layout->setContentsMargins(0,0,0,0); m_listView->setContentsMargins(0,0,0,0); m_layout->addItem(m_listView); setLayout(m_layout); @@ -64,7 +64,7 @@ ListWidget::ListWidget(QGraphicsWidget * parent) m_listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } -ListWidget::~ListWidget() +ListWidget::~ListWidget() { } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp index 57cff5f902..afd8581932 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp @@ -82,7 +82,7 @@ MainView::~MainView() } void MainView::setTestWidget(QGraphicsWidget *testWidget) -{ +{ if (!testWidget) return; @@ -99,7 +99,7 @@ void MainView::setTestWidget(QGraphicsWidget *testWidget) QGraphicsWidget *MainView::takeTestWidget() { if (m_testWidget) { - m_mainLayout->removeItem(m_testWidget); + m_mainLayout->removeItem(m_testWidget); QGraphicsWidget *tmp = m_testWidget; m_testWidget = 0; return tmp; @@ -229,30 +229,30 @@ void MainView::keyPressEvent(QKeyEvent *event) else showFullScreen(); } - + //S60 3.x specific if(m_menu->menuVisible()) { m_menu->keyPressEvent(event); return; } - + if(event->key() == 16777235 ) { //Up Arrow GvbWidget* widget = qobject_cast<GvbWidget*>(m_testWidget); if(widget) widget->keyPressEvent(event); } - + if(event->key() == 16777237 ) { //Down Arrow GvbWidget* widget = qobject_cast<GvbWidget*>(m_testWidget); if(widget) widget->keyPressEvent(event); } - + if(event->key() == 17825792 ) { //LSK if(!m_menu->menuVisible()) m_menu->menuShowHide(); } - + if(event->key() == 17825793 ) { //RSK QApplication::quit(); } @@ -265,7 +265,7 @@ void MainView::construct() #ifndef QT_NO_OPENGL if (m_enableOpenGL) { qDebug() << "OpenGL enabled"; - m_scene->setSortCacheEnabled(false); + m_scene->setSortCacheEnabled(false); setViewport(new QGLWidget); // Qt doc says: This is the preferred update mode for @@ -311,7 +311,7 @@ void MainView::construct() m_mainLayout->addItem(m_topBar); m_topBar->setZValue(1); connect(m_topBar, SIGNAL(clicked(bool)), m_menu, SLOT(menuShowHide())); - + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setContentsMargins(0,0,0,0); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h index 3a484bd7d1..ee8625edce 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h @@ -57,9 +57,9 @@ class BackgroundItem; class TopBar; class MainView : public QGraphicsView { - + Q_OBJECT - + public: MainView(const bool enableOpenGL, const bool outputFps, const bool imageBasedRendering = false, QWidget *parent = 0); ~MainView(); @@ -94,7 +94,7 @@ private slots: private: void construct(); void resizeContent(const QSize &s); - + private: Q_DISABLE_COPY(MainView) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp index f8655bf725..540d7cf31b 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp @@ -73,14 +73,14 @@ Menu::~Menu() void Menu::init() { m_ButtonContainer = new QList<Button*>; - + m_Layout->setContentsMargins(0,0,0,0); m_Layout->setSpacing(0); - - setMinimumWidth(150); - + + setMinimumWidth(150); + setLayout(m_Layout); - + connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange())); } @@ -124,9 +124,9 @@ void Menu::menuHide() void Menu::themeChange() { - QPixmap pixmap = Theme::p()->pixmap("status_field_middle.svg", + QPixmap pixmap = Theme::p()->pixmap("status_field_middle.svg", QSize(MinMenuItemWidth, MinMenuItemHeight)); - + for(int i = 0; i < m_ButtonContainer->count(); i++) { Button* button = m_ButtonContainer->at(i); button->setBackground(pixmap); @@ -142,7 +142,7 @@ void Menu::keyPressEvent(QKeyEvent *event) Button* button = m_ButtonContainer->at(m_currentSelectedIndex); button->select(false); button->update(); - + m_currentSelectedIndex--; button = m_ButtonContainer->at(m_currentSelectedIndex); button->select(true); @@ -162,7 +162,7 @@ void Menu::keyPressEvent(QKeyEvent *event) } } } - + if(event->key() == 16777237 ) { //Down Arrow if (m_currentSelectedIndex < m_ButtonContainer->count()-1) { //One step down if(m_currentSelectedIndex >= 0) { @@ -187,15 +187,15 @@ void Menu::keyPressEvent(QKeyEvent *event) } } } - + if(event->key() == 17825792 || event->key() == 16842752 || //LSK, center key or enter - event->key() == 16777221 ) { + event->key() == 16777221 ) { if(m_currentSelectedIndex >= 0) { Button* button = m_ButtonContainer->at(m_currentSelectedIndex); button->click(); } } - + if(event->key() == 17825793 ) { //RSK menuShowHide(); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h index 84a2e87100..564f6cee53 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h @@ -66,12 +66,12 @@ public slots: public slots: void menuShowHide(); - + private: void init(); void menuShow(); void menuHide(); - + private: Q_DISABLE_COPY(Menu) QGraphicsView* m_Parent; @@ -81,4 +81,4 @@ private: int m_currentSelectedIndex; }; -#endif // __MENU_H__ +#endif // __MENU_H__ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp index 9e487846a0..d73ec2f4ba 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp @@ -57,7 +57,7 @@ RecycledListItem::RecycledListItem(QGraphicsWidget *parent) { m_item->setMinimumWidth(MinItemWidth); setContentsMargins(0,0,0,0); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_layout->addItem(m_item, 0, 0); setLayout(m_layout); m_layout->setContentsMargins(0,0,0,0); @@ -118,7 +118,7 @@ void RecycledListItem::resizeEvent(QGraphicsSceneResizeEvent *event) void RecycledListItem::updateItemContents() { - AbstractViewItem::updateItemContents(); + AbstractViewItem::updateItemContents(); if (m_model && m_index.isValid()) setData(m_model->data(m_index,Qt::DisplayRole), Qt::DisplayRole); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h index cf301e434c..e8dd6292b1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h @@ -52,7 +52,7 @@ public: int availableMemoryInAppThreadHeap; qint64 availableMemoryInSystem; qint64 totalMemoryInSystem; - MemoryAllocation() : + MemoryAllocation() : allocatedInAppThread(0), numberOfAllocatedCellsInAppThread(0), availableMemoryInAppThreadHeap(0), @@ -60,17 +60,17 @@ public: totalMemoryInSystem(0) {} }; - + struct CpuUsage { qreal systemUsage; qreal appTreadUsage; - CpuUsage() : + CpuUsage() : systemUsage(0.0), appTreadUsage(0.0) {} }; - + public: virtual ~ResourceMonitorInterface() {} @@ -78,17 +78,17 @@ public: //for symbian, prepares the resource monitor for data capture, opens handle to ekern null //thread and sets initial values virtual bool Prepare(QString applicationThreadName) = 0; - + //functions for CPU load and memory - Call Prepare before calling these virtual CpuUsage CPULoad()=0; virtual MemoryAllocation MemoryLoad()=0; - + virtual void BeginMeasureMemoryLoad()=0; virtual MemoryAllocation EndMeasureMemoryLoad()=0; - + virtual void BeginMeasureCPULoad()=0; virtual CpuUsage EndMeasureCPULoad()=0; - + }; Q_DECLARE_INTERFACE(ResourceMonitorInterface, diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp index e3c751dbca..2499c7094a 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp @@ -52,7 +52,7 @@ class ScrollBarPrivate { public: - ScrollBarPrivate(Qt::Orientation orientation, ScrollBar *scrollBar) + ScrollBarPrivate(Qt::Orientation orientation, ScrollBar *scrollBar) : orientation(orientation) , sliderPosition(0.0) , sliderSize(0.0) @@ -96,15 +96,15 @@ public: void updateSlider() { QRectF oldSlider = slider; - slider = q_func()->boundingRect(); - + slider = q_func()->boundingRect(); + qreal x = 0; qreal y = 0; qreal w = scrollerPixmap.width(); qreal h = scrollerPixmap.height(); - + //Adjust the scrollBar in relation to the scroller - + if (orientation == Qt::Horizontal) { qreal scrollBarHeight = scrollBarPixmap.height(); @@ -120,7 +120,7 @@ public: } slider.setWidth(scrollBarWidth); } - + if(oldSlider != slider && (slider.size().width() > 0 &&slider.size().height() > 0 )) { scrollBarPixmap = Theme::p()->pixmap("scrollbar.svg", slider.size().toSize()); } @@ -153,7 +153,7 @@ public: ScrollBar::ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent) : QGraphicsWidget(parent) , d_ptr(new ScrollBarPrivate(orientation, this)) -{ +{ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); setContentsMargins(0, 0, 0, 0); @@ -198,8 +198,8 @@ bool ScrollBar::sliderDown() const return d->sliderDown; } -void ScrollBar::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, +void ScrollBar::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_D(ScrollBar); @@ -208,23 +208,23 @@ void ScrollBar::paint(QPainter *painter, d->updateSlider(); - QRect sliderRect = d->slider.toRect(); + QRect sliderRect = d->slider.toRect(); painter->drawPixmap(sliderRect.topLeft(), d->scrollBarPixmap); - + QRect cursorRect = d->cursor.toRect(); painter->drawPixmap(cursorRect.topLeft(), d->scrollerPixmap); } -QSizeF ScrollBar::sizeHint(Qt::SizeHint which, - const QSizeF &constraint) const +QSizeF ScrollBar::sizeHint(Qt::SizeHint which, + const QSizeF &constraint) const { Q_D(const ScrollBar); QSizeF s; - if (d->orientation == Qt::Horizontal) + if (d->orientation == Qt::Horizontal) s = QSizeF(-1, qMax(d->scrollBarPixmap.height(), d->scrollerPixmap.height())); - else + else s = QSizeF(qMax(d->scrollBarPixmap.width(), d->scrollerPixmap.width()), -1); switch (which) @@ -265,18 +265,18 @@ void ScrollBar::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(ScrollBar); - if (!d->sliderDown) + if (!d->sliderDown) return; if (d->orientation == Qt::Horizontal) { qreal f = (event->pos().x() - d->pressPos.x())/(d->slider.width() - d->cursor.width()); qreal dx = f * d->sliderSize; - + d->setSliderPosition(d->sliderPosition + dx); } else { qreal f = (event->pos().y() - d->pressPos.y())/(d->slider.height() - d->cursor.height()); qreal dy = f * d->sliderSize; - + d->setSliderPosition(d->sliderPosition + dy); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h index 82e95046b7..9cb15b16c1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h @@ -77,11 +77,11 @@ public slots: private: - void paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, + void paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, QWidget *widget); - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp index 6fab34ca93..a30e03188f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp @@ -78,7 +78,7 @@ void ScrollerPrivate::stopScrolling() m_scrollTimer.stop(); } -//Maps screen coordinates to scrollArea coordinates though current m_eventViewport widget +//Maps screen coordinates to scrollArea coordinates though current m_eventViewport widget QPointF ScrollerPrivate::mapToScrollArea(const QPoint &point) { if (!m_scrollArea || !m_eventViewport) @@ -106,7 +106,7 @@ bool ScrollerPrivate::eventFilter(QObject *obj, QEvent *event) && event->type() != QEvent::GraphicsSceneKeyReleased*/)) return false; - QGraphicsSceneMouseEvent* mouseEvent = + QGraphicsSceneMouseEvent* mouseEvent = static_cast<QGraphicsSceneMouseEvent*>(event); m_eventViewport = mouseEvent->widget(); @@ -130,7 +130,7 @@ bool ScrollerPrivate::eventFilter(QObject *obj, QEvent *event) m_cursorPos = QCursor::pos(); m_state = ManualScrolling; - if (!m_scrollTimer.isActive()) + if (!m_scrollTimer.isActive()) m_scrollTimer.start(UpdateScrollingInterval); else { m_scrollTimer.stop(); @@ -154,7 +154,7 @@ bool ScrollerPrivate::eventFilter(QObject *obj, QEvent *event) ScrollBar *hscroll = m_scrollArea->horizontalScrollBar(); ScrollBar *vscroll = m_scrollArea->verticalScrollBar(); - QPointF d = m_scrollFactor * (mapToScrollArea(QCursor::pos()) - mapToScrollArea(m_cursorPos)); + QPointF d = m_scrollFactor * (mapToScrollArea(QCursor::pos()) - mapToScrollArea(m_cursorPos)); hscroll->setSliderPosition(hscroll->sliderPosition() - d.x()); vscroll->setSliderPosition(vscroll->sliderPosition() - d.y()); @@ -249,7 +249,7 @@ void ScrollerPrivate::updateScrolling() hscroll->setSliderPosition(hscroll->sliderPosition() - m_scrollFactor * d.x()); vscroll->setSliderPosition(vscroll->sliderPosition() - m_scrollFactor * d.y()); - } else { + } else { m_state = Stopped; scrollOngoing = false; } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h index d84303fd8b..69e300517d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h @@ -76,7 +76,7 @@ public: int resultFormat() const { return m_resultFormat; } - void setResultFormat(int resultFormat) + void setResultFormat(int resultFormat) { m_resultFormat = resultFormat; } const QSize& size() const @@ -86,7 +86,7 @@ public: int angle() const { return m_angle; } - void setAngle(int angle) + void setAngle(int angle) { m_angle = angle; } const Options& options() const @@ -106,9 +106,9 @@ private: QString m_outputFileName; int m_resultFormat; QSize m_size; - int m_angle; + int m_angle; int m_listItemCount; - Options m_options; + Options m_options; }; Q_DECLARE_OPERATORS_FOR_FLAGS(Settings::Options) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp index 4d30286070..cc5df42a66 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp @@ -60,8 +60,8 @@ SimpleList::SimpleList(QGraphicsWidget *parent) } /*virtual*/ -SimpleList::~SimpleList() -{ +SimpleList::~SimpleList() +{ } void SimpleList::addItem(ListItem *item) @@ -116,7 +116,7 @@ void SimpleList::keyPressEvent(QKeyEvent *event) static qreal step = 0.0; static bool repeat = false; int interval = keyPressInterval.elapsed(); - + ScrollBar* sb = verticalScrollBar(); qreal currentValue = sb->sliderPosition(); @@ -132,11 +132,11 @@ void SimpleList::keyPressEvent(QKeyEvent *event) step = itemAt(0)->size().height(); repeat = false; } - + if(event->key() == Qt::Key_Up ) { //Up Arrow sb->setSliderPosition(currentValue - step); } - + if(event->key() == Qt::Key_Down ) { //Down Arrow sb->setSliderPosition(currentValue + step); } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp index 7bfda5173f..c59bd378e1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp @@ -55,7 +55,7 @@ class SimpleListViewPrivate public: - SimpleListViewPrivate(SimpleListView *button) + SimpleListViewPrivate(SimpleListView *button) : m_content(0) , m_layout(0) , m_twoColumns(false) @@ -100,7 +100,7 @@ public: m_content->resize(q->viewport()->size().width(), m_layout->preferredHeight()); - const bool clip = + const bool clip = m_content->size().width() > q->viewport()->size().width() || m_content->size().height() > q->viewport()->size().height(); @@ -161,7 +161,7 @@ public: const QString defaultIcon = Theme::p()->pixmapPath()+"contact_default_icon.svg"; const int itemCount = m_layout->count(); - + for (int i=0; i<itemCount; ++i) { ListItem* item = static_cast<ListItem*>(m_layout->itemAt(i)); @@ -251,7 +251,7 @@ public: QGraphicsLayoutItem *item = m_layout->itemAt(i); m_layout->removeAt(i); moveditems.append(item); - } + } for ( int i = 0; i < moveditems.count(); ++i) m_layout->addItem(moveditems.at(i), i, 1); @@ -267,7 +267,7 @@ public: moveditems.append(m_layout->itemAt(i)); else moveditems.insert(moveditems.begin(), m_layout->itemAt(i)); - m_layout->removeAt(i); + m_layout->removeAt(i); } for (int i = 0; i<moveditems.count(); ++i) { m_layout->addItem(moveditems.at(i), m_layout->count(), 0); @@ -292,17 +292,17 @@ public: bool m_listItemCaching; }; -SimpleListView::SimpleListView(QGraphicsWidget *parent) +SimpleListView::SimpleListView(QGraphicsWidget *parent) : AbstractScrollArea(parent) , d_ptr(new SimpleListViewPrivate(this)) -{ +{ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setContentsMargins(0, 0, 0, 0); verticalScrollBar()->hide(); horizontalScrollBar()->hide(); } -SimpleListView::~SimpleListView() +SimpleListView::~SimpleListView() { Q_D(SimpleListView); @@ -403,7 +403,7 @@ bool SimpleListView::listItemCaching() const void SimpleListView::setListItemCaching(bool enabled) { Q_D(SimpleListView); - + if (d->m_listItemCaching == enabled) return; @@ -430,13 +430,13 @@ void SimpleListView::scrollContentsBy(qreal dx, qreal dy) if (newy < miny) newy = miny; - else if (newy > 0) + else if (newy > 0) newy = 0.0; d->m_content->setPos(contentPos.x(), newy); } -void SimpleListView::resizeEvent(QGraphicsSceneResizeEvent *event) +void SimpleListView::resizeEvent(QGraphicsSceneResizeEvent *event) { Q_D(SimpleListView); @@ -446,7 +446,7 @@ void SimpleListView::resizeEvent(QGraphicsSceneResizeEvent *event) } QSizeF SimpleListView::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const -{ +{ Q_D(const SimpleListView); if (which == Qt::PreferredSize) diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h index 57ec90e717..fcc6805a2f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h @@ -79,7 +79,7 @@ protected: virtual void scrollContentsBy(qreal dx, qreal dy); void resizeEvent(QGraphicsSceneResizeEvent *event); - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const; private: diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp index 136c7ed5ff..4983c574e1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp @@ -44,10 +44,10 @@ ThemeEvent::ThemeEvent( const QString &newTheme, Type type) : QEvent(type), m_theme(newTheme) { - + } ThemeEvent::~ThemeEvent() { - + } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h index eb94123b54..e48fb5f273 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h @@ -55,7 +55,7 @@ public: public: inline QString getTheme() { return m_theme; } - + private: QString m_theme; }; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp index a7a4ad3a3f..9ff6d6d2f1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp @@ -55,7 +55,7 @@ TopBar::TopBar(QGraphicsView* mainView, QGraphicsWidget* parent) : m_orientation(TopBar::None), m_topBarPixmap(), m_sizesBlue(), m_sizesLime() { setDefaultSizes(); - + m_titleFont = Theme::p()->font(Theme::TitleBar); m_statusFont = Theme::p()->font(Theme::StatusBar); @@ -71,7 +71,7 @@ void TopBar::resizeEvent(QGraphicsSceneResizeEvent* /*event*/) //Check orientation QString topbarName; QSize mainViewSize = m_mainView->size(); - int rotationAngle = static_cast<MainView*>(m_mainView)->rotationAngle(); + int rotationAngle = static_cast<MainView*>(m_mainView)->rotationAngle(); if(rotationAngle == 90 || rotationAngle == 270 ) { int wd = mainViewSize.width(); int ht = mainViewSize.height(); @@ -91,49 +91,49 @@ void TopBar::resizeEvent(QGraphicsSceneResizeEvent* /*event*/) m_orientation = TopBar::Landscape; topbarName = "topbar_horisontal.svg"; } - + //Calculate new size, resize by height, don't make it wider than the screen - QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? + QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? m_sizesBlue : m_sizesLime; - + //Get current size for topbarpixmap - QSize currentSize = !m_topBarPixmap.isNull() && !m_orientationChanged ? + QSize currentSize = !m_topBarPixmap.isNull() && !m_orientationChanged ? m_topBarPixmap.size() : sizes[topbarName]; QSize newSize = !m_orientationChanged ? QSize(currentSize) : sizes[topbarName]; - + //Scale according to aspect ratio newSize.scale(size().toSize(), Qt::KeepAspectRatio); - + //fix width to window widht if previous scaling produced too narrow image if(newSize.width() < size().width()) { newSize.scale(size().toSize(), Qt::KeepAspectRatioByExpanding); } - + //Calculate scaling factor for rest of the graphics scaling qreal scaleFactor = (newSize.width() *1.0) / (currentSize.width() * 1.0); - + //Scale graphics, if the scalefactor applies //This is really heavy since the SVG graphics are read again from the resource if(scaleFactor != 1 || m_topBarPixmap.isNull() ) { m_topBarPixmap = Theme::p()->pixmap(topbarName, newSize ); - m_topBarUserIcon = Theme::p()->pixmap("user_default_icon.svg", + m_topBarUserIcon = Theme::p()->pixmap("user_default_icon.svg", !m_topBarUserIcon.isNull() && !m_orientationChanged ? m_topBarUserIcon.size()* scaleFactor : sizes["user_default_icon.svg"] * scaleFactor); - - m_topBarUserStatus = Theme::p()->pixmap("user_status_online.svg", + + m_topBarUserStatus = Theme::p()->pixmap("user_status_online.svg", !m_topBarUserStatus.isNull() && !m_orientationChanged ? m_topBarUserStatus.size() * scaleFactor : sizes["user_status_online.svg"] * scaleFactor); - - m_topBarStatusBarLeft = Theme::p()->pixmap("status_field_left.svg", + + m_topBarStatusBarLeft = Theme::p()->pixmap("status_field_left.svg", !m_topBarStatusBarLeft.isNull() && !m_orientationChanged ? m_topBarStatusBarLeft.size()* scaleFactor : sizes["status_field_left.svg"] * scaleFactor); - + m_topBarStatusBarRight = Theme::p()->pixmap("status_field_right.svg", !m_topBarStatusBarRight.isNull() && !m_orientationChanged ? m_topBarStatusBarRight.size()* scaleFactor : sizes["status_field_right.svg"] * scaleFactor); - + m_topBarStatusBarMiddle = Theme::p()->pixmap("status_field_middle.svg", !m_topBarStatusBarMiddle.isNull() && !m_orientationChanged ? m_topBarStatusBarMiddle.size() * scaleFactor : QSize(185, sizes["status_field_middle.svg"].height()) * scaleFactor); - + //Update the sizeHint to match the size of the scaled m_topBarPixmap updateGeometry(); - + //Point Update - Positions relative to the Top Bar "Backgroud" size. //TODO: consider some layout instead of calculating relative locations QSize topBarPixmapSize = m_topBarPixmap.size(); @@ -141,40 +141,40 @@ void TopBar::resizeEvent(QGraphicsSceneResizeEvent* /*event*/) QSize topBarUserStatusSize = m_topBarUserStatus.size(); QSize topBarStatusBarLeftSize = m_topBarStatusBarLeft.size(); QSize topBarStatusBarMiddleSize = m_topBarStatusBarMiddle.size(); - + //Location for Title text 5% width, 35% height of the background pixmap - m_topBarTitlePoint = QPoint(topBarPixmapSize.width()* 0.05, + m_topBarTitlePoint = QPoint(topBarPixmapSize.width()* 0.05, topBarPixmapSize.height() * 0.35); - + //User Icon location //Placing 70% of the width and 10% of the height of the top bar background m_topBarUserIconPoint = QPoint((topBarPixmapSize.width() * 0.7), (topBarPixmapSize.height() * 0.1)); - + //If Blue theme is in use - position user status icon on the right side of the user icon if(!m_isLimeTheme) { //Place the status icon on top of the right edge of the user icon, lower it by 35% of the height of the user icon - m_topBarUserStatusPoint = QPoint( ( (m_topBarUserIconPoint.x()+topBarUserIconSize.width() ) - - ( topBarUserStatusSize.width()/2 )), + m_topBarUserStatusPoint = QPoint( ( (m_topBarUserIconPoint.x()+topBarUserIconSize.width() ) - + ( topBarUserStatusSize.width()/2 )), (m_topBarUserIconPoint.y() + (topBarUserIconSize.height() * 0.35 ))); } //If Lime theme is in use - position user status icon on the left side of the user icon else { //Place the status icon on top of the left side of the user icon, lower it by 50% of the height of the user icon //and move left by 5% of the icon - m_topBarUserStatusPoint = QPoint( m_topBarUserIconPoint.x() + ( topBarUserIconSize.width() * 0.05), + m_topBarUserStatusPoint = QPoint( m_topBarUserIconPoint.x() + ( topBarUserIconSize.width() * 0.05), (m_topBarUserIconPoint.y() + (topBarUserIconSize.height() * 0.5 ))); } - + //Status bar //Placing the left side of the status bar 5% of the width, 50% of the height of the top bar background //Set the text baseline 80% of the height of the status bar - m_topBarStatusBarLeftPoint = QPoint( (topBarPixmapSize.width()* 0.05), + m_topBarStatusBarLeftPoint = QPoint( (topBarPixmapSize.width()* 0.05), (topBarPixmapSize.height() * 0.5)); - m_topBarStatusBarMiddlePoint = QPoint( (m_topBarStatusBarLeftPoint.x() + topBarStatusBarLeftSize.width()), + m_topBarStatusBarMiddlePoint = QPoint( (m_topBarStatusBarLeftPoint.x() + topBarStatusBarLeftSize.width()), (m_topBarStatusBarLeftPoint.y())); - m_topBarStatusBarRightPoint = QPoint( (m_topBarStatusBarMiddlePoint.x() + topBarStatusBarMiddleSize.width()), + m_topBarStatusBarRightPoint = QPoint( (m_topBarStatusBarMiddlePoint.x() + topBarStatusBarMiddleSize.width()), (m_topBarStatusBarMiddlePoint.y() ) ); - m_topBarStatusBarTextPoint = QPoint(m_topBarStatusBarMiddlePoint.x(), + m_topBarStatusBarTextPoint = QPoint(m_topBarStatusBarMiddlePoint.x(), m_topBarStatusBarMiddlePoint.y() + (topBarStatusBarMiddleSize.height()*0.8) ); } //if scalefactor } @@ -183,18 +183,18 @@ void TopBar::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, Q { //Topbar background painter->drawPixmap(option->exposedRect, m_topBarPixmap, option->exposedRect); - + //User Icon painter->drawPixmap(m_topBarUserIconPoint, m_topBarUserIcon); - + //User Status painter->drawPixmap(m_topBarUserStatusPoint, m_topBarUserStatus); - + //Status bar painter->drawPixmap(m_topBarStatusBarLeftPoint, m_topBarStatusBarLeft); painter->drawPixmap(m_topBarStatusBarMiddlePoint, m_topBarStatusBarMiddle); painter->drawPixmap(m_topBarStatusBarRightPoint, m_topBarStatusBarRight); - + //Title text painter->save(); painter->setFont(m_titleFont); @@ -210,14 +210,14 @@ void TopBar::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, Q QRectF TopBar::boundingRect() const { - //It's possible that m_topBarPixmap is not allocated yet, + //It's possible that m_topBarPixmap is not allocated yet, //in this case default size is used for setting boundingRect - QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? - m_sizesBlue : m_sizesLime; - - if(!m_topBarPixmap.isNull()) + QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? + m_sizesBlue : m_sizesLime; + + if (!m_topBarPixmap.isNull()) return QRectF(0, 0, m_topBarPixmap.size().width(), m_topBarPixmap.size().height()); - else + else return QRectF(0, 0, sizes["topbar.svg"].width(), sizes["topbar.svg"].height()); } @@ -227,95 +227,95 @@ void TopBar::themeChange() m_statusFont = Theme::p()->font(Theme::StatusBar); //Calculate the scaling factor - QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? + QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? m_sizesBlue : m_sizesLime; - - QString topbarString= m_orientation == TopBar::Portrait ? + + QString topbarString= m_orientation == TopBar::Portrait ? "topbar.svg" : "topbar_horisontal.svg"; - + QSize topBarSize = sizes[topbarString]; QSize newSize = QSize(topBarSize); - + //Scale according to aspect ratio newSize.scale(size().toSize(), Qt::KeepAspectRatio); - + //fix width to window widht if previous scaling produced too narrow image if(newSize.width() < size().width()) { newSize.scale(size().toSize(), Qt::KeepAspectRatioByExpanding); } - + //Calculate scaling factor for rest of the graphics scaling qreal scaleFactor = (newSize.width() *1.0) / (topBarSize.width() * 1.0); //Background m_topBarPixmap = Theme::p()->pixmap(topbarString, sizes[topbarString] * scaleFactor); - + //User Icon m_topBarUserIcon = Theme::p()->pixmap("user_default_icon.svg", sizes["user_default_icon.svg"] * scaleFactor); - + //User Status - m_topBarUserStatus = Theme::p()->pixmap("user_status_online.svg", sizes["user_status_online.svg"] * scaleFactor); - - //Status Bar + m_topBarUserStatus = Theme::p()->pixmap("user_status_online.svg", sizes["user_status_online.svg"] * scaleFactor); + + //Status Bar m_topBarStatusBarLeft = Theme::p()->pixmap("status_field_left.svg", sizes["status_field_left.svg"] * scaleFactor); m_topBarStatusBarRight = Theme::p()->pixmap("status_field_right.svg", sizes["status_field_right.svg"] * scaleFactor); - m_topBarStatusBarMiddle = Theme::p()->pixmap("status_field_middle.svg", + m_topBarStatusBarMiddle = Theme::p()->pixmap("status_field_middle.svg", QSize(185, sizes["status_field_middle.svg"].height())* scaleFactor); - + //Update Drawing points for Top Bar elements, points are relative to the top bar background size QSize topBarPixmapSize = m_topBarPixmap.size(); QSize topBarUserIconSize = m_topBarUserIcon.size(); QSize topBarUserStatusSize = m_topBarUserStatus.size(); QSize topBarStatusBarLeftSize = m_topBarStatusBarLeft.size(); - QSize topBarStatusBarMiddleSize = m_topBarStatusBarMiddle.size(); - + QSize topBarStatusBarMiddleSize = m_topBarStatusBarMiddle.size(); + //Theme Check (Theme::p()->theme() == Theme::Lime) ? m_isLimeTheme = true : m_isLimeTheme = false; - + //User Icon location //Placing 70% of the width and 10% of the height of the top bar background m_topBarUserIconPoint = QPoint((0.7*topBarPixmapSize.width()), (0.1*topBarPixmapSize.height())); - + //If Blue theme is in use - position user status icon on the right side of the user icon if(!m_isLimeTheme) { //Place the status icon on top of the right edge of the user icon, lower it by 35% of the height of the user icon - m_topBarUserStatusPoint = QPoint( ( (m_topBarUserIconPoint.x()+topBarUserIconSize.width() ) - ( topBarUserStatusSize.width()/2 )), + m_topBarUserStatusPoint = QPoint( ( (m_topBarUserIconPoint.x()+topBarUserIconSize.width() ) - ( topBarUserStatusSize.width()/2 )), (m_topBarUserIconPoint.y() + (topBarUserIconSize.height() * 0.35 ))); } //If Lime theme is in use - position user status icon on the left side of the user icon else { //Place the status icon on top of the left side of the user icon, lower it by 50% of the height of the user icon //and move left by 5% of the icon - m_topBarUserStatusPoint = QPoint( m_topBarUserIconPoint.x() + ( topBarUserIconSize.width() * 0.05), + m_topBarUserStatusPoint = QPoint( m_topBarUserIconPoint.x() + ( topBarUserIconSize.width() * 0.05), (m_topBarUserIconPoint.y() + (topBarUserIconSize.height() * 0.5 ))); } - + //Status bar //Placing the left side of the status bar 5% of the width, 50% of the height of the top bar background //Set the text baseline 80% of the height of the status bar - m_topBarStatusBarLeftPoint = QPoint( (topBarPixmapSize.width()* 0.05), + m_topBarStatusBarLeftPoint = QPoint( (topBarPixmapSize.width()* 0.05), (topBarPixmapSize.height() * 0.5)); - m_topBarStatusBarMiddlePoint = QPoint( (m_topBarStatusBarLeftPoint.x() + topBarStatusBarLeftSize.width()), + m_topBarStatusBarMiddlePoint = QPoint( (m_topBarStatusBarLeftPoint.x() + topBarStatusBarLeftSize.width()), (m_topBarStatusBarLeftPoint.y())); - m_topBarStatusBarRightPoint = QPoint( (m_topBarStatusBarMiddlePoint.x() + topBarStatusBarMiddleSize.width()), + m_topBarStatusBarRightPoint = QPoint( (m_topBarStatusBarMiddlePoint.x() + topBarStatusBarMiddleSize.width()), (m_topBarStatusBarMiddlePoint.y() ) ); - m_topBarStatusBarTextPoint = QPoint(m_topBarStatusBarMiddlePoint.x(), + m_topBarStatusBarTextPoint = QPoint(m_topBarStatusBarMiddlePoint.x(), m_topBarStatusBarMiddlePoint.y() + (topBarStatusBarMiddleSize.height()*0.8) ); - + update(); } -QSizeF TopBar::sizeHint(Qt::SizeHint which, - const QSizeF &constraint) const +QSizeF TopBar::sizeHint(Qt::SizeHint which, + const QSizeF &constraint) const { - //It's possible that m_topBarPixmap is not allocated yet, + //It's possible that m_topBarPixmap is not allocated yet, //in this case default size is used for setting size hint - QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? - m_sizesBlue : m_sizesLime; - - int height = !m_topBarPixmap.isNull() ? - m_topBarPixmap.height() : sizes["topbar.svg"].height(); - + QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? + m_sizesBlue : m_sizesLime; + + int height = !m_topBarPixmap.isNull() ? + m_topBarPixmap.height() : sizes["topbar.svg"].height(); + switch (which) { case Qt::MinimumSize: @@ -330,7 +330,7 @@ QSizeF TopBar::sizeHint(Qt::SizeHint which, } void TopBar::setDefaultSizes() -{ +{ m_sizesBlue["topbar.svg"] = QSize(356,96); m_sizesBlue["topbar_horisontal.svg"] = QSize(636,96); m_sizesBlue["user_default_icon.svg"] = QSize(68,68); @@ -338,7 +338,7 @@ void TopBar::setDefaultSizes() m_sizesBlue["status_field_left.svg"] = QSize(14,24); m_sizesBlue["status_field_right.svg"] = QSize(10,24); m_sizesBlue["status_field_middle.svg"] = QSize(14,24); - + m_sizesLime["topbar.svg"] = QSize(356,96); m_sizesLime["topbar_horisontal.svg"] = QSize(636,96); m_sizesLime["user_default_icon.svg"] = QSize(84,68); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h index dabffa9d06..808064d04d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h @@ -55,7 +55,7 @@ class QFont; class TopBar : public GvbWidget { Q_OBJECT - + public: enum Orientation { @@ -63,33 +63,34 @@ public: Landscape, None }; - + public: TopBar(QGraphicsView* mainView, QGraphicsWidget* parent); ~TopBar(); - + public: void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 ); QRectF boundingRect() const; void resizeEvent(QGraphicsSceneResizeEvent *event); - inline QPoint getStatusBarLocation() { return m_topBarStatusBarMiddlePoint + - m_topBarStatusBarMiddle.rect().bottomLeft(); } - + inline QPoint getStatusBarLocation() + { + return m_topBarStatusBarMiddlePoint + m_topBarStatusBarMiddle.rect().bottomLeft(); + } + public slots: void themeChange(); - + protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); - + signals: void clicked(bool checked = false); - + private: - QSizeF sizeHint(Qt::SizeHint which, + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; void setDefaultSizes(); - - + private: Q_DISABLE_COPY(TopBar) @@ -100,7 +101,7 @@ private: //Fonts QFont m_titleFont; QFont m_statusFont; - + //Pixmaps QPixmap m_topBarPixmap; QPixmap m_topBarUserIcon; @@ -108,7 +109,7 @@ private: QPixmap m_topBarStatusBarLeft; QPixmap m_topBarStatusBarRight; QPixmap m_topBarStatusBarMiddle; - + //Drawing points QPoint m_topBarUserIconPoint; QPoint m_topBarUserStatusPoint; @@ -117,7 +118,7 @@ private: QPoint m_topBarStatusBarMiddlePoint; QPoint m_topBarStatusBarTextPoint; QPoint m_topBarTitlePoint; - + //Sizes QHash<QString, QSize> m_sizesBlue; QHash<QString, QSize> m_sizesLime; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp index 0883580d70..4fee19230d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp @@ -46,7 +46,7 @@ static const int MotionEndWaitTime = 2000; static const int TileSideLength = 128; -WebViewPrivate::WebViewPrivate(WebView *w) +WebViewPrivate::WebViewPrivate(WebView *w) : q(w) , cache(0) { @@ -56,14 +56,14 @@ WebViewPrivate::WebViewPrivate(WebView *w) web->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); web->page()->mainFrame()->setScrollBarPolicy( - Qt::Horizontal, Qt::ScrollBarAlwaysOff); + Qt::Horizontal, Qt::ScrollBarAlwaysOff); web->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff); web->setZValue(3); // cache = new WebViewCache(web); // web->setGraphicsEffect(cache); - + adjustSize(); } @@ -85,9 +85,8 @@ void WebViewPrivate::adjustSize() q->horizontalScrollBar()->setSliderSize(w); else q->horizontalScrollBar()->setSliderSize(0.0); - - if (h > q->viewport()->boundingRect().height()) + if (h > q->viewport()->boundingRect().height()) q->verticalScrollBar()->setSliderSize(h); else q->verticalScrollBar()->setSliderSize(0.0); @@ -116,7 +115,7 @@ void WebViewPrivate::_q_loadFinished(bool ok) void WebViewPrivate::_q_viewportChanged(QGraphicsWidget* viewport) { web->setParentItem(viewport); - viewport->setFlag(QGraphicsItem::ItemClipsChildrenToShape, + viewport->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); adjustSize(); } @@ -131,7 +130,6 @@ void WebViewPrivate::_q_motionEnded() WebViewCache::WebViewCache(QGraphicsWebView *webView) : m_webView(webView) { - } WebViewCache::~WebViewCache() @@ -178,8 +176,8 @@ void WebViewCache::draw(QPainter * painter, QGraphicsEffectSource * source) for (int j = 0; j < tilesY; j++) { int x = i * TileSideLength; int y = j * TileSideLength; - - m_tileRects[i + j * tilesX] + + m_tileRects[i + j * tilesX] = QRectF(x, y, TileSideLength, TileSideLength); } } @@ -205,13 +203,13 @@ void WebViewCache::draw(QPainter * painter, QGraphicsEffectSource * source) QWebFrame *webFrame = m_webView->page()->mainFrame(); - QPainter tilePainter(&tilePixmap); + QPainter tilePainter(&tilePixmap); tilePainter.translate(-m_tileRects[i].left(), -m_tileRects[i].top()); webFrame->render(&tilePainter, m_tileRects[i].toRect()); tilePainter.end(); m_tilePixmaps[i] = QPixmapCache::insert(tilePixmap); - } + } tileRect = tileRect.translated(-itemPos); @@ -233,7 +231,7 @@ WebView::WebView(QGraphicsWidget *parent) this, SLOT(_q_loadFinished(bool))); connect(this, SIGNAL(viewportChanged(QGraphicsWidget*)), this, SLOT(_q_viewportChanged(QGraphicsWidget*))); - connect(&d->motionTimer, SIGNAL(timeout()), + connect(&d->motionTimer, SIGNAL(timeout()), this, SLOT(_q_motionEnded())); } @@ -272,21 +270,21 @@ void WebView::scrollContentsBy(qreal dx, qreal dy) if (x < minx) x = minx; - else if (x > 0) + else if (x > 0) x = 0.0; qreal y = d->web->pos().y() - dy; if (y < miny) y = miny; - else if (y > 0) + else if (y > 0) y = 0.0; d->web->setPos(x, y); } QSizeF WebView::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const -{ +{ if (which == Qt::PreferredSize) { QSizeF contentSize = d->web->page()->mainFrame()->contentsSize(); return contentSize; diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h index ded7df7f60..a1391cc125 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h @@ -71,7 +71,7 @@ public: QTimer motionTimer; }; -class WebViewCache : public QGraphicsEffect +class WebViewCache : public QGraphicsEffect { Q_OBJECT diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp index 7394a9410e..e8b6388941 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp @@ -51,7 +51,7 @@ int main(int argc, char **argv) app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); MainWindow window; - window.show(); + window.show(); return app.exec(); } diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h index ed3d74919d..74c1fedfac 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h @@ -55,7 +55,7 @@ class MainWindow : public QWidget Q_OBJECT public: MainWindow(QWidget *parent = 0); - + private: void setupMatrix(); void populateScene(); diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h index 3fac23ede0..db2f219222 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h @@ -71,7 +71,7 @@ private slots: void rotateRight(); void timerEvent(QTimerEvent *); - + private: QGraphicsView *graphicsView; QLabel *label; diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h index 711eb833f6..4e5b436f8d 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h @@ -62,7 +62,7 @@ public: Translate }; ChipTester(QWidget *parent = 0); - + void setAntialias(bool enabled); void setOpenGL(bool enabled); void runBenchmark(); @@ -75,7 +75,7 @@ protected: private: void populateScene(); - QGraphicsView *view; + QGraphicsView *view; QGraphicsScene *scene; int npaints; int timerId; diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp index 1d8aa60394..3e912e83b3 100644 --- a/tests/benchmarks/gui/image/blendbench/main.cpp +++ b/tests/benchmarks/gui/image/blendbench/main.cpp @@ -100,7 +100,7 @@ QLatin1String brushTypes[] = { class BlendBench : public QObject { Q_OBJECT -private slots: +private slots: void blendBench_data(); void blendBench(); diff --git a/tests/benchmarks/gui/image/qimagereader/images/black.xpm b/tests/benchmarks/gui/image/qimagereader/images/black.xpm index d7925bf211..4a1f4ec861 100644 --- a/tests/benchmarks/gui/image/qimagereader/images/black.xpm +++ b/tests/benchmarks/gui/image/qimagereader/images/black.xpm @@ -15,21 +15,21 @@ static char * ddd_xpm[] = { "+ c white m white g white g4 white s Light ", "* c DarkGreen m black g grey25 g4 grey25 s Eye ", /* Pixels */ -" . . ", -" . .. ", -" . . ", -" .. . ", -" .. .. .. ", -" .. . . . ", -" . . . . .. ", -" . .X. . ", -" . *.X.* .. ", -" .. .. .XXX. .. ... ", -" . .X...XXX...X. . ", -" .. ..XXX.XXX.XXX. .. ", -" .....XXXX...XXXX. . ", -" .. ..XXXXXXXXX.. .. ", -" ...XXXXXXX..... ", +" . . ", +" . .. ", +" . . ", +" .. . ", +" .. .. .. ", +" .. . . . ", +" . . . . .. ", +" . .X. . ", +" . *.X.* .. ", +" .. .. .XXX. .. ... ", +" . .X...XXX...X. . ", +" .. ..XXX.XXX.XXX. .. ", +" .....XXXX...XXXX. . ", +" .. ..XXXXXXXXX.. .. ", +" ...XXXXXXX..... ", " ......... ", " .XXXXXXX. ", " .....XXX..... ", diff --git a/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp b/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp index 07ee8b7804..c32ff0d099 100644 --- a/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp @@ -174,7 +174,7 @@ void tst_QTableView::spanInit_helper(QTableView *view) for (int i=0; i < 40; i++) { view->setSpan(1+i%2, 1+4*i, 1+i%3, 2); } - + for (int i=1; i < 40; i++) { view->setSpan(6 + i*7, 4, 4, 50); } @@ -185,7 +185,7 @@ void tst_QTableView::spanInit() QtTestTableModel model(500, 500); QTableView v; v.setModel(&model); - + QBENCHMARK { spanInit_helper(&v); } @@ -196,7 +196,7 @@ void tst_QTableView::spanDraw() QtTestTableModel model(500, 500); QTableView v; v.setModel(&model); - + spanInit_helper(&v); v.show(); v.resize(500,500); @@ -214,11 +214,11 @@ void tst_QTableView::spanSelectAll() QtTestTableModel model(500, 500); QTableView v; v.setModel(&model); - + spanInit_helper(&v); v.show(); QTest::qWait(30); - + QBENCHMARK { v.selectAll(); } @@ -229,11 +229,11 @@ void tst_QTableView::spanSelectColumn() QtTestTableModel model(500, 500); QTableView v; v.setModel(&model); - + spanInit_helper(&v); v.show(); QTest::qWait(30); - + QBENCHMARK { v.selectColumn(22); } diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h index 9c0e149ec5..0413290b21 100644 --- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h +++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h @@ -487,7 +487,7 @@ public: m_pixmaps.clear(); m_currentPixmap = 0; QRect m_bounds = QRect(0,0,p->device()->width(), p->device()->height()); - switch (m_mode) { + switch (m_mode) { case PainterMode: m_size = (p->boundingRect(m_bounds, 0, m_text)).size(); // m_rect = m_rect.translated(-m_rect.topLeft()); diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index 3a7d406777..e7e22f0e65 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -291,7 +291,7 @@ void tst_QText::fontResolution() font.setFamily("DejaVu"); font2.setBold(true); - QBENCHMARK { + QBENCHMARK { QFont res = font.resolve(font2); } } |