QT Study Notes (1)-recognition of the ui and recognition of the qt Study Notes ui

Source: Internet
Author: User

QT Study Notes (1)-recognition of the ui and recognition of the qt Study Notes ui

/// // 2015/08/06 ///////////////////

/// // By xbw //////////////////////////

//// // Environment Qt Creator 5.3.1 ////


Finally, I have time to study QT well. Before that, I have some knowledge about the powerful graphical interface of QT. Let's take a note;

Section 1 UI

Step by step. The first time;


 


# Include "mainwindow. h "# include" ui_main1_1_h "# include" mydialog. h "MainWindow: MainWindow (QWidget * parent): QMainWindow (parent), ui (new Ui: MainWindow) {ui-> setupUi (this ); // This editing box is filled with the entire window. In practice, it will overwrite other spaces. Temporarily, you can start learning. setCentralWidget (ui-> plainTextEdit ); // a close button; ui-> pushButton-> setText ("Close"); // use Horizontal Slider to control the growth and decrease of the SS Bar; connect (ui-> horizontalSlider, SIGNAL (valueChanged (int), u I-> progressBar, SLOT (setValue (int); // two progress Bar can be synchronously increased and decreased; connect (ui-> horizontalSlider, SIGNAL (valueChanged (int )), ui-> progressBar_2, SLOT (setValue (int); // uncontrols a progress Bar; disconnect (ui-> horizontalSlider, SIGNAL (valueChanged (int )), ui-> progressBar, SLOT (setValue (int);} MainWindow ::~ MainWindow () {delete ui;} void MainWindow: on_actionNew_Window_triggered () {// only one window created by this method can be displayed; MyDialog mDialog; // The window is displayed normally; mDialog. setModal (true); mDialog.exe c (); // The window is flashing; // mDialog. show (); // This method can create many identical windows, but it must be in mainwindow. in h, private a MyDialog * mDialog. Do not forget the header file # include "mydialog. h "; // mDialog = new MyDialog (this); // mDialog-> show ();}

#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include "mydialog.h"namespace Ui {class MainWindow;}class MainWindow : public QMainWindow{    Q_OBJECTpublic:    explicit MainWindow(QWidget *parent = 0);    ~MainWindow();private slots:    void on_actionNew_Window_triggered();private:    Ui::MainWindow *ui;    MyDialog *mDialog;};#endif // MAINWINDOW_H

 

Zhen shi zui le, bu neng shu ru zhong wen le, ri le gou le.


Xing qu dou mei le, cao

Zookeeper

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.