Add IOT dashboard example
This commit is contained in:
parent
5e546e1e23
commit
ae582afd1b
|
@ -4,6 +4,7 @@ TEMPLATE = subdirs
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
desktop \
|
desktop \
|
||||||
gallery \
|
gallery \
|
||||||
|
iot-dashboard \
|
||||||
layouts \
|
layouts \
|
||||||
listbox \
|
listbox \
|
||||||
messagebox \
|
messagebox \
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "MenuBar.h"
|
||||||
|
|
||||||
|
#include <QskLinearBox.h>
|
||||||
|
|
||||||
|
MainWindow::MainWindow() : QskWindow()
|
||||||
|
{
|
||||||
|
setFixedSize( { 1024, 600 } );
|
||||||
|
setTitle( "IOT dashboard" );
|
||||||
|
|
||||||
|
m_mainLayout = new QskLinearBox( Qt::Horizontal, contentItem() );
|
||||||
|
|
||||||
|
addMenuBar();
|
||||||
|
addMainContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addMenuBar()
|
||||||
|
{
|
||||||
|
auto* menuBar = new MenuBar( m_mainLayout );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addMainContent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QskWindow.h>
|
||||||
|
|
||||||
|
class QskLinearBox;
|
||||||
|
|
||||||
|
class MainWindow : public QskWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addMenuBar();
|
||||||
|
void addMainContent();
|
||||||
|
|
||||||
|
QskLinearBox* m_mainLayout;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "MenuBar.h"
|
||||||
|
|
||||||
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
|
MenuBar::MenuBar( QQuickItem *parent ) : QskLinearBox( Qt::Vertical, parent )
|
||||||
|
{
|
||||||
|
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Expanding );
|
||||||
|
setAutoLayoutChildren( true );
|
||||||
|
setAutoAddChildren( true );
|
||||||
|
|
||||||
|
setBackgroundColor( { 0, 35, 102 } ); // ### style
|
||||||
|
|
||||||
|
m_entries = { "Home", "Details", "Statistics", "Usage" };
|
||||||
|
|
||||||
|
for( const auto entry : m_entries )
|
||||||
|
{
|
||||||
|
auto* label = new QskTextLabel( entry, this );
|
||||||
|
label->setTextColor( Qt::white ); // ### style
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef MENUBAR_H
|
||||||
|
#define MENUBAR_H
|
||||||
|
|
||||||
|
#include <QskLinearBox.h>
|
||||||
|
|
||||||
|
class MenuBar : public QskLinearBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MenuBar( QQuickItem* parent );
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList< QString > m_entries;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MENUBAR_H
|
|
@ -0,0 +1,11 @@
|
||||||
|
CONFIG += qskexample
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
MenuBar.cpp \
|
||||||
|
main.cpp \
|
||||||
|
MainWindow.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
MainWindow.h \
|
||||||
|
MenuBar.h
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include <SkinnyFont.h>
|
||||||
|
#include <SkinnyShortcut.h>
|
||||||
|
|
||||||
|
#include <QskLinearBox.h>
|
||||||
|
#include <QskShortcutMap.h>
|
||||||
|
#include <QskPushButton.h>
|
||||||
|
#include <QskWindow.h>
|
||||||
|
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
int main( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
QGuiApplication app( argc, argv );
|
||||||
|
|
||||||
|
SkinnyFont::init( &app );
|
||||||
|
|
||||||
|
// QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_T ),
|
||||||
|
// false, skinFactory, SLOT(toggleScheme()) );
|
||||||
|
|
||||||
|
// QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ),
|
||||||
|
// false, skinFactory, SLOT(rotateSkin()) );
|
||||||
|
|
||||||
|
// With CTRL-B you can rotate a couple of visual debug modes
|
||||||
|
SkinnyShortcut::enable( SkinnyShortcut::DebugBackground |
|
||||||
|
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
|
||||||
|
|
||||||
|
MainWindow window;
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
Loading…
Reference in New Issue