Moved code from TablesPage into seperate PropetiesPage component
Clears up the TablePage and makes rhe propertypage reusable.
This commit is contained in:
parent
b8cfb223be
commit
38ae5f50e4
8 changed files with 73 additions and 36 deletions
|
|
@ -9,7 +9,7 @@
|
|||
#include "IndexModel.h"
|
||||
#include "MainWindow.h"
|
||||
#include "PgLabItemDelegate.h"
|
||||
#include "PropertyProxyModel.h"
|
||||
#include "PropertiesPage.h"
|
||||
#include "ResultTableModelUtil.h"
|
||||
#include "SqlFormattingUtils.h"
|
||||
#include "SqlSyntaxHighlighter.h"
|
||||
|
|
@ -54,14 +54,6 @@ TablesPage::TablesPage(MainWindow *parent)
|
|||
ui->indexesTable->setItemDelegate(pglab_delegate);
|
||||
ui->indexesTable->setItemDelegateForColumn(0, icon_delegate);
|
||||
|
||||
// Properties
|
||||
PropertyProxyModel* property_model = new PropertyProxyModel(this);
|
||||
property_model->setSourceModel(m_tablesModel);
|
||||
SetTableViewDefault(ui->tablePropertiesTable);
|
||||
ui->tablePropertiesTable->setModel(property_model);
|
||||
ui->tablePropertiesTable->setItemDelegate(pglab_delegate);
|
||||
|
||||
|
||||
// Set code editor fonts
|
||||
QFont code_font = UserConfiguration::instance()->codeFont();
|
||||
ui->constraintSqlEdit->setFont(code_font);
|
||||
|
|
@ -71,14 +63,11 @@ TablesPage::TablesPage(MainWindow *parent)
|
|||
// Connect signals
|
||||
// ---------------
|
||||
// Table selection
|
||||
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||
property_model, &PropertyProxyModel::setActiveRow);
|
||||
// connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||
// property_model, &PropertyProxyModel::setActiveRow);
|
||||
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
&TablesPage::tableListTable_currentRowChanged);
|
||||
|
||||
// connect(ui->constraintsTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
// &TablesPage::constraintsTable_currentRowChanged);
|
||||
|
||||
connect(ui->constraintsTable->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
&TablesPage::constraintsTable_selectionChanged);
|
||||
connect(ui->constraintsTable->model(), &QAbstractItemModel::modelReset, this,
|
||||
|
|
@ -92,8 +81,12 @@ TablesPage::TablesPage(MainWindow *parent)
|
|||
&TablesPage::indexesTable_modelReset);
|
||||
|
||||
// Non designer based code
|
||||
m_propertiesPage = new PropertiesPage(this);
|
||||
m_propertiesTab = addDetailTab(m_propertiesPage);
|
||||
|
||||
m_triggerPage = new TriggerPage(this);
|
||||
m_triggerTab = addDetailTab(m_triggerPage, tr("Triggers"));
|
||||
m_triggerTab = addDetailTab(m_triggerPage);
|
||||
|
||||
retranslateUi(false);
|
||||
}
|
||||
|
||||
|
|
@ -103,16 +96,17 @@ void TablesPage::retranslateUi(bool all)
|
|||
if (all)
|
||||
ui->retranslateUi(this);
|
||||
|
||||
ui->twDetails->setTabText(ui->twDetails->indexOf(m_propertiesTab), QApplication::translate("TablesPage", "Properties", nullptr));
|
||||
ui->twDetails->setTabText(ui->twDetails->indexOf(m_triggerTab), QApplication::translate("TablesPage", "Triggers", nullptr));
|
||||
}
|
||||
|
||||
|
||||
QWidget* TablesPage::addDetailTab(QWidget *contents, QString caption)
|
||||
QWidget* TablesPage::addDetailTab(QWidget *contents)
|
||||
{
|
||||
auto tab = new QWidget();
|
||||
auto verticalLayout = new QVBoxLayout(tab);
|
||||
verticalLayout->addWidget(contents);
|
||||
ui->twDetails->addTab(tab, caption);
|
||||
ui->twDetails->addTab(tab, "");
|
||||
return tab;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue