• 大小: 12KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-23
  • 语言: C/C++
  • 标签: qt  滑屏  翻页  

资源简介

qt 滑屏翻页效果C++程序 #ifndef PICTUREFLOW_H #define PICTUREFLOW_H #include class PictureFlowPrivate; /*! Class PictureFlow implements an image show widget with animation effect like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form of slides, one main slide is shown at the center with few slides on the left and right sides of the center slide. When the next or previous slide is brought to the front, the whole slides flow to the right or the right with smooth animation effect; until the new slide is finally placed at the center. */ class PictureFlow : public QWidget { Q_OBJECT Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize) Q_PROPERTY(int slideCount READ slideCount) Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex) public: enum ReflectionEffect { NoReflection, PlainReflection, BlurredReflection }; /*! Creates a new PictureFlow widget. */ PictureFlow(QWidget* parent = 0); /*! Destroys the widget. */ ~PictureFlow(); /*! Returns the background color. */ QColor backgroundColor() const; /*! Sets the background color. By default it is black. */ void setBackgroundColor(const QColor& c); /*! Returns the dimension of each slide (in pixels). */ QSize slideSize() const; /*! Sets the dimension of each slide (in pixels). */ void setSlideSize(QSize size); /*! Returns the total number of slides. */ int slideCount() const; /*! Returns QImage of specified slide. */ QImage slide(int index) const; /*! Returns the index of slide currently shown in the middle of the viewport. */ int centerIndex() const; /*! Returns the effect applied to the reflection. */ ReflectionEffect reflectionEffect() const; /*! Sets the effect applied to the reflection. The default is PlainReflection.

资源截图

代码片段和文件信息

/*
  PictureFlow - animated image show widget
  http://pictureflow.googlecode.com

  Copyright (C) 2008 Ariya Hidayat (ariya@kde.org)
  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)

  Permission is hereby granted free of charge to any person obtaining a copy
  of this software and associated documentation files (the “Software“) to deal
  in the Software without restriction including without limitation the rights
  to use copy modify merge publish distribute sublicense and/or sell
  copies of the Software and to permit persons to whom the Software is
  furnished to do so subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
  IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
  LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

#include 
#include 
#include 
#include 
#include 

#if QT_VERSION >= 0x040000
#include 
#endif

#include “pictureflow.h“

QStringList findFiles(const QString& path = QString())
{
  QStringList files;

  QDir dir = QDir::current();
  if(!path.isEmpty())
    dir = QDir(path);

  dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymlinks);
#if QT_VERSION >= 0x040000
  QFileInfoList list = dir.entryInfoList();
  for (int i = 0; i < list.size(); ++i) 
  {
    QFileInfo fileInfo = list.at(i);
    files.append(dir.absoluteFilePath(fileInfo.fileName()));
  }
#else
  const QFileInfoList* list = dir.entryInfoList();
  if(list) 
  {
    QFileInfoListIterator it( *list );
    QFileInfo * fi;
    while( (fi=it.current()) != 0 ) 
    {
      ++it;
      files.append(dir.absFilePath(fi->fileName()));
    }
  }
#endif

  return files;
}

#if QT_VERSION < 0x040000
#define modifiers state
#define AltModifier AltButton
#define setWindowtitle setCaption
#endif

#if QT_VERSION < 0x030000
#define flush flushX
#endif

class Browser: public PictureFlow
{
public:
  Browser(): PictureFlow()
  {
    setWindowtitle(“PictureFlow“);
  }

  void keyPressEvent(QKeyEvent* event)
  {
    if(event->key() == Qt::Key_Escape || event->key() == Qt::Key_Enter || 
      event->key() == Qt::Key_Return)
      {
        event->accept();
        close();
      }

    // checking the speed of rendering
    if(event->key() == Qt::Key_F10)
    if(event->modifiers() == Qt::AltModifier)
    {
      qDebug(“benchmarking.... please wait“);
      const int blit_count = 10;

      QTime stopwatch;
      stopwatch.start();
      for(int i = 0; i < blit_count; i++)
      {
        render(); repaint(); QApplication::flu

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5490  2008-02-15 04:52  pictureflow\pictureflow-0.1.0\pictureflow-qt\main.cpp

     文件      29016  2008-02-15 04:52  pictureflow\pictureflow-0.1.0\pictureflow-qt\pictureflow.cpp

     文件       4885  2008-02-15 04:52  pictureflow\pictureflow-0.1.0\pictureflow-qt\pictureflow.h

     文件         95  2008-02-15 04:52  pictureflow\pictureflow-0.1.0\pictureflow-qt\pictureflow.pro

     目录          0  2011-04-18 16:51  pictureflow\pictureflow-0.1.0\pictureflow-qt

     目录          0  2011-07-13 14:26  pictureflow\pictureflow-0.1.0

     目录          0  2011-04-18 16:51  pictureflow

----------- ---------  ---------- -----  ----

                39486                    7


评论

共有 条评论