Qt 4.8
Classes | Macros | Functions
qdeclarativeglobal_p.h File Reference
#include <QtCore/qglobal.h>
#include <QtCore/QObject>

Go to the source code of this file.

Classes

struct  QDeclarativeGraphics_DerivedObject
 

Macros

#define DEFINE_BOOL_CONFIG_OPTION(name, var)
 
#define Q_DECLARATIVE_PRIVATE_EXPORT   Q_DECLARATIVE_EXPORT
 

Functions

bool QDeclarative_isFileCaseCorrect (const QString &fileName)
 Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise. More...
 
void QDeclarative_setParent_noEvent (QObject *object, QObject *parent)
 Makes the object a child of parent. More...
 

Macro Definition Documentation

◆ DEFINE_BOOL_CONFIG_OPTION

#define DEFINE_BOOL_CONFIG_OPTION (   name,
  var 
)
Value:
static bool name() \
{ \
static enum { Yes, No, Unknown } status = Unknown; \
if (status == Unknown) { \
QByteArray v = qgetenv(#var); \
bool value = !v.isEmpty() && v != "0" && v != "false"; \
if (value) status = Yes; \
else status = No; \
} \
return status == Yes; \
}
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
const char * name

Definition at line 54 of file qdeclarativeglobal_p.h.

◆ Q_DECLARATIVE_PRIVATE_EXPORT

#define Q_DECLARATIVE_PRIVATE_EXPORT   Q_DECLARATIVE_EXPORT

Definition at line 70 of file qdeclarativeglobal_p.h.

Function Documentation

◆ QDeclarative_isFileCaseCorrect()

bool QDeclarative_isFileCaseCorrect ( const QString fileName)

Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise.

This is used to ensure that the behavior of QML on a case-insensitive file system is the same as on a case-sensitive file system. This function performs a "best effort" attempt to determine the real case of the file. It may have false positives (say the case is correct when it isn't), but it should never have a false negative (say the case is incorrect when it is correct).

Definition at line 2550 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeImportDatabase::importPlugin(), QDeclarativeDataLoader::load(), QDeclarativeDirParser::parse(), and QDeclarativeGraphics_DerivedObject::setParent_noEvent().

2551 {
2552 #if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
2553  QFileInfo info(fileName);
2554 
2555  QString absolute = info.absoluteFilePath();
2556 
2557 #if defined(Q_OS_MAC)
2558  QString canonical = info.canonicalFilePath();
2559 #elif defined(Q_OS_WIN32)
2560  wchar_t buffer[1024];
2561 
2562  DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024);
2563  if (rv == 0 || rv >= 1024) return true;
2564  rv = ::GetLongPathName(buffer, buffer, 1024);
2565  if (rv == 0 || rv >= 1024) return true;
2566 
2567  QString canonical((QChar *)buffer);
2568 #endif
2569 
2570  int absoluteLength = absolute.length();
2571  int canonicalLength = canonical.length();
2572 
2573  int length = qMin(absoluteLength, canonicalLength);
2574  for (int ii = 0; ii < length; ++ii) {
2575  const QChar &a = absolute.at(absoluteLength - 1 - ii);
2576  const QChar &c = canonical.at(canonicalLength - 1 - ii);
2577 
2578  if (a.toLower() != c.toLower())
2579  return true;
2580  if (a != c)
2581  return false;
2582  }
2583 #else
2584  Q_UNUSED(fileName)
2585 #endif
2586  return true;
2587 }
static mach_timebase_info_data_t info
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290

◆ QDeclarative_setParent_noEvent()

void QDeclarative_setParent_noEvent ( QObject object,
QObject parent 
)
inline

Makes the object a child of parent.

Note that when using this method, neither parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events.

Definition at line 101 of file qdeclarativeglobal_p.h.

Referenced by QDeclarativeLoaderPrivate::_q_sourceLoaded(), QDeclarativeAnimationGroupPrivate::append_animation(), QDeclarativeVisualItemModelPrivate::children_append(), QDeclarativeAnimationGroupPrivate::clear_animation(), QDeclarativeGridViewPrivate::createComponentItem(), QDeclarativeListViewPrivate::createComponentItem(), QDeclarativeTextInput::createCursor(), QDeclarativePathViewPrivate::createHighlight(), QDeclarativeGridViewPrivate::createHighlight(), QDeclarativeListViewPrivate::createHighlight(), QDeclarativeListViewPrivate::createSection(), QDeclarativeFlickablePrivate::init(), QDeclarativeBoundSignal::init(), QDeclarativeItemPrivate::init(), QDeclarativePauseAnimationPrivate::init(), QDeclarativeScriptActionPrivate::init(), QDeclarativePropertyActionPrivate::init(), QDeclarativePropertyAnimationPrivate::init(), QDeclarativeVisualDataModel::item(), QDeclarativeRepeater::itemsInserted(), QDeclarativeTextEdit::loadCursorDelegate(), QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(), QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(), QDeclarativeParentAnimation::QDeclarativeParentAnimation(), QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(), QDeclarativeSmoothedAnimationPrivate::QDeclarativeSmoothedAnimationPrivate(), QDeclarativeRepeater::regenerate(), QDeclarativeVisualItemModel::release(), QDeclarativeVME::run(), QDeclarativeStateGroupPrivate::setCurrentStateInternal(), QDeclarativeGridViewPrivate::updateFooter(), QDeclarativeListViewPrivate::updateFooter(), QDeclarativeGridViewPrivate::updateHeader(), and QDeclarativeListViewPrivate::updateHeader().

102 {
103  static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent);
104 }