Initial Commit

This commit is contained in:
Victor Tran 2016-12-30 22:27:55 +11:00
commit b3783155ab
7 changed files with 155 additions and 0 deletions

6
qt_thelib.pri Normal file
View file

@ -0,0 +1,6 @@
QT.thelib.VERSION = 1.0
QT.thelib.MAJOR_VERSION = 1
QT.thelib.MINOR_VERSION = 0
QT.thelib.name = the-libs
QT.thelib.includes = /usr/include/the-libs/
QT.thelib.libs = /usr/lib

39
the-libs.pro Normal file
View file

@ -0,0 +1,39 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-12-30T16:59:03
#
#-------------------------------------------------
QT += widgets dbus
CONFIG += c++14
TARGET = the-libs
TEMPLATE = lib
DEFINES += THELIBS_LIBRARY
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += tvariantanimation.cpp \
tpropertyanimation.cpp
HEADERS += tvariantanimation.h\
the-libs_global.h \
tpropertyanimation.h
unix {
target.path = /usr/lib
INSTALLS += target
}
DISTFILES += \
qt_thelib.pri

12
the-libs_global.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef THELIBS_GLOBAL_H
#define THELIBS_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(THELIBS_LIBRARY)
# define THELIBSSHARED_EXPORT Q_DECL_EXPORT
#else
# define THELIBSSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // THELIBS_GLOBAL_H

32
tpropertyanimation.cpp Normal file
View file

@ -0,0 +1,32 @@
#include "tpropertyanimation.h"
/*tPropertyAnimation::tPropertyAnimation(QObject* parent) :
tVariantAnimation(parent)
{
//connect(tVariantAnimation, SIGNAL(finished()), this, SIGNAL(finished()));
//connect(QPropertyAnimation, SIGNAL(finished()), this, SIGNAL(finished()));
}*/
tPropertyAnimation::tPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent) :
tVariantAnimation(parent) {
targetObject = target;
targetName = propertyName;
/*connect(this, tVariantAnimation::finished, [=]() {
emit this->finished();
});*/
connect(this, SIGNAL(valueChanged(QVariant)), this, SLOT(propertyChanged(QVariant)));
}
tPropertyAnimation::~tPropertyAnimation() {
}
void tPropertyAnimation::start(QAbstractAnimation::DeletionPolicy policy) {
qDebug() << "tPropertyAnimation::start() called";
tVariantAnimation::start(policy);
}
void tPropertyAnimation::propertyChanged(QVariant value) {
targetObject->setProperty(targetName, value);
}

29
tpropertyanimation.h Normal file
View file

@ -0,0 +1,29 @@
#ifndef TPROPERTYANIMATION_H
#define TPROPERTYANIMATION_H
#include <QObject>
#include "tvariantanimation.h"
class THELIBSSHARED_EXPORT tPropertyAnimation : public tVariantAnimation
{
Q_OBJECT
public:
//tPropertyAnimation(QObject *parent = Q_NULLPTR);
tPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = Q_NULLPTR);
~tPropertyAnimation();
using tVariantAnimation::finished;
public slots:
void start(QAbstractAnimation::DeletionPolicy policy = DeleteWhenStopped);
private slots:
void propertyChanged(QVariant value);
private:
QObject* targetObject;
QByteArray targetName;
};
#endif // TPROPERTYANIMATION_H

17
tvariantanimation.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "tvariantanimation.h"
tVariantAnimation::tVariantAnimation(QObject *parent) : QVariantAnimation(parent)
{
}
tVariantAnimation::~tVariantAnimation() {
}
void tVariantAnimation::start(QAbstractAnimation::DeletionPolicy policy) {
qDebug() << "tVariantAnimation::start() called";
//QVariantAnimation::start(policy);
emit valueChanged(this->endValue());
emit finished();
}

20
tvariantanimation.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef TVARIANTANIMATION_H
#define TVARIANTANIMATION_H
#include <QVariantAnimation>
#include <QDebug>
#include "the-libs_global.h"
class THELIBSSHARED_EXPORT tVariantAnimation : public QVariantAnimation
{
Q_OBJECT
public:
tVariantAnimation(QObject *parent = Q_NULLPTR);
~tVariantAnimation();
public slots:
void start(QAbstractAnimation::DeletionPolicy policy = DeleteWhenStopped);
};
#endif // TVARIANTANIMATION_H