Sohag Developer PostgreSQL Database Applications

Build Powerful Robust Database Applications

Basic Template Part 1

Sat, 08/11/2018 - 11:40 - amr

Basic Generator
Files generated by Basic Generator.
This template uses Qt low level sql api to interact with the database table or view.
1- A Qt project file (.pro file) for every Sohag Developer project.
2- A C++ main file (main.cpp file contains main function) for every Sohag Developer project.
3- Qt UI file (.ui file) for every class or database table or view.
4- C++ header file (.h) for every class or database table or view.
5- C++ implementation file (.cpp file) for every class or database table or view.

In the next sections you will find explanation for every file and its main contents with an example.
The example is built on database table customers
SQL DDL for creating customers table (this structure for PostgreSQL database)


CREATE TABLE cust.customers
(
  cust_id integer NOT NULL,
  customer character varying(200),
  address character varying(500),
  phone character varying(20),
  mobile character varying(20),
  email character varying(50),
  fax character varying(20),
  notes character varying(500),
  CONSTRAINT customers_pkey PRIMARY KEY (cust_id)
)
WITH (
  OIDS=FALSE
);

1- A Qt project file (.pro file) for every Sohag Developer project.
This file contains description and informations that qmake uses to generate the make file for the project


QT       += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = customer
TEMPLATE = app
SOURCES += main.cpp\
        customers.cpp
HEADERS  += customers.h
FORMS    += customers.ui

2- A C++ main file (main.cpp file contains main function) for every Sohag Developer project.
This file contains the main function, Basic generator uses the first class in the project in the main function.


#include "customers.h"
#include 


int main(int argc, char *argv[])
{
    QApplication sohag(argc, argv);
	
    Customers sohagDev;
    sohagDev.show();

    return sohag.exec();
}

Basic Template Part 2

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.