From d7db872a15418d20392990a65d9525c11e2a4fa4 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 16 Oct 2010 15:21:21 +0200 Subject: Made hovering configurable Revamped misc tab in configurationdialog to QGroupBoxes. Added options for enabling or disabling hovering over pictures or the archive tree. Also implemented an option to set the opacity for HoverWindow. --- filestreewidget.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'filestreewidget.cpp') diff --git a/filestreewidget.cpp b/filestreewidget.cpp index 0dab9a2..43611f9 100644 --- a/filestreewidget.cpp +++ b/filestreewidget.cpp @@ -269,9 +269,15 @@ void FilesTreeWidget::fileSelectionChanged(const QItemSelection &selected, const emit sizeChanged(mSelectedSize); } -FilesTreeView::FilesTreeView(QWidget *parent) : QTreeView(parent){ +FilesTreeView::FilesTreeView(QWidget *parent) : QTreeView(parent), mHoverWin(new HoverWindow), mHover(false){ setAttribute(Qt::WA_Hover); - mHoverWin = new HoverWindow; + readConfig(); +} + +void FilesTreeView::readConfig(){ + QSettings s; + mHover = s.value("ui/hoverpics", true).toBool(); + mHoverWin->setWindowOpacity(s.value("ui/hoveropacity", 10).toFloat() / 10.0); } void FilesTreeView::contextMenuEvent(QContextMenuEvent *event){ @@ -283,6 +289,10 @@ void FilesTreeView::contextMenuEvent(QContextMenuEvent *event){ } bool FilesTreeView::event(QEvent *e){ + QSettings s; + if(!s.value("ui/hoverpics").toBool()){ + return true; + } QModelIndex curIdx; QHoverEvent *hEvent = static_cast(e); QPoint hotSpot(hEvent->pos().x(), hEvent->pos().y() - SmGlobals::instance()->cursorOffset()); -- cgit v1.2.3-70-g09d2