27 if (
value.isValid()) {
29 if (!qvariant_cast<bool>(
value))
60 if (
index.isValid()) {
78 for (
const auto &
index : indexes) {
79 if (
index.column() == 0)
87#if QT_CONFIG(draganddrop)
94bool QUrlModel::canDrop(QDragEnterEvent *
event)
96 if (!
event->mimeData()->formats().contains(
mimeTypes().constFirst()))
102 if (!fileSystemModel->
isDir(idx))
132 if (
value.userType() == QMetaType::QUrl) {
182 if (
size.width() < 32) {
187 if (
index.data().toString() != newName)
231 if (!cleanUrl.
compare(local, cs)) {
240 if (!fileSystemModel->
isDir(idx))
244 watching.
append({idx, cleanUrl});
256 for (
int i = 0;
i < numRows; ++
i)
266 if (
model == fileSystemModel)
268 if (fileSystemModel !=
nullptr) {
272 this,
SLOT(layoutChanged()));
274 this,
SLOT(layoutChanged()));
276 fileSystemModel =
model;
277 if (fileSystemModel !=
nullptr) {
281 this,
SLOT(layoutChanged()));
283 this,
SLOT(layoutChanged()));
295 for (
int i = 0;
i < watching.
size(); ++
i) {
305 changed(watching.
at(
i).path);
313void QUrlModel::layoutChanged()
317 for (
const WatchItem &
item :
std::as_const(watching))
357#if QT_CONFIG(draganddrop)
358 setDragDropMode(QAbstractItemView::DragDrop);
371#if QT_CONFIG(draganddrop)
372void QSidebar::dragEnterEvent(QDragEnterEvent *
event)
374 if (urlModel->canDrop(
event))
375 QListView::dragEnterEvent(
event);
383 return QListView::sizeHint();
419 if (actions.
size() > 0)
429void QSidebar::removeEntry()
437 model()->removeRow(persistent.row());
459 QAbstractScrollArea::focusInEvent(
event);
480#include "moc_qsidebar_p.cpp"
virtual QIcon icon(IconType) const
Returns an icon set for the given type, using the current icon theme.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles the data supplied by a drag and drop operation that ended with the given action.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
void rowsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been removed from the model.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
void setItemDelegate(QAbstractItemDelegate *delegate)
Sets the item delegate for this view and its model to delegate.
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This slot is called when a new item becomes the current item.
QSize sizeHintForIndex(const QModelIndex &index) const
Returns the size hint for the item with the specified index or an invalid size for invalid indexes.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
The QAction class provides an abstraction for user commands that can be added to different user inter...
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
static QString toNativeSeparators(const QString &pathName)
\inmodule QtCore \reentrant
QString fileName() const
Returns the name of the file, excluding the path.
The QFileSystemModel class provides a data model for the local filesystem.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
\reimp
QVariant myComputer(int role=Qt::DisplayRole) const
Returns the data stored under the given role for the item "My Computer".
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
\reimp
QAbstractFileIconProvider * iconProvider() const
Returns the file icon provider for this directory model.
bool isDir(const QModelIndex &index) const
Returns true if the model item index represents a directory; otherwise returns false.
The QFocusEvent class contains event parameters for widget focus events.
The QIcon class provides scalable icons in different modes and states.
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
qint64 cacheKey() const
Returns a number that identifies the contents of this QIcon object.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
QModelIndexList selectedIndexes
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
virtual void clear()
Clears the selection model.
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
The QListView class provides a list or icon view onto a model.
bool event(QEvent *e) override
\reimp
void setUniformItemSizes(bool enable)
QModelIndex indexAt(const QPoint &p) const override
\reimp
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
const_reverse_iterator crbegin() const noexcept
void reserve(qsizetype size)
const_iterator cend() const noexcept
void append(parameter_type t)
const_iterator cbegin() const noexcept
const_reverse_iterator crend() const noexcept
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr const QAbstractItemModel * model() const noexcept
Returns a pointer to the model containing the item that this index refers to.
constexpr int column() const noexcept
Returns the column this model index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QPixmap scaledToWidth(int w, Qt::TransformationMode mode=Qt::FastTransformation) const
Returns a scaled copy of the image.
\inmodule QtCore\reentrant
The QStandardItemModel class provides a generic model for storing custom data.
void clear()
Removes all items (including header items) from the model and sets the number of rows and columns to ...
QObject * parent() const
Returns a pointer to the parent object.
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
\reimp
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
int rowCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
Initialize option with the values using the index index.
void setUrls(const QList< QUrl > &list)
void addUrls(const QList< QUrl > &urls, int row=-1, bool move=true)
Add urls list into the list at row.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
\reimp
QMimeData * mimeData(const QModelIndexList &indexes) const override
\reimp
QStringList mimeTypes() const override
\reimp
QList< QUrl > urls() const
Return the complete list of urls in a QList.
void setFileSystemModel(QFileSystemModel *model)
QFileSystemModel to get index's from, clears existing rows.
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
QUrlModel(QObject *parent=nullptr)
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString scheme() const
Returns the scheme of the URL.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLuint * paths
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * row
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QSqlQueryModel * model
[16]
QUrl url("example.com")
[constructor-url-reference]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]
view viewport() -> scroll(dx, dy, deviceRect)
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent