mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Create Qt Designer form for editTableForm dialog
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,179 +1,14 @@
|
||||
#ifndef EDITTABLEFORM_H
|
||||
#define EDITTABLEFORM_H
|
||||
|
||||
#include <qvariant.h>
|
||||
|
||||
#include <QtGui/QTreeWidget>
|
||||
#include <QtGui/QTreeWidgetItem>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QGroupBox>
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDialog>
|
||||
#include "sqlitedb.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_editTableForm
|
||||
{
|
||||
public:
|
||||
// QGridLayout *gridLayout;
|
||||
//QVBoxLayout *vboxLayout;
|
||||
|
||||
|
||||
QLabel *tableLine;
|
||||
|
||||
QTreeWidget *treeWidget;
|
||||
|
||||
QToolButton *renameTableButton;
|
||||
|
||||
QToolButton *renameFieldButton;
|
||||
QToolButton *removeFieldButton;
|
||||
QToolButton *addFieldButton;
|
||||
|
||||
QPushButton *closeButton;
|
||||
|
||||
QStatusBar *statusBar;
|
||||
|
||||
void setupUi(QDialog *editTableForm)
|
||||
{
|
||||
if (editTableForm->objectName().isEmpty()){
|
||||
editTableForm->setObjectName(QString::fromUtf8("editTableForm"));
|
||||
}
|
||||
editTableForm->setWindowIcon(QIcon(":/icons/table"));
|
||||
//TODO remember sizes
|
||||
editTableForm->resize(500, 500);
|
||||
|
||||
QVBoxLayout *mainVBoxLayout = new QVBoxLayout();
|
||||
editTableForm->setLayout(mainVBoxLayout);
|
||||
mainVBoxLayout->setSpacing(10);
|
||||
int m = 10;
|
||||
mainVBoxLayout->setContentsMargins(m,m,m,m);
|
||||
|
||||
//******************************************
|
||||
//** Table Group Box
|
||||
QGroupBox *grpTable = new QGroupBox();
|
||||
mainVBoxLayout->addWidget(grpTable);
|
||||
grpTable->setTitle("Table");
|
||||
QHBoxLayout *grpTableLayout = new QHBoxLayout();
|
||||
grpTable->setLayout(grpTableLayout);
|
||||
grpTableLayout->setSpacing(0);
|
||||
|
||||
//** Table Text
|
||||
tableLine = new QLabel(editTableForm);
|
||||
tableLine->setObjectName(QString::fromUtf8("tableLine"));
|
||||
tableLine->setStyleSheet("font-weight: bold; border: 1px solid #dddddd; background-color: white;");
|
||||
grpTableLayout->addWidget(tableLine);
|
||||
|
||||
//** Rename Table
|
||||
renameTableButton = new QToolButton(editTableForm);
|
||||
renameTableButton->setObjectName(QString::fromUtf8("renameTableButton"));
|
||||
renameTableButton->setIcon(QIcon(":/icons/table_modify"));
|
||||
renameTableButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
grpTableLayout->addWidget(renameTableButton);
|
||||
|
||||
|
||||
//******************************************
|
||||
//** Fields Group Box
|
||||
QGroupBox *grpFields = new QGroupBox();
|
||||
mainVBoxLayout->addWidget(grpFields);
|
||||
grpFields->setTitle("Fields");
|
||||
QVBoxLayout *grpFieldsLayout = new QVBoxLayout();
|
||||
grpFields->setLayout(grpFieldsLayout);
|
||||
grpFieldsLayout->setSpacing(0);
|
||||
|
||||
//** Fields Toolbar **
|
||||
QToolBar *toolBar = new QToolBar();
|
||||
grpFieldsLayout->addWidget(toolBar);
|
||||
|
||||
//** Add Field
|
||||
addFieldButton = new QToolButton(editTableForm);
|
||||
addFieldButton->setObjectName(QString::fromUtf8("addFieldButton"));
|
||||
addFieldButton->setIcon(QIcon(":/icons/field_add"));
|
||||
addFieldButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
toolBar->addWidget(addFieldButton);
|
||||
|
||||
//** Rename Field
|
||||
renameFieldButton = new QToolButton(editTableForm);
|
||||
renameFieldButton->setObjectName(QString::fromUtf8("renameFieldButton"));
|
||||
renameFieldButton->setEnabled(false);
|
||||
renameFieldButton->setIcon(QIcon(":/icons/field_edit"));
|
||||
renameFieldButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
toolBar->addWidget(renameFieldButton);
|
||||
|
||||
//** Remove Field
|
||||
removeFieldButton = new QToolButton(editTableForm);
|
||||
removeFieldButton->setObjectName(QString::fromUtf8("removeFieldButton"));
|
||||
removeFieldButton->setEnabled(false);
|
||||
removeFieldButton->setIcon(QIcon(":/icons/field_delete"));
|
||||
removeFieldButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
toolBar->addWidget(removeFieldButton);
|
||||
|
||||
//**** Tree Widget
|
||||
treeWidget = new QTreeWidget();
|
||||
grpFieldsLayout->addWidget(treeWidget);
|
||||
treeWidget->headerItem()->setText(0, QApplication::translate("createTableForm", "Field name", 0, QApplication::UnicodeUTF8));
|
||||
treeWidget->headerItem()->setText(1, QApplication::translate("createTableForm", "Field type", 0, QApplication::UnicodeUTF8));
|
||||
treeWidget->setRootIsDecorated(false);
|
||||
treeWidget->setAlternatingRowColors(true);
|
||||
|
||||
|
||||
//*** Bottom button box
|
||||
QHBoxLayout *bottomButtonBox = new QHBoxLayout();
|
||||
mainVBoxLayout->addLayout(bottomButtonBox);
|
||||
bottomButtonBox->addStretch(10);
|
||||
closeButton = new QPushButton(editTableForm);
|
||||
closeButton->setObjectName(QString::fromUtf8("closeButton"));
|
||||
bottomButtonBox->addWidget(closeButton);
|
||||
|
||||
statusBar = new QStatusBar();
|
||||
mainVBoxLayout->addWidget(statusBar);
|
||||
|
||||
retranslateUi(editTableForm);
|
||||
QObject::connect(closeButton, SIGNAL(clicked()), editTableForm, SLOT(accept()));
|
||||
QObject::connect(renameTableButton, SIGNAL(clicked()), editTableForm, SLOT(renameTable()));
|
||||
QObject::connect(removeFieldButton, SIGNAL(clicked()), editTableForm, SLOT(removeField()));
|
||||
QObject::connect(addFieldButton, SIGNAL(clicked()), editTableForm, SLOT(addField()));
|
||||
QObject::connect(renameFieldButton, SIGNAL(clicked()), editTableForm, SLOT(editField()));
|
||||
QObject::connect(treeWidget, SIGNAL(itemSelectionChanged()), editTableForm, SLOT(fieldSelectionChanged()));
|
||||
|
||||
QMetaObject::connectSlotsByName(editTableForm);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QDialog *editTableForm)
|
||||
{
|
||||
editTableForm->setWindowTitle(QApplication::translate("editTableForm", "Edit table definition", 0, QApplication::UnicodeUTF8));
|
||||
treeWidget->headerItem()->setText(0, QApplication::translate("editTableForm", "Field name", 0, QApplication::UnicodeUTF8));
|
||||
treeWidget->headerItem()->setText(1, QApplication::translate("editTableForm", "Field type", 0, QApplication::UnicodeUTF8));
|
||||
|
||||
renameTableButton->setText(QApplication::translate("editTableForm", "Rename table", 0, QApplication::UnicodeUTF8));
|
||||
renameFieldButton->setText(QApplication::translate("editTableForm", "Edit field", 0, QApplication::UnicodeUTF8));
|
||||
removeFieldButton->setText(QApplication::translate("editTableForm", "Remove field", 0, QApplication::UnicodeUTF8));
|
||||
addFieldButton->setText(QApplication::translate("editTableForm", "Add field", 0, QApplication::UnicodeUTF8));
|
||||
closeButton->setText(QApplication::translate("editTableForm", "Close", 0, QApplication::UnicodeUTF8));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class editTableForm: public Ui_editTableForm {};
|
||||
} // namespace Ui
|
||||
class editTableForm;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class editTableForm : public QDialog, public Ui::editTableForm
|
||||
class editTableForm : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -187,23 +22,21 @@ public:
|
||||
public slots:
|
||||
virtual void setActiveTable( DBBrowserDB * thedb, QString tableName );
|
||||
virtual void populateFields();
|
||||
virtual void renameTable();
|
||||
virtual void editField();
|
||||
virtual void addField();
|
||||
virtual void removeField();
|
||||
virtual void fieldSelectionChanged();
|
||||
virtual void accept();
|
||||
virtual void checkInput();
|
||||
|
||||
protected:
|
||||
QStringList types;
|
||||
QStringList fields;
|
||||
DBBrowserDB * pdb;
|
||||
|
||||
protected slots:
|
||||
virtual void languageChange();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
Ui::editTableForm *ui;
|
||||
};
|
||||
|
||||
#endif // EDITTABLEFORM_H
|
||||
|
||||
281
src/edittableform.ui
Normal file
281
src/edittableform.ui
Normal file
@@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>editTableForm</class>
|
||||
<widget class="QDialog" name="editTableForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<height>405</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit table definition</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/table</normaloff>:/icons/table</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupTable">
|
||||
<property name="title">
|
||||
<string>Table</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editTableName">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupFields">
|
||||
<property name="title">
|
||||
<string>Fields</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="addFieldButton">
|
||||
<property name="text">
|
||||
<string>Add field</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/field_add</normaloff>:/icons/field_add</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="renameFieldButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit field</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/field_edit</normaloff>:/icons/field_edit</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="removeFieldButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove field</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/field_delete</normaloff>:/icons/field_delete</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Field name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Field type</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>editTableName</tabstop>
|
||||
<tabstop>addFieldButton</tabstop>
|
||||
<tabstop>renameFieldButton</tabstop>
|
||||
<tabstop>removeFieldButton</tabstop>
|
||||
<tabstop>treeWidget</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="icons/icons.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>252</x>
|
||||
<y>400</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>320</x>
|
||||
<y>400</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>treeWidget</sender>
|
||||
<signal>itemSelectionChanged()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>fieldSelectionChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>116</x>
|
||||
<y>193</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>411</x>
|
||||
<y>181</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>addFieldButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>addField()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>57</x>
|
||||
<y>106</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>79</x>
|
||||
<y>65</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>renameFieldButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>editField()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>136</x>
|
||||
<y>108</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>161</x>
|
||||
<y>65</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>removeFieldButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>removeField()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>111</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>249</x>
|
||||
<y>63</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>editTableName</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>editTableForm</receiver>
|
||||
<slot>checkInput()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>62</x>
|
||||
<y>48</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>115</x>
|
||||
<y>3</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>fieldSelectionChanged()</slot>
|
||||
<slot>addField()</slot>
|
||||
<slot>editField()</slot>
|
||||
<slot>removeField()</slot>
|
||||
<slot>checkInput()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
@@ -82,4 +82,5 @@ FORMS += \
|
||||
dialogabout.ui \
|
||||
preferencesform.ui \
|
||||
mainwindow.ui \
|
||||
editfieldform.ui
|
||||
editfieldform.ui \
|
||||
edittableform.ui
|
||||
|
||||
Reference in New Issue
Block a user