diff --git a/src/plugins/scxmleditor/CMakeLists.txt b/src/plugins/scxmleditor/CMakeLists.txt index 68c96d73eed..fef49a90827 100644 --- a/src/plugins/scxmleditor/CMakeLists.txt +++ b/src/plugins/scxmleditor/CMakeLists.txt @@ -2,30 +2,30 @@ add_qtc_plugin(ScxmlEditor INCLUDES common plugin_interface outputpane PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor SOURCES - common/colorpicker.cpp common/colorpicker.h common/colorpicker.ui - common/colorsettings.cpp common/colorsettings.h common/colorsettings.ui - common/colorthemedialog.cpp common/colorthemedialog.h common/colorthemedialog.ui + common/colorpicker.cpp common/colorpicker.h + common/colorsettings.cpp common/colorsettings.h + common/colorthemedialog.cpp common/colorthemedialog.h common/colorthemes.cpp common/colorthemes.h common/colorthemeview.cpp common/colorthemeview.h common/colortoolbutton.cpp common/colortoolbutton.h common/common.qrc common/dragshapebutton.cpp common/dragshapebutton.h common/graphicsview.cpp common/graphicsview.h - common/magnifier.cpp common/magnifier.h common/magnifier.ui + common/magnifier.cpp common/magnifier.h common/mainwidget.cpp common/mainwidget.h common/movableframe.cpp common/movableframe.h common/navigator.cpp common/navigator.h common/navigatorgraphicsview.cpp common/navigatorgraphicsview.h - common/navigatorslider.cpp common/navigatorslider.h common/navigatorslider.ui - common/search.cpp common/search.h common/search.ui + common/navigatorslider.cpp common/navigatorslider.h + common/search.cpp common/search.h common/searchmodel.cpp common/searchmodel.h common/shapegroupwidget.cpp common/shapegroupwidget.h - common/shapestoolbox.cpp common/shapestoolbox.h common/shapestoolbox.ui + common/shapestoolbox.cpp common/shapestoolbox.h common/sizegrip.cpp common/sizegrip.h common/stateproperties.cpp common/stateproperties.h - common/stateview.cpp common/stateview.h common/stateview.ui - common/statistics.cpp common/statistics.h common/statistics.ui - common/statisticsdialog.cpp common/statisticsdialog.h common/statisticsdialog.ui + common/stateview.cpp common/stateview.h + common/statistics.cpp common/statistics.h + common/statisticsdialog.cpp common/statisticsdialog.h common/structure.cpp common/structure.h common/structuremodel.cpp common/structuremodel.h common/treeview.cpp common/treeview.h diff --git a/src/plugins/scxmleditor/common/colorpicker.cpp b/src/plugins/scxmleditor/common/colorpicker.cpp index e994ff9b27a..bcd88213f46 100644 --- a/src/plugins/scxmleditor/common/colorpicker.cpp +++ b/src/plugins/scxmleditor/common/colorpicker.cpp @@ -4,20 +4,22 @@ #include "colorpicker.h" #include "scxmleditorconstants.h" -#include +#include #include +#include +#include + using namespace ScxmlEditor::Common; const char C_SETTINGS_COLORPICKER_LASTUSEDCOLORS[] = "ScxmlEditor/ColorPickerLastUsedColors_%1"; +constexpr int C_BUTTON_COLUMNS_COUNT = 5; ColorPicker::ColorPicker(const QString &key, QWidget *parent) : QFrame(parent) , m_key(key) { - m_ui.setupUi(this); - const QVector colors = { qRgb(0xed, 0xf7, 0xf2), qRgb(0xdf, 0xd3, 0xb6), qRgb(0x89, 0x72, 0x5b), qRgb(0xff, 0xd3, 0x93), qRgb(0xff, 0x97, 0x4f), qRgb(0xff, 0x85, 0x0d), qRgb(0xf7, 0xe9, 0x67), qRgb(0xef, 0xc9, 0x4c), qRgb(0xff, 0xe1, 0x1a), qRgb(0xc2, 0xe0, 0x78), @@ -25,26 +27,31 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent) qRgb(0xc5, 0xba, 0xfc), qRgb(0xb6, 0x65, 0xfc), qRgb(0xa5, 0x08, 0xd0), qRgb(0xcc, 0x56, 0x64), qRgb(0x96, 0x2d, 0x3e) }; - auto vBoxLayout = new QVBoxLayout; - vBoxLayout->setContentsMargins(0, 0, 0, 0); - vBoxLayout->setSpacing(0); + auto basicColorContentFrame = new QWidget; + auto lastUsedColorContainer = new QWidget; - const int buttonRowsCount = 4; - const int buttonColumnsCount = 5; + m_lastUsedColorContainer = new QHBoxLayout(lastUsedColorContainer); + m_lastUsedColorContainer->setContentsMargins(0, 0, 0, 0); - for (int r = 0; r < buttonRowsCount; ++r) { - auto hBoxLayout = new QHBoxLayout; - hBoxLayout->setContentsMargins(0, 0, 0, 0); - hBoxLayout->setSpacing(0); - - for (int c = 0; c < buttonColumnsCount; ++c) - hBoxLayout->addWidget(createButton(colors[r * buttonColumnsCount + c])); - - hBoxLayout->addStretch(); - vBoxLayout->addLayout(hBoxLayout); + using namespace Utils::Layouting; + Grid colorGrid; + for (int i = 0; i < colors.count(); ++i) { + QWidget *button = createButton(colors[i]); + colorGrid.addItem(button); + if ((i + 1) % C_BUTTON_COLUMNS_COUNT == 0) + colorGrid.addItem(br); + if (i == 0) + m_lastUsedColorContainer->addSpacerItem(new QSpacerItem(0, button->sizeHint().height(), + QSizePolicy::MinimumExpanding, + QSizePolicy::Preferred)); } - - m_ui.basicColorContentFrame->setLayout(vBoxLayout); + colorGrid.attachTo(basicColorContentFrame, WithoutMargins); + Column { + tr("Basic Colors"), + basicColorContentFrame, + tr("Last used colors"), + lastUsedColorContainer, + }.attachTo(this); const QStringList lastColors = Core::ICore::settings()->value( QString::fromLatin1(C_SETTINGS_COLORPICKER_LASTUSEDCOLORS).arg(m_key), QStringList()).toStringList(); @@ -69,12 +76,12 @@ void ColorPicker::setLastUsedColor(const QString &colorName) m_lastUsedColorNames.insert(0, colorName); m_lastUsedColorButtons.insert(0, createButton(colorName)); - while (m_lastUsedColorButtons.count() > 5) { + while (m_lastUsedColorButtons.count() > C_BUTTON_COLUMNS_COUNT) { m_lastUsedColorButtons.takeLast()->deleteLater(); m_lastUsedColorNames.takeLast(); } - m_ui.lastUsedColorLayout->insertWidget(0, m_lastUsedColorButtons.first()); + m_lastUsedColorContainer->insertWidget(0, m_lastUsedColorButtons.first()); } QToolButton *ColorPicker::createButton(const QColor &color) diff --git a/src/plugins/scxmleditor/common/colorpicker.h b/src/plugins/scxmleditor/common/colorpicker.h index 000043041ed..71a96cbf621 100644 --- a/src/plugins/scxmleditor/common/colorpicker.h +++ b/src/plugins/scxmleditor/common/colorpicker.h @@ -3,10 +3,12 @@ #pragma once -#include "ui_colorpicker.h" #include -QT_FORWARD_DECLARE_CLASS(QToolButton) +QT_BEGIN_NAMESPACE +class QHBoxLayout; +class QToolButton; +QT_END_NAMESPACE namespace ScxmlEditor { @@ -31,7 +33,8 @@ private: QStringList m_lastUsedColorNames; QVector m_lastUsedColorButtons; QString m_key; - Ui::ColorPicker m_ui; + + QHBoxLayout *m_lastUsedColorContainer; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/colorpicker.ui b/src/plugins/scxmleditor/common/colorpicker.ui deleted file mode 100644 index 12521f41152..00000000000 --- a/src/plugins/scxmleditor/common/colorpicker.ui +++ /dev/null @@ -1,175 +0,0 @@ - - - ScxmlEditor::Common::ColorPicker - - - - 0 - 0 - 79 - 183 - - - - Frame - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Basic Colors - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Last used colors - - - - - - - - 0 - 0 - - - - - 0 - 10 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - diff --git a/src/plugins/scxmleditor/common/colorsettings.cpp b/src/plugins/scxmleditor/common/colorsettings.cpp index 3e7837213da..f0fc76e0cfa 100644 --- a/src/plugins/scxmleditor/common/colorsettings.cpp +++ b/src/plugins/scxmleditor/common/colorsettings.cpp @@ -2,63 +2,80 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "colorsettings.h" +#include "colorthemeview.h" #include "scxmleditorconstants.h" +#include #include #include +#include #include +#include +#include using namespace ScxmlEditor::Common; ColorSettings::ColorSettings(QWidget *parent) : QFrame(parent) { - m_ui.setupUi(this); - - m_ui.m_colorThemeView->setEnabled(false); - + m_colorThemeView = new ColorThemeView; + m_colorThemeView->setEnabled(false); + m_comboColorThemes = new QComboBox; + auto addTheme = new QToolButton; + addTheme->setIcon(Utils::Icons::PLUS.icon()); + addTheme->setAutoRaise(true); + auto removeTheme = new QToolButton; + removeTheme->setIcon(Utils::Icons::MINUS.icon()); + removeTheme->setAutoRaise(true); const QSettings *s = Core::ICore::settings(); - m_colorThemes = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap(); + m_comboColorThemes->addItems(m_colorThemes.keys()); + m_comboColorThemes->setCurrentText( + s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString()); + selectTheme(m_comboColorThemes->currentIndex()); - m_ui.m_comboColorThemes->clear(); - for (auto it = m_colorThemes.cbegin(); it != m_colorThemes.cend(); ++it) - m_ui.m_comboColorThemes->addItem(it.key()); - m_ui.m_comboColorThemes->setCurrentText(s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString()); + using namespace Utils::Layouting; + Column { + Row { + m_comboColorThemes, + addTheme, + removeTheme, + }, + m_colorThemeView, + }.attachTo(this, WithoutMargins); - connect(m_ui.m_comboColorThemes, - &QComboBox::currentIndexChanged, - this, - &ColorSettings::selectTheme); - connect(m_ui.m_colorThemeView, &ColorThemeView::colorChanged, this, &ColorSettings::updateCurrentColors); - connect(m_ui.m_addColorTheme, &QToolButton::clicked, this, &ColorSettings::createTheme); - connect(m_ui.m_removeColorTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme); + connect(m_comboColorThemes, &QComboBox::currentIndexChanged, + this, &ColorSettings::selectTheme); + connect(m_colorThemeView, &ColorThemeView::colorChanged, + this, &ColorSettings::updateCurrentColors); + connect(addTheme, &QToolButton::clicked, this, &ColorSettings::createTheme); + connect(removeTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme); } void ColorSettings::save() { QSettings *s = Core::ICore::settings(); s->setValue(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES, m_colorThemes); - s->setValue(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, m_ui.m_comboColorThemes->currentText()); + s->setValue(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, m_comboColorThemes->currentText()); } void ColorSettings::updateCurrentColors() { - m_colorThemes[m_ui.m_comboColorThemes->currentText()] = m_ui.m_colorThemeView->colorData(); + m_colorThemes[m_comboColorThemes->currentText()] = m_colorThemeView->colorData(); } void ColorSettings::selectTheme(int index) { - const QString name = m_ui.m_comboColorThemes->itemText(index); - m_ui.m_colorThemeView->reset(); + const QString name = m_comboColorThemes->itemText(index); + m_colorThemeView->reset(); if (!name.isEmpty() && m_colorThemes.contains(name)) { - m_ui.m_colorThemeView->setEnabled(true); + m_colorThemeView->setEnabled(true); const QVariantMap colordata = m_colorThemes[name].toMap(); for (auto it = colordata.cbegin(); it != colordata.cend(); ++it) - m_ui.m_colorThemeView->setColor(it.key().toInt(), QColor(it.value().toString())); + m_colorThemeView->setColor(it.key().toInt(), QColor(it.value().toString())); } else { - m_ui.m_colorThemeView->setEnabled(false); + m_colorThemeView->setEnabled(false); } } @@ -69,25 +86,25 @@ void ColorSettings::createTheme() if (m_colorThemes.contains(name)) { QMessageBox::warning(this, tr("Cannot Create Theme"), tr("Theme %1 is already available.").arg(name)); } else { - m_ui.m_colorThemeView->reset(); + m_colorThemeView->reset(); m_colorThemes[name] = QVariantMap(); - m_ui.m_comboColorThemes->addItem(name); - m_ui.m_comboColorThemes->setCurrentText(name); + m_comboColorThemes->addItem(name); + m_comboColorThemes->setCurrentText(name); } } } void ColorSettings::removeTheme() { - const QString name = m_ui.m_comboColorThemes->currentText(); + const QString name = m_comboColorThemes->currentText(); const QMessageBox::StandardButton result = QMessageBox::question(this, tr("Remove Color Theme"), tr("Are you sure you want to delete color theme %1?").arg(name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (result == QMessageBox::Yes) { - m_ui.m_comboColorThemes->removeItem(m_ui.m_comboColorThemes->currentIndex()); + m_comboColorThemes->removeItem(m_comboColorThemes->currentIndex()); m_colorThemes.remove(name); - m_ui.m_comboColorThemes->setCurrentIndex(0); + m_comboColorThemes->setCurrentIndex(0); if (m_colorThemes.isEmpty()) - m_ui.m_colorThemeView->setEnabled(false); + m_colorThemeView->setEnabled(false); } } diff --git a/src/plugins/scxmleditor/common/colorsettings.h b/src/plugins/scxmleditor/common/colorsettings.h index ab8df0d4797..46b4b84d961 100644 --- a/src/plugins/scxmleditor/common/colorsettings.h +++ b/src/plugins/scxmleditor/common/colorsettings.h @@ -3,12 +3,17 @@ #pragma once -#include "ui_colorsettings.h" #include +QT_BEGIN_NAMESPACE +class QComboBox; +QT_END_NAMESPACE + namespace ScxmlEditor { namespace Common { +class ColorThemeView; + class ColorSettings : public QFrame { Q_OBJECT @@ -25,7 +30,8 @@ private: void selectTheme(int); QVariantMap m_colorThemes; - Ui::ColorSettings m_ui; + ColorThemeView *m_colorThemeView; + QComboBox *m_comboColorThemes; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/colorsettings.ui b/src/plugins/scxmleditor/common/colorsettings.ui deleted file mode 100644 index 3982823dafa..00000000000 --- a/src/plugins/scxmleditor/common/colorsettings.ui +++ /dev/null @@ -1,66 +0,0 @@ - - - ScxmlEditor::Common::ColorSettings - - - - 0 - 0 - 330 - 306 - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - ColorThemeView - QFrame -
colorthemeview.h
- 1 -
-
- - -
diff --git a/src/plugins/scxmleditor/common/colorthemedialog.cpp b/src/plugins/scxmleditor/common/colorthemedialog.cpp index 9a434b71e8c..3eeb6dd5410 100644 --- a/src/plugins/scxmleditor/common/colorthemedialog.cpp +++ b/src/plugins/scxmleditor/common/colorthemedialog.cpp @@ -2,20 +2,40 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "colorthemedialog.h" +#include "colorsettings.h" + +#include + +#include +#include using namespace ScxmlEditor::Common; ColorThemeDialog::ColorThemeDialog(QWidget *parent) : QDialog(parent) { - m_ui.setupUi(this); + resize(400, 440); - connect(m_ui.m_btnOk, &QPushButton::clicked, this, &ColorThemeDialog::accept); - connect(m_ui.m_btnCancel, &QPushButton::clicked, this, &ColorThemeDialog::reject); - connect(m_ui.m_btnApply, &QPushButton::clicked, this, &ColorThemeDialog::save); + m_colorSettings = new ColorSettings; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel | + QDialogButtonBox::Apply); + + using namespace Utils::Layouting; + Column { + m_colorSettings, + buttonBox, + }.attachTo(this); + + connect(buttonBox, &QDialogButtonBox::accepted, this, &ColorThemeDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &ColorThemeDialog::reject); + connect(buttonBox, &QDialogButtonBox::clicked, this, [buttonBox, this](QAbstractButton *btn) { + if (buttonBox->standardButton(btn) == QDialogButtonBox::Apply) + save(); + }); } void ColorThemeDialog::save() { - m_ui.m_colorSettings->save(); + m_colorSettings->save(); } diff --git a/src/plugins/scxmleditor/common/colorthemedialog.h b/src/plugins/scxmleditor/common/colorthemedialog.h index e5f65e64dac..8335bdf4b39 100644 --- a/src/plugins/scxmleditor/common/colorthemedialog.h +++ b/src/plugins/scxmleditor/common/colorthemedialog.h @@ -3,13 +3,14 @@ #pragma once -#include "ui_colorthemedialog.h" #include namespace ScxmlEditor { namespace Common { +class ColorSettings; + class ColorThemeDialog : public QDialog { Q_OBJECT @@ -20,7 +21,7 @@ public: void save(); private: - Ui::ColorThemeDialog m_ui; + ColorSettings *m_colorSettings; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/colorthemedialog.ui b/src/plugins/scxmleditor/common/colorthemedialog.ui deleted file mode 100644 index 6b0de010348..00000000000 --- a/src/plugins/scxmleditor/common/colorthemedialog.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - ScxmlEditor::Common::ColorThemeDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - Cancel - - - - - - - Apply - - - - - - - - - - ColorSettings - QFrame -
colorsettings.h
- 1 -
-
- - -
diff --git a/src/plugins/scxmleditor/common/colorthemes.cpp b/src/plugins/scxmleditor/common/colorthemes.cpp index c8e45f74655..c6f8c849a09 100644 --- a/src/plugins/scxmleditor/common/colorthemes.cpp +++ b/src/plugins/scxmleditor/common/colorthemes.cpp @@ -12,6 +12,7 @@ #include #include +#include using namespace ScxmlEditor::Common; diff --git a/src/plugins/scxmleditor/common/graphicsview.cpp b/src/plugins/scxmleditor/common/graphicsview.cpp index 8ceb2c939c9..31b17f26e9b 100644 --- a/src/plugins/scxmleditor/common/graphicsview.cpp +++ b/src/plugins/scxmleditor/common/graphicsview.cpp @@ -31,6 +31,7 @@ GraphicsView::GraphicsView(QWidget *parent) setRubberBandSelectionMode(Qt::ContainsItemShape); setBackgroundBrush(QBrush(QColor(0xef, 0xef, 0xef))); setAcceptDrops(true); + setFrameShape(QFrame::NoFrame); connect(horizontalScrollBar(), &QScrollBar::valueChanged, this, &GraphicsView::updateView); connect(verticalScrollBar(), &QScrollBar::valueChanged, this, &GraphicsView::updateView); diff --git a/src/plugins/scxmleditor/common/magnifier.cpp b/src/plugins/scxmleditor/common/magnifier.cpp index 1cad3fa107f..87ba9628189 100644 --- a/src/plugins/scxmleditor/common/magnifier.cpp +++ b/src/plugins/scxmleditor/common/magnifier.cpp @@ -6,15 +6,21 @@ #include "graphicsview.h" #include +#include using namespace ScxmlEditor::Common; Magnifier::Magnifier(QWidget *parent) : QWidget(parent) { - m_ui.setupUi(this); setMouseTracking(true); - m_ui.m_graphicsView->setEnabled(false); + m_graphicsView = new QGraphicsView(this); + m_graphicsView->setInteractive(false); + m_graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_graphicsView->setEnabled(false); + auto layout = new QVBoxLayout(this); + layout->addWidget(m_graphicsView); } void Magnifier::setTopLeft(const QPoint &topLeft) @@ -34,7 +40,7 @@ void Magnifier::resizeEvent(QResizeEvent *e) m_gradientBrush.setColorAt(0.0, QColor(0, 0, 0, 255)); int cap = radius * 0.1; - m_ui.m_graphicsView->setMask(QRegion(rect().adjusted(cap, cap, -cap, -cap), QRegion::Ellipse)); + m_graphicsView->setMask(QRegion(rect().adjusted(cap, cap, -cap, -cap), QRegion::Ellipse)); } void Magnifier::showEvent(QShowEvent *e) @@ -53,8 +59,8 @@ void Magnifier::mousePressEvent(QMouseEvent *e) { QWidget::mousePressEvent(e); if (m_mainView) - m_mainView->magnifierClicked(m_ui.m_graphicsView->transform().m11(), - m_ui.m_graphicsView->mapToScene(e->pos() - m_topLeft + rect().center())); + m_mainView->magnifierClicked(m_graphicsView->transform().m11(), + m_graphicsView->mapToScene(e->pos() - m_topLeft + rect().center())); } void Magnifier::mouseMoveEvent(QMouseEvent *e) @@ -68,12 +74,12 @@ void Magnifier::wheelEvent(QWheelEvent *e) QWidget::wheelEvent(e); if (e->angleDelta().y() > 0) - m_ui.m_graphicsView->scale(1.1, 1.1); + m_graphicsView->scale(1.1, 1.1); else - m_ui.m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1); + m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1); if (m_mainView) - m_ui.m_graphicsView->centerOn(m_mainView->mapToScene(pos() - m_topLeft + rect().center())); + m_graphicsView->centerOn(m_mainView->mapToScene(pos() - m_topLeft + rect().center())); } void Magnifier::moveEvent(QMoveEvent *e) @@ -81,7 +87,7 @@ void Magnifier::moveEvent(QMoveEvent *e) QWidget::moveEvent(e); if (m_mainView) - m_ui.m_graphicsView->centerOn(m_mainView->mapToScene(e->pos() - m_topLeft + rect().center())); + m_graphicsView->centerOn(m_mainView->mapToScene(e->pos() - m_topLeft + rect().center())); } void Magnifier::setCurrentView(GraphicsView *view) @@ -91,7 +97,7 @@ void Magnifier::setCurrentView(GraphicsView *view) void Magnifier::setCurrentScene(ScxmlEditor::PluginInterface::GraphicsScene *scene) { - m_ui.m_graphicsView->setScene(scene); + m_graphicsView->setScene(scene); } void Magnifier::paintEvent(QPaintEvent *e) diff --git a/src/plugins/scxmleditor/common/magnifier.h b/src/plugins/scxmleditor/common/magnifier.h index c001c55514e..5b2df0e158b 100644 --- a/src/plugins/scxmleditor/common/magnifier.h +++ b/src/plugins/scxmleditor/common/magnifier.h @@ -6,9 +6,10 @@ #include #include -#include "ui_magnifier.h" - -QT_FORWARD_DECLARE_CLASS(QMouseEvent) +QT_BEGIN_NAMESPACE +class QGraphicsView; +class QMouseEvent; +QT_END_NAMESPACE namespace ScxmlEditor { @@ -46,7 +47,7 @@ private: QPoint m_topLeft; QPointer m_mainView; QRadialGradient m_gradientBrush; - Ui::Magnifier m_ui; + QGraphicsView *m_graphicsView; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/magnifier.ui b/src/plugins/scxmleditor/common/magnifier.ui deleted file mode 100644 index ebf58caf3cc..00000000000 --- a/src/plugins/scxmleditor/common/magnifier.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - ScxmlEditor::Common::Magnifier - - - - 0 - 0 - 400 - 300 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - false - - - - - - - - diff --git a/src/plugins/scxmleditor/common/mainwidget.cpp b/src/plugins/scxmleditor/common/mainwidget.cpp index a47ad3dcf71..0e820ffa12b 100644 --- a/src/plugins/scxmleditor/common/mainwidget.cpp +++ b/src/plugins/scxmleditor/common/mainwidget.cpp @@ -8,6 +8,7 @@ #include "colortoolbutton.h" #include "errorwidget.h" #include "graphicsscene.h" +#include "graphicsview.h" #include "magnifier.h" #include "navigator.h" #include "outputtabwidget.h" @@ -38,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/src/plugins/scxmleditor/common/navigator.cpp b/src/plugins/scxmleditor/common/navigator.cpp index 39a76dcbd7b..459553846ba 100644 --- a/src/plugins/scxmleditor/common/navigator.cpp +++ b/src/plugins/scxmleditor/common/navigator.cpp @@ -14,6 +14,7 @@ #include #include #include +#include using namespace ScxmlEditor::Common; diff --git a/src/plugins/scxmleditor/common/navigatorslider.cpp b/src/plugins/scxmleditor/common/navigatorslider.cpp index 40e33eb1bc6..74c589c5dd6 100644 --- a/src/plugins/scxmleditor/common/navigatorslider.cpp +++ b/src/plugins/scxmleditor/common/navigatorslider.cpp @@ -3,32 +3,64 @@ #include "navigatorslider.h" +#include +#include + +#include +#include + using namespace ScxmlEditor::Common; NavigatorSlider::NavigatorSlider(QWidget *parent) : QFrame(parent) { - m_ui.setupUi(this); + m_slider = new QSlider(Qt::Horizontal); + m_slider->setMinimum(0); + m_slider->setMaximum(100); - connect(m_ui.m_zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut); - connect(m_ui.m_zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn); - connect(m_ui.m_slider, &QSlider::valueChanged, this, [=](int newValue){ + auto zoomIn = new QToolButton; + zoomIn->setIcon(Utils::Icons::PLUS.icon()); + auto zoomOut = new QToolButton; + zoomOut->setIcon(Utils::Icons::MINUS.icon()); + for (auto btn : {zoomIn, zoomOut}) { + btn->setAutoRaise(true); + btn->setAutoRepeat(true); + btn->setAutoRepeatDelay(200); + btn->setAutoRepeatInterval(10); + } + + using namespace Utils::Layouting; + Row { + zoomOut, + m_slider, + zoomIn, + Space(20), + }.setSpacing(0).attachTo(this, WithoutMargins); + + connect(zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut); + connect(zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn); + connect(m_slider, &QSlider::valueChanged, this, [=](int newValue){ emit valueChanged(newValue); }); } void NavigatorSlider::zoomIn() { - m_ui.m_slider->setValue(m_ui.m_slider->value() + 1); + m_slider->setValue(m_slider->value() + 1); } void NavigatorSlider::zoomOut() { - m_ui.m_slider->setValue(m_ui.m_slider->value() - 1); + m_slider->setValue(m_slider->value() - 1); +} + +int NavigatorSlider::value() const +{ + return m_slider->value(); } void NavigatorSlider::setSliderValue(int val) { - QSignalBlocker blocker(m_ui.m_slider); - m_ui.m_slider->setValue(val); + QSignalBlocker blocker(m_slider); + m_slider->setValue(val); } diff --git a/src/plugins/scxmleditor/common/navigatorslider.h b/src/plugins/scxmleditor/common/navigatorslider.h index d8f159a01d8..60d3742f624 100644 --- a/src/plugins/scxmleditor/common/navigatorslider.h +++ b/src/plugins/scxmleditor/common/navigatorslider.h @@ -3,10 +3,12 @@ #pragma once -#include "ui_navigatorslider.h" - #include +QT_BEGIN_NAMESPACE +class QSlider; +QT_END_NAMESPACE + namespace ScxmlEditor { namespace Common { @@ -18,11 +20,7 @@ class NavigatorSlider : public QFrame public: explicit NavigatorSlider(QWidget *parent = nullptr); - int value() const - { - return m_ui.m_slider->value(); - } - + int value() const; void setSliderValue(int val); void zoomIn(); void zoomOut(); @@ -31,7 +29,7 @@ signals: void valueChanged(int); private: - Ui::NavigatorSlider m_ui; + QSlider *m_slider; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/navigatorslider.ui b/src/plugins/scxmleditor/common/navigatorslider.ui deleted file mode 100644 index aa961aa351a..00000000000 --- a/src/plugins/scxmleditor/common/navigatorslider.ui +++ /dev/null @@ -1,143 +0,0 @@ - - - ScxmlEditor::Common::NavigatorSlider - - - - 0 - 0 - 240 - 40 - - - - Frame - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - :/scxmleditor/images/minus.png:/scxmleditor/images/minus.png - - - true - - - 200 - - - 10 - - - Qt::ToolButtonTextOnly - - - true - - - - - - - 0 - - - 100 - - - 100 - - - 100 - - - Qt::Horizontal - - - false - - - - - - - + - - - - :/scxmleditor/images/plus.png:/scxmleditor/images/plus.png - - - true - - - 200 - - - 10 - - - Qt::ToolButtonTextOnly - - - true - - - - - - - - - - - diff --git a/src/plugins/scxmleditor/common/search.cpp b/src/plugins/scxmleditor/common/search.cpp index ad3e92b04f7..52a6fd74255 100644 --- a/src/plugins/scxmleditor/common/search.cpp +++ b/src/plugins/scxmleditor/common/search.cpp @@ -5,17 +5,23 @@ #include "graphicsscene.h" #include "scxmldocument.h" #include "searchmodel.h" +#include "tableview.h" +#include +#include + +#include #include using namespace ScxmlEditor::PluginInterface; using namespace ScxmlEditor::Common; +using namespace ScxmlEditor::OutputPane; + +constexpr char FILTER_WILDCARD[] = "xxxxxxxx"; Search::Search(QWidget *parent) : OutputPane(parent) { - m_ui.setupUi(this); - m_model = new SearchModel(this); m_proxyModel = new QSortFilterProxyModel(this); @@ -24,24 +30,41 @@ Search::Search(QWidget *parent) m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setSourceModel(m_model); m_proxyModel->setDynamicSortFilter(false); - m_proxyModel->setFilterWildcard("xxxxxxxx"); + m_proxyModel->setFilterWildcard(FILTER_WILDCARD); - m_ui.m_searchView->setModel(m_proxyModel); + m_searchEdit = new Utils::FancyLineEdit; + m_searchEdit->setFiltering(true); - connect(m_ui.m_searchEdit, &QLineEdit::textChanged, this, &Search::setSearchText); - connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::pressed, this, &Search::rowActivated); - connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::entered, this, &Search::rowEntered); + m_searchView = new TableView; + m_searchView->setAlternatingRowColors(true); + m_searchView->setShowGrid(false); + m_searchView->setSortingEnabled(true); + m_searchView->setSelectionMode(QAbstractItemView::SingleSelection); + m_searchView->setSelectionBehavior(QAbstractItemView::SelectRows); + m_searchView->horizontalHeader()->setStretchLastSection(true); + m_searchView->setModel(m_proxyModel); + m_searchView->setFrameShape(QFrame::NoFrame); + + using namespace Utils::Layouting; + Column { + m_searchEdit, + m_searchView, + }.setSpacing(0).attachTo(this, WithoutMargins); + + connect(m_searchEdit, &Utils::FancyLineEdit::textChanged, this, &Search::setSearchText); + connect(m_searchView, &TableView::pressed, this, &Search::rowActivated); + connect(m_searchView, &TableView::entered, this, &Search::rowEntered); } void Search::setPaneFocus() { - m_ui.m_searchEdit->setFocus(); + m_searchEdit->setFocus(); } void Search::setSearchText(const QString &text) { m_model->setFilter(text); - m_proxyModel->setFilterWildcard(text.isEmpty() ? "xxxxxxxx" : text); + m_proxyModel->setFilterWildcard(text.isEmpty() ? FILTER_WILDCARD : text); } void Search::setDocument(ScxmlDocument *document) @@ -53,7 +76,7 @@ void Search::setDocument(ScxmlDocument *document) void Search::setGraphicsScene(GraphicsScene *scene) { m_scene = scene; - connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::mouseExited, m_scene.data(), &GraphicsScene::unhighlightAll); + connect(m_searchView, &TableView::mouseExited, m_scene.data(), &GraphicsScene::unhighlightAll); } void Search::rowEntered(const QModelIndex &index) diff --git a/src/plugins/scxmleditor/common/search.h b/src/plugins/scxmleditor/common/search.h index 5b2ce13f338..c59c6287e0c 100644 --- a/src/plugins/scxmleditor/common/search.h +++ b/src/plugins/scxmleditor/common/search.h @@ -4,7 +4,6 @@ #pragma once #include "outputpane.h" -#include "ui_search.h" #include @@ -13,6 +12,8 @@ QT_FORWARD_DECLARE_CLASS(QSortFilterProxyModel) +namespace Utils { class FancyLineEdit; } + namespace ScxmlEditor { namespace PluginInterface { @@ -20,6 +21,8 @@ class GraphicsScene; class ScxmlDocument; } // namespace PluginInterface +namespace OutputPane { class TableView; } + namespace Common { class SearchModel; @@ -57,7 +60,9 @@ private: SearchModel *m_model; QSortFilterProxyModel *m_proxyModel; QPointer m_document; - Ui::Search m_ui; + + Utils::FancyLineEdit *m_searchEdit; + ScxmlEditor::OutputPane::TableView *m_searchView; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/search.ui b/src/plugins/scxmleditor/common/search.ui deleted file mode 100644 index 30fd3d6fda5..00000000000 --- a/src/plugins/scxmleditor/common/search.ui +++ /dev/null @@ -1,210 +0,0 @@ - - - ScxmlEditor::Common::Search - - - - 0 - 0 - 400 - 300 - - - - - 0 - 30 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 31 - - - - - 16777215 - 16777215 - - - - - 0 - 0 - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 3 - - - 0 - - - 3 - - - 0 - - - - - Enter search term - - - true - - - - - - - - - - - 0 - 1 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - true - - - true - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - false - - - Qt::NoPen - - - true - - - false - - - 80 - - - 50 - - - true - - - false - - - 19 - - - 19 - - - - - - - - - - - TableView - QTableView -
tableview.h
-
-
- - -
diff --git a/src/plugins/scxmleditor/common/shapestoolbox.cpp b/src/plugins/scxmleditor/common/shapestoolbox.cpp index 659efdcc7a3..b90ff81da37 100644 --- a/src/plugins/scxmleditor/common/shapestoolbox.cpp +++ b/src/plugins/scxmleditor/common/shapestoolbox.cpp @@ -6,12 +6,11 @@ #include "scxmluifactory.h" #include "shapegroupwidget.h" #include "shapeprovider.h" -#include "ui_shapestoolbox.h" -#include -#include -#include +#include +#include +#include #include using namespace ScxmlEditor::Common; @@ -19,7 +18,21 @@ using namespace ScxmlEditor::Common; ShapesToolbox::ShapesToolbox(QWidget *parent) : QFrame(parent) { - m_ui.setupUi(this); + auto scrollArea = new QScrollArea; + scrollArea->setFrameShape(NoFrame); + scrollArea->setWidgetResizable(true); + + auto shapeGroupsContainer = new QWidget; + scrollArea->setWidget(shapeGroupsContainer); + + m_shapeGroupsLayout = new QVBoxLayout(shapeGroupsContainer); + m_shapeGroupsLayout->setContentsMargins(0, 0, 0, 0); + m_shapeGroupsLayout->setSpacing(0); + + using namespace Utils::Layouting; + Column { + scrollArea, + }.setSpacing(0).attachTo(this, WithoutMargins); } void ShapesToolbox::setUIFactory(ScxmlEditor::PluginInterface::ScxmlUiFactory *factory) @@ -42,10 +55,11 @@ void ShapesToolbox::initView() for (int i = 0; i < m_shapeProvider->groupCount(); ++i) { auto widget = new ShapeGroupWidget(m_shapeProvider, i); m_widgets << widget; - m_ui.m_shapeGrouplayout->addWidget(widget); + m_shapeGroupsLayout->addWidget(widget); } } - m_ui.m_shapeGrouplayout->update(); + m_shapeGroupsLayout->addStretch(1); + m_shapeGroupsLayout->update(); update(); } diff --git a/src/plugins/scxmleditor/common/shapestoolbox.h b/src/plugins/scxmleditor/common/shapestoolbox.h index c30c767a1ed..8f9a3211c4c 100644 --- a/src/plugins/scxmleditor/common/shapestoolbox.h +++ b/src/plugins/scxmleditor/common/shapestoolbox.h @@ -3,11 +3,13 @@ #pragma once -#include "ui_shapestoolbox.h" - #include #include +QT_BEGIN_NAMESPACE +class QVBoxLayout; +QT_END_NAMESPACE + namespace ScxmlEditor { namespace PluginInterface { @@ -33,7 +35,7 @@ public: private: QPointer m_shapeProvider; QList m_widgets; - Ui::ShapesToolbox m_ui; + QVBoxLayout *m_shapeGroupsLayout; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/shapestoolbox.ui b/src/plugins/scxmleditor/common/shapestoolbox.ui deleted file mode 100644 index 10a50288392..00000000000 --- a/src/plugins/scxmleditor/common/shapestoolbox.ui +++ /dev/null @@ -1,114 +0,0 @@ - - - ScxmlEditor::Common::ShapesToolbox - - - - 0 - 0 - 321 - 665 - - - - - 0 - 0 - - - - Frame - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 321 - 665 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - diff --git a/src/plugins/scxmleditor/common/stateview.cpp b/src/plugins/scxmleditor/common/stateview.cpp index fadcb7a8aa7..c3df0695d8e 100644 --- a/src/plugins/scxmleditor/common/stateview.cpp +++ b/src/plugins/scxmleditor/common/stateview.cpp @@ -3,10 +3,15 @@ #include "stateview.h" #include "graphicsscene.h" +#include "graphicsview.h" #include "scxmldocument.h" #include "scxmluifactory.h" #include "stateitem.h" +#include + +#include + using namespace ScxmlEditor::PluginInterface; using namespace ScxmlEditor::Common; @@ -14,14 +19,27 @@ StateView::StateView(StateItem *state, QWidget *parent) : QWidget(parent) , m_parentState(state) { - m_ui.setupUi(this); - m_isMainView = !m_parentState; - connect(m_ui.m_btnClose, &QPushButton::clicked, this, &StateView::closeView); + auto titleBar = new QWidget; + titleBar->setVisible(!m_isMainView); + auto stateNameLabel = new QLabel; + stateNameLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + stateNameLabel->setAlignment(Qt::AlignCenter); if (!m_isMainView) - m_ui.m_stateName->setText(m_parentState->itemId()); - m_ui.m_titleFrame->setVisible(!m_isMainView); + stateNameLabel->setText(m_parentState->itemId()); + + m_graphicsView = new GraphicsView; + + using namespace Utils::Layouting; + Row { + PushButton{ text("Back"), onClicked([this] { closeView(); }, this) }, + stateNameLabel, + }.attachTo(titleBar, WithoutMargins); + + Column { + titleBar, m_graphicsView + }.setSpacing(0).attachTo(this, WithoutMargins); initScene(); } @@ -47,7 +65,7 @@ void StateView::initScene() { // Init scene m_scene = new GraphicsScene(this); - m_ui.m_graphicsView->setGraphicsScene(m_scene); + m_graphicsView->setGraphicsScene(m_scene); } void StateView::closeView() @@ -58,14 +76,14 @@ void StateView::closeView() void StateView::setUiFactory(ScxmlUiFactory *factory) { m_scene->setUiFactory(factory); - m_ui.m_graphicsView->setUiFactory(factory); + m_graphicsView->setUiFactory(factory); } void StateView::setDocument(ScxmlDocument *doc) { // Set document to scene m_scene->setDocument(doc); - m_ui.m_graphicsView->setDocument(doc); + m_graphicsView->setDocument(doc); if (doc) connect(doc, &ScxmlDocument::colorThemeChanged, m_scene, [this] { m_scene->invalidate(); }); } @@ -82,5 +100,5 @@ GraphicsScene *StateView::scene() const GraphicsView *StateView::view() const { - return m_ui.m_graphicsView; + return m_graphicsView; } diff --git a/src/plugins/scxmleditor/common/stateview.h b/src/plugins/scxmleditor/common/stateview.h index bae8bae3449..b0a90971dd9 100644 --- a/src/plugins/scxmleditor/common/stateview.h +++ b/src/plugins/scxmleditor/common/stateview.h @@ -3,8 +3,6 @@ #pragma once -#include "ui_stateview.h" - #include namespace ScxmlEditor { @@ -18,6 +16,8 @@ class ScxmlUiFactory; namespace Common { +class GraphicsView; + class StateView : public QWidget { Q_OBJECT @@ -42,7 +42,7 @@ private: PluginInterface::StateItem *m_parentState = nullptr; PluginInterface::GraphicsScene *m_scene = nullptr; bool m_isMainView; - Ui::StateView m_ui; + GraphicsView *m_graphicsView; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/stateview.ui b/src/plugins/scxmleditor/common/stateview.ui deleted file mode 100644 index 38d1349d994..00000000000 --- a/src/plugins/scxmleditor/common/stateview.ui +++ /dev/null @@ -1,99 +0,0 @@ - - - ScxmlEditor::Common::StateView - - - - 0 - 0 - 400 - 300 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Back - - - - :/scxmleditor/images/icon-undo.png - - - - - - - - Qt::AlignCenter - - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - - - GraphicsView - QGraphicsView -
graphicsview.h
-
-
- - -
diff --git a/src/plugins/scxmleditor/common/statistics.cpp b/src/plugins/scxmleditor/common/statistics.cpp index c0d7084fc69..43d7f129111 100644 --- a/src/plugins/scxmleditor/common/statistics.cpp +++ b/src/plugins/scxmleditor/common/statistics.cpp @@ -6,7 +6,11 @@ #include "statistics.h" #include "warningmodel.h" +#include +#include + #include +#include #include using namespace ScxmlEditor::PluginInterface; @@ -112,24 +116,38 @@ QVariant StatisticsModel::data(const QModelIndex &index, int role) const Statistics::Statistics(QWidget *parent) : QFrame(parent) { - m_ui.setupUi(this); - m_model = new StatisticsModel(this); + m_fileNameLabel = new QLabel; + m_fileNameLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + m_levels = new QLabel; + + m_timeLabel = new QLabel; + m_timeLabel->setText(QDateTime::currentDateTime().toString(tr("yyyy/MM/dd hh:mm:ss"))); + m_proxyModel = new QSortFilterProxyModel(this); m_proxyModel->setFilterKeyColumn(-1); m_proxyModel->setSourceModel(m_model); - m_ui.m_statisticsView->setModel(m_proxyModel); - m_ui.m_timeLabel->setText(QDateTime::currentDateTime().toString(tr("yyyy/MM/dd hh:mm:ss"))); + m_statisticsView = new Utils::TreeView; + m_statisticsView->setModel(m_proxyModel); + m_statisticsView->setAlternatingRowColors(true); + m_statisticsView->setSortingEnabled(true); + + using namespace Utils::Layouting; + Grid { + tr("File"), m_fileNameLabel, br, + tr("Time"), m_timeLabel, br, + tr("Max. levels"), m_levels, br, + Span(2, m_statisticsView), br + }.attachTo(this, WithoutMargins); } void Statistics::setDocument(ScxmlDocument *doc) { - m_ui.m_fileNameLabel->setText(doc->fileName()); + m_fileNameLabel->setText(doc->fileName()); m_model->setDocument(doc); m_proxyModel->invalidate(); m_proxyModel->sort(1, Qt::DescendingOrder); - m_ui.m_statisticsView->resizeColumnsToContents(); - m_ui.m_levels->setText(QString::fromLatin1("%1").arg(m_model->levels())); + m_levels->setText(QString::fromLatin1("%1").arg(m_model->levels())); } diff --git a/src/plugins/scxmleditor/common/statistics.h b/src/plugins/scxmleditor/common/statistics.h index aaa7fdb75fb..0ea2895565b 100644 --- a/src/plugins/scxmleditor/common/statistics.h +++ b/src/plugins/scxmleditor/common/statistics.h @@ -3,12 +3,15 @@ #pragma once -#include "ui_statistics.h" - #include #include -QT_FORWARD_DECLARE_CLASS(QSortFilterProxyModel) +QT_BEGIN_NAMESPACE +class QLabel; +class QSortFilterProxyModel; +QT_END_NAMESPACE + +namespace Utils { class TreeView; } namespace ScxmlEditor { @@ -53,7 +56,10 @@ public: private: StatisticsModel *m_model; QSortFilterProxyModel *m_proxyModel; - Ui::Statistics m_ui; + QLabel *m_fileNameLabel; + QLabel *m_levels; + QLabel *m_timeLabel; + Utils::TreeView *m_statisticsView; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/statistics.ui b/src/plugins/scxmleditor/common/statistics.ui deleted file mode 100644 index 60fd6b63279..00000000000 --- a/src/plugins/scxmleditor/common/statistics.ui +++ /dev/null @@ -1,143 +0,0 @@ - - - ScxmlEditor::Common::Statistics - - - - 0 - 0 - 375 - 258 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 15 - - - 6 - - - - - Time - - - - - - - - - - - - - - 0 - - - - - - - File - - - - - - - - 0 - 0 - - - - - - - - - - - true - - - QAbstractItemView::ScrollPerPixel - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - true - - - false - - - - - - - - 0 - 0 - - - - Max. levels - - - - - - - - 0 - 5 - - - - - 16777215 - 5 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - - diff --git a/src/plugins/scxmleditor/common/statisticsdialog.cpp b/src/plugins/scxmleditor/common/statisticsdialog.cpp index 4b30d74fbec..718a481395b 100644 --- a/src/plugins/scxmleditor/common/statisticsdialog.cpp +++ b/src/plugins/scxmleditor/common/statisticsdialog.cpp @@ -2,19 +2,34 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "scxmldocument.h" +#include "statistics.h" #include "statisticsdialog.h" +#include + +#include + using namespace ScxmlEditor::Common; StatisticsDialog::StatisticsDialog(QWidget *parent) : QDialog(parent) { - m_ui.setupUi(this); + resize(400, 300); setWindowTitle(tr("Document Statistics")); - connect(m_ui.m_okButton, &QPushButton::clicked, this, &StatisticsDialog::accept); + + m_statistics = new Statistics; + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); + + using namespace Utils::Layouting; + Column { + m_statistics, + buttonBox, + }.attachTo(this); + + connect(buttonBox, &QDialogButtonBox::accepted, this, &StatisticsDialog::accept); } void StatisticsDialog::setDocument(ScxmlEditor::PluginInterface::ScxmlDocument *doc) { - m_ui.m_statistics->setDocument(doc); + m_statistics->setDocument(doc); } diff --git a/src/plugins/scxmleditor/common/statisticsdialog.h b/src/plugins/scxmleditor/common/statisticsdialog.h index a100c0ba5ff..cec5606dd14 100644 --- a/src/plugins/scxmleditor/common/statisticsdialog.h +++ b/src/plugins/scxmleditor/common/statisticsdialog.h @@ -3,8 +3,6 @@ #pragma once -#include "ui_statisticsdialog.h" - #include namespace ScxmlEditor { @@ -13,6 +11,8 @@ namespace PluginInterface { class ScxmlDocument; } namespace Common { +class Statistics; + class StatisticsDialog : public QDialog { Q_OBJECT @@ -23,7 +23,7 @@ public: void setDocument(PluginInterface::ScxmlDocument *doc); private: - Ui::StatisticsDialog m_ui; + Statistics *m_statistics; }; } // namespace Common diff --git a/src/plugins/scxmleditor/common/statisticsdialog.ui b/src/plugins/scxmleditor/common/statisticsdialog.ui deleted file mode 100644 index b9fc8908613..00000000000 --- a/src/plugins/scxmleditor/common/statisticsdialog.ui +++ /dev/null @@ -1,75 +0,0 @@ - - - ScxmlEditor::Common::StatisticsDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - true - - - true - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - - - - Statistics - QFrame -
statistics.h
- 1 -
-
- - -
diff --git a/src/plugins/scxmleditor/scxmleditor.qbs b/src/plugins/scxmleditor/scxmleditor.qbs index f6212f7e552..c110b92f28d 100644 --- a/src/plugins/scxmleditor/scxmleditor.qbs +++ b/src/plugins/scxmleditor/scxmleditor.qbs @@ -64,17 +64,6 @@ QtcPlugin { "treeview.h", "treeview.cpp", "common.qrc", - - "magnifier.ui", - "colorpicker.ui", - "colorsettings.ui", - "colorthemedialog.ui", - "navigatorslider.ui", - "search.ui", - "shapestoolbox.ui", - "stateview.ui", - "statistics.ui", - "statisticsdialog.ui", ] }