Qt Hotel Management System and qt Hotel Management System

Source: Internet
Author: User

Qt Hotel Management System and qt Hotel Management System

In the past few days, the school has arranged a course and the selected subject is the hotel management system. It's quite easy to get it. It's not just a simple person to stay in. Is it enough to log on and change the password? However, it's not as simple as you think about it. It's really a bit complicated. Due to the time relationship, it's just a small part of the function, add other functions. Let's take a look at the system interface.

1. logon interface (administrator and customer)


The Administrator and the customer can log on separately. In addition, the registration function is added for customers who do not have an account to use for reservation. The registration page is shown in the following figure:


2. log on to the system.

Due to the rush of time, the customer interface is just a simple view of the current room status, you can book those rooms, you can book after selecting the room. As shown in:


The customer can check the status of the current room. By default, all the rooms provided by me are vacant, and the reserved rooms are not displayed.


Another function is to modify the information you have registered.


After all, it is a course set. Besides, the function is too simple, and several pictures are displayed.



The client is a simple function, and many of them do not have time to implement it.

3. administrator interface

Let's take a look at the main interface. Not very good. I put an image to avoid blank space, but it is still not ideal.


Let's take a look at business management-front-end Center


You can query by conditions, view the room status, room floor distribution, whether it is a single room, double room, deluxe suite, and so on.


In fact, in the end, this course is a simple database connection, and there is nothing too complicated. Database Operations are nothing more than simple addition, deletion, modification, query, and repeated operations. As long as the database is used, there is basically no problem. The interface is not important. It is not difficult to start with the interface. It may be a little difficult for beginners. Hey hey, I am also a beginner, after learning Qt for less than a few months, I remembered that I was also trying to make the interface more beautiful. So I found a blog on various Baidu websites, you can use a style sheet to easily and quickly set the skin style on the interface. I read his article and write it like him. Thanks again to liudianwu. The style sheet is used in the hotel management system to set the buttons and table data controls and borders.

A simple style sheet can be written as follows:

QDialog # LoginDialog, QDialog # RoomPicDialog {

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

}

Other effects can be set similarly. To apply your own style sheet, you can write it like 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")));
In this way, you can apply your own style sheet to the entire system.
Some other functions are relatively simple and will not be released. In fact, there is also a database backup function. The sqllite database was used before. The backup is very simple. Just copy your database file .db. This time I use mysql. It turns out that mysqldump uses mysqldump. It is actually not difficult, just a few lines of code:



/ *
 * 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 completed"));

        ui-> pbnOk-> setToolTip (tr ("The backup has been completed"));
    }
}
       The mysqldump is called in the program to realize the backup. Of course, you can also use commands to back up. Open to run, enter cmd, enter open cmd to enter the bin directory of the database, execute the command: mysqldump -uroot -p Backup database name> new name.

Use the dos window for backup, which will be in the current bin directory by default. I can select the directory that I backed up in the program:


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

       Well, that's all, there aren't many functions, but I have been busy for a while, and I finally have some results and gains.

============= ↑ Article content display ↑ =============

Related Article

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.