自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(0)
  • 资源 (3)
  • 收藏
  • 关注

空空如也

C 语言 cJson.h cJson.c c语言实现json封装和解析

C 语言 cJson.h cJson.c c语言实现json封装和解析

2020-11-20

qt 滑屏翻页效果C++程序

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. */ void setReflectionEffect(ReflectionEffect effect); public slots: /*! Adds a new slide. */ void addSlide(const QImage& image); /*! Adds a new slide. */ void addSlide(const QPixmap& pixmap); /*! Sets an image for specified slide. If the slide already exists, it will be replaced. */ void setSlide(int index, const QImage& image); /*! Sets a pixmap for specified slide. If the slide already exists, it will be replaced. */ void setSlide(int index, const QPixmap& pixmap); /*! Sets slide to be shown in the middle of the viewport. No animation effect will be produced, unlike using showSlide. */ void setCenterIndex(int index); /*! Clears all slides. */ void clear(); /*! Shows previous slide using animation effect. */ void showPrevious(); /*! Shows next slide using animation effect. */ void showNext(); /*! Go to specified slide using animation effect. */ void showSlide(int index); /*! Rerender the widget. Normally this function will be automatically invoked whenever necessary, e.g. during the transition animation. */ void render(); /*! Schedules a rendering update. Unlike render(), this function does not cause immediate rendering. */ void triggerRender(); signals: void centerIndexChanged(int index); protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); void resizeEvent(QResizeEvent* event); private slots: void updateAnimation(); private: PictureFlowPrivate* d; }; #endif // PICTUREFLOW_H

2011-08-05

qt 一个有关时间线的使用代码

qt 时间线 对初学者很有帮助 /*************************************************************************** * Copyright (C) 2009 by [email protected]* * [email protected] * * * ***************************************************************************/ #include #include #include #include #include #include #include #include "mainwin.h" #define QUANTITY 20 MainWin::MainWin(QWidget*p, Qt::WFlags f) :QWidget(p), pixmap("./background.png") { setFixedSize(800,600); QTimeLine* tl = new QTimeLine(2000, this);//total time connect(tl, SIGNAL(frameChanged(int)), this, SLOT(changePixmap(int))); tl->setFrameRange(0,100);//max value tl->setCurveShape(QTimeLine::LinearCurve); tl->setUpdateInterval(100);//step tl->start(); } void MainWin::paintEvent(QPaintEvent*e) { QPainter painter(this); painter.setClipRect(e->rect()); painter.drawPixmap(e->rect(),pixmap, e->rect()); } void MainWin::changePixmap(int value) { static int oldx = 0; qWarning() << "change pixmap..." < rect().width()) width = rect().width(); int height = pixmap.height(); if( height > rect().height()) height = rect().height(); int x = width * value / 100; QRect updaterect(oldx, 0, x-oldx + 1, height); qWarning() << value << x << oldx ; p.fillRect(updaterect, QColor(Qt::black)); //p.fillRect(updaterect, palette().color(QPalette::Base)); repaint(updaterect); oldx = x; }

2011-07-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除