diff --git a/CMakeLists.txt b/CMakeLists.txt index fbb806c..776f594 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ set(CPP_SOURCE_FILES set(UI_FILES ui/mainWindow.ui + ui/dbBrowser.ui ui/connectionDialog.ui ui/messageDialog.ui ui/modelInfoEditDialog.ui diff --git a/include/dbBrowser.h b/include/dbBrowser.h index e69de29..6e55f0f 100644 --- a/include/dbBrowser.h +++ b/include/dbBrowser.h @@ -0,0 +1,20 @@ +#include + +QT_BEGIN_NAMESPACE +namespace Ui { +class DatabaseBrowser; +} +QT_END_NAMESPACE + + +class DatabaseBrowser : public QWidget +{ + Q_OBJECT + +public: + DatabaseBrowser(QWidget *parent = nullptr); + ~DatabaseBrowser(); + +private: + Ui::DatabaseBrowser *ui; +}; diff --git a/include/mainwindow.h b/include/mainwindow.h index 4bd45e4..42f04b7 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -7,6 +7,7 @@ #include "messageDialog.h" class DatabaseManager; +class DatabaseBrowser; class ConnectionDialog; class DBStructureView; class DBStructureModel; @@ -38,6 +39,7 @@ private: Ui::MainWindow *ui; DatabaseManager* m_dbManager; + DatabaseBrowser* m_dbBrowser; QSqlError m_lastSqlError; MessageDialog* m_pMessageDialog; ConnectionDialog* m_pConnectionDialog; diff --git a/resource/PowerModeler.qrc b/resource/PowerModeler.qrc index 9b703d4..d3810a3 100644 --- a/resource/PowerModeler.qrc +++ b/resource/PowerModeler.qrc @@ -1,5 +1,21 @@ + images/icon_first.png + images/icon_last.png + images/icon_next.png + images/icon_previous.png + images/icon_refresh3.png + images/icon_close.png + images/icon_done.png + images/icon_plus.png + images/icon_subtra.png + images/icon_save2.png + images/icon_copy.png + images/icon_paste.png + images/icon_download.png + images/icon_refresh2.png + images/icon_addItem.png + images/icon_remove3.png images/icon_hierarchy2.png images/icon_add_hover.png images/icon_remove2.png diff --git a/resource/images/icon_addItem.png b/resource/images/icon_addItem.png new file mode 100644 index 0000000..35da62c Binary files /dev/null and b/resource/images/icon_addItem.png differ diff --git a/resource/images/icon_close.png b/resource/images/icon_close.png new file mode 100644 index 0000000..d27a7ae Binary files /dev/null and b/resource/images/icon_close.png differ diff --git a/resource/images/icon_copy.png b/resource/images/icon_copy.png new file mode 100644 index 0000000..65f2e0f Binary files /dev/null and b/resource/images/icon_copy.png differ diff --git a/resource/images/icon_done.png b/resource/images/icon_done.png new file mode 100644 index 0000000..5a977d1 Binary files /dev/null and b/resource/images/icon_done.png differ diff --git a/resource/images/icon_download.png b/resource/images/icon_download.png new file mode 100644 index 0000000..9679294 Binary files /dev/null and b/resource/images/icon_download.png differ diff --git a/resource/images/icon_first.png b/resource/images/icon_first.png new file mode 100644 index 0000000..c730010 Binary files /dev/null and b/resource/images/icon_first.png differ diff --git a/resource/images/icon_last.png b/resource/images/icon_last.png new file mode 100644 index 0000000..85aff0a Binary files /dev/null and b/resource/images/icon_last.png differ diff --git a/resource/images/icon_next.png b/resource/images/icon_next.png new file mode 100644 index 0000000..69fc258 Binary files /dev/null and b/resource/images/icon_next.png differ diff --git a/resource/images/icon_paste.png b/resource/images/icon_paste.png new file mode 100644 index 0000000..ed03724 Binary files /dev/null and b/resource/images/icon_paste.png differ diff --git a/resource/images/icon_plus.png b/resource/images/icon_plus.png new file mode 100644 index 0000000..eabe77e Binary files /dev/null and b/resource/images/icon_plus.png differ diff --git a/resource/images/icon_previous.png b/resource/images/icon_previous.png new file mode 100644 index 0000000..7a982c1 Binary files /dev/null and b/resource/images/icon_previous.png differ diff --git a/resource/images/icon_refresh2.png b/resource/images/icon_refresh2.png new file mode 100644 index 0000000..4f58631 Binary files /dev/null and b/resource/images/icon_refresh2.png differ diff --git a/resource/images/icon_refresh3.png b/resource/images/icon_refresh3.png new file mode 100644 index 0000000..0034f33 Binary files /dev/null and b/resource/images/icon_refresh3.png differ diff --git a/resource/images/icon_remove3.png b/resource/images/icon_remove3.png new file mode 100644 index 0000000..8d7661e Binary files /dev/null and b/resource/images/icon_remove3.png differ diff --git a/resource/images/icon_save2.png b/resource/images/icon_save2.png new file mode 100644 index 0000000..c9945ea Binary files /dev/null and b/resource/images/icon_save2.png differ diff --git a/resource/images/icon_subtra.png b/resource/images/icon_subtra.png new file mode 100644 index 0000000..30eb021 Binary files /dev/null and b/resource/images/icon_subtra.png differ diff --git a/source/dbBrowser.cpp b/source/dbBrowser.cpp index e69de29..47d8b37 100644 --- a/source/dbBrowser.cpp +++ b/source/dbBrowser.cpp @@ -0,0 +1,14 @@ +#include "dbBrowser.h" +#include "ui_dbBrowser.h" + +DatabaseBrowser::DatabaseBrowser(QWidget *parent) + : QWidget(parent) + , ui(new Ui::DatabaseBrowser) +{ + ui->setupUi(this); +} + +DatabaseBrowser::~DatabaseBrowser() +{ + delete ui; +} diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index 56c045b..4963305 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -2,6 +2,7 @@ #include "./ui_mainwindow.h" #include "dbManager.h" +#include "dbBrowser.h" #include "connectionDialog.h" #include "dbStructureView.h" #include "dbStructureModel.h" @@ -16,6 +17,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_dbManager(nullptr) + , m_dbBrowser(nullptr) , m_pMessageDialog(nullptr) , m_pConnectionDialog(nullptr) , m_pModelInfoDialog(nullptr) @@ -62,6 +64,9 @@ void MainWindow::initialize() connect(m_dbManager, &DatabaseManager::errorOccurred, this, &MainWindow::onSIG_errorFromDBManger); connect(m_dbManager, &DatabaseManager::connectionStatusChanged, this, &MainWindow::onSIG_connectionStatusChanged); + m_dbBrowser = new DatabaseBrowser(this); + ui->layoutAttributeBrowser->addWidget(m_dbBrowser); + m_pDBStrutureView = new DBStructureView(m_dbManager, this); m_pDBStrutureView->setMainWindow(this); connect(m_pDBStrutureView, &DBStructureView::actionTrigger_addModel, this, &MainWindow::onActionTrigger_addModel); @@ -74,8 +79,13 @@ void MainWindow::initialize() int nWidth = screen->size().width() * 0.8; int nHeight = screen->size().height() * 0.8; this->resize(nWidth, nHeight); - ui->splitter->setStretchFactor(0, 1); - ui->splitter->setStretchFactor(1, 10); + //在子部件内含有复杂布局和嵌套空间的时候,setStretchFactor会失效,固采用setSizes的方法来设置初始大小 + QVector factor{1.0, 6.0}; + int nDBStructureWidth = nWidth * (factor.at(0) / (factor.at(0) + factor.at(1))); + int nDBBrowserWidth = nWidth - nDBStructureWidth; + ui->splitter->setSizes({nDBStructureWidth, nDBBrowserWidth}); + // ui->splitter->setStretchFactor(0, 1); + // ui->splitter->setStretchFactor(1, 7); } void MainWindow::showMessageDialog(MessageDialogType type,const QString& strTitle,const QString& strContent) diff --git a/source/sqlQueryExecutor.cpp b/source/sqlQueryExecutor.cpp index c537ccc..12a54cc 100644 --- a/source/sqlQueryExecutor.cpp +++ b/source/sqlQueryExecutor.cpp @@ -76,7 +76,6 @@ QSqlQuery SqlQueryExecutor::executeSQL(const QString& strConnectionName, const Q throw; // 重新抛出异常 } - return sqlQuery; } //多条批量SQL语句执行接口 diff --git a/ui/dbBrowser.ui b/ui/dbBrowser.ui new file mode 100644 index 0000000..d7808bf --- /dev/null +++ b/ui/dbBrowser.ui @@ -0,0 +1,596 @@ + + + DatabaseBrowser + + + + 0 + 0 + 1192 + 597 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + :/img/images/icon_hierarchy2.png:/img/images/icon_hierarchy2.png + + + NULL + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + 0 + 31 + + + + + 16777215 + 31 + + + + QWidget #toolBar +{ +} + +QPushButton +{ + border: 0px solid rgb(205,205,205); + border-radius:0px; +} +QPushButton:hover +{ + background-color:rgba(70,130,180,35); +} +QPushButton:pressed +{ + background-color:rgba(70,130,180,65); +} + + + + QLayout::SizeConstraint::SetNoConstraint + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + false + + + + 10 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 添加 + + + + + + + + + + :/img/images/icon_plus.png:/img/images/icon_plus.png + + + + 16 + 16 + + + + + + false + + + + 36 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 删除 + + + + + + + + + + :/img/images/icon_subtra.png:/img/images/icon_subtra.png + + + + 16 + 16 + + + + + + false + + + + 62 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 提交更改 + + + + + + + :/img/images/icon_done.png:/img/images/icon_done.png + + + + 16 + 16 + + + + + + false + + + + 88 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 取销更改 + + + + + + + :/img/images/icon_close.png:/img/images/icon_close.png + + + + 16 + 16 + + + + + + false + + + + 114 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 刷新 + + + + + + + + + + :/img/images/icon_refresh3.png:/img/images/icon_refresh3.png + + + + 16 + 16 + + + + + + + + + Qt::Orientation::Horizontal + + + + 827 + 20 + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + false + + + + 108 + 5 + 41 + 21 + + + + + 41 + 21 + + + + + 41 + 21 + + + + border:0px; +background-color: rgb(255, 255, 255); + + + 1 + + + Qt::AlignmentFlag::AlignCenter + + + + + false + + + + 68 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 第一页 + + + + + + + + + + :/img/images/icon_first.png:/img/images/icon_first.png + + + + 16 + 16 + + + + + + false + + + + 170 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 最后一页 + + + + + + + + + + :/img/images/icon_last.png:/img/images/icon_last.png + + + + 16 + 16 + + + + + + false + + + + 88 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 上一页 + + + + + + + + + + :/img/images/icon_previous.png:/img/images/icon_previous.png + + + + 16 + 16 + + + + + + false + + + + 150 + 5 + 21 + 21 + + + + + 21 + 21 + + + + + 21 + 21 + + + + 下一页 + + + + + + + + + + :/img/images/icon_next.png:/img/images/icon_next.png + + + + 16 + 16 + + + + + + + + + + + + + + + diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index e407473..bf381db 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -155,6 +155,20 @@ QTreeView::item:selected + + + 0 + + + 0 + + + 0 + + + 0 + + @@ -200,7 +214,6 @@ QTreeView::item:selected - toolBar