KFileWidget
#include <KFileWidget>

Public Types | |
enum | OperationMode { Other = 0, Opening, Saving } |
![]() | |
enum | RenderFlag |
![]() | |
enum | PaintDeviceMetric |
Signals | |
void | accepted () |
void | fileHighlighted (const QUrl &) |
void | fileSelected (const QUrl &) |
void | filterChanged (const QString &filter) |
void | selectionChanged () |
Public Slots | |
void | accept () |
void | slotCancel () |
void | slotOk () |
Public Member Functions | |
KFileWidget (const QUrl &startDir, QWidget *parent=nullptr) | |
~KFileWidget () override | |
KActionCollection * | actionCollection () const |
QUrl | baseUrl () const |
QPushButton * | cancelButton () const |
void | clearFilter () |
QString | currentFilter () const |
QMimeType | currentFilterMimeType () |
QString | currentMimeFilter () const |
QSize | dialogSizeHint () const |
KDirOperator * | dirOperator () |
KFileFilterCombo * | filterWidget () const |
bool | keepsLocation () const |
KUrlComboBox * | locationEdit () const |
KFile::Modes | mode () const |
QPushButton * | okButton () const |
OperationMode | operationMode () const |
void | readConfig (KConfigGroup &group) |
QString | selectedFile () const |
QStringList | selectedFiles () const |
QUrl | selectedUrl () const |
QList< QUrl > | selectedUrls () const |
void | setConfirmOverwrite (bool enable) |
void | setCustomWidget (QWidget *widget) |
void | setCustomWidget (const QString &text, QWidget *widget) |
void | setFilter (const QString &filter) |
void | setInlinePreviewShown (bool show) |
void | setKeepLocation (bool keep) |
void | setLocationLabel (const QString &text) |
void | setMimeFilter (const QStringList &types, const QString &defaultType=QString()) |
void | setMode (KFile::Modes m) |
void | setOperationMode (OperationMode) |
void | setPreviewWidget (KPreviewWidgetBase *w) |
void | setSelectedUrl (const QUrl &url) |
void | setSelectedUrls (const QList< QUrl > &urls) |
void | setSelection (const QString &pathOrUrl) |
void | setSupportedSchemes (const QStringList &schemes) |
void | setUrl (const QUrl &url, bool clearforward=true) |
void | setViewMode (KFile::FileView mode) |
QSize | sizeHint () const override |
QStringList | supportedSchemes () const |
KToolBar * | toolBar () const |
![]() | |
QWidget (QWidget *parent, Qt::WindowFlags f) | |
bool | acceptDrops () const const |
QString | accessibleDescription () const const |
QString | accessibleName () const const |
QList< QAction * > | actions () const const |
void | activateWindow () |
void | addAction (QAction *action) |
void | addActions (QList< QAction * > actions) |
void | adjustSize () |
bool | autoFillBackground () const const |
QPalette::ColorRole | backgroundRole () const const |
QBackingStore * | backingStore () const const |
QSize | baseSize () const const |
QWidget * | childAt (int x, int y) const const |
QWidget * | childAt (const QPoint &p) const const |
QRect | childrenRect () const const |
QRegion | childrenRegion () const const |
void | clearFocus () |
void | clearMask () |
bool | close () |
QMargins | contentsMargins () const const |
QRect | contentsRect () const const |
Qt::ContextMenuPolicy | contextMenuPolicy () const const |
QCursor | cursor () const const |
void | customContextMenuRequested (const QPoint &pos) |
WId | effectiveWinId () const const |
void | ensurePolished () const const |
Qt::FocusPolicy | focusPolicy () const const |
QWidget * | focusProxy () const const |
QWidget * | focusWidget () const const |
const QFont & | font () const const |
QFontInfo | fontInfo () const const |
QFontMetrics | fontMetrics () const const |
QPalette::ColorRole | foregroundRole () const const |
QRect | frameGeometry () const const |
QSize | frameSize () const const |
const QRect & | geometry () const const |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const const |
QPixmap | grab (const QRect &rectangle) |
void | grabGesture (Qt::GestureType gesture, Qt::GestureFlags flags) |
void | grabKeyboard () |
void | grabMouse () |
void | grabMouse (const QCursor &cursor) |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context) |
QGraphicsEffect * | graphicsEffect () const const |
QGraphicsProxyWidget * | graphicsProxyWidget () const const |
bool | hasEditFocus () const const |
bool | hasFocus () const const |
virtual bool | hasHeightForWidth () const const |
bool | hasMouseTracking () const const |
bool | hasTabletTracking () const const |
int | height () const const |
virtual int | heightForWidth (int w) const const |
void | hide () |
Qt::InputMethodHints | inputMethodHints () const const |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const const |
void | insertAction (QAction *before, QAction *action) |
void | insertActions (QAction *before, QList< QAction * > actions) |
bool | isActiveWindow () const const |
bool | isAncestorOf (const QWidget *child) const const |
bool | isEnabled () const const |
bool | isEnabledTo (const QWidget *ancestor) const const |
bool | isEnabledToTLW () const const |
bool | isFullScreen () const const |
bool | isHidden () const const |
bool | isMaximized () const const |
bool | isMinimized () const const |
bool | isModal () const const |
bool | isTopLevel () const const |
bool | isVisible () const const |
bool | isVisibleTo (const QWidget *ancestor) const const |
bool | isWindow () const const |
bool | isWindowModified () const const |
QLayout * | layout () const const |
Qt::LayoutDirection | layoutDirection () const const |
QLocale | locale () const const |
void | lower () |
QPoint | mapFrom (const QWidget *parent, const QPoint &pos) const const |
QPoint | mapFromGlobal (const QPoint &pos) const const |
QPoint | mapFromParent (const QPoint &pos) const const |
QPoint | mapTo (const QWidget *parent, const QPoint &pos) const const |
QPoint | mapToGlobal (const QPoint &pos) const const |
QPoint | mapToParent (const QPoint &pos) const const |
QRegion | mask () const const |
int | maximumHeight () const const |
QSize | maximumSize () const const |
int | maximumWidth () const const |
int | minimumHeight () const const |
QSize | minimumSize () const const |
virtual QSize | minimumSizeHint () const const |
int | minimumWidth () const const |
void | move (int x, int y) |
void | move (const QPoint &) |
QWidget * | nativeParentWidget () const const |
QWidget * | nextInFocusChain () const const |
QRect | normalGeometry () const const |
void | overrideWindowFlags (Qt::WindowFlags flags) |
virtual QPaintEngine * | paintEngine () const const override |
const QPalette & | palette () const const |
QWidget * | parentWidget () const const |
QPoint | pos () const const |
QWidget * | previousInFocusChain () const const |
QWIDGETSIZE_MAX QWIDGETSIZE_MAX | |
void | raise () |
QRect | rect () const const |
void | releaseKeyboard () |
void | releaseMouse () |
void | releaseShortcut (int id) |
void | removeAction (QAction *action) |
void | render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags) |
void | render (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags) |
void | repaint () |
void | repaint (int x, int y, int w, int h) |
void | repaint (const QRect &rect) |
void | repaint (const QRegion &rgn) |
void | resize (int w, int h) |
void | resize (const QSize &) |
bool | restoreGeometry (const QByteArray &geometry) |
QByteArray | saveGeometry () const const |
QScreen * | screen () const const |
void | scroll (int dx, int dy) |
void | scroll (int dx, int dy, const QRect &r) |
void | setAcceptDrops (bool on) |
void | setAccessibleDescription (const QString &description) |
void | setAccessibleName (const QString &name) |
void | setAttribute (Qt::WidgetAttribute attribute, bool on) |
void | setAutoFillBackground (bool enabled) |
void | setBackgroundRole (QPalette::ColorRole role) |
void | setBaseSize (int basew, int baseh) |
void | setBaseSize (const QSize &) |
void | setContentsMargins (const QMargins &margins) |
void | setContentsMargins (int left, int top, int right, int bottom) |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | setCursor (const QCursor &) |
void | setDisabled (bool disable) |
void | setEditFocus (bool enable) |
void | setEnabled (bool) |
void | setFixedHeight (int h) |
void | setFixedSize (const QSize &s) |
void | setFixedSize (int w, int h) |
void | setFixedWidth (int w) |
void | setFocus (Qt::FocusReason reason) |
void | setFocus () |
void | setFocusPolicy (Qt::FocusPolicy policy) |
void | setFocusProxy (QWidget *w) |
void | setFont (const QFont &) |
void | setForegroundRole (QPalette::ColorRole role) |
void | setGeometry (const QRect &) |
void | setGeometry (int x, int y, int w, int h) |
void | setGraphicsEffect (QGraphicsEffect *effect) |
void | setHidden (bool hidden) |
void | setInputMethodHints (Qt::InputMethodHints hints) |
void | setLayout (QLayout *layout) |
void | setLayoutDirection (Qt::LayoutDirection direction) |
void | setLocale (const QLocale &locale) |
void | setMask (const QBitmap &bitmap) |
void | setMask (const QRegion ®ion) |
void | setMaximumHeight (int maxh) |
void | setMaximumSize (int maxw, int maxh) |
void | setMaximumSize (const QSize &) |
void | setMaximumWidth (int maxw) |
void | setMinimumHeight (int minh) |
void | setMinimumSize (const QSize &) |
void | setMinimumSize (int minw, int minh) |
void | setMinimumWidth (int minw) |
void | setMouseTracking (bool enable) |
void | setPalette (const QPalette &) |
void | setParent (QWidget *parent, Qt::WindowFlags f) |
void | setParent (QWidget *parent) |
void | setShortcutAutoRepeat (int id, bool enable) |
void | setShortcutEnabled (int id, bool enable) |
void | setSizeIncrement (const QSize &) |
void | setSizeIncrement (int w, int h) |
void | setSizePolicy (QSizePolicy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
void | setStatusTip (const QString &) |
void | setStyle (QStyle *style) |
void | setStyleSheet (const QString &styleSheet) |
void | setTabletTracking (bool enable) |
void | setToolTip (const QString &) |
void | setToolTipDuration (int msec) |
void | setUpdatesEnabled (bool enable) |
void | setupUi (QWidget *widget) |
virtual void | setVisible (bool visible) |
void | setWhatsThis (const QString &) |
void | setWindowFilePath (const QString &filePath) |
void | setWindowFlag (Qt::WindowType flag, bool on) |
void | setWindowFlags (Qt::WindowFlags type) |
void | setWindowIcon (const QIcon &icon) |
void | setWindowIconText (const QString &) |
void | setWindowModality (Qt::WindowModality windowModality) |
void | setWindowModified (bool) |
void | setWindowOpacity (qreal level) |
void | setWindowRole (const QString &role) |
void | setWindowState (Qt::WindowStates windowState) |
void | setWindowTitle (const QString &) |
void | show () |
void | showFullScreen () |
void | showMaximized () |
void | showMinimized () |
void | showNormal () |
QSize | size () const const |
QSize | sizeIncrement () const const |
QSizePolicy | sizePolicy () const const |
void | stackUnder (QWidget *w) |
QString | statusTip () const const |
QStyle * | style () const const |
QString | styleSheet () const const |
bool | testAttribute (Qt::WidgetAttribute attribute) const const |
QString | toolTip () const const |
int | toolTipDuration () const const |
QWidget * | topLevelWidget () const const |
bool | underMouse () const const |
void | ungrabGesture (Qt::GestureType gesture) |
void | unsetCursor () |
void | unsetLayoutDirection () |
void | unsetLocale () |
void | update (int x, int y, int w, int h) |
void | update (const QRect &rect) |
void | update (const QRegion &rgn) |
void | update () |
void | updateGeometry () |
bool | updatesEnabled () const const |
QRegion | visibleRegion () const const |
QString | whatsThis () const const |
int | width () const const |
QWidget * | window () const const |
QString | windowFilePath () const const |
Qt::WindowFlags | windowFlags () const const |
QWindow * | windowHandle () const const |
QIcon | windowIcon () const const |
void | windowIconChanged (const QIcon &icon) |
QString | windowIconText () const const |
void | windowIconTextChanged (const QString &iconText) |
Qt::WindowModality | windowModality () const const |
qreal | windowOpacity () const const |
QString | windowRole () const const |
Qt::WindowStates | windowState () const const |
QString | windowTitle () const const |
void | windowTitleChanged (const QString &title) |
Qt::WindowType | windowType () const const |
WId | winId () const const |
int | x () const const |
int | y () const const |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
![]() | |
int | colorCount () const const |
int | depth () const const |
int | devicePixelRatio () const const |
qreal | devicePixelRatioF () const const |
int | height () const const |
int | heightMM () const const |
int | logicalDpiX () const const |
int | logicalDpiY () const const |
bool | paintingActive () const const |
int | physicalDpiX () const const |
int | physicalDpiY () const const |
int | width () const const |
int | widthMM () const const |
Static Public Member Functions | |
static QUrl | getStartUrl (const QUrl &startDir, QString &recentDirClass) |
static QUrl | getStartUrl (const QUrl &startDir, QString &recentDirClass, QString &fileName) |
static void | setStartDir (const QUrl &directory) |
![]() | |
QWidget * | createWindowContainer (QWindow *window, QWidget *parent, Qt::WindowFlags flags) |
QWidget * | find (WId id) |
QWidget * | keyboardGrabber () |
QWidget * | mouseGrabber () |
void | setTabOrder (QWidget *first, QWidget *second) |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
bool | eventFilter (QObject *watched, QEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | showEvent (QShowEvent *event) override |
![]() | |
virtual void | actionEvent (QActionEvent *event) |
virtual void | changeEvent (QEvent *event) |
virtual void | closeEvent (QCloseEvent *event) |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
void | create (WId window, bool initializeWindow, bool destroyOldWindow) |
void | destroy (bool destroyWindow, bool destroySubWindows) |
virtual void | dragEnterEvent (QDragEnterEvent *event) |
virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
virtual void | dragMoveEvent (QDragMoveEvent *event) |
virtual void | dropEvent (QDropEvent *event) |
virtual void | enterEvent (QEvent *event) |
virtual bool | event (QEvent *event) override |
virtual void | focusInEvent (QFocusEvent *event) |
bool | focusNextChild () |
virtual bool | focusNextPrevChild (bool next) |
virtual void | focusOutEvent (QFocusEvent *event) |
bool | focusPreviousChild () |
virtual void | hideEvent (QHideEvent *event) |
virtual void | initPainter (QPainter *painter) const const override |
virtual void | inputMethodEvent (QInputMethodEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | keyReleaseEvent (QKeyEvent *event) |
virtual void | leaveEvent (QEvent *event) |
virtual int | metric (QPaintDevice::PaintDeviceMetric m) const const override |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | moveEvent (QMoveEvent *event) |
virtual bool | nativeEvent (const QByteArray &eventType, void *message, long *result) |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | tabletEvent (QTabletEvent *event) |
void | updateMicroFocus () |
virtual void | wheelEvent (QWheelEvent *event) |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Detailed Description
File selector widget.
This is the contents of the KDE file dialog, without the actual QDialog around it. It can be embedded directly into applications.
Definition at line 47 of file kfilewidget.h.
Member Enumeration Documentation
Defines some default behavior of the filedialog.
E.g. in mode Opening
and Saving
, the selected files/urls will be added to the "recent documents" list. The Saving mode also implies setKeepLocation() being set.
Other
means that no default actions are performed.
- See also
- setOperationMode
- operationMode
Definition at line 99 of file kfilewidget.h.
Constructor & Destructor Documentation
Constructs a file selector widget.
- Parameters
-
startDir This can either be: - An empty URL (QUrl()) to start in the current working directory, or the last directory where a file has been selected.
- The path or URL of a starting directory.
- An initial file name to select, with the starting directory being the current working directory or the last directory where a file has been selected.
- The path or URL of a file, specifying both the starting directory and an initially selected file name.
- A URL of the form
kfiledialog:///<keyword>
to start in the directory last used by a filedialog in the same application that specified the same keyword. - A URL of the form
kfiledialog:///<keyword>/<filename>
to start in the directory last used by a filedialog in the same application that specified the same keyword, and to initially select the specified filename. - A URL of the form
kfiledialog:///<keyword>
?global to start in the directory last used by a filedialog in any application that specified the same keyword. - A URL of the form
kfiledialog:///<keyword>/<filename>
?global to start in the directory last used by a filedialog in any application that specified the same keyword, and to initially select the specified filename.
parent The parent widget of this widget
Definition at line 330 of file kfilewidget.cpp.
|
override |
Destructor.
Definition at line 623 of file kfilewidget.cpp.
Member Function Documentation
|
signal |
Emitted by slotOk() (directly or asynchronously) once everything has been done.
Should be used by the caller to call accept().
KActionCollection * KFileWidget::actionCollection | ( | ) | const |
- Returns
- a pointer to the action collection, holding all the used KActions.
Definition at line 2588 of file kfilewidget.cpp.
QUrl KFileWidget::baseUrl | ( | ) | const |
- Returns
- the currently shown directory.
Definition at line 1803 of file kfilewidget.cpp.
QPushButton * KFileWidget::cancelButton | ( | ) | const |
- Returns
- a pointer to the Cancel-Button in the filedialog. Note that the button is hidden and unconnected when using KFileWidget alone; KFileDialog shows it and connects to it.
Definition at line 2004 of file kfilewidget.cpp.
void KFileWidget::clearFilter | ( | ) |
Clears any MIME type or name filter.
Does not reload the directory.
Definition at line 688 of file kfilewidget.cpp.
QString KFileWidget::currentFilter | ( | ) | const |
Returns the current filter as entered by the user or one of the predefined set via setFilter().
- See also
- setFilter()
- filterChanged()
Definition at line 665 of file kfilewidget.cpp.
QMimeType KFileWidget::currentFilterMimeType | ( | ) |
Returns the MIME type for the desired output format.
This is only valid if setFilterMimeType() has been called previously.
- See also
- setFilterMimeType()
Definition at line 708 of file kfilewidget.cpp.
QString KFileWidget::currentMimeFilter | ( | ) | const |
The MIME type for the desired output format.
This is only valid if setMimeFilter() has been called previously.
- See also
- setMimeFilter()
Definition at line 698 of file kfilewidget.cpp.
QSize KFileWidget::dialogSizeHint | ( | ) | const |
Provides a size hint, useful for dialogs that embed the widget.
- Returns
- a QSize, calculated to be optimal for a dialog.
- Since
- 5.0
Definition at line 2906 of file kfilewidget.cpp.
KDirOperator * KFileWidget::dirOperator | ( | ) |
- Returns
- the KDirOperator used to navigate the filesystem
- Since
- 4.3
Definition at line 2850 of file kfilewidget.cpp.
|
signal |
Emitted when the user highlights a file.
- Since
- 4.4
|
signal |
Emitted when the user selects a file.
It is only emitted in single- selection mode. The best way to get notified about selected file(s) is to connect to the okClicked() signal inherited from KDialog and call selectedFile(), selectedFiles(), selectedUrl() or selectedUrls().
- Since
- 4.4
|
signal |
Emitted when the filter changed, i.e.
the user entered an own filter or chose one of the predefined set via setFilter().
- Parameters
-
filter contains the new filter (only the extension part, not the explanation), i.e. "*.cpp" or "*.cpp *.cc".
- See also
- setFilter()
- currentFilter()
KFileFilterCombo * KFileWidget::filterWidget | ( | ) | const |
- Returns
- the combobox that contains the filters
Definition at line 2583 of file kfilewidget.cpp.
This method implements the logic to determine the user's default directory to be listed.
E.g. the documents directory, home directory or a recently used directory.
- Parameters
-
startDir A URL specifying the initial directory, or using the kfiledialog:///
syntax to specify a last used directory. If this URL specifies a file name, it is ignored. Refer to the KFileWidget::KFileWidget() documentation for thekfiledialog:///
URL syntax.recentDirClass If the kfiledialog:///
syntax is used, this will return the string to be passed to KRecentDirs::dir() and KRecentDirs::add().
- Returns
- The URL that should be listed by default (e.g. by KFileDialog or KDirSelectDialog).
- See also
- KFileWidget::KFileWidget()
Definition at line 2663 of file kfilewidget.cpp.
|
static |
Similar to getStartUrl(const QUrl& startDir,QString& recentDirClass), but allows both the recent start directory keyword and a suggested file name to be returned.
- Parameters
-
startDir A URL specifying the initial directory and/or filename, or using the kfiledialog:///
syntax to specify a last used location. Refer to the KFileWidget::KFileWidget() documentation for thekfiledialog:///
URL syntax.recentDirClass If the kfiledialog:///
syntax is used, this will return the string to be passed to KRecentDirs::dir() and KRecentDirs::add().fileName The suggested file name, if specified as part of the StartDir
URL.
- Returns
- The URL that should be listed by default (e.g. by KFileDialog or KDirSelectDialog).
- See also
- KFileWidget::KFileWidget()
- Since
- 4.3
Definition at line 2671 of file kfilewidget.cpp.
bool KFileWidget::keepsLocation | ( | ) | const |
- Returns
- whether the contents of the location edit are kept when changing directories.
Definition at line 2021 of file kfilewidget.cpp.
KUrlComboBox * KFileWidget::locationEdit | ( | ) | const |
- Returns
- the combobox used to type the filename or full location of the file.
Definition at line 2578 of file kfilewidget.cpp.
KFile::Modes KFileWidget::mode | ( | ) | const |
Returns the mode of the filedialog.
- See also
- setMode()
Definition at line 1888 of file kfilewidget.cpp.
QPushButton * KFileWidget::okButton | ( | ) | const |
- Returns
- a pointer to the OK-Button in the filedialog. Note that the button is hidden and unconnected when using KFileWidget alone; KFileDialog shows it and connects to it.
Definition at line 1999 of file kfilewidget.cpp.
KFileWidget::OperationMode KFileWidget::operationMode | ( | ) | const |
- Returns
- the current operation mode, Opening, Saving or Other. Default is Other.
Definition at line 2054 of file kfilewidget.cpp.
void KFileWidget::readConfig | ( | KConfigGroup & | group | ) |
reads the configuration for this widget from the given config group
- Parameters
-
group the KConfigGroup to read from
- Since
- 4.4
Definition at line 2855 of file kfilewidget.cpp.
QString KFileWidget::selectedFile | ( | ) | const |
Returns the full path of the selected file in the local filesystem.
(Local files only)
Definition at line 1757 of file kfilewidget.cpp.
QStringList KFileWidget::selectedFiles | ( | ) | const |
Returns a list of all selected local files.
Definition at line 1774 of file kfilewidget.cpp.
QUrl KFileWidget::selectedUrl | ( | ) | const |
- Returns
- The selected fully qualified filename.
Definition at line 1652 of file kfilewidget.cpp.
- Returns
- The list of selected URLs.
Definition at line 1663 of file kfilewidget.cpp.
|
signal |
Emitted when the user highlights one or more files in multiselection mode.
Note: fileHighlighted() or fileSelected() are not emitted in multiselection mode. You may use selectedItems() to ask for the current highlighted items.
- See also
- fileSelected
void KFileWidget::setConfirmOverwrite | ( | bool | enable | ) |
Sets whether the user should be asked for confirmation when an overwrite might occur.
- Parameters
-
enable Set this to true to enable checking.
- Since
- 4.2
Definition at line 2896 of file kfilewidget.cpp.
void KFileWidget::setCustomWidget | ( | QWidget * | widget | ) |
Set a custom widget that should be added to the file dialog.
- Parameters
-
widget A widget, or a widget of widgets, for displaying custom data in the file widget. This can be used, for example, to display a check box with the caption "Open as read-only". When creating this widget, you don't need to specify a parent, since the widget's parent will be set automatically by KFileWidget.
Definition at line 2817 of file kfilewidget.cpp.
Sets a custom widget that should be added below the location and the filter editors.
- Parameters
-
text Label of the custom widget, which is displayed below the labels "Location:" and "Filter:". widget Any kind of widget, but preferable a combo box or a line editor to be compliant with the location and filter layout. When creating this widget, you don't need to specify a parent, since the widget's parent will be set automatically by KFileWidget.
Definition at line 2839 of file kfilewidget.cpp.
void KFileWidget::setFilter | ( | const QString & | filter | ) |
Sets the filter to be used to filter
.
You can set more filters for the user to select separated by '
'. Every filter entry is defined through namefilter|text to display. If no | is found in the expression, just the namefilter is shown. Examples:
Note: The text to display is not parsed in any way. So, if you want to show the suffix to select by a specific filter, you must repeat it.
If the filter contains an unescaped '/', a MIME type filter is assumed. If you would like a '/' visible in your filter it can be escaped with a '\'. You can specify multiple MIME types like this (separated with space):
- See also
- filterChanged
- setMimeFilter
Definition at line 634 of file kfilewidget.cpp.
void KFileWidget::setInlinePreviewShown | ( | bool | show | ) |
Forces the inline previews to be shown or hidden, depending on show
.
- Parameters
-
show Whether to show inline previews or not.
- Since
- 4.2
Definition at line 2901 of file kfilewidget.cpp.
void KFileWidget::setKeepLocation | ( | bool | keep | ) |
Sets whether the filename/url should be kept when changing directories.
This is for example useful when having a predefined filename where the full path for that file is searched.
This is implicitly set when operationMode() is KFileWidget::Saving
getSaveFileName() and getSaveUrl() set this to true by default, so that you can type in the filename and change the directory without having to type the name again.
Definition at line 2016 of file kfilewidget.cpp.
void KFileWidget::setLocationLabel | ( | const QString & | text | ) |
Sets the text to be displayed in front of the selection.
The default is "Location". Most useful if you want to make clear what the location is used for.
Definition at line 629 of file kfilewidget.cpp.
void KFileWidget::setMimeFilter | ( | const QStringList & | types, |
const QString & | defaultType = QString() |
||
) |
Sets the filter up to specify the output type.
- Parameters
-
types a list of MIME types that can be used as output format defaultType the default MIME type to use as output format, if any. If defaultType
is set, it will be set as the current item. Otherwise, a first item showing all the MIME types will be created. Typically,defaultType
should be empty for loading and set for saving.
Do not use in conjunction with setFilter()
Definition at line 670 of file kfilewidget.cpp.
void KFileWidget::setMode | ( | KFile::Modes | m | ) |
Sets the mode of the dialog.
The mode is defined as (in kfile.h):
You can OR the values, e.g.
Definition at line 1874 of file kfilewidget.cpp.
void KFileWidget::setOperationMode | ( | OperationMode | mode | ) |
Sets the operational mode of the filedialog to Saving
, Opening
or Other
.
This will set some flags that are specific to loading or saving files. E.g. setKeepLocation() makes mostly sense for a save-as dialog. So setOperationMode( KFileWidget::Saving ); sets setKeepLocation for example.
The mode Saving
, together with a default filter set via setMimeFilter() will make the filter combobox read-only.
The default mode is Opening
.
Call this method right after instantiating KFileWidget.
Definition at line 2026 of file kfilewidget.cpp.
void KFileWidget::setPreviewWidget | ( | KPreviewWidgetBase * | w | ) |
Adds a preview widget and enters the preview mode.
In this mode the dialog is split and the right part contains your preview widget.
Ownership is transferred to KFileWidget. You need to create the preview-widget with "new", i.e. on the heap.
- Parameters
-
w The widget to be used for the preview.
Definition at line 714 of file kfilewidget.cpp.
void KFileWidget::setSelectedUrl | ( | const QUrl & | url | ) |
Sets the URL to preselect to url
.
This method handles absolute URLs (remember to use fromLocalFile for local paths). It also handles relative URLs, which you should construct like this: QUrl relativeUrl; relativeUrl.setPath(fileName);
- Since
- 5.33
Definition at line 1576 of file kfilewidget.cpp.
Sets a list of URLs as preselected.
- See also
- setSelectedUrl
- Since
- 5.75
Definition at line 1585 of file kfilewidget.cpp.
void KFileWidget::setSelection | ( | const QString & | pathOrUrl | ) |
Sets the file to preselect to pathOrUrl
.
This method handles absolute paths (on Unix, but probably not correctly on Windows) and absolute URLs as strings (but for those you should use setSelectedUrl instead).
This method does not work with relative paths (filenames) (it would misinterpret a ':' or a '#' in the filename).
- Deprecated:
- since 5.33, use setSelectedUrl instead, after ensuring that construct the QUrl correctly (e.g. use fromLocalFile for local paths).
Definition at line 1557 of file kfilewidget.cpp.
|
static |
Used by KDirSelectDialog to share the dialog's start directory.
Definition at line 2755 of file kfilewidget.cpp.
void KFileWidget::setSupportedSchemes | ( | const QStringList & | schemes | ) |
Set the URL schemes that the file widget should allow navigating to.
If the returned list is empty, all schemes are supported.
- See also
- QFileDialog::setSupportedSchemes
- Since
- 5.43
Definition at line 2922 of file kfilewidget.cpp.
void KFileWidget::setUrl | ( | const QUrl & | url, |
bool | clearforward = true |
||
) |
Sets the directory to view.
- Parameters
-
url URL to show. clearforward Indicates whether the forward queue should be cleared.
Definition at line 1457 of file kfilewidget.cpp.
void KFileWidget::setViewMode | ( | KFile::FileView | mode | ) |
Sets how the view should be displayed.
- See also
- KFile::FileView
- Since
- 5.0
Definition at line 2916 of file kfilewidget.cpp.
|
overridevirtual |
|
slot |
Called when clicking ok (when this widget is used in KFileDialog) Might or might not call accept().
Logic of the next part of code (ends at "end multi relative urls").
We allow for instance to be at "/" and insert '"home/foo/bar.txt" "boot/grub/menu.lst"'. Why we need to support this ? Because we provide tree views, which aren't plain.
Now, how does this logic work. It will get the first element on the list (with no filename), following the previous example say "/home/foo" and set it as the top most url.
After this, it will iterate over the rest of items and check if this URL (topmost url) contains the url being iterated.
As you might have guessed it will do "/home/foo" against "/boot/grub" (again stripping filename), and a false will be returned. Then we upUrl the top most url, resulting in "/home" against "/boot/grub", what will again return false, so we upUrl again. Now we have "/" against "/boot/grub", what returns true for us, so we can say that the closest common ancestor of both is "/".
This example has been written for 2 urls, but this works for any number of urls.
end multi relative urls
Definition at line 772 of file kfilewidget.cpp.
QStringList KFileWidget::supportedSchemes | ( | ) | const |
Returns the URL schemes that the file widget should allow navigating to.
If the returned list is empty, all schemes are supported. Examples for schemes are "file"
or "ftp"
.
- See also
- QFileDialog::supportedSchemes
- Since
- 5.43
Definition at line 2929 of file kfilewidget.cpp.
KToolBar * KFileWidget::toolBar | ( | ) | const |
Returns a pointer to the toolbar.
- Deprecated:
- since 5.66 due to no known users and leaking KXMLGui into the API.
Definition at line 2811 of file kfilewidget.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 23:03:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.