using QskGraphicLabel::Stretch for the background image of the demo
This commit is contained in:
parent
dd109b1283
commit
fffc983bb7
@ -24,9 +24,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow() : QskWindow()
|
MainWindow::MainWindow()
|
||||||
, m_backgroundImage( new QskGraphicLabel( contentItem() ) )
|
|
||||||
, m_layout( new QskLinearBox( Qt::Vertical, contentItem() ) )
|
|
||||||
{
|
{
|
||||||
setPreferredSize( QSize( 1024, 576 ) );
|
setPreferredSize( QSize( 1024, 576 ) );
|
||||||
setAutoLayoutChildren( true );
|
setAutoLayoutChildren( true );
|
||||||
@ -36,10 +34,13 @@ MainWindow::MainWindow() : QskWindow()
|
|||||||
// font.setPointSize( 20 );
|
// font.setPointSize( 20 );
|
||||||
// setFont( QskSkin::DefaultFont, 20 );
|
// setFont( QskSkin::DefaultFont, 20 );
|
||||||
|
|
||||||
QImage image( ":/images/background.jpg" );
|
const QImage image( ":/images/background.jpg" );
|
||||||
QskGraphic graphic = QskGraphic::fromImage( image );
|
|
||||||
m_backgroundImage->setGraphic( graphic );
|
|
||||||
|
|
||||||
|
auto backgroundImage = new QskGraphicLabel( contentItem() );
|
||||||
|
backgroundImage->setGraphic( QskGraphic::fromImage( image ) );
|
||||||
|
backgroundImage->setFillMode( QskGraphicLabel::Stretch );
|
||||||
|
|
||||||
|
m_layout = new QskLinearBox( Qt::Vertical, contentItem() );
|
||||||
m_layout->setAutoAddChildren( true );
|
m_layout->setAutoAddChildren( true );
|
||||||
|
|
||||||
addHeaderBar();
|
addHeaderBar();
|
||||||
@ -49,29 +50,23 @@ MainWindow::MainWindow() : QskWindow()
|
|||||||
|
|
||||||
void MainWindow::addHeaderBar()
|
void MainWindow::addHeaderBar()
|
||||||
{
|
{
|
||||||
QskPushButton* headerBar = new QskPushButton( m_layout );
|
QskLinearBox* header = new QskLinearBox( m_layout );
|
||||||
headerBar->setEnabled( false );
|
header->setOpacity( 0.5 );
|
||||||
headerBar->setPosition( QPointF( 0, 0 ) );
|
header->setBackgroundColor( Qt::black );
|
||||||
headerBar->setOpacity( 0.5 );
|
header->setFixedHeight( 50 );
|
||||||
headerBar->setBackgroundColor( Qt::black );
|
header->setMargins( QMarginsF( 20, 0, 20, 0 ) );
|
||||||
headerBar->setFixedHeight( 50 );
|
|
||||||
headerBar->setFlat( true );
|
|
||||||
headerBar->setAutoLayoutChildren( true );
|
|
||||||
|
|
||||||
QskLinearBox* headerLayout = new QskLinearBox( headerBar );
|
addIcon( header, ":/images/ic_pan_tool_white_48dp_2x.png" );
|
||||||
headerLayout->setMargins( QMarginsF( 20, 0, 20, 0 ) );
|
addIcon( header, ":/images/ic_star_rate_white_18dp_2x.png" );
|
||||||
|
addIcon( header, ":/images/ic_airplanemode_active_white_18dp_2x.png" );
|
||||||
addIcon( headerLayout, ":/images/ic_pan_tool_white_48dp_2x.png" );
|
|
||||||
addIcon( headerLayout, ":/images/ic_star_rate_white_18dp_2x.png" );
|
|
||||||
addIcon( headerLayout, ":/images/ic_airplanemode_active_white_18dp_2x.png" );
|
|
||||||
|
|
||||||
QDate currentDate = QDate::currentDate();
|
QDate currentDate = QDate::currentDate();
|
||||||
QskTextLabel* dateLabel = new QskTextLabel( currentDate.toString(), headerLayout );
|
QskTextLabel* dateLabel = new QskTextLabel( currentDate.toString(), header );
|
||||||
dateLabel->setColor( QskTextLabel::Text, Qt::white );
|
dateLabel->setColor( QskTextLabel::Text, Qt::white );
|
||||||
|
|
||||||
addIcon( headerLayout, ":/images/ic_face_white_48px.svg" );
|
addIcon( header, ":/images/ic_face_white_48px.svg" );
|
||||||
addIcon( headerLayout, ":/images/ic_extension_white_48dp_2x.png" );
|
addIcon( header, ":/images/ic_extension_white_48dp_2x.png" );
|
||||||
addIcon( headerLayout, ":/images/ic_build_white_24dp_2x.png" );
|
addIcon( header, ":/images/ic_build_white_24dp_2x.png" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addMainContent()
|
void MainWindow::addMainContent()
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QskPushButton.h>
|
|
||||||
#include <QskWindow.h>
|
#include <QskWindow.h>
|
||||||
|
|
||||||
class QskGraphicLabel;
|
|
||||||
class QskLinearBox;
|
class QskLinearBox;
|
||||||
|
|
||||||
class MainWindow : public QskWindow
|
class MainWindow : public QskWindow
|
||||||
@ -17,7 +15,6 @@ private:
|
|||||||
void addMainContent();
|
void addMainContent();
|
||||||
void addBottomBar();
|
void addBottomBar();
|
||||||
|
|
||||||
QskGraphicLabel* m_backgroundImage;
|
|
||||||
QskLinearBox* m_layout;
|
QskLinearBox* m_layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <QskControl.h>
|
#include <QskControl.h>
|
||||||
|
|
||||||
class QskLinearBox;
|
|
||||||
|
|
||||||
class RadioControl : public QskControl
|
class RadioControl : public QskControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user