Mode | Name | Size | |
-rw-r--r-- | ADDITIONAL_CLEAN_FILES.rst | 1068 | logstatsplain |
-rw-r--r-- | AIX_EXPORT_ALL_SYMBOLS.rst | 550 | logstatsplain |
-rw-r--r-- | ALIASED_TARGET.rst | 177 | logstatsplain |
-rw-r--r-- | ALIAS_GLOBAL.rst | 648 | logstatsplain |
-rw-r--r-- | ANDROID_ANT_ADDITIONAL_OPTIONS.rst | 367 | logstatsplain |
-rw-r--r-- | ANDROID_API.rst | 384 | logstatsplain |
-rw-r--r-- | ANDROID_API_MIN.rst | 334 | logstatsplain |
-rw-r--r-- | ANDROID_ARCH.rst | 593 | logstatsplain |
-rw-r--r-- | ANDROID_ASSETS_DIRECTORIES.rst | 386 | logstatsplain |
-rw-r--r-- | ANDROID_GUI.rst | 653 | logstatsplain |
-rw-r--r-- | ANDROID_JAR_DEPENDENCIES.rst | 305 | logstatsplain |
-rw-r--r-- | ANDROID_JAR_DIRECTORIES.rst | 564 | logstatsplain |
-rw-r--r-- | ANDROID_JAVA_SOURCE_DIR.rst | 369 | logstatsplain |
-rw-r--r-- | ANDROID_NATIVE_LIB_DEPENDENCIES.rst | 517 | logstatsplain |
-rw-r--r-- | ANDROID_NATIVE_LIB_DIRECTORIES.rst | 597 | logstatsplain |
-rw-r--r-- | ANDROID_PROCESS_MAX.rst | 315 | logstatsplain |
-rw-r--r-- | ANDROID_PROGUARD.rst | 398 | logstatsplain |
-rw-r--r-- | ANDROID_PROGUARD_CONFIG_PATH.rst | 415 | logstatsplain |
-rw-r--r-- | ANDROID_SECURE_PROPS_PATH.rst | 353 | logstatsplain |
-rw-r--r-- | ANDROID_SKIP_ANT_STEP.rst | 296 | logstatsplain |
-rw-r--r-- | ANDROID_STL_TYPE.rst | 707 | logstatsplain |
-rw-r--r-- | ARCHIVE_OUTPUT_DIRECTORY.rst | 339 | logstatsplain |
-rw-r--r-- | ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst | 659 | logstatsplain |
-rw-r--r-- | ARCHIVE_OUTPUT_NAME.rst | 234 | logstatsplain |
-rw-r--r-- | ARCHIVE_OUTPUT_NAME_CONFIG.rst | 249 | logstatsplain |
-rw-r--r-- | AUTOGEN_BUILD_DIR.rst | 600 | logstatsplain |
-rw-r--r-- | AUTOGEN_ORIGIN_DEPENDS.rst | 1621 | logstatsplain |
-rw-r--r-- | AUTOGEN_PARALLEL.rst | 879 | logstatsplain |
-rw-r--r-- | AUTOGEN_TARGET_DEPENDS.rst | 1532 | logstatsplain |
-rw-r--r-- | AUTOMOC.rst | 9256 | logstatsplain |
-rw-r--r-- | AUTOMOC_COMPILER_PREDEFINES.rst | 1040 | logstatsplain |
-rw-r--r-- | AUTOMOC_DEPEND_FILTERS.rst | 3381 | logstatsplain |
-rw-r--r-- | AUTOMOC_EXECUTABLE.rst | 660 | logstatsplain |
-rw-r--r-- | AUTOMOC_MACRO_NAMES.rst | 1131 | logstatsplain |
-rw-r--r-- | AUTOMOC_MOC_OPTIONS.rst | 669 | logstatsplain |
-rw-r--r-- | AUTOMOC_PATH_PREFIX.rst | 1288 | logstatsplain |
-rw-r--r-- | AUTORCC.rst | 2439 | logstatsplain |
-rw-r--r-- | AUTORCC_EXECUTABLE.rst | 660 | logstatsplain |
-rw-r--r-- | AUTORCC_OPTIONS.rst | 828 | logstatsplain |
-rw-r--r-- | AUTOUIC.rst | 2924 | logstatsplain |
-rw-r--r-- | AUTOUIC_EXECUTABLE.rst | 660 | logstatsplain |
-rw-r--r-- | AUTOUIC_OPTIONS.rst | 982 | logstatsplain |
-rw-r--r-- | AUTOUIC_SEARCH_PATHS.rst | 386 | logstatsplain |
-rw-r--r-- | BINARY_DIR.rst | 191 | logstatsplain |
-rw-r--r-- | BUILD_RPATH.rst | 567 | logstatsplain |
-rw-r--r-- | BUILD_RPATH_USE_ORIGIN.rst | 1086 | logstatsplain |
-rw-r--r-- | BUILD_WITH_INSTALL_NAME_DIR.rst | 597 | logstatsplain |
-rw-r--r-- | BUILD_WITH_INSTALL_RPATH.rst | 666 | logstatsplain |
-rw-r--r-- | BUNDLE.rst | 334 | logstatsplain |
-rw-r--r-- | BUNDLE_EXTENSION.rst | 267 | logstatsplain |
-rw-r--r-- | COMMON_LANGUAGE_RUNTIME.rst | 776 | logstatsplain |
-rw-r--r-- | COMPATIBLE_INTERFACE_BOOL.rst | 924 | logstatsplain |
-rw-r--r-- | COMPATIBLE_INTERFACE_NUMBER_MAX.rst | 912 | logstatsplain |
-rw-r--r-- | COMPATIBLE_INTERFACE_NUMBER_MIN.rst | 912 | logstatsplain |
-rw-r--r-- | COMPATIBLE_INTERFACE_STRING.rst | 792 | logstatsplain |
-rw-r--r-- | COMPILE_DEFINITIONS.rst | 1093 | logstatsplain |
-rw-r--r-- | COMPILE_DEFINITIONS_CONFIG.rst | 678 | logstatsplain |
-rw-r--r-- | COMPILE_FEATURES.rst | 617 | logstatsplain |
-rw-r--r-- | COMPILE_FLAGS.rst | 411 | logstatsplain |
-rw-r--r-- | COMPILE_OPTIONS.rst | 998 | logstatsplain |
-rw-r--r-- | COMPILE_PDB_NAME.rst | 349 | logstatsplain |
-rw-r--r-- | COMPILE_PDB_NAME_CONFIG.rst | 364 | logstatsplain |
-rw-r--r-- | COMPILE_PDB_NOTE.txt | 256 | logstatsplain |
-rw-r--r-- | COMPILE_PDB_OUTPUT_DIRECTORY.rst | 531 | logstatsplain |
-rw-r--r-- | COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 697 | logstatsplain |
-rw-r--r-- | CONFIG_OUTPUT_NAME.rst | 224 | logstatsplain |
-rw-r--r-- | CONFIG_POSTFIX.rst | 537 | logstatsplain |
-rw-r--r-- | CROSSCOMPILING_EMULATOR.rst | 617 | logstatsplain |
-rw-r--r-- | CUDA_ARCHITECTURES.rst | 1316 | logstatsplain |
-rw-r--r-- | CUDA_EXTENSIONS.rst | 718 | logstatsplain |
-rw-r--r-- | CUDA_PTX_COMPILATION.rst | 301 | logstatsplain |
-rw-r--r-- | CUDA_RESOLVE_DEVICE_SYMBOLS.rst | 937 | logstatsplain |
-rw-r--r-- | CUDA_RUNTIME_LIBRARY-VALUES.txt | 325 | logstatsplain |
-rw-r--r-- | CUDA_RUNTIME_LIBRARY.rst | 727 | logstatsplain |
-rw-r--r-- | CUDA_SEPARABLE_COMPILATION.rst | 471 | logstatsplain |
-rw-r--r-- | CUDA_STANDARD.rst | 1457 | logstatsplain |
-rw-r--r-- | CUDA_STANDARD_REQUIRED.rst | 853 | logstatsplain |
-rw-r--r-- | CXX_EXTENSIONS.rst | 709 | logstatsplain |
-rw-r--r-- | CXX_STANDARD.rst | 1563 | logstatsplain |
-rw-r--r-- | CXX_STANDARD_REQUIRED.rst | 847 | logstatsplain |
-rw-r--r-- | C_EXTENSIONS.rst | 695 | logstatsplain |
-rw-r--r-- | C_STANDARD.rst | 1517 | logstatsplain |
-rw-r--r-- | C_STANDARD_REQUIRED.rst | 841 | logstatsplain |
-rw-r--r-- | DEBUG_POSTFIX.rst | 203 | logstatsplain |
-rw-r--r-- | DEFINE_SYMBOL.rst | 485 | logstatsplain |
-rw-r--r-- | DEPLOYMENT_ADDITIONAL_FILES.rst | 687 | logstatsplain |
-rw-r--r-- | DEPLOYMENT_REMOTE_DIRECTORY.rst | 600 | logstatsplain |
-rw-r--r-- | DEPRECATION.rst | 215 | logstatsplain |
-rw-r--r-- | DISABLE_PRECOMPILE_HEADERS.rst | 289 | logstatsplain |
-rw-r--r-- | DOTNET_TARGET_FRAMEWORK.rst | 390 | logstatsplain |
-rw-r--r-- | DOTNET_TARGET_FRAMEWORK_VERSION.rst | 499 | logstatsplain |
-rw-r--r-- | ENABLE_EXPORTS.rst | 1419 | logstatsplain |
-rw-r--r-- | EXCLUDE_FROM_ALL.rst | 1363 | logstatsplain |
-rw-r--r-- | EXCLUDE_FROM_DEFAULT_BUILD.rst | 238 | logstatsplain |
-rw-r--r-- | EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst | 412 | logstatsplain |
-rw-r--r-- | EXPORT_COMPILE_COMMANDS.rst | 287 | logstatsplain |
-rw-r--r-- | EXPORT_NAME.rst | 237 | logstatsplain |
-rw-r--r-- | EXPORT_PROPERTIES.rst | 870 | logstatsplain |
-rw-r--r-- | EchoString.rst | 179 | logstatsplain |
-rw-r--r-- | FOLDER.rst | 507 | logstatsplain |
-rw-r--r-- | FRAMEWORK.rst | 1310 | logstatsplain |
-rw-r--r-- | FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst | 1122 | logstatsplain |
-rw-r--r-- | FRAMEWORK_VERSION.rst | 239 | logstatsplain |
-rw-r--r-- | Fortran_BUILDING_INSTRINSIC_MODULES.rst | 626 | logstatsplain |
-rw-r--r-- | Fortran_FORMAT.rst | 498 | logstatsplain |
-rw-r--r-- | Fortran_MODULE_DIRECTORY.rst | 1314 | logstatsplain |
-rw-r--r-- | Fortran_PREPROCESS.rst | 993 | logstatsplain |
-rw-r--r-- | GENERATOR_FILE_NAME.rst | 314 | logstatsplain |
-rw-r--r-- | GHS_INTEGRITY_APP.rst | 362 | logstatsplain |
-rw-r--r-- | GHS_NO_SOURCE_GROUP_FILE.rst | 535 | logstatsplain |
-rw-r--r-- | GNUtoMS.rst | 860 | logstatsplain |
-rw-r--r-- | HAS_CXX.rst | 155 | logstatsplain |
-rw-r--r-- | HIP_ARCHITECTURES.rst | 893 | logstatsplain |
-rw-r--r-- | HIP_EXTENSIONS.rst | 714 | logstatsplain |
-rw-r--r-- | HIP_STANDARD.rst | 1179 | logstatsplain |
-rw-r--r-- | HIP_STANDARD_REQUIRED.rst | 722 | logstatsplain |
-rw-r--r-- | IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst | 836 | logstatsplain |
-rw-r--r-- | IMPORTED.rst | 284 | logstatsplain |
-rw-r--r-- | IMPORTED_COMMON_LANGUAGE_RUNTIME.rst | 244 | logstatsplain |
-rw-r--r-- | IMPORTED_CONFIGURATIONS.rst | 447 | logstatsplain |
-rw-r--r-- | IMPORTED_GLOBAL.rst | 1321 | logstatsplain |
-rw-r--r-- | IMPORTED_IMPLIB.rst | 325 | logstatsplain |
-rw-r--r-- | IMPORTED_IMPLIB_CONFIG.rst | 218 | logstatsplain |
-rw-r--r-- | IMPORTED_LIBNAME.rst | 1080 | logstatsplain |
-rw-r--r-- | IMPORTED_LIBNAME_CONFIG.rst | 244 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_DEPENDENT_LIBRARIES.rst | 734 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst | 357 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_LANGUAGES.rst | 642 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst | 357 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_LIBRARIES.rst | 699 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst | 546 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst | 212 | logstatsplain |
-rw-r--r-- | IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst | 266 | logstatsplain |
-rw-r--r-- | IMPORTED_LOCATION.rst | 1579 | logstatsplain |
-rw-r--r-- | IMPORTED_LOCATION_CONFIG.rst | 224 | logstatsplain |
-rw-r--r-- | IMPORTED_NO_SONAME.rst | 393 | logstatsplain |
-rw-r--r-- | IMPORTED_NO_SONAME_CONFIG.rst | 227 | log
By default, this property's value is derived from the highest signed integer available (typically 2147483647).
*/
/*!
\qmlproperty int IntValidator::bottom
This property holds the validator's lowest acceptable value.
By default, this property's value is derived from the lowest signed integer available (typically -2147483647).
*/
/*!
\qmlclass DoubleValidator QDoubleValidator
This element provides a validator for non-integer numbers.
*/
/*!
\qmlproperty real DoubleValidator::top
This property holds the validator's maximum acceptable value.
By default, this property contains a value of infinity.
*/
/*!
\qmlproperty real DoubleValidator::bottom
This property holds the validator's minimum acceptable value.
By default, this property contains a value of -infinity.
*/
/*!
\qmlproperty int DoubleValidator::decimals
This property holds the validator's maximum number of digits after the decimal point.
By default, this property contains a value of 1000.
*/
/*!
\qmlproperty enumeration DoubleValidator::notation
This property holds the notation of how a string can describe a number.
The values for this property are DoubleValidator.StandardNotation or DoubleValidator.ScientificNotation.
If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part(i.e. 1.5E-2).
By default, this property is set to DoubleValidator.ScientificNotation.
*/
/*!
\qmlclass RegExpValidator QRegExpValidator
This element provides a validator, which counts as valid any string which
matches a specified regular expression.
*/
/*!
\qmlproperty regExp RegExpValidator::regExp
This property holds the regular expression used for validation.
Note that this property should be a regular expression in JS syntax, e.g /a/ for the regular expression
matching "a".
By default, this property contains a regular expression with the pattern .* that matches any string.
*/
/*!
\qmlproperty Validator TextInput::validator
Allows you to set a validator on the TextInput. When a validator is set
the TextInput will only accept input which leaves the text property in
an acceptable or intermediate state. The accepted signal will only be sent
if the text is in an acceptable state when enter is pressed.
Currently supported validators are IntValidator, DoubleValidator and
RegExpValidator. An example of using validators is shown below, which allows
input of integers between 11 and 31 into the text input:
\code
import Qt 4.7
TextInput{
validator: IntValidator{bottom: 11; top: 31;}
focus: true
}
\endcode
\sa acceptableInput, inputMask
*/
#ifndef QT_NO_VALIDATOR
QValidator* QDeclarativeTextInput::validator() const
{
Q_D(const QDeclarativeTextInput);
//###const cast isn't good, but needed for property system?
return const_cast<QValidator*>(d->control->validator());
}
void QDeclarativeTextInput::setValidator(QValidator* v)
{
Q_D(QDeclarativeTextInput);
if (d->control->validator() == v)
return;
d->control->setValidator(v);
if(!d->control->hasAcceptableInput()){
d->oldValidity = false;
emit acceptableInputChanged();
}
emit validatorChanged();
}
#endif // QT_NO_VALIDATOR
/*!
\qmlproperty string TextInput::inputMask
Allows you to set an input mask on the TextInput, restricting the allowable
text inputs. See QLineEdit::inputMask for further details, as the exact
same mask strings are used by TextInput.
\sa acceptableInput, validator
*/
QString QDeclarativeTextInput::inputMask() const
{
Q_D(const QDeclarativeTextInput);
return d->control->inputMask();
}
void QDeclarativeTextInput::setInputMask(const QString &im)
{
Q_D(QDeclarativeTextInput);
if (d->control->inputMask() == im)
return;
d->control->setInputMask(im);
emit inputMaskChanged(d->control->inputMask());
}
/*!
\qmlproperty bool TextInput::acceptableInput
This property is always true unless a validator or input mask has been set.
If a validator or input mask has been set, this property will only be true
if the current text is acceptable to the validator or input mask as a final
string (not as an intermediate string).
*/
bool QDeclarativeTextInput::hasAcceptableInput() const
{
Q_D(const QDeclarativeTextInput);
return d->control->hasAcceptableInput();
}
/*!
\qmlproperty enumeration TextInput::echoMode
Specifies how the text should be displayed in the TextInput.
\list
\o TextInput.Normal - Displays the text as it is. (Default)
\o TextInput.Password - Displays asterixes instead of characters.
\o TextInput.NoEcho - Displays nothing.
\o TextInput.PasswordEchoOnEdit - Displays all but the current character as asterixes.
\endlist
*/
QDeclarativeTextInput::EchoMode QDeclarativeTextInput::echoMode() const
{
Q_D(const QDeclarativeTextInput);
return (QDeclarativeTextInput::EchoMode)d->control->echoMode();
}
void QDeclarativeTextInput::setEchoMode(QDeclarativeTextInput::EchoMode echo)
{
Q_D(QDeclarativeTextInput);
if (echoMode() == echo)
return;
Qt::InputMethodHints imHints = inputMethodHints();
if (echo == Password || echo == NoEcho)
imHints |= Qt::ImhHiddenText;
else
imHints &= ~Qt::ImhHiddenText;
if (echo != Normal)
imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
else
imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
setInputMethodHints(imHints);
d->control->setEchoMode((uint)echo);
update();
emit echoModeChanged(echoMode());
}
/*!
\qmlproperty Component TextInput::cursorDelegate
The delegate for the cursor in the TextInput.
If you set a cursorDelegate for a TextInput, this delegate will be used for
drawing the cursor instead of the standard cursor. An instance of the
delegate will be created and managed by the TextInput when a cursor is
needed, and the x property of delegate instance will be set so as
to be one pixel before the top left of the current character.
Note that the root item of the delegate component must be a QDeclarativeItem or
QDeclarativeItem derived item.
*/
QDeclarativeComponent* QDeclarativeTextInput::cursorDelegate() const
{
Q_D(const QDeclarativeTextInput);
return d->cursorComponent;
}
void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c)
{
Q_D(QDeclarativeTextInput);
if (d->cursorComponent == c)
return;
d->cursorComponent = c;
if(!c){
//note that the components are owned by something else
disconnect(d->control, SIGNAL(cursorPositionChanged(int, int)),
this, SLOT(moveCursor()));
delete d->cursorItem;
}else{
d->startCreatingCursor();
}
emit cursorDelegateChanged();
}
void QDeclarativeTextInputPrivate::startCreatingCursor()
{
Q_Q(QDeclarativeTextInput);
q->connect(control, SIGNAL(cursorPositionChanged(int, int)),
q, SLOT(moveCursor()));
if(cursorComponent->isReady()){
q->createCursor();
}else if(cursorComponent->isLoading()){
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
}else {//isError
qmlInfo(q, cursorComponent->errors()) << QDeclarativeTextInput::tr("Could not load cursor delegate");
}
}
void QDeclarativeTextInput::createCursor()
{
Q_D(QDeclarativeTextInput);
if(d->cursorComponent->isError()){
qmlInfo(this, d->cursorComponent->errors()) << tr("Could not load cursor delegate");
return;
}
if(!d->cursorComponent->isReady())
return;
if(d->cursorItem)
delete d->cursorItem;
d->cursorItem = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create());
if(!d->cursorItem){
qmlInfo(this, d->cursorComponent->errors()) << tr("Could not instantiate cursor delegate");
return;
}
QDeclarative_setParent_noEvent(d->cursorItem, this);
d->cursorItem->setParentItem(this);
d->cursorItem->setX(d->control->cursorToX());
d->cursorItem->setHeight(d->control->height());
}
void QDeclarativeTextInput::moveCursor()
{
Q_D(QDeclarativeTextInput);
if(!d->cursorItem)
return;
d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
}
/*!
\qmlmethod rect TextInput::positionToRectangle(int x)
*/
QRectF QDeclarativeTextInput::positionToRectangle(int x) const
{
Q_D(const QDeclarativeTextInput);
QFontMetrics fm = QFontMetrics(d->font);
return QRectF(d->control->cursorToX(x)-d->hscroll,
0.0,
d->control->cursorWidth(),
cursorRectangle().height());
}
/*!
\qmlmethod int TextInput::positionAt(int x)
This function returns the character position at
x pixels from the left of the textInput. Position 0 is before the
first character, position 1 is after the first character but before the second,
and so on until position text.length, which is after all characters.
This means that for all x values before the first character this function returns 0,
and for all x values after the last character this function returns text.length.
*/
int QDeclarativeTextInput::positionAt(int x) const
{
Q_D(const QDeclarativeTextInput);
return d->control->xToPos(x + d->hscroll);
}
void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus)
{
Q_Q(QDeclarativeTextInput);
focused = hasFocus;
q->setCursorVisible(hasFocus);
if(q->echoMode() == QDeclarativeTextInput::PasswordEchoOnEdit && !hasFocus)
control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events
if (!hasFocus)
control->deselect();
QDeclarativeItemPrivate::focusChanged(hasFocus);
}
void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
{
Q_D(QDeclarativeTextInput);
keyPressPreHandler(ev);
if (ev->isAccepted())
return;
if (((ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier) // Don't allow MacOSX up/down support, and we don't allow a completer.
|| (((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
|| (d->control->cursor() == d->control->text().length()
&& ev->key() == Qt::Key_Right))
&& (d->lastSelectionStart == d->lastSelectionEnd)))
{
//ignore when moving off the end
//unless there is a selection, because then moving will do something (deselect)
ev->ignore();
}else{
d->control->processKeyEvent(ev);
}
if (!ev->isAccepted())
QDeclarativePaintedItem::keyPressEvent(ev);
}
/*!
\overload
Handles the given mouse \a event.
*/
void QDeclarativeTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
if (d->selectByMouse) {
int cursor = d->xToPos(event->pos().x());
d->control->selectWordAtPos(cursor);
event->setAccepted(true);
} else {
QDeclarativePaintedItem::mouseDoubleClickEvent(event);
}
}
void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
if(d->focusOnPress){
bool hadFocus = hasFocus();
QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope?
while(p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope)
p->setFocus();
p = p->parentItem();
}
setFocus(true);
if (d->showInputPanelOnFocus) {
if (hasFocus() && hadFocus && !isReadOnly()) {
// re-open input panel on press if already focused
openSoftwareInputPanel();
}
} else { // show input panel on click
if (hasFocus() && !hadFocus) {
d->clickCausedFocus = true;
}
}
}
bool mark = event->modifiers() & Qt::ShiftModifier;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
event->setAccepted(true);
}
void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
if (d->selectByMouse) {
d->control->moveCursor(d->xToPos(event->pos().x()), true);
event->setAccepted(true);
} else {
QDeclarativePaintedItem::mouseMoveEvent(event);
}
}
/*!
\overload
Handles the given mouse \a event.
*/
void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
if (!d->showInputPanelOnFocus) { // input panel on click
if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
if (view->scene() && view->scene() == scene()) {
qt_widget_private(view)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
}
}
}
}
d->clickCausedFocus = false;
d->control->processEvent(event);
if (!event->isAccepted())
QDeclarativePaintedItem::mouseReleaseEvent(event);
}
bool QDeclarativeTextInput::event(QEvent* ev)
{
Q_D(QDeclarativeTextInput);
//Anything we don't deal with ourselves, pass to the control
bool handled = false;
switch(ev->type()){
case QEvent::KeyPress:
case QEvent::KeyRelease://###Should the control be doing anything with release?
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMouseDoubleClick:
break;
default:
handled = d->control->processEvent(ev);
if (ev->type() == QEvent::InputMethod)
updateSize();
}
if(!handled)
handled = QDeclarativePaintedItem::event(ev);
return handled;
}
void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (newGeometry.width() != oldGeometry.width())
updateSize();
QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r)
{
Q_D(QDeclarativeTextInput);
p->setRenderHint(QPainter::TextAntialiasing, true);
p->save();
p->setPen(QPen(d->color));
int flags = QLineControl::DrawText;
if(!isReadOnly() && d->cursorVisible && !d->cursorItem)
flags |= QLineControl::DrawCursor;
if (d->control->hasSelectedText())
flags |= QLineControl::DrawSelections;
QPoint offset = QPoint(0,0);
QFontMetrics fm = QFontMetrics(d->font);
int cix = qRound(d->control->cursorToX());
QRect br(boundingRect().toRect());
//###Is this using bearing appropriately?
int minLB = qMax(0, -fm.minLeftBearing());
int minRB = qMax(0, -fm.minRightBearing());
int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB;
if (d->autoScroll) {
if ((minLB + widthUsed) <= br.width()) {
// text fits in br; use hscroll for alignment
switch (d->hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) {
case Qt::AlignRight:
d->hscroll = widthUsed - br.width() + 1;
break;
case Qt::AlignHCenter:
d->hscroll = (widthUsed - br.width()) / 2;
break;
default:
// Left
d->hscroll = 0;
break;
}
d->hscroll -= minLB;
} else if (cix - d->hscroll >= br.width()) {
// text doesn't fit, cursor is to the right of br (scroll right)
d->hscroll = cix - br.width() + 1;
} else if (cix - d->hscroll < 0 && d->hscroll < widthUsed) {
// text doesn't fit, cursor is to the left of br (scroll left)
d->hscroll = cix;
} else if (widthUsed - d->hscroll < br.width()) {
// text doesn't fit, text document is to the left of br; align
// right
d->hscroll = widthUsed - br.width() + 1;
}
// the y offset is there to keep the baseline constant in case we have script changes in the text.
offset = br.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent());
} else {
if(d->hAlign == AlignRight){
d->hscroll = width() - widthUsed;
}else if(d->hAlign == AlignHCenter){
d->hscroll = (width() - widthUsed) / 2;
}
d->hscroll -= minLB;
offset = QPoint(d->hscroll, 0);
}
d->control->draw(p, offset, r, flags);
p->restore();
}
/*!
\overload
Returns the value of the given \a property.
*/
QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
{
Q_D(const QDeclarativeTextInput);
switch(property) {
case Qt::ImMicroFocus:
return d->control->cursorRect();
case Qt::ImFont:
return font();
case Qt::ImCursorPosition:
return QVariant(d->control->cursor());
case Qt::ImSurroundingText:
return QVariant(text());
case Qt::ImCurrentSelection:
return QVariant(selectedText());
case Qt::ImMaximumTextLength:
return QVariant(maxLength());
case Qt::ImAnchorPosition:
if (d->control->selectionStart() == d->control->selectionEnd())
return QVariant(d->control->cursor());
else if (d->control->selectionStart() == d->control->cursor())
return QVariant(d->control->selectionEnd());
else
return QVariant(d->control->selectionStart());
default:
return QVariant();
}
}
/*!
\qmlmethod void TextInput::selectAll()
Causes all text to be selected.
*/
void QDeclarativeTextInput::selectAll()
{
Q_D(QDeclarativeTextInput);
d->control->setSelection(0, d->control->text().length());
}
/*!
\qmlmethod void TextInput::selectWord()
Causes the word closest to the current cursor position to be selected.
*/
void QDeclarativeTextInput::selectWord()
{
Q_D(QDeclarativeTextInput);
d->control->selectWordAtPos(d->control->cursor());
}
/*!
\qmlproperty bool TextInput::smooth
This property holds whether the text is smoothly scaled or transformed.
Smooth filtering gives better visual quality, but is slower. If
the item is displayed at its natural size, this property has no visual or
performance effect.
\note Generally scaling artifacts are only visible if the item is stationary on
the screen. A common pattern when animating an item is to disable smooth
filtering at the beginning of the animation and reenable it at the conclusion.
*/
/*!
\qmlproperty string TextInput::passwordCharacter
This is the character displayed when echoMode is set to Password or
PasswordEchoOnEdit. By default it is an asterisk.
If this property is set to a string with more than one character,
the first character is used. If the string is empty, the value
is ignored and the property is not set.
*/
QString QDeclarativeTextInput::passwordCharacter() const
{
Q_D(const QDeclarativeTextInput);
return QString(d->control->passwordCharacter());
}
void QDeclarativeTextInput::setPasswordCharacter(const QString &str)
{
Q_D(QDeclarativeTextInput);
if(str.length() < 1)
return;
emit passwordCharacterChanged();
d->control->setPasswordCharacter(str.constData()[0]);
}
/*!
\qmlproperty string TextInput::displayText
This is the text displayed in the TextInput.
If \l echoMode is set to TextInput::Normal, this holds the
same value as the TextInput::text property. Otherwise,
this property holds the text visible to the user, while
the \l text property holds the actual entered text.
*/
QString QDeclarativeTextInput::displayText() const
{
Q_D(const QDeclarativeTextInput);
return d->control->displayText();
}
/*!
\qmlproperty bool TextInput::selectByMouse
Defaults to false.
If true, the user can use the mouse to select text in some
platform-specific way. Note that for some platforms this may
not be an appropriate interaction (eg. may conflict with how
the text needs to behave inside a Flickable.
*/
bool QDeclarativeTextInput::selectByMouse() const
{
Q_D(const QDeclarativeTextInput);
return d->selectByMouse;
}
void QDeclarativeTextInput::setSelectByMouse(bool on)
{
Q_D(QDeclarativeTextInput);
if (d->selectByMouse != on) {
d->selectByMouse = on;
emit selectByMouseChanged(on);
}
}
/*!
\qmlmethod void TextInput::moveCursorSelection(int position)
Moves the cursor to \a position and updates the selection accordingly.
(To only move the cursor, set the \l cursorPosition property.)
When this method is called it additionally sets either the
selectionStart or the selectionEnd (whichever was at the previous cursor position)
to the specified position. This allows you to easily extend and contract the selected
text range.
For example, take this sequence of calls:
\code
cursorPosition = 5
moveCursorSelection(9)
moveCursorSelection(7)
\endcode
This moves the cursor to position 5, extend the selection end from 5 to 9
and then retract the selection end from 9 to 7, leaving the text from position 5 to 7
selected (the 6th and 7th characters).
*/
void QDeclarativeTextInput::moveCursorSelection(int position)
{
Q_D(QDeclarativeTextInput);
d->control->moveCursor(position, true);
}
/*!
\qmlmethod void TextInput::openSoftwareInputPanel()
Opens software input panels like virtual keyboards for typing, useful for
customizing when you want the input keyboard to be shown and hidden in
your application.
By default the opening of input panels follows the platform style. On Symbian^1 and
Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
manually closed by the user. On other platforms the panels are automatically opened
when TextInput element gains focus and closed when the focus is lost.
. You can disable the automatic behavior by setting the property \c focusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
\qml
import Qt 4.7
TextInput {
id: textInput
text: "Hello world!"
focusOnPress: false
MouseArea {
anchors.fill: parent
onClicked: {
if (!textInput.focus) {
textInput.focus = true;
textInput.openSoftwareInputPanel();
} else {
textInput.focus = false;
textInput.closeSoftwareInputPanel();
}
}
}
}
\endqml
*/
void QDeclarativeTextInput::openSoftwareInputPanel()
{
QEvent event(QEvent::RequestSoftwareInputPanel);
if (qApp) {
if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
if (view->scene() && view->scene() == scene()) {
QApplication::sendEvent(view, &event);
}
}
}
}
/*!
\qmlmethod void TextInput::closeSoftwareInputPanel()
Closes a software input panel like a virtual keyboard shown on the screen, useful
for customizing when you want the input keyboard to be shown and hidden in
your application.
By default the opening of input panels follows the platform style. On Symbian^1 and
Symbian^3 -based devices the panels are opened by clicking TextInput and need to be
manually closed by the user. On other platforms the panels are automatically opened
when TextInput element gains focus and closed when the focus is lost.
. You can disable the automatic behavior by setting the property \c focusOnPress to false
and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
the behavior you want.
Only relevant on platforms, which provide virtual keyboards.
\qml
import Qt 4.7
TextInput {
id: textInput
text: "Hello world!"
focusOnPress: false
MouseArea {
anchors.fill: parent
onClicked: {
if (!textInput.focus) {
textInput.focus = true;
textInput.openSoftwareInputPanel();
} else {
textInput.focus = false;
textInput.closeSoftwareInputPanel();
}
}
}
}
\endqml
*/
void QDeclarativeTextInput::closeSoftwareInputPanel()
{
QEvent event(QEvent::CloseSoftwareInputPanel);
if (qApp) {
QEvent event(QEvent::CloseSoftwareInputPanel);
if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
if (view->scene() && view->scene() == scene()) {
QApplication::sendEvent(view, &event);
}
}
}
}
void QDeclarativeTextInput::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
if (d->showInputPanelOnFocus) {
if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
openSoftwareInputPanel();
}
}
QDeclarativePaintedItem::focusInEvent(event);
}
void QDeclarativeTextInput::focusOutEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
if (d->showInputPanelOnFocus) {
if (d->focusOnPress && !isReadOnly()) {
closeSoftwareInputPanel();
}
}
QDeclarativePaintedItem::focusOutEvent(event);
}
void QDeclarativeTextInputPrivate::init()
{
Q_Q(QDeclarativeTextInput);
control->setCursorWidth(1);
control->setPasswordCharacter(QLatin1Char('*'));
control->setLayoutDirection(Qt::LeftToRight);
q->setSmooth(smooth);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QGraphicsItem::ItemHasNoContents, false);
q->setFlag(QGraphicsItem::ItemAcceptsInputMethod);
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(cursorPosChanged()));
q->connect(control, SIGNAL(selectionChanged()),
q, SLOT(selectionChanged()));
q->connect(control, SIGNAL(textChanged(const QString &)),
q, SIGNAL(displayTextChanged(const QString &)));
q->connect(control, SIGNAL(textChanged(const QString &)),
q, SLOT(q_textChanged()));
q->connect(control, SIGNAL(accepted()),
q, SIGNAL(accepted()));
q->connect(control, SIGNAL(updateNeeded(QRect)),
q, SLOT(updateRect(QRect)));
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(updateRect()));//TODO: Only update rect between pos's
q->connect(control, SIGNAL(selectionChanged()),
q, SLOT(updateRect()));//TODO: Only update rect in selection
//Note that above TODOs probably aren't that big a savings
q->updateSize();
oldValidity = control->hasAcceptableInput();
lastSelectionStart = 0;
lastSelectionEnd = 0;
QPalette p = control->palette();
selectedTextColor = p.color(QPalette::HighlightedText);
selectionColor = p.color(QPalette::Highlight);
}
void QDeclarativeTextInput::cursorPosChanged()
{
Q_D(QDeclarativeTextInput);
emit cursorPositionChanged();
if(!d->control->hasSelectedText()){
if(d->lastSelectionStart != d->control->cursor()){
d->lastSelectionStart = d->control->cursor();
emit selectionStartChanged();
}
if(d->lastSelectionEnd != d->control->cursor()){
d->lastSelectionEnd = d->control->cursor();
emit selectionEndChanged();
}
}
}
void QDeclarativeTextInput::selectionChanged()
{
Q_D(QDeclarativeTextInput);
emit selectedTextChanged();
if(d->lastSelectionStart != d->control->selectionStart()){
d->lastSelectionStart = d->control->selectionStart();
if(d->lastSelectionStart == -1)
d->lastSelectionStart = d->control->cursor();
emit selectionStartChanged();
}
if(d->lastSelectionEnd != d->control->selectionEnd()){
d->lastSelectionEnd = d->control->selectionEnd();
if(d->lastSelectionEnd == -1)
d->lastSelectionEnd = d->control->cursor();
emit selectionEndChanged();
}
}
void QDeclarativeTextInput::q_textChanged()
{
Q_D(QDeclarativeTextInput);
updateSize();
emit textChanged();
if(hasAcceptableInput() != d->oldValidity){
d->oldValidity = hasAcceptableInput();
emit acceptableInputChanged();
}
}
void QDeclarativeTextInput::updateRect(const QRect &r)
{
Q_D(QDeclarativeTextInput);
if(r == QRect())
clearCache();
else
dirtyCache(QRect(r.x() - d->hscroll, r.y(), r.width(), r.height()));
update();
}
void QDeclarativeTextInput::updateSize(bool needsRedraw)
{
Q_D(QDeclarativeTextInput);
int w = width();
int h = height();
setImplicitHeight(d->control->height());
int cursorWidth = d->control->cursorWidth();
if(d->cursorItem)
cursorWidth = d->cursorItem->width();
setImplicitWidth(d->control->naturalTextWidth() + cursorWidth);
setContentsSize(QSize(width(), height()));//Repaints if changed
if(w==width() && h==height() && needsRedraw){
clearCache();
update();
}
}
QT_END_NAMESPACE
|