Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickfolderbreadcrumbbar.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
7#include <QtCore/qdir.h>
8#include <QtCore/qloggingcategory.h>
9#if QT_CONFIG(shortcut)
10#include <QtGui/private/qshortcutmap_p.h>
11#endif
12#include <QtGui/private/qguiapplication_p.h>
13#include <QtQml/QQmlFile>
14#include <QtQuick/private/qquicktextinput_p.h>
15#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
16#include <QtQuickTemplates2/private/qquickpopupitem_p_p.h>
17#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
18
23
25
26Q_LOGGING_CATEGORY(lcFolderBreadcrumbBar, "qt.quick.dialogs.folderbreadcrumbbar")
27Q_LOGGING_CATEGORY(lcContentSize, "qt.quick.dialogs.folderbreadcrumbbar.contentsize")
28Q_LOGGING_CATEGORY(lcDelegates, "qt.quick.dialogs.folderbreadcrumbbar.delegates")
29Q_LOGGING_CATEGORY(lcShortcuts, "qt.quick.dialogs.folderbreadcrumbbar.shortcuts")
30Q_LOGGING_CATEGORY(lcTextInput, "qt.quick.dialogs.folderbreadcrumbbar.textinput")
31Q_LOGGING_CATEGORY(lcCurrentItem, "qt.quick.dialogs.folderbreadcrumbbar.currentitem")
32
33QQuickItem *QQuickFolderBreadcrumbBarPrivate::createDelegateItem(QQmlComponent *component, const QVariantMap &initialProperties)
34{
36 // If we don't use the correct context, it won't be possible to refer to
37 // the control's id from within the delegates.
38 QQmlContext *context = component->creationContext();
39 // The component might not have been created in QML, in which case
40 // the creation context will be null and we have to create it ourselves.
41 if (!context)
43
44 // If we have initial properties we assume that all necessary information is passed via
45 // initial properties.
46 if (!component->isBound() && initialProperties.isEmpty()) {
48 context->setContextObject(q);
49 }
50
51 QQuickItem *item = qobject_cast<QQuickItem*>(component->createWithInitialProperties(initialProperties, context));
52 if (item)
54 qCDebug(lcDelegates) << "- created delegate item" << item << "with initialProperties" << initialProperties;
55 return item;
56}
57
59{
60 if (folderPath == QLatin1String("/")) {
61 // Unix root.
62 return folderPath;
63 } else if (folderPath.endsWith(QLatin1String(":/"))) {
64 // Windows drive.
65 return folderPath.mid(0, folderPath.size() - 1);
66 }
67 const QString baseName = folderPath.mid(folderPath.lastIndexOf(QLatin1Char('/')) + 1);
68 return baseName;
69}
70
77{
79 QDir dir(folderPath);
80 // In order to collect the paths for each breadcrumb, we need to work backwards, so we prepend.
82 do {
83 paths.prepend(dir.absolutePath());
84 } while (dir.cdUp());
85 return paths;
86}
87
89{
91 qCDebug(lcDelegates) << "attemping to repopulate breadcrumb bar using folder...";
92
93 if (repopulating)
94 return;
95
96 if (!buttonDelegate || !separatorDelegate || !q->contentItem()) {
97 qCWarning(lcDelegates) << "Both delegates and contentItem must be set before repopulating";
98 return;
99 }
100
101 QBoolBlocker repopulateGuard(repopulating);
102
103 auto failureCleanup = [this, q](){
104 folderPaths.clear();
105 while (q->count() > 0)
106 q->removeItem(q->itemAt(0));
107 };
108
109 qCDebug(lcDelegates) << "- getting paths for directory" << dialogFolder();
110 folderPaths = crumbPathsForFolder(dialogFolder());
111
112 while (q->count() > 0)
113 q->removeItem(q->itemAt(0));
114
115 for (int i = 0; i < folderPaths.size(); ++i) {
116 const QString &folderPath = folderPaths.at(i);
117
118 QVariantMap initialProperties = {
119 { QStringLiteral("index"), QVariant::fromValue(i) },
120 { QStringLiteral("folderName"), QVariant::fromValue(folderBaseName(folderPath)) }
121 };
122 QQuickItem *buttonItem = createDelegateItem(buttonDelegate, initialProperties);
123 if (!buttonItem) {
124 qCWarning(lcDelegates) << "Failed creating breadcrumb buttonDelegate item:\n" << buttonDelegate->errorString();
125 failureCleanup();
126 break;
127 }
128 if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(buttonItem)) {
131 }
132 insertItem(q->count(), buttonItem);
133
134 // Don't add a separator for the last button.
135 if (i < folderPaths.size() - 1) {
136 initialProperties = {};
137 QQuickItem *separatorItem = createDelegateItem(separatorDelegate, initialProperties);
138 if (!separatorItem) {
139 qCWarning(lcDelegates) << "Failed creating breadcrumb separatorDelegate item:\n" << buttonDelegate->errorString();
140 failureCleanup();
141 break;
142 }
143 insertItem(q->count(), separatorItem);
144 }
145 }
146
147 const int finalCount = q->count();
148 // We would do - 2, since separators are included in the count,
149 // but as we don't add a separator for the last button, we only need to subtract 1.
150 const int newCurrentIndex = finalCount > 2 ? finalCount - 1 : -1;
151 qCDebug(lcDelegates) << "- setting currentIndex to" << newCurrentIndex;
152 q->setCurrentIndex(newCurrentIndex);
153
155
156 qCDebug(lcDelegates) << "... bar now contains" << q->count()
157 << "buttons and separators in total, for the following paths:" << folderPaths;
158}
159
161{
163 qCDebug(lcCurrentItem) << "updateCurrentIndex called by sender" << q->sender();
164 QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(q->sender());
165 if (button) {
166 const int buttonIndex = contentModel->indexOf(button, nullptr);
167 q->setCurrentIndex(buttonIndex);
168 const QUrl folderUrl = QUrl::fromLocalFile(folderPaths.at(buttonIndex / 2));
169 // TODO: don't repopulate the whole model when clicking on crumbs
170 qCDebug(lcCurrentItem) << "setting file dialog's folder to" << folderUrl;
171 setDialogFolder(folderUrl);
172 }
173}
174
180
181static inline QString upButtonName()
182{
183 return QStringLiteral("upButton");
184}
185
191
193{
195 if (upButton.wasExecuted())
196 return;
197
198 if (!upButton || complete)
199 quickBeginDeferred(q, upButtonName(), upButton);
200 if (complete)
202}
203
210
211static inline QString textFieldName()
212{
213 return QStringLiteral("textField");
214}
215
221
223{
225 if (textField.wasExecuted())
226 return;
227
228 if (!textField || complete)
229 quickBeginDeferred(q, textFieldName(), textField);
230 if (complete)
232}
233
235{
237
238 qCDebug(lcTextInput).nospace() << "text field visibility was " << textField->isVisible()
239 << "; setting it to " << !textField->isVisible();
240 textField->setVisible(!textField->isVisible());
241
242 if (textField->isVisible()) {
243 // The text field is now visible, so give it focus,
244 // select the text, and let it handle escape/back.
246 textField->selectAll();
247 }
248
249 // We connect to the TextField's visibleChanged signal, so textFieldVisibleChanged()
250 // will get called automatically and we don't need to call it here.
251
252 contentItem->setVisible(!textField->isVisible());
253
254 // When the TextField is visible, certain items in the dialog need to be disabled.
255 if (auto fileDialog = asFileDialog()) {
256 auto fileDialogPrivate = QQuickFileDialogImplPrivate::get(fileDialog);
257 fileDialogPrivate->updateEnabled();
258 } else if (auto folderDialog = asFolderDialog()) {
259 auto folderDialogPrivate = QQuickFolderDialogImplPrivate::get(folderDialog);
260 folderDialogPrivate->updateEnabled();
261 }
262}
263
265{
266 const QUrl fileUrl = QUrl::fromLocalFile(textField->text());
267 const auto fileDialog = asFileDialog();
268 const bool mustExist = fileDialog ? fileDialog->options()->acceptMode() != QFileDialogOptions::AcceptSave : true;
269 const bool enteredPathIsValidUrl = fileUrl.isValid();
270 bool enteredPathExists = false;
271 bool enteredPathIsDir = false;
272 if (enteredPathIsValidUrl) {
273 const QFileInfo fileInfo(textField->text());
274 enteredPathExists = fileInfo.exists();
275 if (enteredPathExists)
276 enteredPathIsDir = fileInfo.isDir();
277 }
278
279 qCDebug(lcTextInput).nospace() << "text field accepted -"
280 << " text=" << textField->text()
281 << " fileUrl=" << fileUrl
282 << " mustExist=" << mustExist
283 << " enteredPathIsValidUrl=" << enteredPathIsValidUrl
284 << " enteredPathExists=" << enteredPathExists
285 << " enteredPathIsDir=" << enteredPathIsDir;
286
287 if (enteredPathIsDir && (enteredPathExists || !mustExist)) {
288 qCDebug(lcTextInput) << "path entered is a folder; setting folder";
289 setDialogFolder(fileUrl);
290 } else if (!enteredPathIsDir && (enteredPathExists || !mustExist)) {
291 qCDebug(lcTextInput) << "path entered is a file; setting file and calling accept()";
292 if (isFileDialog()) {
293 auto fileDialog = asFileDialog();
294 fileDialog->setSelectedFile(fileUrl);
295 fileDialog->accept();
296 } else {
297 setDialogFolder(fileUrl);
298 }
299 } else {
300 qCDebug(lcTextInput) << "path entered is not valid; not setting file/folder";
301 }
302
303 // If the enter key was pressed and the dialog closed, the text input will lose
304 // active focus, and textFieldActiveFocusChanged() will toggle its visibility.
305 // We should only toggle visibility if the dialog is actually closed, otherwise
306 // we'll end up toggling twice, and the text input will be visible the next time
307 // the dialog is opened.
308 if (dialog->isVisible())
310}
311
313{
314 qCDebug(lcShortcuts) << "text field was either hidden or shown";
315
316 if (textField && textField->isVisible())
318 else
320}
321
323{
324 qCDebug(lcTextInput) << "text field activeFocus changed to" << textField->hasActiveFocus();
325
326 // When the text field loses focus, it should be hidden.
327 if (!textField->hasActiveFocus() && textField->isVisible())
329}
330
331/*
332 When the text field is visible:
333
334 - Ctrl+L should do nothing (matches e.g. Ubuntu and Windows)
335 - Escape/back should hide it
336*/
338{
339#if QT_CONFIG(shortcut)
340 if (editPathToggleShortcutId == 0)
341 return;
342
343 qCDebug(lcShortcuts) << "text field was shown; ungrabbing edit path shortcut";
345#endif
346}
347
348/*
349 When the text field is not visible:
350
351 - Ctrl+L should make it visible
352 - Escape/back should close the dialog
353*/
355{
356#if QT_CONFIG(shortcut)
358
360 qCDebug(lcShortcuts) << "text field was hidden; grabbing edit path shortcut";
361
362 if (editPathToggleShortcutId == 0) {
363 editPathToggleShortcutId = appPrivate->shortcutMap.addShortcut(
365 }
366
367 qCDebug(lcShortcuts).nospace() << "... editPathToggleShortcutId=" << editPathToggleShortcutId;
368#endif
369}
370
372{
373#if QT_CONFIG(shortcut)
376 if (editPathToggleShortcutId != 0) {
377 appPrivate->shortcutMap.removeShortcut(editPathToggleShortcutId, q);
378 editPathToggleShortcutId = 0;
379 }
380#endif
381}
382
384{
385 return qobject_cast<QQuickFileDialogImpl*>(dialog);
386}
387
389{
390 return qobject_cast<QQuickFolderDialogImpl*>(dialog);
391}
392
397
399{
400 return dialog->property("currentFolder").toUrl();
401}
402
404{
406 if (!dialog->setProperty("currentFolder", folder))
407 qmlWarning(q) << "Failed to set currentFolder property of dialog" << dialog->objectName() << "to" << folder;
408}
409
411{
412 Q_Q(const QQuickFolderBreadcrumbBar);
413 const int count = contentModel->count();
414 qreal totalWidth = qMax(0, count - 1) * spacing;
415 for (int i = 0; i < count; ++i) {
416 QQuickItem *item = q->itemAt(i);
417 if (item) {
419 if (!p->widthValid())
420 totalWidth += item->implicitWidth();
421 else
422 totalWidth += item->width();
423 }
424 }
425 qCDebug(lcContentSize) << "content width:" << totalWidth;
426 return totalWidth;
427}
428
430{
431 Q_Q(const QQuickFolderBreadcrumbBar);
432 const int count = contentModel->count();
433 qreal maxHeight = 0;
434 for (int i = 0; i < count; ++i) {
435 QQuickItem *item = q->itemAt(i);
436 if (item)
437 maxHeight = qMax(maxHeight, item->implicitHeight());
438 }
439 qCDebug(lcContentSize) << "content height:" << maxHeight;
440 return maxHeight;
441}
442
444{
446 if (contentItem) {
447 const int upButtonSpace = q->upButton() ? q->upButton()->width() + upButtonSpacing : 0;
448 contentItem->setPosition(QPointF(q->leftPadding() + upButtonSpace, q->topPadding()));
449 contentItem->setSize(QSizeF(q->availableWidth() - upButtonSpace, q->availableHeight()));
450
451 if (textField) {
452 textField->setPosition(contentItem->position());
453 textField->setSize(contentItem->size());
454 }
455 }
456}
457
464
471
478
494
496{
497 Q_D(const QQuickFolderBreadcrumbBar);
498 return d->dialog;
499}
500
502{
504 if (dialog == d->dialog)
505 return;
506
507 if (d->dialog) {
508 if (auto fileDialog = d->asFileDialog()) {
509 // TODO: rename impl's currentFolder too, when name is decided
512 } else if (auto folderDialog = d->asFolderDialog()) {
515 }
516 }
517
518 d->dialog = dialog;
519
520 if (d->dialog) {
521 if (auto fileDialog = d->asFileDialog()) {
524 } else if (auto folderDialog = d->asFolderDialog()) {
527 }
528 }
529
531}
532
534{
536 return d->buttonDelegate;
537}
538
540{
542 qCDebug(lcFolderBreadcrumbBar) << "setButtonDelegate called with" << delegate;
543 if (d->componentComplete) {
544 // Simplify the code by disallowing this.
545 qCWarning(lcFolderBreadcrumbBar) << "BreadcrumbBar does not support setting delegates after component completion";
546 return;
547 }
548
549 if (delegate == d->buttonDelegate)
550 return;
551
552 d->buttonDelegate = delegate;
554}
555
557{
559 return d->separatorDelegate;
560}
561
563{
565 qCDebug(lcFolderBreadcrumbBar) << "setSeparatorDelegate called with" << delegate;
566 if (d->componentComplete) {
567 qCWarning(lcFolderBreadcrumbBar) << "BreadcrumbBar does not support setting delegates after component completion";
568 return;
569 }
570
571 if (delegate == d->separatorDelegate)
572 return;
573
574 d->separatorDelegate = delegate;
576}
577
579{
581 if (!d->upButton)
582 d->executeUpButton();
583 return d->upButton;
584}
585
587{
589 if (upButton == d->upButton)
590 return;
591
592 if (!d->upButton.isExecuting())
593 d->cancelUpButton();
594
595 if (d->upButton) {
598 }
599
601 d->upButton = upButton;
602 if (d->upButton) {
603 if (!d->upButton->parentItem())
604 d->upButton->setParentItem(this);
605
608 }
609 if (!d->upButton.isExecuting())
611}
612
614{
615 Q_D(const QQuickFolderBreadcrumbBar);
616 return d->upButtonSpacing;
617}
618
620{
622 if (upButtonSpacing == d->upButtonSpacing)
623 return;
624
625 d->upButtonSpacing = upButtonSpacing;
627}
628
630{
632 return d->textField;
633}
634
636{
638 if (textField == d->textField)
639 return;
640
641 if (!d->textField.isExecuting())
642 d->cancelUpButton();
643
644 if (d->textField)
645 d->handleTextFieldHidden();
646
647 if (d->textField) {
654 }
655
657 d->textField = textField;
658 if (d->textField) {
659 if (!d->textField->parentItem())
660 d->textField->setParentItem(this);
661
662 d->textField->setVisible(false);
663
670 }
671 if (!d->textField.isExecuting())
673}
674
676{
677#if QT_CONFIG(shortcut)
679 if (event->type() == QEvent::Shortcut) {
680 QShortcutEvent *shortcutEvent = static_cast<QShortcutEvent *>(event);
681 if (shortcutEvent->shortcutId() == d->editPathToggleShortcutId) {
682 d->toggleTextFieldVisibility();
683 return true;
684 } else if (shortcutEvent->shortcutId() == d->goUpShortcutId) {
685 d->goUp();
686 }
687 }
688#endif
689 return QQuickItem::event(event);
690}
691
693{
694#if QT_CONFIG(shortcut)
696
697 if (event->matches(QKeySequence::Cancel) && d->textField->isVisible()) {
698 d->toggleTextFieldVisibility();
699 event->accept();
700 } else
701#endif
702 {
704 }
705}
706
708{
710 qCDebug(lcFolderBreadcrumbBar) << "componentComplete";
712 d->repopulate();
713
714 if (d->textField) {
715 // Force it to be updated as setTextField() is too early to do it.
716 d->textFieldVisibleChanged();
717 }
718}
719
721{
724
726 if (data.boolValue && d->dialog->isVisible()) {
727 // It's visible.
728 d->handleTextFieldHidden();
729
730#if QT_CONFIG(shortcut)
731 d->goUpShortcutId = QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(
733#endif
734 } else {
735 // It's hidden.
736 // Hide the text field so that when the dialog gets opened again, it's not still visible.
737 if (d->textField)
738 d->textField->setVisible(false);
739
740 // Make the ListView visible again.
741 if (d->contentItem)
742 d->contentItem->setVisible(true);
743
744 // We also need to ungrab the edit path shortcut when we're not visible.
745 d->ungrabEditPathShortcut();
746
747#if QT_CONFIG(shortcut)
748 if (d->goUpShortcutId != 0) {
749 QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->goUpShortcutId, this);
750 d->goUpShortcutId = 0;
751 }
752#endif
753 }
754 }
755}
756
758{
759 if (!qmlContext(item))
760 return false;
761
762 if (QQuickItemPrivate::get(item)->isTransparentForPositioner())
763 return false;
764
765 return true;
766}
767
773
774#if QT_CONFIG(accessibility)
775QAccessible::Role QQuickFolderBreadcrumbBar::accessibleRole() const
776{
777 // TODO
778 return QAccessible::PageTabList;
779}
780#endif
781
783
784#include "moc_qquickfolderbreadcrumbbar_p.cpp"
\inmodule QtCore
Definition qdir.h:20
static QString fromNativeSeparators(const QString &pathName)
Definition qdir.cpp:962
\inmodule QtCore
Definition qcoreevent.h:45
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory.
bool exists() const
Returns true if the file system entry this QFileInfo refers to exists; otherwise returns false.
\reentrant
Definition qfont.h:22
static QGuiApplicationPrivate * instance()
The QKeyEvent class describes a key event.
Definition qevent.h:424
The QKeySequence class encapsulates a key sequence as used by shortcuts.
qsizetype size() const noexcept
Definition qlist.h:397
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
void clear()
Definition qlist.h:434
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
Definition qobject_p.h:299
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
Definition qobject_p.h:328
QString objectName
the name of this object
Definition qobject.h:107
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQmlComponent class encapsulates a QML component definition.
Q_INVOKABLE QString errorString() const
\qmlmethod string Component::errorString()
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to \l{QFile}.
Definition qqmlfile.cpp:742
int count() const override
\qmlproperty int QtQml.Models::ObjectModel::count
int indexOf(QObject *object, QObject *objectContext) const override
void insertItem(int index, QQuickItem *item)
QQmlObjectModel * contentModel
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
QQuickDeferredPointer< QQuickItem > contentItem
static void hideOldItem(QQuickItem *item)
static QQuickFileDialogImplPrivate * get(QQuickFileDialogImpl *dialog)
void currentFolderChanged(const QUrl &folderUrl)
QQuickFolderDialogImpl * asFolderDialog() const
QQuickFileDialogImpl * asFileDialog() const
void itemImplicitWidthChanged(QQuickItem *item) override
void itemImplicitHeightChanged(QQuickItem *item) override
static QStringList crumbPathsForFolder(const QUrl &folder)
static QString folderBaseName(const QString &folderPath)
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
QQuickItem * createDelegateItem(QQmlComponent *component, const QVariantMap &initialProperties)
void setButtonDelegate(QQmlComponent *delegate)
void keyPressEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
bool event(QEvent *event) override
This virtual function receives events to an object and should return true if the event e was recogniz...
void setDialog(QQuickDialog *dialog)
void setTextField(QQuickTextField *textField)
void setUpButton(QQuickAbstractButton *upButton)
bool isContent(QQuickItem *item) const override
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQuickFolderBreadcrumbBar(QQuickItem *parent=nullptr)
void setSeparatorDelegate(QQmlComponent *delegate)
void setUpButtonSpacing(int upButtonSpacing)
static QQuickFolderDialogImplPrivate * get(QQuickFolderDialogImpl *dialog)
void currentFolderChanged(const QUrl &folderUrl)
virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
virtual void itemImplicitWidthChanged(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
quint32 componentComplete
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
bool event(QEvent *) override
\reimp
void activeFocusChanged(bool)
void setSize(const QSizeF &size)
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
void setParentItem(QQuickItem *parent)
bool hasActiveFocus() const
bool isVisible() const
void visibleChanged()
QSizeF size() const
void setVisible(bool)
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
QPointF position() const
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
void setPosition(const QPointF &)
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
@ ItemVisibleHasChanged
Definition qquickitem.h:148
void selectAll()
\qmlmethod QtQuick::TextInput::selectAll()
void setText(const QString &)
static QFont font(Scope scope)
\inmodule QtCore\reentrant
Definition qrect.h:484
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
\inmodule QtCore
Definition qsize.h:208
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString mid(qsizetype position, qsizetype n=-1) const &
Definition qstring.cpp:5300
\inmodule QtCore
Definition qurl.h:94
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
Definition qurl.cpp:3368
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
Definition qurl.cpp:1882
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
QPushButton * button
[2]
Combined button and popup list for selecting options.
@ CTRL
@ ALT
@ Key_Up
Definition qnamespace.h:678
@ Key_L
Definition qnamespace.h:558
@ ShortcutFocusReason
@ WindowShortcut
static void * context
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei const GLuint * paths
struct _cl_event * event
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
static qreal component(const QPointF &point, unsigned int i)
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
void QQml_setParent_noEvent(QObject *object, QObject *parent)
Makes the object a child of parent.
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
void quickCancelDeferred(QObject *object, const QString &property)
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
static QString upButtonName()
static QString textFieldName()
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
Definition qquickitem.h:492
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define QStringLiteral(str)
#define emit
double qreal
Definition qtypes.h:187
QString dir
[11]
QFileDialog dialog(this)
[1]
QGraphicsItem * item
\inmodule QtCore \reentrant
Definition qchar.h:18
static bool matcher(QObject *object, Qt::ShortcutContext context)
\inmodule QtQuick
Definition qquickitem.h:159