hardcoded colors removed + themed top level backgrounds

This commit is contained in:
Uwe Rathmann 2023-07-03 16:53:12 +02:00
parent 2911aaf88a
commit 7fd2fabb78
11 changed files with 59 additions and 37 deletions

View File

@ -9,7 +9,6 @@ Qsk.Window
width: 600
height: 600
color: "Beige"
Component.onCompleted:
{
@ -30,9 +29,10 @@ Qsk.Window
{
orientation: Qt.Horizontal
dimension: 3
panel : true // to have a themed background
//margins: 10 // only possible with Qt <= 6.1
margins { left: 10; top: 10; right: 10; bottom: 10 }
// padding: 10 // only possible with Qt <= 6.1
padding { left: 10; top: 10; right: 10; bottom: 10 }
spacing: 10
TestButton

View File

@ -271,8 +271,11 @@ int main( int argc, char* argv[] )
Qsk::addGraphicProvider( QString(), new GraphicProvider() );
Qsk::addGraphicProvider( "shapes", new SkinnyShapeProvider() );
// dialogs in faked windows -> QskSubWindow
QskDialog::instance()->setPolicy( QskDialog::EmbeddedBox );
if ( true ) // environment variable, TODO ...
{
// dialogs in faked windows -> QskSubWindow
QskDialog::instance()->setPolicy( QskDialog::EmbeddedBox );
}
QGuiApplication app( argc, argv );

View File

@ -8,15 +8,15 @@ Qsk.Window
width: 600
height: 600
color: "Beige"
Qsk.LinearBox
{
orientation: Qt.Horizontal
panel: true
dimension: 3
//margins: 10
margins { left: 10; top: 10; right: 10; bottom: 10 }
//padding: 10
padding { left: 10; top: 10; right: 10; bottom: 10 }
spacing: 20
Repeater

View File

@ -20,6 +20,29 @@
#include <QGuiApplication>
namespace
{
class TabView : public QskTabView
{
public:
TabView( QQuickItem* parent = nullptr )
: QskTabView( parent )
{
setMargins( 10 );
setTabBarEdge( Qt::LeftEdge );
setAutoFitTabs( true );
addTab( "Grid Layout", new GridLayoutPage() );
addTab( "Flow Layout", new FlowLayoutPage() );
addTab( "Linear Layout", new LinearLayoutPage() );
addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() );
addTab( "Stack Layout", new StackLayoutPage() );
setCurrentIndex( 0 );
}
};
}
int main( int argc, char* argv[] )
{
#ifdef ITEM_STATISTICS
@ -32,25 +55,16 @@ int main( int argc, char* argv[] )
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
auto tabView = new QskTabView();
auto box = new QskBox(); // to have a themed application background
box->setAutoLayoutChildren( true );
tabView->setMargins( 10 );
tabView->setTabBarEdge( Qt::LeftEdge );
tabView->setAutoFitTabs( true );
tabView->addTab( "Grid Layout", new GridLayoutPage() );
tabView->addTab( "Flow Layout", new FlowLayoutPage() );
tabView->addTab( "Linear Layout", new LinearLayoutPage() );
tabView->addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() );
tabView->addTab( "Stack Layout", new StackLayoutPage() );
tabView->setCurrentIndex( 0 );
(void) new TabView( box );
QSize size( 800, 600 );
size = size.expandedTo( tabView->sizeHint().toSize() );
size = size.expandedTo( box->sizeHint().toSize() );
QskWindow window;
window.addItem( tabView );
window.addItem( box );
window.addItem( new QskFocusIndicator() );
window.resize( size );

View File

@ -28,7 +28,7 @@ class GraphicLabel : public QskGraphicLabel
public:
enum Role
{
Normal,
Normal = 1000,
Inverted
};
@ -94,7 +94,8 @@ MainWindow::MainWindow()
invertButton->setLayoutAlignmentHint( Qt::AlignRight );
auto box = new QskLinearBox( Qt::Vertical );
box->setMargins( 5 );
box->setPanel( true );
box->setPadding( 5 );
box->addItem( invertButton );
box->addItem( m_tabView );

View File

@ -20,7 +20,8 @@ int main( int argc, char* argv[] )
QGuiApplication app( argc, argv );
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
SkinnyShortcut::enable( SkinnyShortcut::DebugBackground |
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
auto focusIndicator = new QskFocusIndicator();
focusIndicator->setObjectName( "FocusIndicator" );

View File

@ -160,8 +160,9 @@ int main( int argc, char* argv[] )
auto layoutBox = new QskLinearBox( Qt::Vertical );
layoutBox->setDefaultAlignment( Qt::AlignLeft );
layoutBox->setMargins( 20 );
layoutBox->setPadding( 20 );
layoutBox->setSpacing( 10 );
layoutBox->setPanel( true );
layoutBox->addItem( buttonBox );
layoutBox->addItem( tabView );

View File

@ -77,8 +77,6 @@ class Thumbnail : public QskPushButton
setBoxShapeHint( QskPushButton::Panel, QskBoxShapeMetrics( 20, Qt::RelativeSize ) );
setStrutSizeHint( QskPushButton::Icon, -1, -1 );
setSection( QskAspect::Header ); // to make them flat
}
private:
@ -191,7 +189,8 @@ class ScrollArea : public QskScrollArea
{
// settings usually done in the skins
setBoxBorderMetricsHint( Viewport, 2 );
setBoxShapeHint( Viewport, 20 );
setBoxBorderColorsHint( Viewport, Qt::gray ); // works with most color schemes
setBoxShapeHint( Viewport, 40 ); // a radius to see that clipping works
for ( auto subControl : { HorizontalScrollBar, VerticalScrollBar } )
setMetric( subControl | QskAspect::Size, 20 );
@ -257,7 +256,8 @@ int main( int argc, char* argv[] )
*/
auto box = new QskLinearBox( Qt::Vertical );
box->setMargins( 20 );
box->setPanel( true );
box->setPadding( 20 );
auto buttonBox = new QskLinearBox( Qt::Horizontal, box );
buttonBox->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
@ -280,7 +280,6 @@ int main( int argc, char* argv[] )
QskWindow window;
window.resize( 600, 600 );
window.setColor( "SteelBlue" );
window.addItem( box );
window.addItem( focusIndicator );

View File

@ -14,7 +14,8 @@ Window::Window( Qt::Orientation orientation )
{
m_layoutBox = new QskLinearBox( invertedOrientation() );
m_layoutBox->setObjectName( "MainBox" );
m_layoutBox->setMargins( 10 );
m_layoutBox->setPanel( true );
m_layoutBox->setPadding( 10 );
m_layoutBox->setExtraSpacingAt( Qt::BottomEdge | Qt::RightEdge );
addBox( QskDialog::Ok );

View File

@ -329,7 +329,8 @@ class Window : public QskWindow
{
auto box = new QskLinearBox( Qt::Horizontal );
box->setSpacing( 10 );
box->setMargins( 20 );
box->setPadding( 10 );
box->setPanel( true );
auto listView = new LocaleListView( box );
auto inputBox = new InputBox( box );
@ -367,14 +368,14 @@ int main( int argc, char* argv[] )
Window window1;
window1.setObjectName( "Window 1" );
window1.setColor( "PapayaWhip" );
window1.setTitle( "Window 1" );
window1.resize( 600, 600 );
window1.show();
#if 1
Window window2;
window2.setObjectName( "Window 2" );
window2.setColor( "Pink" );
window2.setTitle( "Window 2" );
window2.setX( window1.x() + 100 );
window2.resize( 600, 600 );
window2.show();

View File

@ -65,7 +65,8 @@ class GridBox : public QskGridBox
GridBox( QQuickItem* parent = nullptr )
: QskGridBox( parent )
{
setMargins( 5 );
setPanel( true );
setPadding( 5 );
setColumnStretchFactor( 1, 1 );
auto sliderX = new Slider( -50, 50, 1, 10 );