Sohag Developer PostgreSQL Database Applications

Build Powerful Robust Database Applications

Creating First Project Using Sohag Developer For PostgreSQL

Mon, 07/03/2017 - 02:44 - amr

In this tutorial we are going to follow few simple steps to create sohag
developer project to generate the Qt/C++ code to implement basic sql DML
operation (Insert Update Delete Query) into postgresql database table or
view and generating Qt/UI (GUI Form) automatically for the selected
columns of database table or view and layout the generated ui widgets to
grid layout.

1- Lunch Sohag Developer For PostgreSQL from the desktop icon or the
start menu icon



2 Connect to the PostgreSQL database

Click on the connect icon (Plug Icon) the very first icon in the toolbar

Or goto File menu and click on Connect menu Item

a connection dialog appears add the database credentials  (you can use
the host and port default values by leaving them empty) and then press the
Connect button to connect to the databse.



3 After connecting to the database a database information pane appears at
the left hand side of the Sohag Developer For PostgreSQL Application, You
can use this pane to browse database schemas, tables and views in a
hierarchical form.

hierarchical

4 Now we will create a new project.

Press the New Project icon the second icon in the toolbar or press

File Menu -> New Project item the New Project appears showing the welcome
page.

Press Next button to proceed to the next page.



5 Fill in the project name in the Project name field, If you want to add the
project in specific location the use Chang Location button to browse you
computer or leave the default location which is the Documents folder of the
current user then press next button to proceed to the next step.





6 Check the table or view from the table at the button of the page, When
checking table or view you will see its data (schema name, table or view
name and the type if it's a basic table or view).

If can't see the table name or view you can search for it by writing in the
find table box that will filter the table view names and reduce them in the
table to see the tables or views that matches the search only.

After selecting the required table or view press next to proceed to the next
step.



7 Now you can see all the columns of the previously selected table or view

Check the columns you want generate Qt Gui widget for it and use in the
generated SQL DML methods that will be generated by Sohag Developer For
PostgreSQL

Check the column name you want to use, Also you can set the label for the
generated Qt Widget by changing it in the label column(by default Sohag
Developer will process the column name and generates the label depending on
it).

Also you can change widget type by selecting the widget from Set Widget To
combobox and select the columns you want to change and then press Set Widget
button, But leave them all as the default widget which is QLineEdit.

Note that Sohag Developer will generate two widgets for every column one for
the label which is always a QLabel (Can't be changed) and the other is the
data widget by default it is a QLineEdit but can be changed.

After checking the required columns press next to proceed.



8 Change the class name if you would like to change it or leave the default
value.

Select the Base Class which can be QWidget or QDialog.

Then press Finish to create the project and close the wizard.



9 After closing the project wizard a new tab opens and you can see the
summery for the Project Classes





11 Now we will generate the Qt/C++ project files corresponding to our Sohag
Developer Project.

From the toolbar press the down arrow next to the Generate button a menu
will appear press on the simple menu item.

(Sohag Developer For PostgreSQL contains three templates that you can
generate the Qt/C++ code according to them the default one is the basic).

After pressing on the Simple menu item the Qt project files will be
generated.





Now we will browse the project files to see the generated files.

Go to the Project Menu and press Open Project Location this will open the
default browser for you system and you view see all the project files.



The generated project files as you can see Sohag Developer For PostgreSQL
will generate .pro file which is Qt project file, main.cpp file and a header
.h , an implementation .cpp and Qt designer form  .ui file for every
class in the Sohag Developer project.



Open the generated Qt project in the Qt Creator from the Projec Menu press
Open Project In Qt this will lunch Qt creator and opens the projec

Now you can proceed with Qt creator to complete the development of you project



The generated Qt designer form



The generated header file of the class



The generated implementation file .cpp and the project after running.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.