From bede0d3d17d818b7a8864ddbdb3e30e14bd4e06a Mon Sep 17 00:00:00 2001 From: tianduanrui <2407223896@qq.com> Date: Wed, 27 Dec 2017 14:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0QVariant=E5=9C=A8=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8Farm=E4=B8=8A=E6=B5=8B=E8=AF=95=E4=BB=A5?= =?UTF-8?q?=E5=A4=87=E7=BB=99pictureeffecttabbar=E9=87=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84QQtDictNode=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QQt.pro | 6 ++-- test/customqvariant/customqvariant.pro | 39 ++++++++++++++++++++++++++ test/customqvariant/main.cpp | 38 +++++++++++++++++++++++++ test/customqvariant/mainwindow.cpp | 14 +++++++++ test/customqvariant/mainwindow.h | 22 +++++++++++++++ test/customqvariant/mainwindow.ui | 21 ++++++++++++++ 6 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 test/customqvariant/customqvariant.pro create mode 100644 test/customqvariant/main.cpp create mode 100644 test/customqvariant/mainwindow.cpp create mode 100644 test/customqvariant/mainwindow.h create mode 100644 test/customqvariant/mainwindow.ui diff --git a/QQt.pro b/QQt.pro index c12345c9..eccbce46 100644 --- a/QQt.pro +++ b/QQt.pro @@ -1,7 +1,8 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = src/qqt.pro +SUBDIRS = src/qqt.pro \ + test/customqvariant ##----------------------------------------------------------------- ##basic example @@ -34,8 +35,7 @@ SUBDIRS = src/qqt.pro ##some test project ##----------------------------------------------------------------- #SUBDIRS += test/gumbo_query_test -# -SUBDIRS += test/svgtest +#SUBDIRS += test/svgtest #SUBDIRS += test/framelesshelperwidget #SUBDIRS += test/treeviewtest #SUBDIRS += test/qqtdicttest diff --git a/test/customqvariant/customqvariant.pro b/test/customqvariant/customqvariant.pro new file mode 100644 index 00000000..5704b235 --- /dev/null +++ b/test/customqvariant/customqvariant.pro @@ -0,0 +1,39 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2017-12-25T19:00:03 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = customqvariant +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has 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 += \ + main.cpp \ + mainwindow.cpp + +HEADERS += \ + mainwindow.h + +FORMS += \ + mainwindow.ui + +CONFIG += mobility +MOBILITY = + +include ($${PWD}/../../src/app_configure.pri) diff --git a/test/customqvariant/main.cpp b/test/customqvariant/main.cpp new file mode 100644 index 00000000..c6740b1f --- /dev/null +++ b/test/customqvariant/main.cpp @@ -0,0 +1,38 @@ +#include "mainwindow.h" +#include +#include + +typedef struct tagBtnIconTable2 +{ + QString pixmap[5]; + + tagBtnIconTable2() {} + + QString pixMap ( int index ) {} + void setPixMap ( int index, QString pix ) {} + void initNormal ( QString normal, QString press ) {} + void initCheck ( QString uncheck, QString check ) {} + void initOther ( QString hover, QString disable ) {} + const QString& operator[] ( int index ) const {} + QString& operator [] ( int index ) {} +} TBtnIconTable2; + +Q_DECLARE_METATYPE ( TBtnIconTable2 ) + +int main ( int argc, char* argv[] ) +{ + QApplication a ( argc, argv ); + + QVariant vv; + TBtnIconTable2 icc; + icc.pixmap[0] = "icon"; + + vv.setValue ( icc ); + + qDebug() << vv.value().pixmap[0]; + + //MainWindow w; + //w.show(); + + return 0;//a.exec(); +} diff --git a/test/customqvariant/mainwindow.cpp b/test/customqvariant/mainwindow.cpp new file mode 100644 index 00000000..49d64fce --- /dev/null +++ b/test/customqvariant/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/test/customqvariant/mainwindow.h b/test/customqvariant/mainwindow.h new file mode 100644 index 00000000..a3948a91 --- /dev/null +++ b/test/customqvariant/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/test/customqvariant/mainwindow.ui b/test/customqvariant/mainwindow.ui new file mode 100644 index 00000000..7ebf8731 --- /dev/null +++ b/test/customqvariant/mainwindow.ui @@ -0,0 +1,21 @@ + + MainWindow + + + + 0 + 0 + 800 + 480 + + + + MainWindow + + + + + + + +