summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt
ModeNameSize
-rw-r--r--ADDITIONAL_CLEAN_FILES.rst1068logstatsplain
-rw-r--r--AIX_EXPORT_ALL_SYMBOLS.rst550logstatsplain
-rw-r--r--ALIASED_TARGET.rst177logstatsplain
-rw-r--r--ALIAS_GLOBAL.rst648logstatsplain
-rw-r--r--ANDROID_ANT_ADDITIONAL_OPTIONS.rst367logstatsplain
-rw-r--r--ANDROID_API.rst384logstatsplain
-rw-r--r--ANDROID_API_MIN.rst334logstatsplain
-rw-r--r--ANDROID_ARCH.rst593logstatsplain
-rw-r--r--ANDROID_ASSETS_DIRECTORIES.rst386logstatsplain
-rw-r--r--ANDROID_GUI.rst653logstatsplain
-rw-r--r--ANDROID_JAR_DEPENDENCIES.rst305logstatsplain
-rw-r--r--ANDROID_JAR_DIRECTORIES.rst564logstatsplain
-rw-r--r--ANDROID_JAVA_SOURCE_DIR.rst369logstatsplain
-rw-r--r--ANDROID_NATIVE_LIB_DEPENDENCIES.rst517logstatsplain
-rw-r--r--ANDROID_NATIVE_LIB_DIRECTORIES.rst597logstatsplain
-rw-r--r--ANDROID_PROCESS_MAX.rst315logstatsplain
-rw-r--r--ANDROID_PROGUARD.rst398logstatsplain
-rw-r--r--ANDROID_PROGUARD_CONFIG_PATH.rst415logstatsplain
-rw-r--r--ANDROID_SECURE_PROPS_PATH.rst353logstatsplain
-rw-r--r--ANDROID_SKIP_ANT_STEP.rst296logstatsplain
-rw-r--r--ANDROID_STL_TYPE.rst707logstatsplain
-rw-r--r--ARCHIVE_OUTPUT_DIRECTORY.rst339logstatsplain
-rw-r--r--ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst659logstatsplain
-rw-r--r--ARCHIVE_OUTPUT_NAME.rst234logstatsplain
-rw-r--r--ARCHIVE_OUTPUT_NAME_CONFIG.rst249logstatsplain
-rw-r--r--AUTOGEN_BUILD_DIR.rst600logstatsplain
-rw-r--r--AUTOGEN_ORIGIN_DEPENDS.rst1621logstatsplain
-rw-r--r--AUTOGEN_PARALLEL.rst879logstatsplain
-rw-r--r--AUTOGEN_TARGET_DEPENDS.rst1532logstatsplain
-rw-r--r--AUTOMOC.rst9256logstatsplain
-rw-r--r--AUTOMOC_COMPILER_PREDEFINES.rst1040logstatsplain
-rw-r--r--AUTOMOC_DEPEND_FILTERS.rst3381logstatsplain
-rw-r--r--AUTOMOC_EXECUTABLE.rst660logstatsplain
-rw-r--r--AUTOMOC_MACRO_NAMES.rst1131logstatsplain
-rw-r--r--AUTOMOC_MOC_OPTIONS.rst669logstatsplain
-rw-r--r--AUTOMOC_PATH_PREFIX.rst1288logstatsplain
-rw-r--r--AUTORCC.rst2439logstatsplain
-rw-r--r--AUTORCC_EXECUTABLE.rst660logstatsplain
-rw-r--r--AUTORCC_OPTIONS.rst828logstatsplain
-rw-r--r--AUTOUIC.rst2924logstatsplain
-rw-r--r--AUTOUIC_EXECUTABLE.rst660logstatsplain
-rw-r--r--AUTOUIC_OPTIONS.rst982logstatsplain
-rw-r--r--AUTOUIC_SEARCH_PATHS.rst386logstatsplain
-rw-r--r--BINARY_DIR.rst191logstatsplain
-rw-r--r--BUILD_RPATH.rst567logstatsplain
-rw-r--r--BUILD_RPATH_USE_ORIGIN.rst1086logstatsplain
-rw-r--r--BUILD_WITH_INSTALL_NAME_DIR.rst597logstatsplain
-rw-r--r--BUILD_WITH_INSTALL_RPATH.rst666logstatsplain
-rw-r--r--BUNDLE.rst334logstatsplain
-rw-r--r--BUNDLE_EXTENSION.rst267logstatsplain
-rw-r--r--COMMON_LANGUAGE_RUNTIME.rst776logstatsplain
-rw-r--r--COMPATIBLE_INTERFACE_BOOL.rst924logstatsplain
-rw-r--r--COMPATIBLE_INTERFACE_NUMBER_MAX.rst912logstatsplain
-rw-r--r--COMPATIBLE_INTERFACE_NUMBER_MIN.rst912logstatsplain
-rw-r--r--COMPATIBLE_INTERFACE_STRING.rst792logstatsplain
-rw-r--r--COMPILE_DEFINITIONS.rst1093logstatsplain
-rw-r--r--COMPILE_DEFINITIONS_CONFIG.rst678logstatsplain
-rw-r--r--COMPILE_FEATURES.rst617logstatsplain
-rw-r--r--COMPILE_FLAGS.rst411logstatsplain
-rw-r--r--COMPILE_OPTIONS.rst998logstatsplain
-rw-r--r--COMPILE_PDB_NAME.rst349logstatsplain
-rw-r--r--COMPILE_PDB_NAME_CONFIG.rst364logstatsplain
-rw-r--r--COMPILE_PDB_NOTE.txt256logstatsplain
-rw-r--r--COMPILE_PDB_OUTPUT_DIRECTORY.rst531logstatsplain
-rw-r--r--COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst697logstatsplain
-rw-r--r--CONFIG_OUTPUT_NAME.rst224logstatsplain
-rw-r--r--CONFIG_POSTFIX.rst537logstatsplain
-rw-r--r--CROSSCOMPILING_EMULATOR.rst617logstatsplain
-rw-r--r--CUDA_ARCHITECTURES.rst1316logstatsplain
-rw-r--r--CUDA_EXTENSIONS.rst718logstatsplain
-rw-r--r--CUDA_PTX_COMPILATION.rst301logstatsplain
-rw-r--r--CUDA_RESOLVE_DEVICE_SYMBOLS.rst937logstatsplain
-rw-r--r--CUDA_RUNTIME_LIBRARY-VALUES.txt325logstatsplain
-rw-r--r--CUDA_RUNTIME_LIBRARY.rst727logstatsplain
-rw-r--r--CUDA_SEPARABLE_COMPILATION.rst471logstatsplain
-rw-r--r--CUDA_STANDARD.rst1457logstatsplain
-rw-r--r--CUDA_STANDARD_REQUIRED.rst853logstatsplain
-rw-r--r--CXX_EXTENSIONS.rst709logstatsplain
-rw-r--r--CXX_STANDARD.rst1563logstatsplain
-rw-r--r--CXX_STANDARD_REQUIRED.rst847logstatsplain
-rw-r--r--C_EXTENSIONS.rst695logstatsplain
-rw-r--r--C_STANDARD.rst1517logstatsplain
-rw-r--r--C_STANDARD_REQUIRED.rst841logstatsplain
-rw-r--r--DEBUG_POSTFIX.rst203logstatsplain
-rw-r--r--DEFINE_SYMBOL.rst485logstatsplain
-rw-r--r--DEPLOYMENT_ADDITIONAL_FILES.rst687logstatsplain
-rw-r--r--DEPLOYMENT_REMOTE_DIRECTORY.rst600logstatsplain
-rw-r--r--DEPRECATION.rst215logstatsplain
-rw-r--r--DISABLE_PRECOMPILE_HEADERS.rst289logstatsplain
-rw-r--r--DOTNET_TARGET_FRAMEWORK.rst390logstatsplain
-rw-r--r--DOTNET_TARGET_FRAMEWORK_VERSION.rst499logstatsplain
-rw-r--r--ENABLE_EXPORTS.rst1419logstatsplain
-rw-r--r--EXCLUDE_FROM_ALL.rst1363logstatsplain
-rw-r--r--EXCLUDE_FROM_DEFAULT_BUILD.rst238logstatsplain
-rw-r--r--EXCLUDE_FROM_DEFAULT_BUILD_CONFIG.rst412logstatsplain
-rw-r--r--EXPORT_COMPILE_COMMANDS.rst287logstatsplain
-rw-r--r--EXPORT_NAME.rst237logstatsplain
-rw-r--r--EXPORT_PROPERTIES.rst870logstatsplain
-rw-r--r--EchoString.rst179logstatsplain
-rw-r--r--FOLDER.rst507logstatsplain
-rw-r--r--FRAMEWORK.rst1310logstatsplain
-rw-r--r--FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG.rst1122logstatsplain
-rw-r--r--FRAMEWORK_VERSION.rst239logstatsplain
-rw-r--r--Fortran_BUILDING_INSTRINSIC_MODULES.rst626logstatsplain
-rw-r--r--Fortran_FORMAT.rst498logstatsplain
-rw-r--r--Fortran_MODULE_DIRECTORY.rst1314logstatsplain
-rw-r--r--Fortran_PREPROCESS.rst993logstatsplain
-rw-r--r--GENERATOR_FILE_NAME.rst314logstatsplain
-rw-r--r--GHS_INTEGRITY_APP.rst362logstatsplain
-rw-r--r--GHS_NO_SOURCE_GROUP_FILE.rst535logstatsplain
-rw-r--r--GNUtoMS.rst860logstatsplain
-rw-r--r--HAS_CXX.rst155logstatsplain
-rw-r--r--HIP_ARCHITECTURES.rst893logstatsplain
-rw-r--r--HIP_EXTENSIONS.rst714logstatsplain
-rw-r--r--HIP_STANDARD.rst1179logstatsplain
-rw-r--r--HIP_STANDARD_REQUIRED.rst722logstatsplain
-rw-r--r--IMPLICIT_DEPENDS_INCLUDE_TRANSFORM.rst836logstatsplain
-rw-r--r--IMPORTED.rst284logstatsplain
-rw-r--r--IMPORTED_COMMON_LANGUAGE_RUNTIME.rst244logstatsplain
-rw-r--r--IMPORTED_CONFIGURATIONS.rst447logstatsplain
-rw-r--r--IMPORTED_GLOBAL.rst1321logstatsplain
-rw-r--r--IMPORTED_IMPLIB.rst325logstatsplain
-rw-r--r--IMPORTED_IMPLIB_CONFIG.rst218logstatsplain
-rw-r--r--IMPORTED_LIBNAME.rst1080logstatsplain
-rw-r--r--IMPORTED_LIBNAME_CONFIG.rst244logstatsplain
-rw-r--r--IMPORTED_LINK_DEPENDENT_LIBRARIES.rst734logstatsplain
-rw-r--r--IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG.rst357logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_LANGUAGES.rst642logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG.rst357logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_LIBRARIES.rst699logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_LIBRARIES_CONFIG.rst546logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_MULTIPLICITY.rst212logstatsplain
-rw-r--r--IMPORTED_LINK_INTERFACE_MULTIPLICITY_CONFIG.rst266logstatsplain
-rw-r--r--IMPORTED_LOCATION.rst1579logstatsplain
-rw-r--r--IMPORTED_LOCATION_CONFIG.rst224logstatsplain
-rw-r--r--IMPORTED_NO_SONAME.rst393logstatsplain
-rw-r--r--IMPORTED_NO_SONAME_CONFIG.rst227log 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