9#if QT_CONFIG(whatsthis)
18#if QT_CONFIG(lineedit)
21#if QT_CONFIG(textedit)
28#include <private/qtextengine_p.h>
29#include <private/qabstractitemdelegate_p.h>
31#include <qpa/qplatformintegration.h>
32#if QT_CONFIG(draganddrop)
33#include <qpa/qplatformdrag.h>
34#include <private/qdnd_p.h>
36#include <private/qguiapplication_p.h>
221 const QStyleOptionViewItem &,
240 editor->deleteLater();
286 const QStyleOptionViewItem &,
307 const QStyleOptionViewItem &,
331 const QStyleOptionViewItem &
option,
338 switch (
event->type()) {
339#if QT_CONFIG(tooltip)
348 event->setAccepted(!tooltip.
isEmpty());
352#if QT_CONFIG(whatsthis)
364 event->setAccepted(!whatsthis.
isEmpty());
372 return event->isAccepted();
392#if QT_CONFIG(textedit)
394 if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor)) {
395 switch (
event->key()) {
425#ifndef QT_NO_SHORTCUT
433 switch (keyEvent->
key()) {
436 emit q->commitData(editor);
442 emit q->commitData(editor);
467 w =
w->parentWidget();
469#if QT_CONFIG(draganddrop)
478 emit q->commitData(editor);
483 QWidget *editorParent = editor->parentWidget();
484 const bool manuallyFixFocus = (
event->type() ==
QEvent::FocusOut) && !editor->hasFocus() &&
488 if (manuallyFixFocus)
491#ifndef QT_NO_SHORTCUT
504#if QT_CONFIG(lineedit)
505 if (
QLineEdit *
e = qobject_cast<QLineEdit*>(editor)) {
506 if (!
e->hasAcceptableInput()) {
507#if QT_CONFIG(validator)
508 if (
const QValidator *validator =
e->validator()) {
510 validator->fixup(
text);
514 return e->hasAcceptableInput();
528 switch (
value.userType()) {
529 case QMetaType::Float:
532 case QMetaType::Double:
536 case QMetaType::LongLong:
537 text = locale.toString(
value.toLongLong());
539 case QMetaType::UInt:
540 case QMetaType::ULongLong:
541 text = locale.toString(
value.toULongLong());
543 case QMetaType::QDate:
544 text = locale.toString(
value.toDate(), formatType);
546 case QMetaType::QTime:
547 text = locale.toString(
value.toTime(), formatType);
549 case QMetaType::QDateTime:
550 text = locale.toString(
value.toDateTime(), formatType);
552 case QMetaType::QJsonValue: {
558 if (
val.isDouble()) {
578 emit q->commitData(editor);
584#include "moc_qabstractitemdelegate.cpp"
QString textForRole(Qt::ItemDataRole role, const QVariant &value, const QLocale &locale, int precision=6) const
void _q_commitDataAndCloseEditor(QWidget *editor)
bool tryFixup(QWidget *editor)
bool editorEventFilter(QObject *object, QEvent *event)
QAbstractItemDelegatePrivate()
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual ~QAbstractItemDelegate()
Destroys the abstract item delegate.
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the editor to be used for editing the data item with the given index.
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
Updates the geometry of the editor for the item with the given index, according to the rectangle spec...
virtual QList< int > paintingRoles() const
virtual void destroyEditor(QWidget *editor, const QModelIndex &index) const
Called when the editor is no longer needed for editing the data item with the given index and should ...
virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
When editing of an item starts, this function is called with the event that triggered the editing,...
QAbstractItemDelegate(QObject *parent=nullptr)
Creates a new abstract item delegate with the given parent.
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Sets the contents of the given editor to the data for the item at the given index.
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Sets the data for the item at the given index in the model to the contents of the given editor.
virtual bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
The QAbstractItemView class provides the basic functionality for item view classes.
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
The QFocusEvent class contains event parameters for widget focus events.
static QPlatformIntegration * platformIntegration()
static QGuiApplicationPrivate * instance()
The QHelpEvent class provides an event that is used to request helpful information about a particular...
const QPoint & globalPos() const
Returns the mouse cursor position when the event was generated in global coordinates.
\inmodule QtCore\reentrant
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
The QLineEdit widget is a one-line text editor.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QValidator class provides validation of input text.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static void showText(const QPoint &pos, const QString &text, QWidget *w=nullptr)
Shows text as a "What's This?" window, at global position pos.
Combined button and popup list for selecting options.
@ ActiveWindowFocusReason
static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_ARG(Type, data)
GLfloat GLfloat GLfloat w
[0]
GLdouble GLdouble GLdouble GLdouble q
GLenum GLint GLint * precision
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent