"QT5 Development and examples" 9, a QQ interface

Source: Internet
Author: User

This program is mainly to learn about the tool box class, where 3 tool boxes are used and then added to the entire interface,

are: Friends (good Friend), strangers (Do not Remember), blacklist (black items) Haha, forgive me this is not good English, understand me.

Implementation diagram:

Code:

Drawer.h

/*** Book: "QT5 Development and examples" * function: Realize a own QQ interface * File: drawer.cpp* time: January 2, 2015 11:01:12* Author: cutter_point*/#ifndef drawer_h#define Drawer_h#include <QToolBox> #include <QToolButton> #include <qwidget>class drawer:public qtoolbox{  Q_objectpublic:  Drawer (Qwidget *parent = 0, Qt::windowflags f = 0);p rivate:    //Private member  Qtoolbutton *toolbtn1_1;    QQ on the head button  Qtoolbutton *toolbtn1_2;  Qtoolbutton *toolbtn1_3;  Qtoolbutton *toolbtn1_4;  Qtoolbutton *toolbtn1_5;  Qtoolbutton *toolbtn2_1;  Qtoolbutton *toolbtn2_2;  Qtoolbutton *toolbtn3_1;  Qtoolbutton *toolbtn3_2;}; #endif//Drawer_h

Drawer.cpp

