version 2.27.0
Graphic legend checks context menu rework
This commit is contained in:
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
||||
project(QAD)
|
||||
set(QAD_MAJOR 2)
|
||||
set(QAD_MINOR 26)
|
||||
set(QAD_MINOR 27)
|
||||
set(QAD_REVISION 0)
|
||||
set(QAD_SUFFIX )
|
||||
set(QAD_COMPANY SHS)
|
||||
|
||||
@@ -159,9 +159,12 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
|
||||
aupdate = grid = isFit = navigation = true;
|
||||
aalias = bufferActive = isOGL = cancel = guides = hasLblX = hasLblY = isHover = false;
|
||||
pause_ = only_expand_x = only_expand_y = m_LODOptimization = was_trace = false;
|
||||
limit_.setCoords(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
|
||||
eminx = eminy = DBL_MAX;
|
||||
emaxx = emaxy = DBL_MIN;
|
||||
limit_.setCoords(-std::numeric_limits<double>::max(),
|
||||
-std::numeric_limits<double>::max(),
|
||||
std::numeric_limits<double>::max(),
|
||||
std::numeric_limits<double>::max());
|
||||
eminx = eminy = std::numeric_limits<double>::max();
|
||||
emaxx = emaxy = -std::numeric_limits<double>::max();
|
||||
grad_x = grad_y = Auto;
|
||||
axis_type_x = Numeric;
|
||||
floating_axis_type = Trace;
|
||||
@@ -307,6 +310,9 @@ bool Graphic::eventFilter(QObject * o, QEvent * e) {
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (e->type() == QEvent::ContextMenu) {
|
||||
action_source = qobject_cast<QCheckBox *>(o);
|
||||
}
|
||||
return QFrame::eventFilter(o, e);
|
||||
}
|
||||
|
||||
@@ -1292,6 +1298,7 @@ void Graphic::setGraphicsCount(int count, bool update) {
|
||||
changed = true;
|
||||
}
|
||||
while (graphics.size() > count) {
|
||||
if (action_source == graphics.back().pb) action_source = nullptr;
|
||||
graphics.back().destroy();
|
||||
graphics.pop_back();
|
||||
changed = true;
|
||||
@@ -1326,9 +1333,9 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
|
||||
bool isRangeX = (start_x != end_x), isRangeY = (start_y != end_y);
|
||||
bool can_fast = (start_x == 0 && end_x == 0 && start_y == 0 && end_y == 0);
|
||||
bool anyVisible = false, isTimeLimit = (visible_time > 0.) && !(isRangeX || isRangeY);
|
||||
vx = -DBL_MAX;
|
||||
minY = minX = DBL_MAX;
|
||||
maxY = maxX = -DBL_MAX;
|
||||
vx = -std::numeric_limits<double>::max();
|
||||
minY = minX = std::numeric_limits<double>::max();
|
||||
maxY = maxX = -std::numeric_limits<double>::max();
|
||||
foreach(const GraphicType & t, graphics) {
|
||||
if (!t.visible) continue;
|
||||
if (vx < (pause_ ? t.max_x_pause : t.max_x)) vx = (pause_ ? t.max_x_pause : t.max_x);
|
||||
@@ -1738,6 +1745,16 @@ bool Graphic::checkGraphicIndex(int index) const {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::graphicVisibleChanged() {
|
||||
if (isFit)
|
||||
autofit();
|
||||
else {
|
||||
repaintCanvas();
|
||||
}
|
||||
emit graphicSettingsChanged();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::drawGraphics() {
|
||||
if (isHover && ui->status->isVisible()) {
|
||||
ui->status->setText(tr("Cursor: ") + pointCoords(canvas2real(QPointF(curpos))));
|
||||
@@ -2458,11 +2475,9 @@ void Graphic::updateLegend(bool es) {
|
||||
ui->layoutLegend->invalidate();
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
if (graphics[i].init()) {
|
||||
QAction * act = new QAction(tr("Check all"), 0);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(true);
|
||||
graphics[i].pb->addAction(act);
|
||||
connect(act, SIGNAL(triggered(bool)), this, SLOT(graphicAllVisibleChange(bool)));
|
||||
graphics[i].pb->addActions(
|
||||
{ui->actionCheck_all, ui->actionUncheck_all, ui->actionInvert_selection, ui->actionSelect_only_this});
|
||||
graphics[i].pb->installEventFilter(this);
|
||||
connect(graphics[i].pb, SIGNAL(toggled(bool)), this, SLOT(graphicVisibleChange(bool)));
|
||||
graphics[i].pb->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
@@ -2515,28 +2530,7 @@ void Graphic::graphicVisibleChange(bool checked) {
|
||||
QCheckBox * cb = qobject_cast<QCheckBox *>(sender());
|
||||
int i = cb->property("graphic_num").toInt();
|
||||
graphics[i].visible = checked;
|
||||
if (isFit)
|
||||
autofit();
|
||||
else {
|
||||
repaintCanvas();
|
||||
}
|
||||
emit graphicSettingsChanged();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::graphicAllVisibleChange(bool checked) {
|
||||
visible_update = true;
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
graphics[i].visible = checked;
|
||||
graphics[i].pb->setChecked(checked);
|
||||
}
|
||||
visible_update = false;
|
||||
if (isFit)
|
||||
autofit();
|
||||
else {
|
||||
repaintCanvas();
|
||||
}
|
||||
emit graphicSettingsChanged();
|
||||
graphicVisibleChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -2564,6 +2558,51 @@ void Graphic::lineYMaxChanged(double value) {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionCheck_all_triggered() {
|
||||
visible_update = true;
|
||||
for (auto & g: graphics) {
|
||||
g.visible = true;
|
||||
g.pb->setChecked(true);
|
||||
}
|
||||
visible_update = false;
|
||||
graphicVisibleChanged();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionUncheck_all_triggered() {
|
||||
visible_update = true;
|
||||
for (auto & g: graphics) {
|
||||
g.visible = false;
|
||||
g.pb->setChecked(false);
|
||||
}
|
||||
visible_update = false;
|
||||
graphicVisibleChanged();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionInvert_selection_triggered() {
|
||||
visible_update = true;
|
||||
for (auto & g: graphics) {
|
||||
g.visible = !g.visible;
|
||||
g.pb->setChecked(g.visible);
|
||||
}
|
||||
visible_update = false;
|
||||
graphicVisibleChanged();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionSelect_only_this_triggered() {
|
||||
visible_update = true;
|
||||
for (auto & g: graphics) {
|
||||
g.visible = (g.pb == action_source);
|
||||
g.pb->setChecked(g.visible);
|
||||
}
|
||||
visible_update = false;
|
||||
graphicVisibleChanged();
|
||||
action_source = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_graphic_buttonClose_clicked() {
|
||||
emit closeRequest(this);
|
||||
}
|
||||
|
||||
@@ -435,6 +435,7 @@ protected:
|
||||
void fillDateFormats();
|
||||
void askForExport(bool view_only);
|
||||
bool checkGraphicIndex(int index) const;
|
||||
void graphicVisibleChanged();
|
||||
|
||||
Ui::Graphic * ui;
|
||||
UGLWidget * canvas_gl;
|
||||
@@ -458,7 +459,8 @@ protected:
|
||||
GraphicConf * conf;
|
||||
EvalSpinBox line_x_min, line_x_max, line_y_min, line_y_max;
|
||||
QElapsedTimer tm;
|
||||
QMenu * buttons_menu = nullptr;
|
||||
QMenu * buttons_menu = nullptr;
|
||||
QCheckBox * action_source = nullptr;
|
||||
#ifdef Q_OS_ANDROID
|
||||
QElapsedTimer tm_fscr;
|
||||
#endif
|
||||
@@ -489,11 +491,14 @@ protected slots:
|
||||
void canvasWheelEvent(QWheelEvent *);
|
||||
void canvasLeaveEvent(QEvent *);
|
||||
void graphicVisibleChange(bool checked);
|
||||
void graphicAllVisibleChange(bool checked);
|
||||
void lineXMinChanged(double value);
|
||||
void lineXMaxChanged(double value);
|
||||
void lineYMinChanged(double value);
|
||||
void lineYMaxChanged(double value);
|
||||
void on_actionCheck_all_triggered();
|
||||
void on_actionUncheck_all_triggered();
|
||||
void on_actionInvert_selection_triggered();
|
||||
void on_actionSelect_only_this_triggered();
|
||||
void on_graphic_buttonClose_clicked();
|
||||
void on_graphic_buttonClear_clicked();
|
||||
void on_graphic_buttonAutofit_clicked();
|
||||
|
||||
@@ -506,6 +506,37 @@
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheck_all">
|
||||
<property name="icon">
|
||||
<iconset resource="../application/qad_application.qrc">
|
||||
<normaloff>:/icons/layer-visible-on.png</normaloff>:/icons/layer-visible-on.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check all</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUncheck_all">
|
||||
<property name="icon">
|
||||
<iconset resource="../application/qad_application.qrc">
|
||||
<normaloff>:/icons/layer-visible-off.png</normaloff>:/icons/layer-visible-off.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Uncheck all</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInvert_selection">
|
||||
<property name="text">
|
||||
<string>Invert selection</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSelect_only_this">
|
||||
<property name="text">
|
||||
<string>Select only this</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select only this</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@@ -89,6 +89,22 @@
|
||||
<source>Esc</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="524"/>
|
||||
<source>Uncheck all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="529"/>
|
||||
<source>Invert selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="534"/>
|
||||
<location filename="../graphic.ui" line="537"/>
|
||||
<source>Select only this</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="360"/>
|
||||
<source>Record graphic</source>
|
||||
@@ -116,97 +132,97 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="481"/>
|
||||
<location filename="../graphic.cpp" line="1722"/>
|
||||
<location filename="../graphic.cpp" line="487"/>
|
||||
<location filename="../graphic.cpp" line="1760"/>
|
||||
<source>Cursor: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="494"/>
|
||||
<location filename="../graphic.cpp" line="500"/>
|
||||
<source>Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="494"/>
|
||||
<location filename="../graphic.cpp" line="500"/>
|
||||
<source>Size</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="501"/>
|
||||
<location filename="../graphic.cpp" line="509"/>
|
||||
<location filename="../graphic.cpp" line="507"/>
|
||||
<location filename="../graphic.cpp" line="515"/>
|
||||
<source>Range</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="502"/>
|
||||
<location filename="../graphic.cpp" line="510"/>
|
||||
<location filename="../graphic.cpp" line="508"/>
|
||||
<location filename="../graphic.cpp" line="516"/>
|
||||
<source>Length</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="615"/>
|
||||
<location filename="../graphic.cpp" line="671"/>
|
||||
<location filename="../graphic.cpp" line="621"/>
|
||||
<location filename="../graphic.cpp" line="677"/>
|
||||
<source>Cursor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1146"/>
|
||||
<location filename="../graphic.cpp" line="1703"/>
|
||||
<location filename="../graphic.cpp" line="1168"/>
|
||||
<location filename="../graphic.cpp" line="1731"/>
|
||||
<source>Export graphics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1146"/>
|
||||
<location filename="../graphic.cpp" line="1168"/>
|
||||
<source>Can`t open file "%1"!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>ms</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>s</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>m</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>h</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2347"/>
|
||||
<location filename="../graphic.cpp" line="2385"/>
|
||||
<source>Save Image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1270"/>
|
||||
<location filename="../graphic.cpp" line="1292"/>
|
||||
<source>y(x)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1709"/>
|
||||
<location filename="../graphic.cpp" line="1737"/>
|
||||
<source>Select decimal point</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1709"/>
|
||||
<location filename="../graphic.cpp" line="1737"/>
|
||||
<source>Decimal point:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2373"/>
|
||||
<location filename="../graphic.cpp" line="2411"/>
|
||||
<source>Save GIF</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2440"/>
|
||||
<location filename="../graphic.ui" line="515"/>
|
||||
<source>Check all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -71,6 +71,22 @@
|
||||
<source>Configure ...</source>
|
||||
<translation>Настроить ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="524"/>
|
||||
<source>Uncheck all</source>
|
||||
<translation>Скрыть все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="529"/>
|
||||
<source>Invert selection</source>
|
||||
<translation>Инвертировать выбор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="534"/>
|
||||
<location filename="../graphic.ui" line="537"/>
|
||||
<source>Select only this</source>
|
||||
<translation>Выбрать только этот</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save image ...</source>
|
||||
<translation type="vanished">Сохранить изображение ...</translation>
|
||||
@@ -148,99 +164,99 @@
|
||||
<translation type="vanished">Свободная трассировка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="481"/>
|
||||
<location filename="../graphic.cpp" line="1722"/>
|
||||
<location filename="../graphic.cpp" line="487"/>
|
||||
<location filename="../graphic.cpp" line="1760"/>
|
||||
<source>Cursor: </source>
|
||||
<translation>Курсор: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="494"/>
|
||||
<location filename="../graphic.cpp" line="500"/>
|
||||
<source>Selection</source>
|
||||
<translation>Выделение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="494"/>
|
||||
<location filename="../graphic.cpp" line="500"/>
|
||||
<source>Size</source>
|
||||
<translation>Размер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="501"/>
|
||||
<location filename="../graphic.cpp" line="509"/>
|
||||
<location filename="../graphic.cpp" line="507"/>
|
||||
<location filename="../graphic.cpp" line="515"/>
|
||||
<source>Range</source>
|
||||
<translation>Диапазон</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="502"/>
|
||||
<location filename="../graphic.cpp" line="510"/>
|
||||
<location filename="../graphic.cpp" line="508"/>
|
||||
<location filename="../graphic.cpp" line="516"/>
|
||||
<source>Length</source>
|
||||
<translation>Длина</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="615"/>
|
||||
<location filename="../graphic.cpp" line="671"/>
|
||||
<location filename="../graphic.cpp" line="621"/>
|
||||
<location filename="../graphic.cpp" line="677"/>
|
||||
<source>Cursor</source>
|
||||
<translation>Курсор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1146"/>
|
||||
<location filename="../graphic.cpp" line="1703"/>
|
||||
<location filename="../graphic.cpp" line="1168"/>
|
||||
<location filename="../graphic.cpp" line="1731"/>
|
||||
<source>Export graphics</source>
|
||||
<translation>Экспорт графиков</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1146"/>
|
||||
<location filename="../graphic.cpp" line="1168"/>
|
||||
<source>Can`t open file "%1"!</source>
|
||||
<translation>Невозможно открыть файл "%1"!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>ms</source>
|
||||
<translation>мс</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>s</source>
|
||||
<translation>сек</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>m</source>
|
||||
<translation>мин</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1684"/>
|
||||
<location filename="../graphic.cpp" line="1712"/>
|
||||
<source>h</source>
|
||||
<translation>ч</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2347"/>
|
||||
<location filename="../graphic.cpp" line="2385"/>
|
||||
<source>Save Image</source>
|
||||
<translation>Сохранить изображение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1270"/>
|
||||
<location filename="../graphic.cpp" line="1292"/>
|
||||
<source>y(x)</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1709"/>
|
||||
<location filename="../graphic.cpp" line="1737"/>
|
||||
<source>Select decimal point</source>
|
||||
<translation>Выберите десятичный разделитель</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1709"/>
|
||||
<location filename="../graphic.cpp" line="1737"/>
|
||||
<source>Decimal point:</source>
|
||||
<translation>Десятичный разделитель:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2373"/>
|
||||
<location filename="../graphic.cpp" line="2411"/>
|
||||
<source>Save GIF</source>
|
||||
<translation>Сохранить GIF</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="2440"/>
|
||||
<location filename="../graphic.ui" line="515"/>
|
||||
<source>Check all</source>
|
||||
<translation>Выбрать все</translation>
|
||||
<translation>Показать все</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
@@ -19,5 +19,7 @@
|
||||
<file>../../icons/border-line.png</file>
|
||||
<file>../../icons/legend.png</file>
|
||||
<file>../../icons/graphic.png</file>
|
||||
<file>../../icons/layer-visible-off.png</file>
|
||||
<file>../../icons/layer-visible-on.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user