using QskBoxNode for the subwindow title bar
This commit is contained in:
parent
cc7d3eb473
commit
83cf24737b
|
@ -43,12 +43,6 @@ QskSubWindow::~QskSubWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskSubWindow::isActive() const
|
|
||||||
{
|
|
||||||
// not implemented yet
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QskSubWindow::setDecorated( bool on )
|
void QskSubWindow::setDecorated( bool on )
|
||||||
{
|
{
|
||||||
if ( on == isDecorated() )
|
if ( on == isDecorated() )
|
||||||
|
|
|
@ -55,8 +55,6 @@ public:
|
||||||
virtual QSizeF contentsSizeHint() const override;
|
virtual QSizeF contentsSizeHint() const override;
|
||||||
virtual QRectF layoutRect() const override;
|
virtual QRectF layoutRect() const override;
|
||||||
|
|
||||||
bool isActive() const;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void titleChanged();
|
void titleChanged();
|
||||||
void decoratedChanged();
|
void decoratedChanged();
|
||||||
|
|
|
@ -199,6 +199,9 @@ bool QskSubWindowArea::mouseEventFilter( QskSubWindow* window, const QMouseEvent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( event->button() == Qt::LeftButton )
|
||||||
|
window->setFocus( true );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// how to handle not to be process visual
|
// how to handle not to be process visual
|
||||||
// changes for double click events ???
|
// changes for double click events ???
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
#include "QskBoxBorderMetrics.h"
|
#include "QskBoxBorderMetrics.h"
|
||||||
|
|
||||||
#include <QSGSimpleRectNode>
|
|
||||||
#include <QFontMetricsF>
|
#include <QFontMetricsF>
|
||||||
|
|
||||||
QskSubWindowSkinlet::QskSubWindowSkinlet( QskSkin* skin ):
|
QskSubWindowSkinlet::QskSubWindowSkinlet( QskSkin* skin ):
|
||||||
|
@ -45,40 +44,15 @@ QSGNode* QskSubWindowSkinlet::updateSubNode( const QskSkinnable* skinnable,
|
||||||
switch( nodeRole )
|
switch( nodeRole )
|
||||||
{
|
{
|
||||||
case PanelRole:
|
case PanelRole:
|
||||||
{
|
|
||||||
return updateBoxNode( subWindow, node, QskSubWindow::Panel );
|
return updateBoxNode( subWindow, node, QskSubWindow::Panel );
|
||||||
}
|
|
||||||
|
|
||||||
case TitleBarRole:
|
case TitleBarRole:
|
||||||
{
|
return updateBoxNode( subWindow, node, QskSubWindow::TitleBar );
|
||||||
return updateTitleBarNode( subWindow, node );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskSubWindowSkinlet::updateTitleBarNode(
|
|
||||||
const QskSubWindow* subWindow, QSGNode* node ) const
|
|
||||||
{
|
|
||||||
const QRectF rect = subControlRect( subWindow, QskSubWindow::TitleBar );
|
|
||||||
if ( rect.isEmpty() )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto barNode = static_cast< QSGSimpleRectNode* >( node );
|
|
||||||
if ( barNode == nullptr )
|
|
||||||
barNode = new QSGSimpleRectNode();
|
|
||||||
|
|
||||||
QskAspect::Aspect aspect = QskSubWindow::TitleBar;
|
|
||||||
if ( subWindow->isActive() )
|
|
||||||
aspect = aspect | QskControl::Focused;
|
|
||||||
|
|
||||||
barNode->setColor( subWindow->color( aspect ) );
|
|
||||||
barNode->setRect( rect );
|
|
||||||
|
|
||||||
return barNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QskSubWindowSkinlet::titleBarRect( const QskSubWindow* subWindow ) const
|
QRectF QskSubWindowSkinlet::titleBarRect( const QskSubWindow* subWindow ) const
|
||||||
{
|
{
|
||||||
const auto border = subWindow->boxBorderMetricsHint( QskSubWindow::Panel );
|
const auto border = subWindow->boxBorderMetricsHint( QskSubWindow::Panel );
|
||||||
|
|
|
@ -35,8 +35,6 @@ protected:
|
||||||
quint8 nodeRole, QSGNode* ) const override;
|
quint8 nodeRole, QSGNode* ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSGNode* updateTitleBarNode( const QskSubWindow*, QSGNode* ) const;
|
|
||||||
|
|
||||||
qreal titleBarHeight( const QskSubWindow* ) const;
|
qreal titleBarHeight( const QskSubWindow* ) const;
|
||||||
QRectF titleBarRect( const QskSubWindow* ) const;
|
QRectF titleBarRect( const QskSubWindow* ) const;
|
||||||
|
|
||||||
|
|
|
@ -633,8 +633,8 @@ void QskMaterialSkin::initSubWindowHints()
|
||||||
setBoxBorderColors( Q::Panel, colors );
|
setBoxBorderColors( Q::Panel, colors );
|
||||||
|
|
||||||
// title bar
|
// title bar
|
||||||
setColor( Q::TitleBar, pal.darker200 );
|
setGradient( Q::TitleBar, pal.darker200 );
|
||||||
setColor( Q::TitleBar | Q::Focused, pal.accentColor );
|
setGradient( Q::TitleBar | Q::Focused, pal.accentColor );
|
||||||
|
|
||||||
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,8 +676,8 @@ void QskSquiekSkin::initSubWindowHints()
|
||||||
// TitleBar
|
// TitleBar
|
||||||
|
|
||||||
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
||||||
setColor( Q::TitleBar | Q::Focused, pal.highlighted );
|
setGradient( Q::TitleBar | Q::Focused, pal.highlighted );
|
||||||
setColor( Q::TitleBar, pal.contrasted );
|
setGradient( Q::TitleBar, pal.contrasted );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_QskSquiekSkin.cpp"
|
#include "moc_QskSquiekSkin.cpp"
|
||||||
|
|
Loading…
Reference in New Issue