QT + + core status bar controls + floating window

#include " mainwindow.h " 

#include <QStatusBar> 
#include <QLabel> 
#include <QTextEdit> 
#include <QDockWidget> // floating window required header files 
MainWindow :: MainWindow (QWidget * parent) 
    : QMainWindow (parent) 

{ 

    the this -> setFixedSize ( 520. , 590 is ); 

    // status bar 
        QStatusBar * = statusBar1   the statusBar (); 
        the QLabel * label = new new the QLabel ( the this ); 
        label -> the setText ( " Normal the Text File "); 
        StatusBar1 -> addWidget (label); 

        // addWidget from left to right to add 
        statusBar1-> addWidget ( new new QLabel ( " 123123 " , the this )); 

        // addPermanentWidget from right to left to add 
        statusBar1 -> addPermanentWidget ( new new QLabel ( " 456456 " , the this )); 


    // core controls 
        QTextEdit * textEdit = new new QTextEdit ( the this );   
        setCentralWidget (textEdit); 
    // floating window 
        QDockWidget the Dock * = new newThe QDockWidget ( the this ); 
        addDockWidget (the Qt :: RightDockWidgetArea, Dock); 
        // add an editor window that is floating on to the floating window add controls 
        QTextEdit * = textEdit1 new new QTextEdit ( the this ); 
        Dock -> setWidget (textEdit1); 

} 

the MainWindow :: ~ the MainWindow () 
{ 

}

The following is the default:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
};

#endif // MAINWINDOW_H

 

Guess you like

Origin www.cnblogs.com/doker/p/11029913.html