/*** Book: "QT5 Development and examples" * function: To achieve a own QQ interface, I like programmers, they are simple, stubborn, easy to experience the sense of accomplishment, the face of pressure, can midnight oil sleepless; * Facing difficulties, can challenge themselves. They will also be confused and 徨, but each programmer's heart has a Bill Gates or jobs dream * "with wisdom to create their own business." What I want to say is, actually I am a programmer * File: drawer.cpp* time: January 2, 2015 11:01:12* Author: cutter_point*/#include "drawer.h" #include <qgroupbox >//a combo box with a caption. #include <QVBoxLayout>//This is the vertical layout of the header file Drawer::D rawer (Qwidget *parent, Qt::windowflags f): Qtoolbox (parent, f) {set    WindowTitle (tr ("My QQ"));   Title of the Project box toolbtn1_1 = new Qtoolbutton;   Create a Toolbutton object tool box class Toolbtn1_1->settext (tr ("Zhang San"));    Zhang San Toolbtn1_1->seticon (Qpixmap ("://11.png"));   Introduced photo toolbtn1_1->seticonsize (Qpixmap ("://11.png"). Size ());   Specifies the size of the photo toolbtn1_1->setautoraise (true);  Sets whether automatic float is valid for enable. Toolbtn1_1->settoolbuttonstyle (Qt::toolbuttontextbesideicon);   The text of the button is displayed next to toolbtn1_2 = new Qtoolbutton;   Create a Toolbutton object tool box class Toolbtn1_2->settext (tr ("Li Shi"));    John Doe Toolbtn1_2->seticon (Qpixmap (":/12.png")); Introducing photos to Toolbtn1_2-> Seticonsize (Qpixmap (":/12.png"). Size ());   Specifies the size of the photo toolbtn1_2->setautoraise (true);  Sets whether automatic float is valid for enable. Toolbtn1_2->settoolbuttonstyle (Qt::toolbuttontextbesideicon);   The text of the button is displayed next to toolbtn1_3 = new Qtoolbutton;   Create a Toolbutton object tool box class Toolbtn1_3->settext (TR ("Wang Wu"));    Harry Toolbtn1_3->seticon (Qpixmap (":/13.png"));   Introduced photo toolbtn1_3->seticonsize (Qpixmap (":/13.png"). Size ());   Specifies the size of the photo toolbtn1_3->setautoraise (true);  Sets whether automatic float is valid for enable. Toolbtn1_3->settoolbuttonstyle (Qt::toolbuttontextbesideicon);   The text of the button is displayed next to toolbtn1_4 = new Qtoolbutton;   Create a Toolbutton object tool box class Toolbtn1_4->settext (tr ("Xiao Zhao"));    Xiao Zhao Toolbtn1_4->seticon (qpixmap (":/14.png"));   Introduced photo toolbtn1_4->seticonsize (Qpixmap (":/14.png"). Size ());   Specifies the size of the photo toolbtn1_4->setautoraise (true);  Sets whether automatic float is valid for enable. Toolbtn1_4->settoolbuttonstyle (Qt::toolbuttontextbesideicon);   The text of the button is displayed next to toolbtn1_5 = new Qtoolbutton; Create a Toolbutton object tool box class TOOLBTN1_5-&GT;settext (tr ("Xiao Sun"));    Xiao Sun Toolbtn1_5->seticon (Qpixmap (":/15.png"));   Introduced photo toolbtn1_5->seticonsize (Qpixmap (":/15.png"). Size ());   Specifies the size of the photo toolbtn1_5->setautoraise (true);  Sets whether automatic float is valid for enable. Toolbtn1_5->settoolbuttonstyle (Qt::toolbuttontextbesideicon);  The text of the button is displayed beside Qgroupbox *groupbox1 = new Qgroupbox;     Qvboxlayout *layout1 = new Qvboxlayout (groupBox1);  Combo box.   Layout1->setmargin (10);    Sets the display spacing for each form in the layout layout1->setalignment (qt::alignhcenter);  The position of each form in the layout, which should be the middle layout1->addwidget (toolbtn1_1);  Layout1->addwidget (toolbtn1_2);  Layout1->addwidget (toolbtn1_3);  Layout1->addwidget (toolbtn1_4);  Layout1->addwidget (toolbtn1_5);    Layout1->addstretch (); Insert a placeholder/************************************** gorgeous delimiter ********************************************************  /toolbtn2_1 = new Qtoolbutton;   Toolbtn2_1->settext (tr ("Xiao Wang")); Xiao Wang Toolbtn2_1->seticon (qpixmap (":/21.Png "));  Toolbtn2_1->seticonsize (Qpixmap (":/21.png"). Size ());  Toolbtn2_1->setautoraise (TRUE);  Toolbtn2_1->settoolbuttonstyle (Qt::toolbuttontextbesideicon);  Toolbtn2_2 = new Qtoolbutton;   Toolbtn2_2->settext (tr ("Xiao Zhang"));  Xiao Zhang Toolbtn2_2->seticon (qpixmap (":/22.png"));  Toolbtn2_2->seticonsize (Qpixmap (":/22.png"). Size ());  Toolbtn2_2->setautoraise (TRUE);  Toolbtn2_2->settoolbuttonstyle (Qt::toolbuttontextbesideicon);  Qgroupbox *groupbox2 = new Qgroupbox;     Qvboxlayout *layout2 = new Qvboxlayout (GROUPBOX2);  Combo box.   Layout2->setmargin (10);    Sets the display spacing for each form in the layout layout2->setalignment (qt::alignhcenter);  The position of each form in the layout, which should be the middle layout2->addwidget (toolbtn2_1);    Layout2->addwidget (toolbtn2_2);//Layout1->addstretch (); Insert a placeholder/************************************** gorgeous delimiter ********************************************************  /toolbtn3_1 = new Qtoolbutton; Toolbtn3_1->settext (tr ("Xiao Chen"));   Xiao Chen Toolbtn3_1->seticon (qpixmap (":/31.png"));  Toolbtn3_1->seticonsize (Qpixmap (":/31.png"). Size ());  Toolbtn3_1->setautoraise (TRUE);  Toolbtn3_1->settoolbuttonstyle (Qt::toolbuttontextbesideicon);  Toolbtn3_2 = new Qtoolbutton;   Toolbtn3_2->settext (tr ("Xiao Li"));  Xiao Li Toolbtn3_2->seticon (qpixmap (":/32.png"));  Toolbtn3_2->seticonsize (Qpixmap (":/32.png"). Size ());  Toolbtn3_2->setautoraise (TRUE);  Toolbtn3_2->settoolbuttonstyle (Qt::toolbuttontextbesideicon);  Qgroupbox *groupbox3 = new Qgroupbox;     Qvboxlayout *layout3 = new Qvboxlayout (GROUPBOX3);  Combo box.   Layout3->setmargin (10);    Sets the display spacing for each form in the layout layout3->setalignment (qt::alignhcenter);  The position of each form in the layout, which should be the middle layout3->addwidget (toolbtn3_1);    Layout3->addwidget (toolbtn3_2);//Layout1->addstretch (); Insert a placeholder/************************************** gorgeous delimiter ******************************************************** /This->additem ((qwidget*)GroupBox1, tr ("My good friend"));  Friend This->additem ((qwidget*) GroupBox2, tr ("Do not Remember"));    Stranger This->additem ((qwidget*) GroupBox3, tr ("Black Items")); Blacklist

Last resource link, this next I know how to open, in the Personal homepage, click that

That down can jump past = =, egg hurts. I tried again, this time it seems that no matter how it is very fast!!!!

But after uploading resources directly point, go to my Resources page, basic into not go, the page crashes directly!!!

Resources link, there are corresponding images: The amount, the link is not shown today, and then link it =













"QT5 Development and examples" 9, a QQ interface

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.