QT Hotel Management System

Source: Internet
Author: User
Tags mysql backup

In recent days, the school arranged classes, the choice of the topic is the hotel management system, just get hands feel quite simple, not simple to come to stay, to achieve login, modify the password on the line. But calm down to an analysis, not think of themselves so simple, really is a little complicated, due to the time relationship, but to achieve a small part of the function, and so busy this time, in addition to other functions. Let's take a look at the system interface first.

1. Login interface (admin and customer)

Can realize the administrator and the customer login separately. Also added the registration function, provided to the customer does not have the account use, uses for the reservation. The following image of the registration interface diagram shows:

2, Customer landing system.

Because of the time, the customer interface is simply to view the current room status, you can book those rooms, selected rooms can be scheduled. As shown in the following illustration:

Customers can view the current room status, my default rooms are available, the room has been booked is not shown.

Another feature is the ability to modify your current registered information.

After all, the class is set, and also the function is too single, it shows a few pictures, Baidu when.


The client is simple function, many have no time to realize, and so do a good winter vacation.

3, the Administrator interface

Let's look at the main interface first. Not very good, in order to avoid the blank, I put a picture, or not ideal

Let's take a look at the Business Management-----Reception Center.

Can be achieved according to the conditions of the query, check the room status, room floor distribution, whether it is single, double room, luxury suites and so on.


In the final analysis, this class is a simple database connection, there is nothing too complex things. The operation of the database is simply to add, delete, change, check, has been repeated operation. As long as the database will, basically no problem, interface is not important, talking about the interface, it is not difficult, perhaps as a beginner is a bit difficult, hey, I am also considered a novice, learning Qt less than a few months, think of their own at that time also want to do the interface to do some beautiful, so in the online all kinds of Baidu Inadvertently found a blog is so said, using style sheets can be very convenient to set the interface of the skin style, I saw his article, imitate his writing ah write. Thanks again for Liudianwu. The hotel management system uses the style sheet, the button, the Display table data control, borders are set.

A simple style sheet can be written like this:

qdialog#logindialog,qdialog#roompicdialog{

border:1px solid #1B89CA;
border-radius:0px;

}

Other effects can be set like this. To apply your own style sheet, you can write this:

    Qfile file (QString (":/image/%1.css"). Arg (stylename));
    File.Open (qfile::readonly);
    QString QSS = qlatin1string (File.readall ());
    Qapp->setstylesheet (QSS);
    Qapp->setpalette (Qpalette) (Qcolor ("#F0F0F0"));
This allows you to apply your own style sheet to the entire system.

Some of the other features are simpler and will not go out. In fact, there is a database backup function, previously used in the Sqllite database, backup is very simple, Copy your own database files. db, this time with MySQL, do not know how to backup, on Baidu, the original, MySQL backup is mysqldump. It's not hard, it's just a few lines of code:


 /* Function function: Backup database
/void backupdatanasedialog::on_pbnok_clicked ()
{
    QString pathname = ui-> Lineedit->text ();
    QString CMD = QString ("Mysqldump.exe--add-drop-table-u%1-p%2 Hotel"). Arg ("root", "123456");
    QString Path = QString ("%1"). Arg (pathname);
    Qprocess *poc=new qprocess;
    Poc->setstandardoutputfile (Path);
    Poc->start (CMD);

    for (int i = 0;i<5000;i++)
    {
        ui->labelbackinfo->settext (tr ("Backing up ..."));
        for (int j = 0;j<2000;j++)
        {
            ui->progressbar->setvalue (i);
        }
        Ui->labelbackinfo->settext (TR ("Backup Complete"));

        Ui->pbnok->settooltip (TR ("backed up completed"));
    }
The program is called Mysqldump to implement the backup. Of course, you can also use the command to back up. Open Run, enter cmd, enter open cmd into the database bin directory, execute command: mysqldump-uroot-p BACKUP database name > new name. sql


Using a DOS window for backup, the default is in the current bin directory. I can select my own backup directory in my program:

A progress bar is added to show the current backup process.

Well, that's all, the function is not much, but, I have been busy for a while, and finally have some results and harvest.

Because a lot of friends need code as a reference, put the code out, technology lies in communication ...

QT Hotel Management System



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.