Qt 4.8
Public Functions | Static Private Functions | Properties | List of all members
QDeclarativeGridScaledImage Class Reference

#include <qdeclarativescalegrid_p_p.h>

Public Functions

int gridBottom () const
 
int gridLeft () const
 
int gridRight () const
 
int gridTop () const
 
QDeclarativeBorderImage::TileMode horizontalTileRule () const
 
bool isValid () const
 
QDeclarativeGridScaledImageoperator= (const QDeclarativeGridScaledImage &)
 
QString pixmapUrl () const
 
 QDeclarativeGridScaledImage ()
 
 QDeclarativeGridScaledImage (const QDeclarativeGridScaledImage &)
 
 QDeclarativeGridScaledImage (QIODevice *)
 
QDeclarativeBorderImage::TileMode verticalTileRule () const
 

Static Private Functions

static QDeclarativeBorderImage::TileMode stringToRule (const QString &)
 

Properties

int _b
 
QDeclarativeBorderImage::TileMode _h
 
int _l
 
QString _pix
 
int _r
 
int _t
 
QDeclarativeBorderImage::TileMode _v
 

Detailed Description

Definition at line 98 of file qdeclarativescalegrid_p_p.h.

Constructors and Destructors

◆ QDeclarativeGridScaledImage() [1/3]

QDeclarativeGridScaledImage::QDeclarativeGridScaledImage ( )

◆ QDeclarativeGridScaledImage() [2/3]

QDeclarativeGridScaledImage::QDeclarativeGridScaledImage ( const QDeclarativeGridScaledImage o)

◆ QDeclarativeGridScaledImage() [3/3]

QDeclarativeGridScaledImage::QDeclarativeGridScaledImage ( QIODevice data)

Definition at line 127 of file qdeclarativescalegrid.cpp.

129 {
130  int l = -1;
131  int r = -1;
132  int t = -1;
133  int b = -1;
134  QString imgFile;
135 
136  QByteArray raw;
137  while(raw = data->readLine(), !raw.isEmpty()) {
138  QString line = QString::fromUtf8(raw.trimmed());
139  if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
140  continue;
141 
142  int colonId = line.indexOf(QLatin1Char(':'));
143  if (colonId <= 0)
144  return;
145  QStringList list;
146  list.append(line.left(colonId).trimmed());
147  list.append(line.mid(colonId+1).trimmed());
148 
149  if (list[0] == QLatin1String("border.left"))
150  l = list[1].toInt();
151  else if (list[0] == QLatin1String("border.right"))
152  r = list[1].toInt();
153  else if (list[0] == QLatin1String("border.top"))
154  t = list[1].toInt();
155  else if (list[0] == QLatin1String("border.bottom"))
156  b = list[1].toInt();
157  else if (list[0] == QLatin1String("source"))
158  imgFile = list[1];
159  else if (list[0] == QLatin1String("horizontalTileRule"))
160  _h = stringToRule(list[1]);
161  else if (list[0] == QLatin1String("verticalTileRule"))
162  _v = stringToRule(list[1]);
163  }
164 
165  if (l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty())
166  return;
167 
168  _l = l; _r = r; _t = t; _b = b;
169 
170  _pix = imgFile;
171 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static QDeclarativeBorderImage::TileMode stringToRule(const QString &)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QByteArray trimmed() const
Returns a byte array that has whitespace removed from the start and the end.
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static int toInt(const QByteArray &str)
Definition: generator.cpp:167
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QDeclarativeBorderImage::TileMode _v
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes...
Definition: qiodevice.cpp:1110
QFactoryLoader * l
QDeclarativeBorderImage::TileMode _h
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Functions

◆ gridBottom()

int QDeclarativeGridScaledImage::gridBottom ( ) const

Definition at line 206 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

207 {
208  return _b;
209 }

◆ gridLeft()

int QDeclarativeGridScaledImage::gridLeft ( ) const

Definition at line 191 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

192 {
193  return _l;
194 }

◆ gridRight()

int QDeclarativeGridScaledImage::gridRight ( ) const

Definition at line 196 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

197 {
198  return _r;
199 }

◆ gridTop()

int QDeclarativeGridScaledImage::gridTop ( ) const

Definition at line 201 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

202 {
203  return _t;
204 }

◆ horizontalTileRule()

QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::horizontalTileRule ( ) const
inline

Definition at line 110 of file qdeclarativescalegrid_p_p.h.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

110 { return _h; }
QDeclarativeBorderImage::TileMode _h

◆ isValid()

bool QDeclarativeGridScaledImage::isValid ( ) const

Definition at line 186 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

187 {
188  return _l >= 0;
189 }

◆ operator=()

QDeclarativeGridScaledImage & QDeclarativeGridScaledImage::operator= ( const QDeclarativeGridScaledImage o)

Definition at line 115 of file qdeclarativescalegrid.cpp.

116 {
117  _l = o._l;
118  _r = o._r;
119  _t = o._t;
120  _b = o._b;
121  _h = o._h;
122  _v = o._v;
123  _pix = o._pix;
124  return *this;
125 }
QDeclarativeBorderImage::TileMode _v
QDeclarativeBorderImage::TileMode _h

◆ pixmapUrl()

QString QDeclarativeGridScaledImage::pixmapUrl ( ) const

Definition at line 211 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

212 {
213  return _pix;
214 }

◆ stringToRule()

QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::stringToRule ( const QString s)
staticprivate

Definition at line 173 of file qdeclarativescalegrid.cpp.

Referenced by QDeclarativeGridScaledImage().

174 {
175  if (s == QLatin1String("Stretch"))
177  if (s == QLatin1String("Repeat"))
179  if (s == QLatin1String("Round"))
181 
182  qWarning("QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch.");
184 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_CORE_EXPORT void qWarning(const char *,...)

◆ verticalTileRule()

QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::verticalTileRule ( ) const
inline

Definition at line 111 of file qdeclarativescalegrid_p_p.h.

Referenced by QDeclarativeBorderImage::setGridScaledImage().

111 { return _v; }
QDeclarativeBorderImage::TileMode _v

Properties

◆ _b

int QDeclarativeGridScaledImage::_b
private

Definition at line 122 of file qdeclarativescalegrid_p_p.h.

Referenced by gridBottom(), operator=(), and QDeclarativeGridScaledImage().

◆ _h

QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::_h
private

Definition at line 123 of file qdeclarativescalegrid_p_p.h.

Referenced by operator=(), and QDeclarativeGridScaledImage().

◆ _l

int QDeclarativeGridScaledImage::_l
private

◆ _pix

QString QDeclarativeGridScaledImage::_pix
private

Definition at line 125 of file qdeclarativescalegrid_p_p.h.

Referenced by operator=(), pixmapUrl(), and QDeclarativeGridScaledImage().

◆ _r

int QDeclarativeGridScaledImage::_r
private

Definition at line 120 of file qdeclarativescalegrid_p_p.h.

Referenced by gridRight(), operator=(), and QDeclarativeGridScaledImage().

◆ _t

int QDeclarativeGridScaledImage::_t
private

Definition at line 121 of file qdeclarativescalegrid_p_p.h.

Referenced by gridTop(), operator=(), and QDeclarativeGridScaledImage().

◆ _v

QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::_v
private

Definition at line 124 of file qdeclarativescalegrid_p_p.h.

Referenced by operator=(), and QDeclarativeGridScaledImage().


The documentation for this class was generated from the following files: