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:
@@ -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);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
auto * ed = qobject_cast<EDockWidget *>(d);
|
||||
if (ed) {
|
||||
// qDebug() << d->windowTitle() << tabifiedDockWidgets(d);
|
||||
if (tabifiedDockWidgets(d).isEmpty() || invalid_tab_docks.contains(d))
|
||||
ed->setStandardHeader();
|
||||
else
|
||||
ed->setEmptyHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user