Re: Thumbnail Bar
"Ilya Konkov" <[email protected]> Fri, 8 Feb 2008 22:39:14 +0500
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
Sorry that keep pestering, this is really last... for today at least =]
This is needed for last thumbnail bar version.
fullscreenbar.h:
+ virtual QPoint posAt(qreal value = -1.0);
fullscreenbar.cpp:
+QPoint FullScreenBar::posAt(qreal value) {
+ if (value < 0 || value > 1.0) {
+ value = d->mTimeLine->currentValue();
+ }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Gwenview-general mailing list
Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/gwenview-general
thumbnailbar.cpp
(text/x-c++src, 3.2 KB)
// vim: set tabstop=4 shiftwidth=4 noexpandtab: /* Gwenview: an image viewer Copyright 2007 Aurélien Gâteau <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // Self #include "thumbnailbar.moc" // Qt #include <QApplication> #include <QResizeEvent> #include <QEvent> #include <QWheelEvent> #include <QObject> #include <QScrollBar> //KDE // Local #include "lib/thumbnailview.h" namespace Gwenview { ThumbnailBar::ThumbnailBar(QWidget *parent) : FullScreenBar(parent), mView(new ThumbnailView(this)) { addWidget(mView); mView->setFrameStyle(QFrame::NoFrame); mView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); mView->setThumbnailSize(64); mView->setObjectName("thumbnailBarView"); setStyleSheet( "#thumbnailBarView {" " background-color:" " qlineargradient(x1:0, y1:0, x2:0, y2:1," " stop:0 #444, stop: 0.6 rgba(0,0,0, 75), stop:1 rgba(0,0,0, 255));" " color: white;" " border-top: 1px solid #888;" " padding-right: 2px;" " padding-left: 2px;" "}" ); setPosition(FullScreenBar::Bottom); mView->setPreviewMode(ThumbnailView::RowMode); mView->setWrapping(false); parent->installEventFilter(this); mView->installEventFilter(mView); setHideCursor(false); } ThumbnailView* ThumbnailBar::view() const { return mView; } bool ThumbnailBar::eventFilter(QObject* object, QEvent* event) { if (object == parent()) { if (event->type() == QEvent::Resize) { switch (mView->previewMode()) { case ThumbnailView::NormalMode: // resize(parentWidget()->width(), parentWidget()->height()); break; case ThumbnailView::RowMode: resize(parentWidget()->width(), mView->itemHeight() + 15); break; case ThumbnailView::ColumnMode: resize(mView->itemWidth() + 15, parentWidget()->height()); break; } move(posAt()); return false; } } if (object == mView && mView->previewMode() == ThumbnailView::RowMode) { if (event->type() == QEvent::Wheel) { mView->horizontalScrollBar()->setValue(mView->horizontalScrollBar()->value() - dynamic_cast<QWheelEvent*>(event)->delta()); event->accept(); } return false; } if (event->type() == QEvent::MouseMove) { QRect rect = QWidget::rect(); rect.moveTo(posAt(1.0)); QPoint pos = parentWidget()->mapFromGlobal(QCursor::pos()); if (rect.contains(pos)) { return FullScreenBar::eventFilter(object, event); } return false; } return FullScreenBar::eventFilter(object, event); } } // namespace
thumbnailbar.h
(text/x-chdr, 1.2 KB)
// vim: set tabstop=4 shiftwidth=4 noexpandtab: /* Gwenview: an image viewer Copyright 2007 Aurélien Gâteau <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef THUMBNAILBAR_H #define THUMBNAILBAR_H // Qt // KDE // Local #include "lib/fullscreenbar.h" namespace Gwenview { class ThumbnailView; class ThumbnailBar : public FullScreenBar { Q_OBJECT public: ThumbnailBar(QWidget *parent = 0); ThumbnailView* view() const; protected: virtual bool eventFilter(QObject*, QEvent*); private: ThumbnailView* mView; }; } // namespace #endif /* THUMBNAILBAR_H */