version 2.20
icon change EDockWidget improvements EMainWindow small refactoring Graphic now remember last loaded graphics style and restore it on setGraphicsCount
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 19)
|
||||
set(QAD_MINOR 20)
|
||||
set(QAD_REVISION 0)
|
||||
set(QAD_SUFFIX )
|
||||
set(QAD_COMPANY SHS)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 4.6 KiB |
@@ -6,6 +6,27 @@
|
||||
#include <QStyle>
|
||||
|
||||
|
||||
EDockWidget::EDockWidget(const QString & title, QWidget * parent, Qt::WindowFlags flags): QDockWidget(title, parent, flags) {
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
EDockWidget::EDockWidget(QWidget * parent, Qt::WindowFlags flags): QDockWidget(parent, flags) {
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
EDockWidget::~EDockWidget() {
|
||||
delete btn_hide;
|
||||
delete btn_dock;
|
||||
delete btn_maximize;
|
||||
delete lbl_title;
|
||||
delete lbl_icon;
|
||||
delete header;
|
||||
delete empty_header;
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) {
|
||||
btn_dock->setVisible(features.testFlag(DockWidgetFloatable));
|
||||
btn_hide->setVisible(features.testFlag(DockWidgetClosable));
|
||||
@@ -31,6 +52,16 @@ void EDockWidget::setWindowIcon(const QIcon & icon) {
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::setEmptyHeader() {
|
||||
if (titleBarWidget() != empty_header) setTitleBarWidget(empty_header);
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::setStandardHeader() {
|
||||
if (titleBarWidget() != header) setTitleBarWidget(header);
|
||||
}
|
||||
|
||||
|
||||
bool EDockWidget::event(QEvent * e) {
|
||||
if (e->type() == QEvent::FontChange || e->type() == QEvent::Polish) {
|
||||
updateStyle();
|
||||
@@ -39,9 +70,19 @@ bool EDockWidget::event(QEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::WindowStateChange || e->type() == QEvent::LanguageChange) {
|
||||
updateStyle();
|
||||
}
|
||||
QDockWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::init() {
|
||||
header = new QFrame();
|
||||
header->setFrameShape(QFrame::StyledPanel);
|
||||
empty_header = new QWidget();
|
||||
empty_header->setLayout(new QBoxLayout(QBoxLayout::BottomToTop));
|
||||
QBoxLayout * lay =
|
||||
new QBoxLayout(features().testFlag(QDockWidget::DockWidgetVerticalTitleBar) ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
|
||||
lay->setContentsMargins(2, 2, 2, 2);
|
||||
@@ -62,38 +103,62 @@ void EDockWidget::init() {
|
||||
// #endif
|
||||
lbl_title = new QLabel(windowTitle());
|
||||
lbl_title->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
btn_dock = new QToolButton();
|
||||
// btn_dock->setIconSize(QSize(16, 16));
|
||||
btn_dock->setAutoRaise(true);
|
||||
btn_dock->setFocusPolicy(Qt::NoFocus);
|
||||
btn_dock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
btn_hide = new QToolButton();
|
||||
// btn_hide->setIconSize(QSize(16, 16));
|
||||
btn_hide->setAutoRaise(true);
|
||||
btn_hide->setFocusPolicy(Qt::NoFocus);
|
||||
btn_hide->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
connect(btn_dock, SIGNAL(clicked(bool)), this, SLOT(dockClicked()));
|
||||
connect(btn_hide, SIGNAL(clicked(bool)), this, SLOT(hide()));
|
||||
auto createButton = [this](const char * slot) {
|
||||
auto * ret = new QToolButton();
|
||||
ret->setAutoRaise(true);
|
||||
ret->setFocusPolicy(Qt::NoFocus);
|
||||
ret->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
// ret->setIconSize(QSize(16, 16));
|
||||
connect(ret, SIGNAL(clicked(bool)), this, slot);
|
||||
return ret;
|
||||
};
|
||||
btn_dock = createButton(SLOT(dockClicked()));
|
||||
btn_maximize = createButton(SLOT(maximize()));
|
||||
btn_hide = createButton(SLOT(hide()));
|
||||
lay->addWidget(lbl_icon);
|
||||
lay->addWidget(lbl_title);
|
||||
lay->addWidget(btn_dock);
|
||||
lay->addWidget(btn_maximize);
|
||||
lay->addWidget(btn_hide);
|
||||
header->setLayout(lay);
|
||||
updateStyle();
|
||||
setTitleBarWidget(header);
|
||||
connect(this, &QDockWidget::topLevelChanged, this, &EDockWidget::updateStyle);
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::updateStyle() {
|
||||
int eh_m = style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin);
|
||||
empty_header->layout()->setContentsMargins(eh_m, eh_m, 0, 0);
|
||||
QSize icon_size = preferredIconSize(0.75, this);
|
||||
int bm = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
|
||||
QSize btn_size = icon_size;
|
||||
btn_size += QSize(bm, bm);
|
||||
btn_dock->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
|
||||
btn_dock->setIconSize(icon_size);
|
||||
btn_dock->setFixedSize(btn_size);
|
||||
btn_hide->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
|
||||
btn_hide->setIconSize(icon_size);
|
||||
btn_hide->setFixedSize(btn_size);
|
||||
lbl_icon->setFixedSize(preferredIconSize(1.5, this));
|
||||
auto restyleButton = [this, icon_size, btn_size](QToolButton * btn, QStyle::StandardPixmap pm) {
|
||||
btn->setIcon(style()->standardIcon(pm));
|
||||
btn->setIconSize(icon_size);
|
||||
btn->setFixedSize(btn_size);
|
||||
};
|
||||
restyleButton(btn_dock, isFloating() ? QStyle::SP_TitleBarUnshadeButton : QStyle::SP_TitleBarShadeButton);
|
||||
restyleButton(btn_maximize, isMaximized() ? QStyle::SP_TitleBarNormalButton : QStyle::SP_TitleBarMaxButton);
|
||||
restyleButton(btn_hide, QStyle::SP_TitleBarCloseButton);
|
||||
btn_dock->setToolTip(isFloating() ? tr("Dock") : tr("Undock"));
|
||||
btn_maximize->setToolTip(isMaximized() ? tr("Show normal") : tr("Maximize"));
|
||||
btn_hide->setToolTip(tr("Hide"));
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::dockClicked() {
|
||||
if (!isFloating() && isMaximized()) showNormal();
|
||||
setFloating(!isFloating());
|
||||
}
|
||||
|
||||
|
||||
void EDockWidget::maximize() {
|
||||
if (!isFloating()) setFloating(true);
|
||||
if (isMaximized())
|
||||
showNormal();
|
||||
else
|
||||
showMaximized();
|
||||
}
|
||||
|
||||
@@ -35,34 +35,31 @@ class QAD_APPLICATION_EXPORT EDockWidget: public QDockWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags())
|
||||
: QDockWidget(title, parent, flags) {
|
||||
init();
|
||||
}
|
||||
explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()): QDockWidget(parent, flags) { init(); }
|
||||
~EDockWidget() {
|
||||
delete btn_hide;
|
||||
delete btn_dock;
|
||||
delete lbl_title;
|
||||
delete lbl_icon;
|
||||
delete header;
|
||||
}
|
||||
explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
~EDockWidget();
|
||||
|
||||
void setFeatures(QDockWidget::DockWidgetFeatures features);
|
||||
void setWindowTitle(const QString & title);
|
||||
void setWindowIcon(const QIcon & icon);
|
||||
|
||||
void setEmptyHeader();
|
||||
void setStandardHeader();
|
||||
|
||||
private:
|
||||
bool event(QEvent * e);
|
||||
bool event(QEvent * e) override;
|
||||
void changeEvent(QEvent * e) override;
|
||||
void init();
|
||||
void updateStyle();
|
||||
|
||||
QFrame * header;
|
||||
QWidget * empty_header;
|
||||
QLabel *lbl_title, *lbl_icon;
|
||||
QToolButton *btn_hide, *btn_dock;
|
||||
QToolButton *btn_hide, *btn_dock, *btn_maximize;
|
||||
|
||||
private slots:
|
||||
void dockClicked() { setFloating(!isFloating()); }
|
||||
void dockClicked();
|
||||
void maximize();
|
||||
};
|
||||
|
||||
#endif // EDOCKWIDGET_H
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <edockwidget.h>
|
||||
|
||||
|
||||
EMainWindow::EMainWindow(QWidget * parent)
|
||||
@@ -11,8 +12,7 @@ EMainWindow::EMainWindow(QWidget * parent)
|
||||
, action_show_all_tools(this)
|
||||
, action_hide_all_tools(this)
|
||||
, action_show_all_docks(this)
|
||||
, action_hide_all_docks(this)
|
||||
, first_show(true) {
|
||||
, action_hide_all_docks(this) {
|
||||
menu_recent = 0;
|
||||
action_clear_recent = new QAction(QIcon(":/icons/edit-clear.png"), tr("Clear recent list"), this);
|
||||
connect(action_clear_recent, SIGNAL(triggered()), this, SLOT(clearRecent()));
|
||||
@@ -268,8 +268,8 @@ void EMainWindow::initDocks() {
|
||||
|
||||
|
||||
void EMainWindow::initSession() {
|
||||
connect(&session, SIGNAL(loading(QPIConfig &)), this, SLOT(sessionLoading(QPIConfig &)));
|
||||
connect(&session, SIGNAL(saving(QPIConfig &)), this, SLOT(sessionSaving(QPIConfig &)));
|
||||
connect(&session, &SessionManager::loading, this, [this](QPIConfig & conf) { loadingSession(conf); });
|
||||
connect(&session, &SessionManager::saving, this, [this](QPIConfig & conf) { savingSession(conf); });
|
||||
}
|
||||
|
||||
|
||||
@@ -289,6 +289,12 @@ bool EMainWindow::checkSave() {
|
||||
}
|
||||
|
||||
|
||||
void EMainWindow::setChanged(bool yes) {
|
||||
is_changed = yes;
|
||||
setWindowModified(yes);
|
||||
}
|
||||
|
||||
|
||||
void EMainWindow::changedDock() {
|
||||
if (isHidden()) return;
|
||||
QSet<QDockWidget *> invalid_tab_docks;
|
||||
@@ -325,30 +331,19 @@ void EMainWindow::changedDock() {
|
||||
|
||||
for (QDockWidget * d: docks) {
|
||||
if (!d->titleBarWidget()) continue;
|
||||
QWidget * ctb = d->titleBarWidget();
|
||||
if (!d->property("__titleWidget").isValid()) {
|
||||
d->setProperty("__titleWidget", qulonglong(ctb));
|
||||
QWidget * ntb = new QWidget();
|
||||
int m = style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin);
|
||||
ntb->setLayout(new QBoxLayout(QBoxLayout::BottomToTop));
|
||||
ntb->layout()->setContentsMargins(m, m, 0, 0);
|
||||
d->setProperty("__titleEmptyWidget", qulonglong(ntb));
|
||||
}
|
||||
if (!tdocks.contains(d)) {
|
||||
// qDebug() << "add dock" << d;
|
||||
tdocks << d;
|
||||
connect(d, &QObject::destroyed, this, [this, d]() { tdocks.removeOne(d); });
|
||||
d->installEventFilter(this);
|
||||
}
|
||||
auto * ed = qobject_cast<EDockWidget *>(d);
|
||||
if (ed) {
|
||||
// qDebug() << d->windowTitle() << tabifiedDockWidgets(d);
|
||||
if (tabifiedDockWidgets(d).isEmpty() || invalid_tab_docks.contains(d)) {
|
||||
if (d->titleBarWidget() != (QWidget *)(d->property("__titleWidget").toULongLong()))
|
||||
d->setTitleBarWidget((QWidget *)(d->property("__titleWidget").toULongLong()));
|
||||
} else {
|
||||
if (d->titleBarWidget() != (QWidget *)(d->property("__titleEmptyWidget").toULongLong())) {
|
||||
d->setTitleBarWidget((QWidget *)(d->property("__titleEmptyWidget").toULongLong()));
|
||||
d->layout()->setContentsMargins(0, 20, 0, 0);
|
||||
}
|
||||
if (tabifiedDockWidgets(d).isEmpty() || invalid_tab_docks.contains(d))
|
||||
ed->setStandardHeader();
|
||||
else
|
||||
ed->setEmptyHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,59 +88,47 @@ public:
|
||||
void setRecentMenu(QMenu * m);
|
||||
|
||||
int maxRecentItems() const { return max_recent; }
|
||||
bool isChanged() const { return is_changed; }
|
||||
|
||||
protected:
|
||||
// Qt`s overloaded
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void changeEvent(QEvent * e);
|
||||
QMenu * createPopupMenu();
|
||||
void addToRecent(const QString & path);
|
||||
void prepareRecent();
|
||||
void showEvent(QShowEvent *) override;
|
||||
void closeEvent(QCloseEvent *) override;
|
||||
bool eventFilter(QObject * o, QEvent * e) override;
|
||||
void changeEvent(QEvent * e) override;
|
||||
QMenu * createPopupMenu() override;
|
||||
|
||||
void init(const QString & config) {
|
||||
session.setFile(config);
|
||||
initMenus();
|
||||
initSession();
|
||||
loadSession();
|
||||
} // unusable
|
||||
void saveSession();
|
||||
void loadSession();
|
||||
virtual void savingSession(QPIConfig & conf) {}
|
||||
void setChanged(bool yes = true);
|
||||
void addToRecent(const QString & path);
|
||||
|
||||
virtual void loadingSession(QPIConfig & conf) {}
|
||||
virtual void savingSession(QPIConfig & conf) {}
|
||||
virtual QSize dockTabsIconSize() const { return iconSize(); }
|
||||
virtual QString loadFilter() { return "All files(*)"; }
|
||||
virtual QString saveFilter() { return "All files(*)"; }
|
||||
|
||||
SessionManager session;
|
||||
QString file_name;
|
||||
|
||||
private:
|
||||
void prepareRecent();
|
||||
|
||||
bool checkSave();
|
||||
void setChanged(bool yes = true) {
|
||||
isChanged = yes;
|
||||
setWindowModified(yes);
|
||||
}
|
||||
|
||||
void initMenus();
|
||||
void initDocks();
|
||||
void initSession();
|
||||
|
||||
QAction action_show_all_tools, action_hide_all_tools, action_show_all_docks, action_hide_all_docks;
|
||||
QString file_name;
|
||||
QList<QTabBar *> tbars;
|
||||
QList<QDockWidget *> tdocks;
|
||||
QList<QAction *> actions_recent;
|
||||
QAction * action_clear_recent;
|
||||
QMenu * menu_recent;
|
||||
SessionManager session;
|
||||
bool isChanged, first_show;
|
||||
bool is_changed;
|
||||
int max_recent;
|
||||
|
||||
private slots:
|
||||
void changedDock();
|
||||
void sessionLoading(QPIConfig & conf) { loadingSession(conf); }
|
||||
void sessionSaving(QPIConfig & conf) { savingSession(conf); }
|
||||
void closeDock(int index);
|
||||
void recentTriggered();
|
||||
|
||||
public slots:
|
||||
void setMaxRecentItems(int mr);
|
||||
void changed() { setChanged(true); }
|
||||
@@ -152,6 +140,11 @@ public slots:
|
||||
bool saveAsFile();
|
||||
void clearRecent();
|
||||
|
||||
private slots:
|
||||
void changedDock();
|
||||
void closeDock(int index);
|
||||
void recentTriggered();
|
||||
|
||||
signals:
|
||||
};
|
||||
|
||||
|
||||
@@ -9,93 +9,121 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="41"/>
|
||||
<location filename="../aboutwindow.ui" line="44"/>
|
||||
<source>Versions</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="56"/>
|
||||
<location filename="../aboutwindow.ui" line="59"/>
|
||||
<source>Build</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="71"/>
|
||||
<location filename="../aboutwindow.ui" line="74"/>
|
||||
<source>Authors</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="100"/>
|
||||
<location filename="../aboutwindow.ui" line="103"/>
|
||||
<source>About Qt...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="111"/>
|
||||
<location filename="../aboutwindow.ui" line="114"/>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.cpp" line="33"/>
|
||||
<location filename="../aboutwindow.cpp" line="157"/>
|
||||
<location filename="../aboutwindow.cpp" line="155"/>
|
||||
<source>About</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EDockWidget</name>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="131"/>
|
||||
<source>Dock</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="131"/>
|
||||
<source>Undock</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="132"/>
|
||||
<source>Show normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="132"/>
|
||||
<source>Maximize</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="133"/>
|
||||
<source>Hide</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EMainWindow</name>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="12"/>
|
||||
<location filename="../emainwindow.cpp" line="130"/>
|
||||
<location filename="../emainwindow.cpp" line="17"/>
|
||||
<location filename="../emainwindow.cpp" line="123"/>
|
||||
<source>Clear recent list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="15"/>
|
||||
<location filename="../emainwindow.cpp" line="16"/>
|
||||
<location filename="../emainwindow.cpp" line="126"/>
|
||||
<location filename="../emainwindow.cpp" line="127"/>
|
||||
<location filename="../emainwindow.cpp" line="20"/>
|
||||
<location filename="../emainwindow.cpp" line="21"/>
|
||||
<location filename="../emainwindow.cpp" line="119"/>
|
||||
<location filename="../emainwindow.cpp" line="120"/>
|
||||
<source>Show all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="17"/>
|
||||
<location filename="../emainwindow.cpp" line="18"/>
|
||||
<location filename="../emainwindow.cpp" line="128"/>
|
||||
<location filename="../emainwindow.cpp" line="129"/>
|
||||
<location filename="../emainwindow.cpp" line="22"/>
|
||||
<location filename="../emainwindow.cpp" line="23"/>
|
||||
<location filename="../emainwindow.cpp" line="121"/>
|
||||
<location filename="../emainwindow.cpp" line="122"/>
|
||||
<source>Hide all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="152"/>
|
||||
<location filename="../emainwindow.cpp" line="144"/>
|
||||
<source>Toolbars</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="177"/>
|
||||
<location filename="../emainwindow.cpp" line="169"/>
|
||||
<source>Docks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="395"/>
|
||||
<location filename="../emainwindow.cpp" line="390"/>
|
||||
<source>Select file to open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="404"/>
|
||||
<location filename="../emainwindow.cpp" line="398"/>
|
||||
<source>Select files to open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="414"/>
|
||||
<location filename="../emainwindow.cpp" line="409"/>
|
||||
<source>Save changes%1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="414"/>
|
||||
<location filename="../emainwindow.cpp" line="409"/>
|
||||
<source> in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="427"/>
|
||||
<location filename="../emainwindow.cpp" line="423"/>
|
||||
<source>Select file to save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -103,8 +131,8 @@
|
||||
<context>
|
||||
<name>HistoryView</name>
|
||||
<message>
|
||||
<location filename="../historyview.cpp" line="17"/>
|
||||
<location filename="../historyview.cpp" line="97"/>
|
||||
<location filename="../historyview.cpp" line="19"/>
|
||||
<location filename="../historyview.cpp" line="96"/>
|
||||
<source>History cleared</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -117,26 +145,27 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.ui" line="119"/>
|
||||
<location filename="../logview.cpp" line="37"/>
|
||||
<location filename="../logview.cpp" line="133"/>
|
||||
<location filename="../logview.ui" line="125"/>
|
||||
<location filename="../logview.cpp" line="54"/>
|
||||
<location filename="../logview.cpp" line="222"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="35"/>
|
||||
<location filename="../logview.cpp" line="131"/>
|
||||
<location filename="../logview.cpp" line="52"/>
|
||||
<location filename="../logview.cpp" line="220"/>
|
||||
<source>Select All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="36"/>
|
||||
<location filename="../logview.cpp" line="132"/>
|
||||
<location filename="../logview.cpp" line="53"/>
|
||||
<location filename="../logview.cpp" line="221"/>
|
||||
<source>Copy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="46"/>
|
||||
<location filename="../logview.cpp" line="63"/>
|
||||
<location filename="../logview.cpp" line="219"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -9,93 +9,121 @@
|
||||
<translation> - О программе</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="41"/>
|
||||
<location filename="../aboutwindow.ui" line="44"/>
|
||||
<source>Versions</source>
|
||||
<translation>Версии</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="56"/>
|
||||
<location filename="../aboutwindow.ui" line="59"/>
|
||||
<source>Build</source>
|
||||
<translation>Сборка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="71"/>
|
||||
<location filename="../aboutwindow.ui" line="74"/>
|
||||
<source>Authors</source>
|
||||
<translation>Авторы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="100"/>
|
||||
<location filename="../aboutwindow.ui" line="103"/>
|
||||
<source>About Qt...</source>
|
||||
<translation>О Qt ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.ui" line="111"/>
|
||||
<location filename="../aboutwindow.ui" line="114"/>
|
||||
<source>OK</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../aboutwindow.cpp" line="33"/>
|
||||
<location filename="../aboutwindow.cpp" line="157"/>
|
||||
<location filename="../aboutwindow.cpp" line="155"/>
|
||||
<source>About</source>
|
||||
<translation>О программе</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EDockWidget</name>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="131"/>
|
||||
<source>Dock</source>
|
||||
<translation>Закрепить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="131"/>
|
||||
<source>Undock</source>
|
||||
<translation>Открепить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="132"/>
|
||||
<source>Show normal</source>
|
||||
<translation>Восстановить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="132"/>
|
||||
<source>Maximize</source>
|
||||
<translation>Развернуть</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../edockwidget.cpp" line="133"/>
|
||||
<source>Hide</source>
|
||||
<translation>Скрыть</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EMainWindow</name>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="12"/>
|
||||
<location filename="../emainwindow.cpp" line="130"/>
|
||||
<location filename="../emainwindow.cpp" line="17"/>
|
||||
<location filename="../emainwindow.cpp" line="123"/>
|
||||
<source>Clear recent list</source>
|
||||
<translation>Очистить список недавних</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="15"/>
|
||||
<location filename="../emainwindow.cpp" line="16"/>
|
||||
<location filename="../emainwindow.cpp" line="126"/>
|
||||
<location filename="../emainwindow.cpp" line="127"/>
|
||||
<location filename="../emainwindow.cpp" line="20"/>
|
||||
<location filename="../emainwindow.cpp" line="21"/>
|
||||
<location filename="../emainwindow.cpp" line="119"/>
|
||||
<location filename="../emainwindow.cpp" line="120"/>
|
||||
<source>Show all</source>
|
||||
<translation>Показать все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="17"/>
|
||||
<location filename="../emainwindow.cpp" line="18"/>
|
||||
<location filename="../emainwindow.cpp" line="128"/>
|
||||
<location filename="../emainwindow.cpp" line="129"/>
|
||||
<location filename="../emainwindow.cpp" line="22"/>
|
||||
<location filename="../emainwindow.cpp" line="23"/>
|
||||
<location filename="../emainwindow.cpp" line="121"/>
|
||||
<location filename="../emainwindow.cpp" line="122"/>
|
||||
<source>Hide all</source>
|
||||
<translation>Скрыть все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="152"/>
|
||||
<location filename="../emainwindow.cpp" line="144"/>
|
||||
<source>Toolbars</source>
|
||||
<translation>Панели инструментов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="177"/>
|
||||
<location filename="../emainwindow.cpp" line="169"/>
|
||||
<source>Docks</source>
|
||||
<translation>Окна</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="395"/>
|
||||
<location filename="../emainwindow.cpp" line="390"/>
|
||||
<source>Select file to open</source>
|
||||
<translation>Выбрать файл для открытия</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="404"/>
|
||||
<location filename="../emainwindow.cpp" line="398"/>
|
||||
<source>Select files to open</source>
|
||||
<translation>Выберите файлы для открытия</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="414"/>
|
||||
<location filename="../emainwindow.cpp" line="409"/>
|
||||
<source>Save changes%1?</source>
|
||||
<translation>Сохранить изменения%1?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="414"/>
|
||||
<location filename="../emainwindow.cpp" line="409"/>
|
||||
<source> in</source>
|
||||
<translation> в</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../emainwindow.cpp" line="427"/>
|
||||
<location filename="../emainwindow.cpp" line="423"/>
|
||||
<source>Select file to save</source>
|
||||
<translation>Выберите файл для сохранения</translation>
|
||||
</message>
|
||||
@@ -103,8 +131,8 @@
|
||||
<context>
|
||||
<name>HistoryView</name>
|
||||
<message>
|
||||
<location filename="../historyview.cpp" line="17"/>
|
||||
<location filename="../historyview.cpp" line="97"/>
|
||||
<location filename="../historyview.cpp" line="19"/>
|
||||
<location filename="../historyview.cpp" line="96"/>
|
||||
<source>History cleared</source>
|
||||
<translation>История очищена</translation>
|
||||
</message>
|
||||
@@ -117,26 +145,27 @@
|
||||
<translation>Категория:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.ui" line="119"/>
|
||||
<location filename="../logview.cpp" line="37"/>
|
||||
<location filename="../logview.cpp" line="133"/>
|
||||
<location filename="../logview.ui" line="125"/>
|
||||
<location filename="../logview.cpp" line="54"/>
|
||||
<location filename="../logview.cpp" line="222"/>
|
||||
<source>Clear</source>
|
||||
<translation>Очистить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="35"/>
|
||||
<location filename="../logview.cpp" line="131"/>
|
||||
<location filename="../logview.cpp" line="52"/>
|
||||
<location filename="../logview.cpp" line="220"/>
|
||||
<source>Select All</source>
|
||||
<translation>Выделить всё</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="36"/>
|
||||
<location filename="../logview.cpp" line="132"/>
|
||||
<location filename="../logview.cpp" line="53"/>
|
||||
<location filename="../logview.cpp" line="221"/>
|
||||
<source>Copy</source>
|
||||
<translation>Копировать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logview.cpp" line="46"/>
|
||||
<location filename="../logview.cpp" line="63"/>
|
||||
<location filename="../logview.cpp" line="219"/>
|
||||
<source>All</source>
|
||||
<translation>Все</translation>
|
||||
</message>
|
||||
|
||||
@@ -1252,24 +1252,31 @@ void Graphic::setCurrentGraphic(int arg) {
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setGraphicsCount(int arg, bool update) {
|
||||
if (arg < 0) return;
|
||||
while (graphics.size() < arg) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
graphics.append(
|
||||
GraphicType(tr("y(x)"),
|
||||
QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - QRandomGenerator::global()->generate() % 115)));
|
||||
# define _G_QRAND_ QRandomGenerator::global()->generate()
|
||||
#else
|
||||
graphics.append(GraphicType(tr("y(x)"), QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - qrand() % 115)));
|
||||
# define _G_QRAND_ qrand()
|
||||
#endif
|
||||
|
||||
void Graphic::setGraphicsCount(int count, bool update) {
|
||||
if (count < 0) return;
|
||||
while (graphics.size() < count) {
|
||||
GraphicType gt(tr("y(x)"));
|
||||
if (loaded_configs.size() > graphics.size())
|
||||
gt = loaded_configs[graphics.size()];
|
||||
else
|
||||
gt.pen.setColor(QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - _G_QRAND_ % 115));
|
||||
graphics.append(gt);
|
||||
}
|
||||
while (graphics.size() > arg) {
|
||||
while (graphics.size() > count) {
|
||||
delete graphics.back().pb;
|
||||
graphics.pop_back();
|
||||
}
|
||||
if (update) updateLegend();
|
||||
}
|
||||
|
||||
#undef _G_QRAND_
|
||||
|
||||
|
||||
void Graphic::removeGraphic(int arg, bool update) {
|
||||
if (arg < 0 || arg >= graphics.size()) return;
|
||||
@@ -2309,6 +2316,10 @@ void Graphic::on_graphic_buttonConfigure_clicked() {
|
||||
setGridEnabled(conf->ui->groupGrid->isChecked());
|
||||
updateLegend();
|
||||
repaintCanvas();
|
||||
for (int i = 0; i < qMin<int>(graphics.size(), loaded_configs.size()); ++i) {
|
||||
loaded_configs[i] = graphics[i];
|
||||
loaded_configs[i].removeData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2702,6 +2713,9 @@ void Graphic::load(QByteArray ba) {
|
||||
setLegendVisible(a);
|
||||
} break;
|
||||
}
|
||||
loaded_configs = graphics;
|
||||
for (auto & i: loaded_configs)
|
||||
i.removeData();
|
||||
if (has_opengl != isOGL) setOpenGL(has_opengl);
|
||||
updateLegend();
|
||||
repaintCanvas(true);
|
||||
|
||||
@@ -442,7 +442,7 @@ protected:
|
||||
QBrush selbrush;
|
||||
QPen grid_pen, selpen;
|
||||
QColor back_color, text_color;
|
||||
QVector<GraphicType> graphics;
|
||||
QVector<GraphicType> graphics, loaded_configs;
|
||||
int curGraphic;
|
||||
GraphicAction curaction, prevaction;
|
||||
QRectF grect, selrect, limit_, def_rect;
|
||||
|
||||
@@ -3,6 +3,38 @@
|
||||
#include "qad_types.h"
|
||||
#include "ui_graphic_conf.h"
|
||||
|
||||
// GraphicType
|
||||
|
||||
GraphicType::GraphicType(QString name_, QColor color, Qt::PenStyle style, double width, bool visible_) {
|
||||
pen.setColor(color);
|
||||
pen.setStyle(style);
|
||||
lines = true;
|
||||
points = false;
|
||||
fill = false;
|
||||
fill_color = Qt::yellow;
|
||||
if (qRound(width) == width)
|
||||
pen.setWidth(qRound(width));
|
||||
else
|
||||
pen.setWidthF(width);
|
||||
pen.setWidth(1);
|
||||
pen.setCosmetic(true);
|
||||
max_x = 0.;
|
||||
name = name_;
|
||||
visible = visible_;
|
||||
pointWidth = 2.;
|
||||
pb = new QCheckBox(name);
|
||||
}
|
||||
|
||||
|
||||
void GraphicType::removeData() {
|
||||
polyline.clear();
|
||||
polyline_pause.clear();
|
||||
_lod.clear();
|
||||
_lod_pause.clear();
|
||||
}
|
||||
|
||||
|
||||
// GraphicConf
|
||||
|
||||
GraphicConf::GraphicConf(QVector<GraphicType> & graphics_, QWidget * parent): QDialog(parent), graphics(graphics_) {
|
||||
ui = new Ui::GraphicConf();
|
||||
|
||||
@@ -38,25 +38,8 @@ struct QAD_GRAPHIC_EXPORT GraphicType {
|
||||
QColor color = Qt::red,
|
||||
Qt::PenStyle style = Qt::SolidLine,
|
||||
double width = 0.,
|
||||
bool visible_ = true) {
|
||||
pen.setColor(color);
|
||||
pen.setStyle(style);
|
||||
lines = true;
|
||||
points = false;
|
||||
fill = false;
|
||||
fill_color = Qt::yellow;
|
||||
if (qRound(width) == width)
|
||||
pen.setWidth(qRound(width));
|
||||
else
|
||||
pen.setWidthF(width);
|
||||
pen.setWidth(1);
|
||||
pen.setCosmetic(true);
|
||||
max_x = 0.;
|
||||
name = name_;
|
||||
visible = visible_;
|
||||
pointWidth = 2.;
|
||||
pb = new QCheckBox(name);
|
||||
}
|
||||
bool visible_ = true);
|
||||
void removeData();
|
||||
//~GraphicType() {delete pb;}
|
||||
QString name;
|
||||
QPolygonF polyline;
|
||||
|
||||
Reference in New Issue
Block a user