git-svn-id: svn://db.shs.com.ru/libs@462 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-11-28 14:48:50 +00:00
parent efc185f510
commit 90a1478af6
16 changed files with 83 additions and 25 deletions

View File

@@ -24,9 +24,12 @@ Ribbon::~Ribbon() {
bool Ribbon::eventFilter(QObject * o, QEvent * e) {
//qDebug() << e;
if (o == parent) {
if (e->type() == QEvent::Resize || e->type() == QEvent::WindowActivate)
_resize();
if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish)
_setIconsSize();
return QToolBar::eventFilter(o, e);
}
if (e->type() == QEvent::ActionChanged) {
@@ -57,6 +60,13 @@ void Ribbon::_resize() {
}
void Ribbon::_setIconsSize() {
qDebug() << "resize" << preferredIconSize() << QApplication::font();
setTabIconSize(preferredIconSize(2, this));
setIconSize(preferredIconSize(3, this));
}
void Ribbon::setVisible(bool yes) {
QToolBar::setVisible(yes);
if (parent == 0) return;
@@ -183,8 +193,7 @@ void Ribbon::init() {
parent->addToolBar(Qt::TopToolBarArea, this);
parent->menuBar()->hide();
tab->setAutoFillBackground(false);
setTabIconSize(preferredIconSize(2));
setIconSize(preferredIconSize(3));
_setIconsSize();
}