add examples
This commit is contained in:
parent
4621d08cdc
commit
ddf31b4bf8
|
@ -0,0 +1,17 @@
|
||||||
|
#include "about.h"
|
||||||
|
|
||||||
|
About::About(QWidget *parent)
|
||||||
|
: QLabel(parent)
|
||||||
|
{
|
||||||
|
setFrameShape(QFrame::NoFrame);
|
||||||
|
setText(
|
||||||
|
"<center>"
|
||||||
|
"<h1>About</h1>"
|
||||||
|
"<p>Lorem ipsum, blah blah</p>"
|
||||||
|
"</center>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
About::~About()
|
||||||
|
{
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
#ifndef ABOUT_H
|
#ifndef ABOUT_H
|
||||||
#define ABOUT_H
|
#define ABOUT_H
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
class About : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit About(QWidget *parent = 0);
|
||||||
|
~About();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // ABOUT_H
|
#endif // ABOUT_H
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "appbarexamples.h"
|
||||||
|
|
||||||
|
AppBarExamples::AppBarExamples(QWidget *parent)
|
||||||
|
: ExampleList(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AppBarExamples::~AppBarExamples()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef APPBAREXAMPLES_H
|
||||||
|
#define APPBAREXAMPLES_H
|
||||||
|
|
||||||
|
#include "examplelist.h"
|
||||||
|
|
||||||
|
class AppBarExamples : public ExampleList
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AppBarExamples(QWidget *parent = 0);
|
||||||
|
~AppBarExamples();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPBAREXAMPLES_H
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include "examplelist.h"
|
||||||
|
|
||||||
|
ExampleList::ExampleList(QWidget *parent)
|
||||||
|
: QScrollArea(parent)
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
QWidget *widget = new QWidget;
|
||||||
|
|
||||||
|
widget->setLayout(layout);
|
||||||
|
|
||||||
|
QSizePolicy policy;
|
||||||
|
policy.setHorizontalPolicy(QSizePolicy::Expanding);
|
||||||
|
policy.setVerticalPolicy(QSizePolicy::Maximum);
|
||||||
|
widget->setSizePolicy(policy);
|
||||||
|
|
||||||
|
setWidget(widget);
|
||||||
|
setWidgetResizable(true);
|
||||||
|
|
||||||
|
setFrameShape(QFrame::NoFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExampleList::~ExampleList()
|
||||||
|
{
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
#ifndef EXAMPLELIST_H
|
#ifndef EXAMPLELIST_H
|
||||||
#define EXAMPLELIST_H
|
#define EXAMPLELIST_H
|
||||||
|
|
||||||
|
#include <QScrollArea>
|
||||||
|
|
||||||
|
class ExampleList : public QScrollArea
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExampleList(QWidget *parent = 0);
|
||||||
|
~ExampleList();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // EXAMPLELIST_H
|
#endif // EXAMPLELIST_H
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "exampleview.h"
|
||||||
|
|
||||||
|
ExampleView::ExampleView(QWidget *parent)
|
||||||
|
: QGraphicsView(parent)
|
||||||
|
{
|
||||||
|
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||||
|
setScene(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExampleView::~ExampleView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
#ifndef EXAMPLEVIEW_H
|
#ifndef EXAMPLEVIEW_H
|
||||||
#define EXAMPLEVIEW_H
|
#define EXAMPLEVIEW_H
|
||||||
|
|
||||||
|
#include <QGraphicsView>
|
||||||
|
|
||||||
|
class ExampleView : public QGraphicsView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExampleView(QWidget *parent = 0);
|
||||||
|
~ExampleView();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // EXAMPLEVIEW_H
|
#endif // EXAMPLEVIEW_H
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#include <QLayout>
|
||||||
|
#include "flatbuttonexamples.h"
|
||||||
|
#include "components/flatbutton.h"
|
||||||
|
#include "exampleview.h"
|
||||||
|
#include "frame.h"
|
||||||
|
|
||||||
|
FlatButtonExamples::FlatButtonExamples(QWidget *parent)
|
||||||
|
: ExampleList(parent)
|
||||||
|
{
|
||||||
|
QLayout *layout = widget()->layout();
|
||||||
|
|
||||||
|
{
|
||||||
|
FlatButton *flatButton = new FlatButton;
|
||||||
|
flatButton->setText("Press me!");
|
||||||
|
flatButton->setMinimumSize(200, 42);
|
||||||
|
|
||||||
|
ExampleView *view = new ExampleView;
|
||||||
|
view->scene()->addWidget(flatButton);
|
||||||
|
|
||||||
|
Frame *frame = new Frame;
|
||||||
|
frame->setCodeSnippet(
|
||||||
|
"FlatButton *flatButton = new FlatButton;\n"
|
||||||
|
"flatButton->setText(\"Press me!\");"
|
||||||
|
);
|
||||||
|
frame->setWidget(view);
|
||||||
|
|
||||||
|
layout->addWidget(frame);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
FlatButton *flatButton = new FlatButton;
|
||||||
|
flatButton->setText("Press me!");
|
||||||
|
flatButton->setIcon(QIcon("../qt-material-widgets/face.svg"));
|
||||||
|
flatButton->setMinimumSize(200, 50);
|
||||||
|
|
||||||
|
ExampleView *view = new ExampleView;
|
||||||
|
view->scene()->addWidget(flatButton);
|
||||||
|
|
||||||
|
Frame *frame = new Frame;
|
||||||
|
frame->setCodeSnippet(
|
||||||
|
"FlatButton *flatButton = new FlatButton;\n"
|
||||||
|
"flatButton->setText(\"Press me!\");\n"
|
||||||
|
"flatButton->setIcon(QIcon(\"face.svg\"));"
|
||||||
|
);
|
||||||
|
frame->setWidget(view);
|
||||||
|
|
||||||
|
layout->addWidget(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FlatButtonExamples::~FlatButtonExamples()
|
||||||
|
{
|
||||||
|
}
|
|
@ -1,4 +1,15 @@
|
||||||
#ifndef FLATBUTTONEXAMPLES_H
|
#ifndef FLATBUTTONEXAMPLES_H
|
||||||
#define FLATBUTTONEXAMPLES_H
|
#define FLATBUTTONEXAMPLES_H
|
||||||
|
|
||||||
|
#include "examplelist.h"
|
||||||
|
|
||||||
|
class FlatButtonExamples : public ExampleList
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FlatButtonExamples(QWidget *parent = 0);
|
||||||
|
~FlatButtonExamples();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // FLATBUTTONEXAMPLES_H
|
#endif // FLATBUTTONEXAMPLES_H
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include <QLayout>
|
||||||
|
#include "iconbuttonexamples.h"
|
||||||
|
#include "components/flatbutton.h"
|
||||||
|
#include "exampleview.h"
|
||||||
|
#include "frame.h"
|
||||||
|
|
||||||
|
IconButtonExamples::IconButtonExamples(QWidget *parent)
|
||||||
|
: ExampleList(parent)
|
||||||
|
{
|
||||||
|
QLayout *layout = widget()->layout();
|
||||||
|
|
||||||
|
{
|
||||||
|
IconButton *iconButton = new IconButton("../qt-material-widgets/face.svg");
|
||||||
|
|
||||||
|
ExampleView *view = new ExampleView;
|
||||||
|
view->scene()->addWidget(iconButton);
|
||||||
|
|
||||||
|
Frame *frame = new Frame;
|
||||||
|
frame->setCodeSnippet(
|
||||||
|
"IconButton *iconButton = new IconButton(\"face.svg\");\n"
|
||||||
|
);
|
||||||
|
frame->setWidget(view);
|
||||||
|
|
||||||
|
layout->addWidget(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IconButtonExamples::~IconButtonExamples()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef ICONBUTTONEXAMPLE_H
|
||||||
|
#define ICONBUTTONEXAMPLE_H
|
||||||
|
|
||||||
|
#include "examplelist.h"
|
||||||
|
|
||||||
|
class IconButtonExamples : public ExampleList
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit IconButtonExamples(QWidget *parent = 0);
|
||||||
|
~IconButtonExamples();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ICONBUTTONEXAMPLE_H
|
Loading…
Reference in New Issue