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

@@ -1,5 +1,6 @@
#include "edockwidget.h"
#include "qad_types.h"
#include <QEvent>
#include <QStyle>
@@ -22,9 +23,17 @@ void EDockWidget::setWindowIcon(const QIcon & icon) {
QDockWidget::setWindowIcon(icon);
if (!icon.isNull()) {
lbl_icon->setScaledContents(true);
lbl_icon->setFixedSize(preferredIconSize(1.5));
lbl_icon->setFixedSize(preferredIconSize(1.5, this));
}
//#endif
//#endif
}
bool EDockWidget::event(QEvent * e) {
if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish) {
lbl_icon->setFixedSize(preferredIconSize(1.5, this));
}
return QDockWidget::event(e);
}

View File

@@ -23,6 +23,7 @@ public:
void setWindowIcon(const QIcon & icon);
private:
bool event(QEvent * e);
void init();
QFrame * header;

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();
}

View File

@@ -36,6 +36,7 @@ private:
bool eventFilter(QObject * o, QEvent * e);
void timerEvent(QTimerEvent * e);
void _resize();
void _setIconsSize();
int hovered, delay;
bool delay_e;