diff --git a/qad/application/ribbon.cpp b/qad/application/ribbon.cpp index d54e8e7..b6fea1d 100644 --- a/qad/application/ribbon.cpp +++ b/qad/application/ribbon.cpp @@ -166,7 +166,7 @@ void Ribbon::init() { //b->setIconSize(QSize(16, 16)); b->setIcon(j->icon()); b->setText(j->text()); - //b->setToolTip(j->toolTip()); + b->setToolTip(j->text()); //b->addAction(j); //b->setShortcut(j->shortcut()); b->setAutoRaise(true); diff --git a/qad/blockview/blockeditor.ui b/qad/blockview/blockeditor.ui index c318e9f..d6ab517 100644 --- a/qad/blockview/blockeditor.ui +++ b/qad/blockview/blockeditor.ui @@ -314,7 +314,14 @@ - + + + false + + + true + + @@ -390,7 +397,7 @@ Load ... - + :/icons/document-open.png:/icons/document-open.png @@ -452,6 +459,7 @@ + diff --git a/qad/blockview/blockview.cpp b/qad/blockview/blockview.cpp index 2b24556..4212850 100644 --- a/qad/blockview/blockview.cpp +++ b/qad/blockview/blockview.cpp @@ -40,7 +40,7 @@ void BlockView::_init() { thumb_hide_delay = 500; timer_thumb = 0; smode = BlockView::MultiSelection; - cur_scl = thumb_scl = 1.; + cur_scl = thumb_scl = prev_app_scale = 1.; _talpha = 0.; ae_enabled = is_nav_anim = is_block_anim = true; nav_prev_aa = nav_prev_imaa = nav_prev_grid = true; @@ -139,6 +139,16 @@ void BlockView::_updateBack() { } +bool BlockView::event(QEvent * e) { + if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish) { + double cscl = appScale(this); + QGraphicsView::scale(cscl / prev_app_scale, cscl / prev_app_scale); + prev_app_scale = cscl; + } + return QGraphicsView::event(e); +} + + bool BlockView::eventFilter(QObject * o, QEvent * e) { if (o == &widget_thumb) { QMouseEvent * me = (QMouseEvent*)e; @@ -1873,7 +1883,7 @@ void BlockView::zoom(double factor) { void BlockView::zoomReset() { cur_scl = qSqrt(transform().determinant()); - zoom(1. / cur_scl); + zoom(prev_app_scale / cur_scl); } diff --git a/qad/blockview/blockview.h b/qad/blockview/blockview.h index 22d19f7..f7cd9ab 100644 --- a/qad/blockview/blockview.h +++ b/qad/blockview/blockview.h @@ -108,6 +108,7 @@ public: protected: void _init(); void _updateBack(); + bool event(QEvent * e); bool eventFilter(QObject * o, QEvent * e); void stopTimer(int & tid); void restartTimer(int & tid, int msecs); @@ -188,6 +189,7 @@ protected: bool grid_visible, grid_snap, pm_connect, navigation, m_connect, m_trace_with_buses, m_pin_mc, minimap, prev_tcb, wheel_zoom; bool nav_prev_aa, nav_prev_imaa, nav_prev_grid; double grid_step, grid_points, cur_scl, _talpha, thumb_scl; + double prev_app_scale; protected slots: void getPinMC(bool * v) {if (v) *v = m_pin_mc;} diff --git a/qad/utils/qad_types.cpp b/qad/utils/qad_types.cpp index 7d21251..843b1f8 100644 --- a/qad/utils/qad_types.cpp +++ b/qad/utils/qad_types.cpp @@ -8,7 +8,7 @@ #endif -__QADTypesRegistrator__ __registrator__; +bool __QADTypesRegistrator__::_inited = false; int QAD::Enum::selectedValue() const { diff --git a/qad/utils/qad_types.h b/qad/utils/qad_types.h index 18f5bdc..023d2ae 100644 --- a/qad/utils/qad_types.h +++ b/qad/utils/qad_types.h @@ -78,6 +78,8 @@ inline QDebug operator <<(QDebug s, const QAD::Dir & v) {s.nospace() << v.dir; r class __QADTypesRegistrator__ { public: __QADTypesRegistrator__() { + if (_inited) return; + _inited = true; qRegisterMetaType("QAD::Enumerator"); qRegisterMetaTypeStreamOperators("QAD::Enumerator"); qRegisterMetaType("QAD::Enum"); @@ -96,8 +98,11 @@ public: QMetaType::registerConverter(&QAD::Dir::toString); #endif } + static bool _inited; }; +static __QADTypesRegistrator__ __registrator__; + inline qreal quantize(qreal x, qreal q = 10.f) {return qRound(x / q) * q;} inline QPointF quantize(QPointF x, qreal q = 10.f) {return QPointF(quantize(x.x(), q), quantize(x.y(), q));}