Results 1 to 2 of 2

Thread: Unable to display qpaint widget

  1. #1
    Join Date
    Sep 2013
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Unable to display qpaint widget

    Hi, I am a real beginnner in qt and I have trouble creating a simple qt widget.
    #include <QtGui/QWidget>
    #ifndef simple_MYWIDGET_H
    #define simple_MYWIDGET_H

    //namespace simple


    /************************************************** ***************************
    ** Interface [MainWindow]
    ************************************************** ***************************/
    /**
    * @brief Qt central, all operations relating to the view part here.
    */

    class MyWidget : public QWidget
    {


    public:
    MyWidget(QWidget *parent = 0);
    ~MyWidget();
    public slots:


    protected:
    void paintEvent(QPaintEvent *event);
    private:

    };



    #endif



    #include "../include/simple/mywidget.h"
    #include <qpainter.h>


    MyWidget::MyWidget( QWidget *parent )
    {

    }


    MyWidget::~MyWidget()
    {
    }


    void MyWidget:aintEvent(QPaintEvent *event)
    {
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing, true);
    painter.setPen(QPen(Qt::black, 12, Qt:ashDotLine, Qt::RoundCap));
    painter.setBrush(QBrush(Qt::green, Qt::SolidPattern));
    painter.drawEllipse(80, 80, 400, 240);
    }


    When I run my qt4 designer all i see is a blank screen even though I have promoted my qwidget.
    Screenshot from 2013-09-17 10:19:29.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Unable to display qpaint widget

    Quote Originally Posted by qtbeginner101 View Post
    When I run my qt4 designer all i see is a blank screen even though I have promoted my qwidget.
    Promoting means that the generated code will have an instance of your widget. The designer work form only shows the widget you promoted from.
    If you need to see your widget in designer you need to create a designer plugin.

    Right now your widget should show up in the program just fine.

    Cheers,

    _

Similar Threads

  1. UNABLE TO DISPLAY OUTPUT USING QTextStream
    By ayanda83 in forum Newbie
    Replies: 3
    Last Post: 11th July 2012, 08:15
  2. Unable to get my spinbox to display (all that shows is the associated label)
    By bschumacher in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 17th May 2012, 02:32
  3. Unable to display image in windows
    By ankireddy in forum Newbie
    Replies: 1
    Last Post: 7th January 2012, 03:58
  4. Replies: 15
    Last Post: 3rd June 2011, 14:11
  5. Unable to display flash into webkit on MAC
    By jay in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 11:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.