mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
provide a hover information in the statusbar if the mouse cursor enters an item
svn path=/trunk/KDE/kdebase/apps/; revision=663779
This commit is contained in:
parent
d03b27f288
commit
794911106c
|
@ -42,6 +42,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control
|
|||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setDropIndicatorShown(false);
|
||||
|
||||
setMouseTracking(true);
|
||||
viewport()->setAttribute(Qt::WA_Hover);
|
||||
|
||||
if (KGlobalSettings::singleClick()) {
|
||||
|
@ -53,6 +54,10 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control
|
|||
}
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)),
|
||||
controller, SLOT(triggerItem(const QModelIndex&)));
|
||||
connect(this, SIGNAL(entered(const QModelIndex&)),
|
||||
controller, SLOT(emitItemEntered(const QModelIndex&)));
|
||||
connect(this, SIGNAL(viewportEntered()),
|
||||
controller, SLOT(emitViewportEntered()));
|
||||
connect(controller, SIGNAL(zoomIn()),
|
||||
this, SLOT(zoomIn()));
|
||||
connect(controller, SIGNAL(zoomOut()),
|
||||
|
|
|
@ -92,6 +92,16 @@ void DolphinController::triggerItem(const QModelIndex& index)
|
|||
emit itemTriggered(index);
|
||||
}
|
||||
|
||||
void DolphinController::emitItemEntered(const QModelIndex& index)
|
||||
{
|
||||
emit itemEntered(index);
|
||||
}
|
||||
|
||||
void DolphinController::emitViewportEntered()
|
||||
{
|
||||
emit viewportEntered();
|
||||
}
|
||||
|
||||
void DolphinController::indicateSelectionChange()
|
||||
{
|
||||
emit selectionChanged();
|
||||
|
|
|
@ -84,7 +84,23 @@ public:
|
|||
inline bool isZoomOutPossible() const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Emits the signal itemTriggered(). The method should be invoked by the
|
||||
* controller parent whenever the user has triggered an item. */
|
||||
void triggerItem(const QModelIndex& index);
|
||||
|
||||
/**
|
||||
* Emits the signal itemEntered(). The method should be invoked by
|
||||
* the controller parent whenever the mouse cursor is above an item.
|
||||
*/
|
||||
void emitItemEntered(const QModelIndex& index);
|
||||
|
||||
/**
|
||||
* Emits the signal viewportEntered(). The method should be invoked by
|
||||
* the controller parent whenever the mouse cursor is above the viewport.
|
||||
*/
|
||||
void emitViewportEntered();
|
||||
|
||||
void indicateSelectionChange();
|
||||
|
||||
signals:
|
||||
|
@ -136,6 +152,17 @@ signals:
|
|||
*/
|
||||
void itemTriggered(const QModelIndex& index);
|
||||
|
||||
/**
|
||||
* Is emitted if the mouse cursor has entered the item
|
||||
* given by \a index.
|
||||
*/
|
||||
void itemEntered(const QModelIndex& index);
|
||||
|
||||
/**
|
||||
* Is emitted if the mouse cursor has entered
|
||||
* the viewport. */
|
||||
void viewportEntered();
|
||||
|
||||
/** Is emitted if the selection has been changed by the user. */
|
||||
void selectionChanged();
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
|
|||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setDropIndicatorShown(false);
|
||||
|
||||
setMouseTracking(true);
|
||||
viewport()->setAttribute(Qt::WA_Hover);
|
||||
|
||||
const ViewProperties props(controller->url());
|
||||
|
@ -69,7 +70,10 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
|
|||
}
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)),
|
||||
controller, SLOT(triggerItem(const QModelIndex&)));
|
||||
|
||||
connect(this, SIGNAL(entered(const QModelIndex&)),
|
||||
controller, SLOT(emitItemEntered(const QModelIndex&)));
|
||||
connect(this, SIGNAL(viewportEntered()),
|
||||
controller, SLOT(emitViewportEntered()));
|
||||
connect(controller, SIGNAL(zoomIn()),
|
||||
this, SLOT(zoomIn()));
|
||||
connect(controller, SIGNAL(zoomOut()),
|
||||
|
|
|
@ -40,6 +40,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
|
|||
setViewMode(QListView::IconMode);
|
||||
setResizeMode(QListView::Adjust);
|
||||
|
||||
setMouseTracking(true);
|
||||
viewport()->setAttribute(Qt::WA_Hover);
|
||||
|
||||
if (KGlobalSettings::singleClick()) {
|
||||
|
@ -51,6 +52,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
|
|||
}
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)),
|
||||
controller, SLOT(triggerItem(const QModelIndex&)));
|
||||
connect(this, SIGNAL(entered(const QModelIndex&)),
|
||||
controller, SLOT(emitItemEntered(const QModelIndex&)));
|
||||
connect(this, SIGNAL(viewportEntered()),
|
||||
controller, SLOT(emitViewportEntered()));
|
||||
connect(controller, SIGNAL(showPreviewChanged(bool)),
|
||||
this, SLOT(slotShowPreviewChanged(bool)));
|
||||
connect(controller, SIGNAL(showAdditionalInfoChanged(bool)),
|
||||
|
|
|
@ -157,6 +157,10 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
|
|||
this, SLOT(emitSelectionChangedSignal()));
|
||||
connect(m_controller, SIGNAL(activated()),
|
||||
this, SLOT(requestActivation()));
|
||||
connect(m_controller, SIGNAL(itemEntered(const QModelIndex&)),
|
||||
this, SLOT(showHoverInformation(const QModelIndex&)));
|
||||
connect(m_controller, SIGNAL(viewportEntered()),
|
||||
this, SLOT(clearHoverInformation()));
|
||||
|
||||
createView();
|
||||
|
||||
|
@ -1179,6 +1183,25 @@ void DolphinView::updateCutItems()
|
|||
applyCutItemEffect();
|
||||
}
|
||||
|
||||
void DolphinView::showHoverInformation(const QModelIndex& index)
|
||||
{
|
||||
if (hasSelection()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const KFileItem* item = fileItem(index);
|
||||
if (item != 0) {
|
||||
m_statusBar->setMessage(item->getStatusBarInfo(), DolphinStatusBar::Default);
|
||||
emit requestItemInfo(item->url());
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinView::clearHoverInformation()
|
||||
{
|
||||
m_statusBar->clear();
|
||||
}
|
||||
|
||||
|
||||
void DolphinView::createView()
|
||||
{
|
||||
// delete current view
|
||||
|
|
|
@ -528,6 +528,20 @@ private slots:
|
|||
/** Applies an item effect to all cut items of the clipboard. */
|
||||
void updateCutItems();
|
||||
|
||||
/**
|
||||
* Updates the status bar to show hover information for the
|
||||
* item with the index \a index. If currently other items are selected,
|
||||
* no hover information is shown.
|
||||
* @see DolphinView::clearHoverInformation()
|
||||
*/
|
||||
void showHoverInformation(const QModelIndex& index);
|
||||
|
||||
/**
|
||||
* Clears the hover information shown in the status bar.
|
||||
* @see DolphinView::showHoverInformation().
|
||||
*/
|
||||
void clearHoverInformation();
|
||||
|
||||
private:
|
||||
void startDirLister(const KUrl& url, bool reload = false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue