summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 05:53:41 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 05:53:41 (GMT)
commit1f73b205ec57be6327f62ef39099358425a7f0a8 (patch)
tree0d0bf89430fee0ab4ab747fd13ce86c8e9717ccb /src
parentf4ad1cc44e3a25d0089d39cdf16820d9fbb2e050 (diff)
parent162dd5b9360a362a78e77387ed92c49934201a32 (diff)
downloadQt-1f73b205ec57be6327f62ef39099358425a7f0a8.zip
Qt-1f73b205ec57be6327f62ef39099358425a7f0a8.tar.gz
Qt-1f73b205ec57be6327f62ef39099358425a7f0a8.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qcombobox.cpp5
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp51
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h8
3 files changed, 21 insertions, 43 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index b606538..0e888d6 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -2174,11 +2174,14 @@ void QComboBox::insertSeparator(int index)
/*!
Removes the item at the given \a index from the combobox.
This will update the current index if the index is removed.
+
+ This function does nothing if \a index is out of range.
*/
void QComboBox::removeItem(int index)
{
- Q_ASSERT(index >= 0 && index < count());
Q_D(QComboBox);
+ if (index < 0 || index >= count())
+ return;
d->model->removeRows(index, 1, d->root);
}
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 2b0de96..e6ef8f3 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -58,7 +58,7 @@ public:
, scanLineDirection(QVideoSurfaceFormat::TopToBottom)
, pixelAspectRatio(1, 1)
, yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined)
- , frameRate(0, 0)
+ , frameRate(0.0)
{
}
@@ -73,7 +73,7 @@ public:
, pixelAspectRatio(1, 1)
, yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined)
, viewport(QPoint(0, 0), size)
- , frameRate(0, 0)
+ , frameRate(0.0)
{
}
@@ -100,7 +100,7 @@ public:
&& frameSize == other.frameSize
&& pixelAspectRatio == other.pixelAspectRatio
&& viewport == other.viewport
- && frameRate == other.frameRate
+ && frameRatesEqual(frameRate, other.frameRate)
&& yuvColorSpace == other.yuvColorSpace
&& propertyNames.count() == other.propertyNames.count()) {
for (int i = 0; i < propertyNames.count(); ++i) {
@@ -115,6 +115,11 @@ public:
}
}
+ inline static bool frameRatesEqual(qreal r1, qreal r2)
+ {
+ return qAbs(r1 - r2) <= 0.00001 * qMin(qAbs(r1), qAbs(r2));
+ }
+
QVideoFrame::PixelFormat pixelFormat;
QAbstractVideoBuffer::HandleType handleType;
QVideoSurfaceFormat::Direction scanLineDirection;
@@ -122,7 +127,7 @@ public:
QSize pixelAspectRatio;
QVideoSurfaceFormat::YuvColorSpace yuvColorSpace;
QRect viewport;
- QVideoSurfaceFormat::FrameRate frameRate;
+ qreal frameRate;
QList<QByteArray> propertyNames;
QList<QVariant> propertyValues;
};
@@ -201,15 +206,6 @@ public:
The full range Y'CbCr color space used in JPEG files.
*/
-
-/*!
- \typedef QVideoSurfaceFormat::FrameRate
-
- A pair of integers representing the frame rate of a video stream.
-
- The first number is the numerator and the second the denominator.
-*/
-
/*!
Constructs a null video stream format.
*/
@@ -415,41 +411,24 @@ void QVideoSurfaceFormat::setScanLineDirection(Direction direction)
}
/*!
- Returns the frame rate of a video stream.
-
- The frame rate is a rational number represented by a pair of integers.
- The first integer is the numerator and the second the denominator.
+ Returns the frame rate of a video stream in frames per second.
*/
-QVideoSurfaceFormat::FrameRate QVideoSurfaceFormat::frameRate() const
+qreal QVideoSurfaceFormat::frameRate() const
{
return d->frameRate;
}
/*!
- Sets the frame \a rate of a video stream.
-
- The frame rate is a rational number represented by a pair of integers.
- The first integer is the numerator and the second the denominator.
+ Sets the frame \a rate of a video stream in frames per second.
*/
-void QVideoSurfaceFormat::setFrameRate(const FrameRate &rate)
+void QVideoSurfaceFormat::setFrameRate(qreal rate)
{
d->frameRate = rate;
}
/*!
- \overload
-
- Sets the \a numerator and \a denominator of the frame rate of a video stream.
-*/
-
-void QVideoSurfaceFormat::setFrameRate(int numerator, int denominator)
-{
- d->frameRate = qMakePair(numerator, denominator);
-}
-
-/*!
Returns a video stream's pixel aspect ratio.
*/
@@ -599,8 +578,8 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value)
if (qVariantCanConvert<Direction>(value))
d->scanLineDirection = qvariant_cast<Direction>(value);
} else if (qstrcmp(name, "frameRate") == 0) {
- if (qVariantCanConvert<FrameRate>(value))
- d->frameRate = qvariant_cast<FrameRate>(value);
+ if (qVariantCanConvert<qreal>(value))
+ d->frameRate = qvariant_cast<qreal>(value);
} else if (qstrcmp(name, "pixelAspectRatio") == 0) {
if (qVariantCanConvert<QSize>(value))
d->pixelAspectRatio = qvariant_cast<QSize>(value);
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
index b3005bd..1f4a5cb 100644
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ b/src/multimedia/video/qvideosurfaceformat.h
@@ -87,8 +87,6 @@ public:
#endif
};
- typedef QPair<int, int> FrameRate;
-
QVideoSurfaceFormat();
QVideoSurfaceFormat(
const QSize &size,
@@ -120,9 +118,8 @@ public:
Direction scanLineDirection() const;
void setScanLineDirection(Direction direction);
- FrameRate frameRate() const;
- void setFrameRate(const FrameRate &rate);
- void setFrameRate(int numerator, int denominator = 1);
+ qreal frameRate() const;
+ void setFrameRate(qreal rate);
QSize pixelAspectRatio() const;
void setPixelAspectRatio(const QSize &ratio);
@@ -147,7 +144,6 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &);
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QVideoSurfaceFormat::FrameRate)
Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction)
Q_DECLARE_METATYPE(QVideoSurfaceFormat::YuvColorSpace)