KFilePlacesView Class

This class allows to display a KFilePlacesModel. More...

Header: #include <KFilePlacesView>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets)
Inherits: QListView

Public Functions

KFilePlacesView(QWidget *parent = nullptr)
(since 5.91) bool allPlacesShown() const
int dragAutoActivationDelay() const
bool isAutoResizeItemsEnabled() const
bool isDropOnPlaceEnabled() const
void setAutoResizeItemsEnabled(bool enabled)
(since 5.92) void setDragAutoActivationDelay(int delay)
void setDropOnPlaceEnabled(bool enabled)
(since 5.91) void setTeardownFunction(KFilePlacesView::TeardownFunction teardownFunc)

Public Slots

void setShowAll(bool showAll)
void setUrl(const QUrl &url)

Signals

(since 5.91) void activeTabRequested(const QUrl &url)
(since 5.91) void allPlacesShownChanged(bool allPlacesShown)
(since 5.91) void contextMenuAboutToShow(const QModelIndex &index, QMenu *menu)
(since 5.91) void newWindowRequested(const QUrl &url)
(since 5.91) void placeActivated(const QUrl &url)
(since 5.91) void tabRequested(const QUrl &url)
void urlsDropped(const QUrl &dest, QDropEvent *event, QWidget *parent)

Detailed Description

Member Function Documentation

[explicit] KFilePlacesView::KFilePlacesView(QWidget *parent = nullptr)

[signal, since 5.91] void KFilePlacesView::activeTabRequested(const QUrl &url)

* Emitted when the URL url should be opened in a new active tab because * the user clicked on a place with the middle mouse button with * the Shift modifier pressed or left-clicked with both the Ctrl and Shift * modifiers pressed.

* If a storage device needs to be mounted first, this signal is emitted once * mounting has completed successfully. *

This function was introduced in 5.91.

[since 5.91] bool KFilePlacesView::allPlacesShown() const

Whether hidden places, if any, are currently shown.

This function was introduced in 5.91.

[signal, since 5.91] void KFilePlacesView::allPlacesShownChanged(bool allPlacesShown)

Emitted when allPlacesShown changes

This function was introduced in 5.91.

[signal, since 5.91] void KFilePlacesView::contextMenuAboutToShow(const QModelIndex &index, QMenu *menu)

Emitted just before the context menu opens. This can be used to add additional application actions to the menu.

index The model index of the place whose menu is about to open.

menu The menu that will be opened.

This function was introduced in 5.91.

int KFilePlacesView::dragAutoActivationDelay() const

See also setDragAutoActivationDelay().

bool KFilePlacesView::isAutoResizeItemsEnabled() const

bool KFilePlacesView::isDropOnPlaceEnabled() const

[signal, since 5.91] void KFilePlacesView::newWindowRequested(const QUrl &url)

Emitted when the URL url should be opened in a new window because the user left-clicked on a place with Shift modifier pressed or selected "Open in New Window" from the context menu.

If a storage device needs to be mounted first, this signal is emitted once mounting has completed successfully.

This function was introduced in 5.91.

[signal, since 5.91] void KFilePlacesView::placeActivated(const QUrl &url)

Emitted when an item in the places view is clicked on with left mouse button with no modifier keys pressed.

If a storage device needs to be mounted first, this signal is emitted once mounting has completed successfully.

url The URL of the place

This function was introduced in 5.91.

void KFilePlacesView::setAutoResizeItemsEnabled(bool enabled)

If enabled is true (the default), items will automatically resize themselves to fill the view.

See also isAutoResizeItemsEnabled().

[since 5.92] void KFilePlacesView::setDragAutoActivationDelay(int delay)

If delay (in ms) is greater than zero, the place will automatically be activated if an item is dragged over and held on top of a place for at least that duraton.

delay Delay in ms, default is zero.

This function was introduced in 5.92.

See also dragAutoActivationDelay().

void KFilePlacesView::setDropOnPlaceEnabled(bool enabled)

If enabled is true, it is allowed dropping items above a place for e. g. copy or move operations. The application has to take care itself to perform the operation (see KFilePlacesView::urlsDropped()). If enabled is false, it is only possible adding items as additional place. Per default dropping on a place is disabled.

See also isDropOnPlaceEnabled().

[slot] void KFilePlacesView::setShowAll(bool showAll)

[since 5.91] void KFilePlacesView::setTeardownFunction(KFilePlacesView::TeardownFunction teardownFunc)

Sets a custom function that will be called when teardown of a device (e.g. unmounting a drive) is requested.

This function was introduced in 5.91.

[slot] void KFilePlacesView::setUrl(const QUrl &url)

[signal, since 5.91] void KFilePlacesView::tabRequested(const QUrl &url)

Emitted when the URL url should be opened in a new inactive tab because the user clicked on a place with the middle mouse button or left-clicked with the Ctrl modifier pressed or selected "Open in New Tab" from the context menu.

If a storage device needs to be mounted first, this signal is emitted once mounting has completed successfully.

This function was introduced in 5.91.

[signal] void KFilePlacesView::urlsDropped(const QUrl &dest, QDropEvent *event, QWidget *parent)

Is emitted if items are dropped on the place dest.

The application has to take care itself about performing the corresponding action like copying or moving.