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

This commit is contained in:
2018-12-10 20:56:57 +00:00
parent 6d3dab9324
commit 6260046885
6 changed files with 31 additions and 6 deletions

View File

@@ -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);

View File

@@ -314,7 +314,14 @@
</layout>
</item>
<item>
<widget class="BlockView" name="blockView"/>
<widget class="BlockView" name="blockView">
<property name="miniMap" stdset="0">
<bool>false</bool>
</property>
<property name="zoomWheelOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
@@ -390,7 +397,7 @@
<string>Load ...</string>
</property>
<property name="icon">
<iconset resource="qad_blockview.qrc">
<iconset resource="../application/qad_application.qrc">
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
</property>
<property name="shortcut">
@@ -452,6 +459,7 @@
</customwidgets>
<resources>
<include location="../utils/qad_utils.qrc"/>
<include location="../application/qad_application.qrc"/>
<include location="qad_blockview.qrc"/>
</resources>
<connections>

View File

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

View File

@@ -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;}

View File

@@ -8,7 +8,7 @@
#endif
__QADTypesRegistrator__ __registrator__;
bool __QADTypesRegistrator__::_inited = false;
int QAD::Enum::selectedValue() const {

View File

@@ -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>("QAD::Enumerator");
qRegisterMetaTypeStreamOperators<QAD::Enumerator>("QAD::Enumerator");
qRegisterMetaType<QAD::Enum>("QAD::Enum");
@@ -96,8 +98,11 @@ public:
QMetaType::registerConverter<QAD::Dir, QString>(&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));}