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.