TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   Integration of a QTextEdit (http://forums.techarena.in/software-development/1257547.htm)

Zool 12-10-2009 12:03 PM

Integration of a QTextEdit
 
I am trying to include QTextEdit widget in main... I am able to do so (with a code given below), I want you to insert or help me put my QTextEdit:
Code:

# include <QApplication>
  # include <QtGui> "Fe.h"
  # include "Fe.h"

  int main (int argc, char * argv [])
  (
      QApplication app (argc, argv);

      Fe window;
      window. show ();

      return app. exec ();
  )



Fe.h
  # ifndef HEADER_FE
  # define HEADER_FE

  # include <QtGui>

  Fe class: public QMainWindow
  (
          public:
                  Fe();

          private:

  );


  # endif



Fe.cpp

Code: C + +  1
  2
  3
  4
  5
  6          # include "Fe.h"

  Fe: Fe ()
  (

  )


Zecho 12-10-2009 12:05 PM

Re: Integration of a QTextEdit
 
As you are inside the class uses the this pointer
Code:

# include "Fee.h"

  Fe: Fe ()
  (
      QTextEdit * textarea = new QTextEdit (this);

      QVBoxLayout * layout = new QVBoxLayout;
      layout -> addWidget (textarea);
      setLayout (layout);
  )


Walby 12-10-2009 12:07 PM

Re: Integration of a QTextEdit
 
The QTextEdit class provides a widget that is used to edit and display both plain and rich text. Example : QTextEdit ( const QString & text, const QString & context = QString::null, QWidget * parent = 0, const char * name = 0 ), QTextEdit ( QWidget * parent = 0, const char * name = 0 ).

Aberto 12-10-2009 12:08 PM

Re: Integration of a QTextEdit
 
It is a QMainWindow, so no layout, but a central widget.
Code:

# include "Fe.h"

  Fe: Fe ()
  (
      QTextEdit * textarea = new QTextEdit (this);
      setCentralWidget (textarea);
  )



All times are GMT +5.5. The time now is 04:57 PM.