diff options
Diffstat (limited to 'examples')
12 files changed, 58 insertions, 31 deletions
diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 4573160..8d38cca 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -8,13 +8,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 7db1c80..7d73900 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -6,13 +6,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 75080b4..3cace8d 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -4,13 +4,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml new file mode 100644 index 0000000..26758e6 --- /dev/null +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -0,0 +1,19 @@ +import Qt 4.6 + +// Here, we implement "Scale to Fit" behaviour, using the +// fillMode property. +// +Rectangle { + // default size: whole image, unscaled + width: Face.width + height: Face.height + color: "gray" + clip: true + + Image { + id: Face + source: "pics/face.png" + fillMode: "PreserveAspectCrop" + anchors.fill: parent + } +} diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index a6bd2c8..18cc110 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 744abce..7450ea4 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index 4ee06ba..dcccd69 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -1,19 +1,19 @@ import Qt 4.6 // Here, we implement "Scale to Fit" behaviour, using the -// preserveAspect property. +// fillMode property. // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" - fillMode: "PreserveAspect" + fillMode: "PreserveAspectFit" anchors.fill: parent } } diff --git a/examples/declarative/modules/local/Foo.qml b/examples/declarative/modules/local/Foo.qml new file mode 100644 index 0000000..6cb07d5 --- /dev/null +++ b/examples/declarative/modules/local/Foo.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + text: "lib/Foo.qml" + color: "#00ff00" +} diff --git a/examples/declarative/modules/local/SubLib/Bar.qml b/examples/declarative/modules/local/SubLib/Bar.qml new file mode 100644 index 0000000..ad09d2e --- /dev/null +++ b/examples/declarative/modules/local/SubLib/Bar.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + text: "lib/SubLib/Bar.qml" + color: "#8898FF" +} diff --git a/examples/declarative/support/contact.cpp b/examples/declarative/support/contact.cpp index 0821295..9ffeb97 100644 --- a/examples/declarative/support/contact.cpp +++ b/examples/declarative/support/contact.cpp @@ -12,7 +12,6 @@ ****************************************************************************/ #include "contact.h" -#include "qmltypes.h" QML_DEFINE_TYPE(0,0,0,0,Contact,Contact); Contact::Contact() : QObject(0) @@ -26,13 +25,13 @@ Contact::Contact() : QObject(0) m_numbers << new PhoneNumber; m_numbers << new PhoneNumber; m_numbers << new PhoneNumber; - + m_numbers.at(0)->setType(PhoneNumber::HomePhone); m_numbers.at(0)->setNumber("35412451"); m_numbers.at(1)->setType(PhoneNumber::BusinessPhone); m_numbers.at(1)->setNumber("33424994"); - + m_numbers.at(2)->setType(PhoneNumber::MobilePhone); m_numbers.at(2)->setNumber("0424655137"); @@ -52,8 +51,7 @@ Contact::Contact() : QObject(0) void Contact::addNumber(PhoneNumber *newNumber) { - - m_numbers << newNumber; + m_numbers << newNumber; emit numbersChanged(); } diff --git a/examples/declarative/support/contact.h b/examples/declarative/support/contact.h index c403f8b..7b25869 100644 --- a/examples/declarative/support/contact.h +++ b/examples/declarative/support/contact.h @@ -15,8 +15,7 @@ #define CONTACT_H #include <qml.h> -#include <QtGui> - +#include <QtCore> class Address : public QObject { @@ -105,7 +104,7 @@ public: Q_PROPERTY(QList<PhoneNumber *>* numbers READ numbers); QList<PhoneNumber *>* numbers() { return &m_numbers; } - + void addEmail(QString&); void addAddress(Address*); void addNumber(PhoneNumber*); diff --git a/examples/declarative/support/contactmodel.cpp b/examples/declarative/support/contactmodel.cpp index efe108fb..ff71b9c 100644 --- a/examples/declarative/support/contactmodel.cpp +++ b/examples/declarative/support/contactmodel.cpp @@ -12,7 +12,6 @@ ****************************************************************************/ #include "contactmodel.h" -#include "qmltypes.h" ContactModel::ContactModel(QObject *parent) : QListModelInterface(parent) { @@ -29,7 +28,7 @@ ContactModel::ContactModel(QObject *parent) : QListModelInterface(parent) c->addEmail(list[i]); //contactList.append(c); insertContact(c); - + text = ts.readLine(); } f.close(); @@ -149,7 +148,7 @@ int ContactModel::findIndex(QString &searchName) const else return middle; } return start; -} +} int ContactModel::isAfter(QString &name1, QString &name2) const { |