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 )
|
||||
{
|
||||
if ( on == isDecorated() )
|
||||
|
@ -55,8 +55,6 @@ public:
|
||||
virtual QSizeF contentsSizeHint() const override;
|
||||
virtual QRectF layoutRect() const override;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void titleChanged();
|
||||
void decoratedChanged();
|
||||
|
@ -199,6 +199,9 @@ bool QskSubWindowArea::mouseEventFilter( QskSubWindow* window, const QMouseEvent
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( event->button() == Qt::LeftButton )
|
||||
window->setFocus( true );
|
||||
|
||||
#if 0
|
||||
// how to handle not to be process visual
|
||||
// changes for double click events ???
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "QskAspect.h"
|
||||
#include "QskBoxBorderMetrics.h"
|
||||
|
||||
#include <QSGSimpleRectNode>
|
||||
#include <QFontMetricsF>
|
||||
|
||||
QskSubWindowSkinlet::QskSubWindowSkinlet( QskSkin* skin ):
|
||||
@ -45,40 +44,15 @@ QSGNode* QskSubWindowSkinlet::updateSubNode( const QskSkinnable* skinnable,
|
||||
switch( nodeRole )
|
||||
{
|
||||
case PanelRole:
|
||||
{
|
||||
return updateBoxNode( subWindow, node, QskSubWindow::Panel );
|
||||
}
|
||||
|
||||
case TitleBarRole:
|
||||
{
|
||||
return updateTitleBarNode( subWindow, node );
|
||||
}
|
||||
return updateBoxNode( subWindow, node, QskSubWindow::TitleBar );
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
const auto border = subWindow->boxBorderMetricsHint( QskSubWindow::Panel );
|
||||
|
@ -35,8 +35,6 @@ protected:
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QSGNode* updateTitleBarNode( const QskSubWindow*, QSGNode* ) const;
|
||||
|
||||
qreal titleBarHeight( const QskSubWindow* ) const;
|
||||
QRectF titleBarRect( const QskSubWindow* ) const;
|
||||
|
||||
|
@ -633,8 +633,8 @@ void QskMaterialSkin::initSubWindowHints()
|
||||
setBoxBorderColors( Q::Panel, colors );
|
||||
|
||||
// title bar
|
||||
setColor( Q::TitleBar, pal.darker200 );
|
||||
setColor( Q::TitleBar | Q::Focused, pal.accentColor );
|
||||
setGradient( Q::TitleBar, pal.darker200 );
|
||||
setGradient( Q::TitleBar | Q::Focused, pal.accentColor );
|
||||
|
||||
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
||||
}
|
||||
|
@ -676,8 +676,8 @@ void QskSquiekSkin::initSubWindowHints()
|
||||
// TitleBar
|
||||
|
||||
setFontRole( Q::TitleBar, QskSkin::TinyFont );
|
||||
setColor( Q::TitleBar | Q::Focused, pal.highlighted );
|
||||
setColor( Q::TitleBar, pal.contrasted );
|
||||
setGradient( Q::TitleBar | Q::Focused, pal.highlighted );
|
||||
setGradient( Q::TitleBar, pal.contrasted );
|
||||
}
|
||||
|
||||
#include "moc_QskSquiekSkin.cpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user