Merge branch 'master' of https://git.shs.tools/SHS/qad
This commit is contained in:
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.0)
|
||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(qad)
|
||||
set(qad_MAJOR 1)
|
||||
set(qad_MINOR 15)
|
||||
set(qad_REVISION 0)
|
||||
set(qad_MINOR 17)
|
||||
set(qad_REVISION 1)
|
||||
set(qad_SUFFIX )
|
||||
set(qad_COMPANY SHS)
|
||||
set(qad_DOMAIN org.SHS)
|
||||
|
||||
@@ -91,6 +91,12 @@ void Ribbon::init() {
|
||||
if (parent == 0) return;
|
||||
if (parent->menuBar() == 0) return;
|
||||
QList<QAction * > lm = parent->menuBar()->actions(), la;
|
||||
QString prev_tab;
|
||||
if (tab) {
|
||||
if (tab->currentIndex() >= 0)
|
||||
prev_tab = tab->tabText(tab->currentIndex());
|
||||
tab->deleteLater();
|
||||
}
|
||||
clear();
|
||||
if (scroll_area) delete scroll_area;
|
||||
buttons.clear();
|
||||
@@ -192,6 +198,8 @@ void Ribbon::init() {
|
||||
tl->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
//sa->widget()->setLayout(tl);
|
||||
tab->widget(tab->count() - 1)->setLayout(tl);
|
||||
if (i->text() == prev_tab)
|
||||
tab->setCurrentIndex(tab->count() - 1);
|
||||
}
|
||||
setFloatable(false);
|
||||
setMovable(false);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QPanGesture>
|
||||
#include <QPinchGesture>
|
||||
#include <QActionGroup>
|
||||
#include <QScrollArea>
|
||||
#include <QTimer>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
# include <QRandomGenerator>
|
||||
#endif
|
||||
@@ -25,6 +27,28 @@ const double rad2deg_qpie = 45. / atan(1.);
|
||||
|
||||
__GraphicRegistrator__ __graphic_registrator__;
|
||||
|
||||
class LegendScrollArea: public QScrollArea {
|
||||
public:
|
||||
LegendScrollArea(QWidget * w): QScrollArea() {
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
setWidgetResizable(true);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
setWidget(w);
|
||||
viewport()->setAutoFillBackground(false);
|
||||
w->setAutoFillBackground(false);
|
||||
}
|
||||
protected:
|
||||
virtual QSize sizeHint() const {
|
||||
QSize ret;
|
||||
if (!widget()) return ret;
|
||||
ret = widget()->sizeHint();
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), line_x_max(this), line_y_min(this), line_y_max(this) {
|
||||
canvas_gl = 0;
|
||||
@@ -39,20 +63,22 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
|
||||
#endif
|
||||
ui = new Ui::Graphic();
|
||||
ui->setupUi(this);
|
||||
ui->scrollLegend->layout()->addWidget(new LegendScrollArea(ui->widgetLegend));
|
||||
ui->scrollLegend->hide();
|
||||
QActionGroup * agroup = new QActionGroup(this);
|
||||
agroup->addAction(ui->actionGuidesFree );
|
||||
agroup->addAction(ui->actionGuidesTraceX);
|
||||
agroup->addAction(ui->actionGuidesTraceY);
|
||||
ui->actionGuidesFree ->setProperty("_value", (int)Free );
|
||||
ui->actionGuidesTraceX->setProperty("_value", (int)TraceX);
|
||||
ui->actionGuidesTraceY->setProperty("_value", (int)TraceY);
|
||||
ui->actionGuidesFree->setChecked(true);
|
||||
agroup->addAction(ui->graphic_actionGuidesFree );
|
||||
agroup->addAction(ui->graphic_actionGuidesTraceX);
|
||||
agroup->addAction(ui->graphic_actionGuidesTraceY);
|
||||
ui->graphic_actionGuidesFree ->setProperty("_value", (int)Free );
|
||||
ui->graphic_actionGuidesTraceX->setProperty("_value", (int)TraceX);
|
||||
ui->graphic_actionGuidesTraceY->setProperty("_value", (int)TraceY);
|
||||
ui->graphic_actionGuidesFree->setChecked(true);
|
||||
connect(agroup, SIGNAL(triggered(QAction*)), this, SLOT(actionGuidesTriggered(QAction*)));
|
||||
ui->checkGuides->addAction(ui->actionGuidesFree );
|
||||
ui->checkGuides->addAction(ui->actionGuidesTraceX);
|
||||
ui->checkGuides->addAction(ui->actionGuidesTraceY);
|
||||
ui->buttonAutofit->addAction(ui->actionExpandX);
|
||||
ui->buttonAutofit->addAction(ui->actionExpandY);
|
||||
ui->graphic_checkGuides ->addAction(ui->graphic_actionGuidesFree );
|
||||
ui->graphic_checkGuides ->addAction(ui->graphic_actionGuidesTraceX);
|
||||
ui->graphic_checkGuides ->addAction(ui->graphic_actionGuidesTraceY);
|
||||
ui->graphic_buttonAutofit->addAction(ui->graphic_actionExpandX);
|
||||
ui->graphic_buttonAutofit->addAction(ui->graphic_actionExpandY);
|
||||
line_x_min.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
line_x_max.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
((QBoxLayout * )ui->widgetLY->layout())->insertWidget(0, &line_y_min);
|
||||
@@ -143,7 +169,12 @@ void Graphic::changeEvent(QEvent * e) {
|
||||
|
||||
|
||||
void Graphic::resizeEvent(QResizeEvent *) {
|
||||
if (leg_update) updateLegend(false);
|
||||
if (leg_update)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||
QTimer::singleShot(0, this, [this](){updateLegend(false);});
|
||||
#else
|
||||
updateLegend(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -540,7 +571,7 @@ void Graphic::clear() {
|
||||
graphics[i].max_x = 0.;
|
||||
graphics[i].cvrect = QRectF();
|
||||
}
|
||||
if (isFit) on_buttonAutofit_clicked();
|
||||
if (isFit) on_graphic_buttonAutofit_clicked();
|
||||
}
|
||||
|
||||
|
||||
@@ -553,9 +584,9 @@ void Graphic::setAntialiasing(bool enabled) {
|
||||
|
||||
void Graphic::setPaused(bool yes) {
|
||||
pause_ = yes;
|
||||
ui->checkPause->blockSignals(true);
|
||||
ui->checkPause->setChecked(yes);
|
||||
ui->checkPause->blockSignals(false);
|
||||
ui->graphic_checkPause->blockSignals(true);
|
||||
ui->graphic_checkPause->setChecked(yes);
|
||||
ui->graphic_checkPause->blockSignals(false);
|
||||
for (int i = 0; i < graphics.size(); ++i)
|
||||
graphics[i].cvrect = QRectF();
|
||||
if (!pause_) {
|
||||
@@ -592,17 +623,17 @@ void Graphic::setHistorySize(double val) {
|
||||
|
||||
void Graphic::setMaxVisibleTime(double val) {
|
||||
visible_time = val;
|
||||
if (isFit) on_buttonAutofit_clicked();
|
||||
if (isFit) on_graphic_buttonAutofit_clicked();
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setOnlyExpandY(bool yes) {
|
||||
ui->actionExpandY->setChecked(yes);
|
||||
ui->graphic_actionExpandY->setChecked(yes);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setOnlyExpandX(bool yes) {
|
||||
ui->actionExpandX->setChecked(yes);
|
||||
ui->graphic_actionExpandX->setChecked(yes);
|
||||
}
|
||||
|
||||
|
||||
@@ -649,25 +680,25 @@ void Graphic::setGraphicsDataRaw(const QByteArray & ba) {
|
||||
|
||||
|
||||
void Graphic::setFloatingAxisEnabled(bool on) {
|
||||
ui->checkGuides->setChecked(on);
|
||||
ui->graphic_checkGuides->setChecked(on);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setButtons(Graphic::Buttons b) {
|
||||
buttons_ = b;
|
||||
ui->buttonAutofit->setVisible(b.testFlag(Autofit));
|
||||
ui->checkGrid->setVisible(b.testFlag(Grid));
|
||||
ui->checkGuides->setVisible(b.testFlag(CursorAxis));
|
||||
ui->buttonFullscreen->setVisible(b.testFlag(Fullscreen));
|
||||
ui->checkBorderInputs->setVisible(b.testFlag(BorderInputs));
|
||||
ui->checkLegend->setVisible(b.testFlag(Legend));
|
||||
ui->buttonClear->setVisible(b.testFlag(Clear));
|
||||
ui->buttonConfigure->setVisible(b.testFlag(Configure));
|
||||
ui->buttonSave->setVisible(b.testFlag(Save));
|
||||
ui->buttonClose->setVisible(b.testFlag(Close));
|
||||
ui->checkPause->setVisible(b.testFlag(Pause));
|
||||
if (ui->buttonAutofit->isVisible() || ui->checkGrid->isVisible() || ui->checkGuides->isVisible() ||
|
||||
ui->buttonConfigure->isVisible() || ui->buttonSave->isVisible() || ui->checkPause->isVisible())
|
||||
ui->graphic_buttonAutofit->setVisible(b.testFlag(Autofit));
|
||||
ui->graphic_checkGrid->setVisible(b.testFlag(Grid));
|
||||
ui->graphic_checkGuides->setVisible(b.testFlag(CursorAxis));
|
||||
ui->graphic_buttonFullscreen->setVisible(b.testFlag(Fullscreen));
|
||||
ui->graphic_checkBorderInputs->setVisible(b.testFlag(BorderInputs));
|
||||
ui->graphic_checkLegend->setVisible(b.testFlag(Legend));
|
||||
ui->graphic_buttonClear->setVisible(b.testFlag(Clear));
|
||||
ui->graphic_buttonConfigure->setVisible(b.testFlag(Configure));
|
||||
ui->graphic_buttonSave->setVisible(b.testFlag(Save));
|
||||
ui->graphic_buttonClose->setVisible(b.testFlag(Close));
|
||||
ui->graphic_checkPause->setVisible(b.testFlag(Pause));
|
||||
if (ui->graphic_buttonAutofit ->isVisible() || ui->graphic_checkGrid ->isVisible() || ui->graphic_checkGuides->isVisible() ||
|
||||
ui->graphic_buttonConfigure->isVisible() || ui->graphic_buttonSave->isVisible() || ui->graphic_checkPause ->isVisible())
|
||||
ui->verticalSpacer->changeSize(0, 30, QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
else
|
||||
ui->verticalSpacer->changeSize(0, 0, QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
@@ -1447,7 +1478,7 @@ void Graphic::tick(int index, bool slide, bool update_) {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_buttonAutofit_clicked() {
|
||||
void Graphic::on_graphic_buttonAutofit_clicked() {
|
||||
isFit = true;
|
||||
bool isEmpty = true;
|
||||
foreach (const GraphicType & t, graphics) {
|
||||
@@ -1464,7 +1495,7 @@ void Graphic::on_buttonAutofit_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_buttonConfigure_clicked() {
|
||||
void Graphic::on_graphic_buttonConfigure_clicked() {
|
||||
conf->graphicItems.clear();
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
GraphicConf::GraphicItem item;
|
||||
@@ -1510,7 +1541,7 @@ void Graphic::on_buttonConfigure_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_checkGuides_toggled(bool checked) {
|
||||
void Graphic::on_graphic_checkGuides_toggled(bool checked) {
|
||||
guides = checked;
|
||||
setGuidesCursor();
|
||||
update();
|
||||
@@ -1530,7 +1561,7 @@ void Graphic::updateLegend(bool es) {
|
||||
p.end();
|
||||
graphics[i].icon = QIcon(pix);
|
||||
}
|
||||
if (!ui->widgetLegend->isVisibleTo(this)) {
|
||||
if (!ui->scrollLegend->isVisibleTo(this)) {
|
||||
if (es) emit graphicSettingsChanged();
|
||||
return;
|
||||
}
|
||||
@@ -1564,15 +1595,18 @@ void Graphic::updateLegend(bool es) {
|
||||
}
|
||||
int maxcol = qMax<int>(ui->widgetLegend->width() / ps - 1, 1);
|
||||
int row = 0, col = 0;
|
||||
bool lv = ui->widgetLegend->isVisibleTo(this);
|
||||
ui->widgetLegend->hide();
|
||||
bool lv = ui->scrollLegend->isVisibleTo(this);
|
||||
ui->scrollLegend->hide();
|
||||
for (int i = 0; i < graphics.size(); i++) {
|
||||
ui->layoutLegend->addWidget(graphics[i].pb,row,col);
|
||||
graphics[i].pb->show();
|
||||
col++;
|
||||
if (col > maxcol) {col = 0; row++;}
|
||||
}
|
||||
ui->widgetLegend->setVisible(lv);
|
||||
ui->gridLayout->invalidate();
|
||||
ui->scrollLegend->setVisible(lv);
|
||||
ui->scrollLegend->layout()->itemAt(0)->widget()->updateGeometry();
|
||||
//ui->gridLayout->invalidate();
|
||||
leg_update = true;
|
||||
if (es) emit graphicSettingsChanged();
|
||||
}
|
||||
@@ -1594,8 +1628,8 @@ void Graphic::graphicVisibleChange(bool checked) {
|
||||
QCheckBox * cb = qobject_cast<QCheckBox*>(sender());
|
||||
int i = cb->property("graphic_num").toInt();
|
||||
graphics[i].visible = checked;
|
||||
if (isFit) on_buttonAutofit_clicked();
|
||||
else update();
|
||||
if (isFit) on_graphic_buttonAutofit_clicked();
|
||||
else {update();}
|
||||
emit graphicSettingsChanged();
|
||||
}
|
||||
|
||||
@@ -1607,8 +1641,8 @@ void Graphic::graphicAllVisibleChange(bool checked) {
|
||||
graphics[i].pb->setChecked(checked);
|
||||
}
|
||||
visible_update = false;
|
||||
if (isFit) on_buttonAutofit_clicked();
|
||||
else update();
|
||||
if (isFit) on_graphic_buttonAutofit_clicked();
|
||||
else {update();}
|
||||
emit graphicSettingsChanged();
|
||||
}
|
||||
|
||||
@@ -1672,7 +1706,7 @@ bool Graphic::statusVisible() const {
|
||||
|
||||
|
||||
bool Graphic::legendVisible() const {
|
||||
return ui->widgetLegend->isVisible();
|
||||
return ui->scrollLegend->isVisible();
|
||||
}
|
||||
|
||||
|
||||
@@ -1759,14 +1793,14 @@ void Graphic::setCaption(const QString & str) {
|
||||
|
||||
|
||||
void Graphic::setGridEnabled(bool enabled) {
|
||||
ui->checkGrid->setChecked(enabled);
|
||||
ui->graphic_checkGrid->setChecked(enabled);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setBorderInputsVisible(bool visible) {
|
||||
ui->widgetLX->setVisible(visible);
|
||||
ui->widgetLY->setVisible(visible);
|
||||
ui->checkBorderInputs->setChecked(visible);
|
||||
ui->graphic_checkBorderInputs->setChecked(visible);
|
||||
if (visible) setRectToLines();
|
||||
}
|
||||
|
||||
@@ -1777,25 +1811,29 @@ void Graphic::setStatusVisible(bool visible) {
|
||||
|
||||
|
||||
void Graphic::setLegendVisible(bool visible) {
|
||||
ui->widgetLegend->setVisible(visible);
|
||||
ui->checkLegend->setChecked(visible);
|
||||
ui->scrollLegend->setVisible(visible);
|
||||
ui->graphic_checkLegend->setChecked(visible);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||
QTimer::singleShot(0, this, [this](){updateLegend();});
|
||||
#else
|
||||
updateLegend();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionExpandX_triggered(bool checked) {
|
||||
void Graphic::on_graphic_actionExpandX_triggered(bool checked) {
|
||||
only_expand_x = checked;
|
||||
ui->actionExpandX->setIcon(checked ? icon_exp_x : icon_exp_sx);
|
||||
ui->graphic_actionExpandX->setIcon(checked ? icon_exp_x : icon_exp_sx);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::on_actionExpandY_triggered(bool checked) {
|
||||
void Graphic::on_graphic_actionExpandY_triggered(bool checked) {
|
||||
only_expand_y = checked;
|
||||
ui->actionExpandY->setIcon(checked ? icon_exp_y : icon_exp_sy);
|
||||
ui->graphic_actionExpandY->setIcon(checked ? icon_exp_y : icon_exp_sy);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::actionGuidesTriggered(QAction * a) {
|
||||
ui->checkGuides->setChecked(true);
|
||||
ui->graphic_checkGuides->setChecked(true);
|
||||
setFloatingAxisType((FloatingAxisType)a->property("_value").toInt());
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public slots:
|
||||
void addGraphic(const GraphicType & gd, bool update = true) {graphics << gd; if (update) updateLegend();}
|
||||
void setVisualRect(const QRectF & rect);
|
||||
void setDefaultRect(const QRectF & rect);
|
||||
void autofit() {on_buttonAutofit_clicked();}
|
||||
void autofit() {on_graphic_buttonAutofit_clicked();}
|
||||
void saveImage();
|
||||
void clear();
|
||||
void update(bool force = false);
|
||||
@@ -416,19 +416,19 @@ protected slots:
|
||||
void lineXMaxChanged(double value) {selrect.setRight(value); checkLines();}
|
||||
void lineYMinChanged(double value) {selrect.setBottom(value); checkLines();}
|
||||
void lineYMaxChanged(double value) {selrect.setTop(value); checkLines();}
|
||||
void on_buttonClose_clicked() {emit closeRequest(this);}
|
||||
void on_buttonClear_clicked() {clear(); emit cleared();}
|
||||
void on_buttonAutofit_clicked();
|
||||
void on_buttonConfigure_clicked();
|
||||
void on_buttonFullscreen_clicked() {fullscreen();}
|
||||
void on_buttonSave_clicked() {saveImage();}
|
||||
void on_checkGrid_toggled(bool checked) {grid = checked; update();}
|
||||
void on_checkGuides_toggled(bool checked);
|
||||
void on_actionExpandX_triggered(bool checked);
|
||||
void on_actionExpandY_triggered(bool checked);
|
||||
void on_checkBorderInputs_toggled(bool checked) {setBorderInputsVisible(checked);}
|
||||
void on_checkLegend_toggled(bool checked) {setLegendVisible(checked);}
|
||||
void on_checkPause_toggled(bool checked) {setPaused(checked);}
|
||||
void on_graphic_buttonClose_clicked() {emit closeRequest(this);}
|
||||
void on_graphic_buttonClear_clicked() {clear(); emit cleared();}
|
||||
void on_graphic_buttonAutofit_clicked();
|
||||
void on_graphic_buttonConfigure_clicked();
|
||||
void on_graphic_buttonFullscreen_clicked() {fullscreen();}
|
||||
void on_graphic_buttonSave_clicked() {saveImage();}
|
||||
void on_graphic_checkGrid_toggled(bool checked) {grid = checked; update();}
|
||||
void on_graphic_checkGuides_toggled(bool checked);
|
||||
void on_graphic_actionExpandX_triggered(bool checked);
|
||||
void on_graphic_actionExpandY_triggered(bool checked);
|
||||
void on_graphic_checkBorderInputs_toggled(bool checked) {setBorderInputsVisible(checked);}
|
||||
void on_graphic_checkLegend_toggled(bool checked) {setLegendVisible(checked);}
|
||||
void on_graphic_checkPause_toggled(bool checked) {setPaused(checked);}
|
||||
void actionGuidesTriggered(QAction * a);
|
||||
void enterFullscreen();
|
||||
void leaveFullscreen();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>564</width>
|
||||
<height>433</height>
|
||||
<height>484</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -32,6 +32,16 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCaption">
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QWidget" name="widgetLeft" native="true">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
@@ -48,7 +58,7 @@
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonAutofit">
|
||||
<widget class="QToolButton" name="graphic_buttonAutofit">
|
||||
<property name="toolTip">
|
||||
<string>Autofit</string>
|
||||
</property>
|
||||
@@ -59,7 +69,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="checkGrid">
|
||||
<widget class="QToolButton" name="graphic_checkGrid">
|
||||
<property name="toolTip">
|
||||
<string>Grid</string>
|
||||
</property>
|
||||
@@ -76,7 +86,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="checkGuides">
|
||||
<widget class="QToolButton" name="graphic_checkGuides">
|
||||
<property name="toolTip">
|
||||
<string>Cursor axis</string>
|
||||
</property>
|
||||
@@ -90,7 +100,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonFullscreen">
|
||||
<widget class="QToolButton" name="graphic_buttonFullscreen">
|
||||
<property name="toolTip">
|
||||
<string>Fullscreen</string>
|
||||
</property>
|
||||
@@ -101,7 +111,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="checkBorderInputs">
|
||||
<widget class="QToolButton" name="graphic_checkBorderInputs">
|
||||
<property name="toolTip">
|
||||
<string>Border inputs</string>
|
||||
</property>
|
||||
@@ -118,7 +128,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="checkLegend">
|
||||
<widget class="QToolButton" name="graphic_checkLegend">
|
||||
<property name="toolTip">
|
||||
<string>Legend</string>
|
||||
</property>
|
||||
@@ -135,7 +145,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="checkPause">
|
||||
<widget class="QToolButton" name="graphic_checkPause">
|
||||
<property name="toolTip">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
@@ -149,23 +159,23 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonConfigure">
|
||||
<widget class="QToolButton" name="graphic_buttonConfigure">
|
||||
<property name="toolTip">
|
||||
<string>Configure ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<iconset resource="../application/qad_application.qrc">
|
||||
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonSave">
|
||||
<widget class="QToolButton" name="graphic_buttonSave">
|
||||
<property name="toolTip">
|
||||
<string>Save image ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<iconset resource="../blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -187,23 +197,23 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonClear">
|
||||
<widget class="QToolButton" name="graphic_buttonClear">
|
||||
<property name="toolTip">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<iconset resource="../application/qad_application.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonClose">
|
||||
<widget class="QToolButton" name="graphic_buttonClose">
|
||||
<property name="toolTip">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<iconset resource="../blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/dialog-close.png</normaloff>:/icons/dialog-close.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -216,7 +226,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>79</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@@ -225,19 +235,16 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCaption">
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="2">
|
||||
<widget class="QWidget" name="widgetRight" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="status">
|
||||
<property name="text">
|
||||
<string>Cursor: ( ; )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
@@ -359,45 +366,50 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QWidget" name="widgetLegend" native="true">
|
||||
<layout class="QGridLayout" name="layoutLegend">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="status">
|
||||
<property name="text">
|
||||
<string>Cursor: ( ; )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="widgetLegend" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="layoutLegend">
|
||||
<widget class="QWidget" name="scrollLegend" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionGuidesFree">
|
||||
<action name="graphic_actionGuidesFree">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -405,7 +417,7 @@
|
||||
<string>Free</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGuidesTraceX">
|
||||
<action name="graphic_actionGuidesTraceX">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -413,7 +425,7 @@
|
||||
<string>Trace X</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGuidesTraceY">
|
||||
<action name="graphic_actionGuidesTraceY">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -421,7 +433,7 @@
|
||||
<string>Trace Y</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpandX">
|
||||
<action name="graphic_actionExpandX">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -429,7 +441,7 @@
|
||||
<string>Only expand X</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpandY">
|
||||
<action name="graphic_actionExpandY">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -449,6 +461,8 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../application/qad_application.qrc"/>
|
||||
<include location="../blockview/qad_blockview.qrc"/>
|
||||
<include location="qad_graphic.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
||||
@@ -322,8 +322,10 @@ bool SQLRecordWidget::isEmpty() const {
|
||||
|
||||
void SQLRecordWidget::updateRelations() {
|
||||
relations.clear();
|
||||
QSqlDatabase db(QSqlDatabase::database(connection_name));
|
||||
if (!db.isOpen()) return;
|
||||
for (int i = 0; i < relations_src.size(); ++i) {
|
||||
QSqlQuery q(QString("SELECT %1,%2 FROM %3").arg(relations_src[i].key, relations_src[i].ocol, relations_src[i].table), QSqlDatabase::database(connection_name));
|
||||
QSqlQuery q(QString("SELECT %1,%2 FROM %3").arg(relations_src[i].key, relations_src[i].ocol, relations_src[i].table), db);
|
||||
QList<QPair<int, QString> > cr;
|
||||
while (q.next())
|
||||
cr << QPair<int, QString>(q.value(0).toInt(), q.value(1).toString());
|
||||
|
||||
@@ -42,6 +42,12 @@ void SessionManager::removeMainWidget(QWidget * e) {
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::addEntry(const QString & name, QMainWindow * e) {
|
||||
mwindows.push_back(QPair<QString, QMainWindow * >(name, e));
|
||||
mw_splitters[e] = e->findChildren<QSplitter * >();
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::save() {
|
||||
if (file_.isEmpty()) {
|
||||
qDebug() << "[SessionManager] filename is empty";
|
||||
@@ -54,8 +60,8 @@ void SessionManager::save() {
|
||||
sr.setValue(mwindows[i].first + " state", mwindows[i].second->saveState(), false);
|
||||
sr.setValue(mwindows[i].first + " window state", (int)mwindows[i].second->windowState(), false);
|
||||
sr.setValue(mwindows[i].first + " geometry " + QString::number((int)mwindows[i].second->windowState()), mwindows[i].second->saveGeometry(), false);
|
||||
QList<QSplitter * > sp = mwindows[i].second->findChildren<QSplitter * >();
|
||||
foreach (QSplitter * s, sp)
|
||||
QList<QSplitter*> spl = mw_splitters[mwindows[i].second];
|
||||
foreach (QSplitter * s, spl)
|
||||
sr.setValue(mwindows[i].first + " splitter " + s->objectName(), s->saveState(), false);
|
||||
}
|
||||
for (int i = 0; i < widgets.size(); ++i) {
|
||||
@@ -165,8 +171,8 @@ void SessionManager::load(bool onlyMainwindow) {
|
||||
QByteArray ba = sr.getValue(mwindows[i].first + " state").toByteArray();
|
||||
if (!ba.isEmpty())
|
||||
mw->restoreState(ba);
|
||||
QList<QSplitter * > sp = mw->findChildren<QSplitter * >();
|
||||
foreach (QSplitter * s, sp) {
|
||||
QList<QSplitter*> spl = mw_splitters[mw];
|
||||
foreach (QSplitter * s, spl) {
|
||||
ba = sr.getValue(mwindows[i].first + " splitter " + s->objectName()).toByteArray();
|
||||
if (!ba.isEmpty())
|
||||
s->restoreState(ba);
|
||||
@@ -261,6 +267,7 @@ void SessionManager::clear(bool with_filename) {
|
||||
bools.clear();
|
||||
ints.clear();
|
||||
floats.clear();
|
||||
mw_splitters.clear();
|
||||
if (with_filename) setFile("");
|
||||
}
|
||||
|
||||
|
||||
@@ -52,42 +52,42 @@ public:
|
||||
|
||||
void setFile(const QString & file);
|
||||
|
||||
void addEntry(QMainWindow * e) {mwindows.push_back(QPair<QString, QMainWindow * >(e->objectName(), e));}
|
||||
void addEntry(QCheckBox * e) {checks.push_back(QPair<QString, QCheckBox * >(e->objectName(), e));}
|
||||
void addEntry(QLineEdit * e) {lines.push_back(QPair<QString, QLineEdit * >(e->objectName(), e));}
|
||||
void addEntry(QComboBox * e) {combos.push_back(QPair<QString, QComboBox * >(e->objectName(), e));}
|
||||
void addEntry(QDoubleSpinBox * e) {dspins.push_back(QPair<QString, QDoubleSpinBox * >(e->objectName(), e));}
|
||||
void addEntry(QSpinBox * e) {spins.push_back(QPair<QString, QSpinBox * >(e->objectName(), e));}
|
||||
void addEntry(SpinSlider * e) {spinsliders.push_back(QPair<QString, SpinSlider * >(e->objectName(), e));}
|
||||
void addEntry(EvalSpinBox * e) {evals.push_back(QPair<QString, EvalSpinBox * >(e->objectName(), e));}
|
||||
void addEntry(QTabWidget * e) {tabs.push_back(QPair<QString, QTabWidget * >(e->objectName(), e));}
|
||||
void addEntry(QGroupBox * e) {groups.push_back(QPair<QString, QGroupBox * >(e->objectName(), e));}
|
||||
void addEntry(QAction * e) {actions.push_back(QPair<QString, QAction * >(e->objectName(), e));}
|
||||
void addEntry(QAbstractButton * e) {buttons.push_back(QPair<QString, QAbstractButton * >(e->objectName(), e));}
|
||||
void addEntry(QStackedWidget * e) {stacks.push_back(QPair<QString, QStackedWidget * >(e->objectName(), e));}
|
||||
void addMainWidget(QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(e->objectName(), e));}
|
||||
void addEntry(QMainWindow * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QCheckBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QLineEdit * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QComboBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QDoubleSpinBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QSpinBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(SpinSlider * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(EvalSpinBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QTabWidget * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QGroupBox * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QAction * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QAbstractButton * e) {addEntry(e->objectName(), e);}
|
||||
void addEntry(QStackedWidget * e) {addEntry(e->objectName(), e);}
|
||||
void addMainWidget(QWidget * e) {addMainWidget(e->objectName(), e);}
|
||||
void removeMainWidget(QWidget * e);
|
||||
|
||||
void addEntry(const QString & name, QMainWindow * e) {mwindows.push_back(QPair<QString, QMainWindow * >(name, e));}
|
||||
void addEntry(const QString & name, QCheckBox * e) {checks.push_back(QPair<QString, QCheckBox * >(name, e));}
|
||||
void addEntry(const QString & name, QLineEdit * e) {lines.push_back(QPair<QString, QLineEdit * >(name, e));}
|
||||
void addEntry(const QString & name, QComboBox * e) {combos.push_back(QPair<QString, QComboBox * >(name, e));}
|
||||
void addEntry(const QString & name, QDoubleSpinBox * e) {dspins.push_back(QPair<QString, QDoubleSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, QSpinBox * e) {spins.push_back(QPair<QString, QSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, SpinSlider * e) {spinsliders.push_back(QPair<QString, SpinSlider * >(name, e));}
|
||||
void addEntry(const QString & name, EvalSpinBox * e) {evals.push_back(QPair<QString, EvalSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, QTabWidget * e) {tabs.push_back(QPair<QString, QTabWidget * >(name, e));}
|
||||
void addEntry(const QString & name, QGroupBox * e) {groups.push_back(QPair<QString, QGroupBox * >(name, e));}
|
||||
void addEntry(const QString & name, QMainWindow * e);
|
||||
void addEntry(const QString & name, QCheckBox * e) {checks.push_back(QPair<QString, QCheckBox * >(name, e));}
|
||||
void addEntry(const QString & name, QLineEdit * e) {lines.push_back(QPair<QString, QLineEdit * >(name, e));}
|
||||
void addEntry(const QString & name, QComboBox * e) {combos.push_back(QPair<QString, QComboBox * >(name, e));}
|
||||
void addEntry(const QString & name, QDoubleSpinBox * e) {dspins.push_back(QPair<QString, QDoubleSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, QSpinBox * e) {spins.push_back(QPair<QString, QSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, SpinSlider * e) {spinsliders.push_back(QPair<QString, SpinSlider * >(name, e));}
|
||||
void addEntry(const QString & name, EvalSpinBox * e) {evals.push_back(QPair<QString, EvalSpinBox * >(name, e));}
|
||||
void addEntry(const QString & name, QTabWidget * e) {tabs.push_back(QPair<QString, QTabWidget * >(name, e));}
|
||||
void addEntry(const QString & name, QGroupBox * e) {groups.push_back(QPair<QString, QGroupBox * >(name, e));}
|
||||
void addEntry(const QString & name, QAbstractButton * e) {buttons.push_back(QPair<QString, QAbstractButton * >(name, e));}
|
||||
void addEntry(const QString & name, QStackedWidget * e) {stacks.push_back(QPair<QString, QStackedWidget * >(name, e));}
|
||||
void addEntry(const QString & name, QAction * e) {actions.push_back(QPair<QString, QAction * >(name, e));}
|
||||
void addEntry(const QString & name, QStringList * e) {stringlists.push_back(QPair<QString, QStringList * >(name, e));}
|
||||
void addEntry(const QString & name, QString * e) {strings.push_back(QPair<QString, QString * >(name, e));}
|
||||
void addEntry(const QString & name, QColor * e) {colors.push_back(QPair<QString, QColor * >(name, e));}
|
||||
void addEntry(const QString & name, bool * e) {bools.push_back(QPair<QString, bool * >(name, e));}
|
||||
void addEntry(const QString & name, int * e) {ints.push_back(QPair<QString, int * >(name, e));}
|
||||
void addEntry(const QString & name, float * e) {floats.push_back(QPair<QString, float * >(name, e));}
|
||||
void addMainWidget(const QString & name, QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(name, e));}
|
||||
void addEntry(const QString & name, QStackedWidget * e) {stacks.push_back(QPair<QString, QStackedWidget * >(name, e));}
|
||||
void addEntry(const QString & name, QAction * e) {actions.push_back(QPair<QString, QAction * >(name, e));}
|
||||
void addEntry(const QString & name, QStringList * e) {stringlists.push_back(QPair<QString, QStringList * >(name, e));}
|
||||
void addEntry(const QString & name, QString * e) {strings.push_back(QPair<QString, QString * >(name, e));}
|
||||
void addEntry(const QString & name, QColor * e) {colors.push_back(QPair<QString, QColor * >(name, e));}
|
||||
void addEntry(const QString & name, bool * e) {bools.push_back(QPair<QString, bool * >(name, e));}
|
||||
void addEntry(const QString & name, int * e) {ints.push_back(QPair<QString, int * >(name, e));}
|
||||
void addEntry(const QString & name, float * e) {floats.push_back(QPair<QString, float * >(name, e));}
|
||||
void addMainWidget(const QString & name, QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(name, e));}
|
||||
|
||||
private:
|
||||
QMap<const QMetaObject*, QByteArray> metaFunctions(const QSet<QObject*> & objects, QByteArray fname);
|
||||
@@ -112,6 +112,7 @@ private:
|
||||
QVector<QPair<QString, bool * > > bools;
|
||||
QVector<QPair<QString, int * > > ints;
|
||||
QVector<QPair<QString, float * > > floats;
|
||||
QMap<QMainWindow*, QList<QSplitter*> > mw_splitters;
|
||||
QString file_;
|
||||
|
||||
public slots:
|
||||
|
||||
Reference in New Issue
Block a user