Results 1 to 2 of 2

Thread: Drawing

  1. #1
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Drawing

    Hi All,

    In my application QMainWindow is Widget . And i have a QFrame or QWidget inside my application. Now i want to draw line inside the qFrame or QWidget...

    usually what ever the drawing operation that i am going to perform in the QPaintEvent will perform the drawing in QMainWindow .. But not in QFrame .. How to get control to QFrame or QWidget??

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Drawing

    you create a new class by drive QWidget and draw your lines in paintEvent.

    class myWidget : public QWidget
    {
    ...
    protected:
    void paintEvent ( QPaintEvent * event );

    }


    void myWidget:aintEvent ( QPaintEvent * event )
    {
    // draw your lines here
    }

    use this myWidget in your MainWindow code in place of QWidget

Similar Threads

  1. Replies: 2
    Last Post: 23rd July 2012, 09:42
  2. How Could I promote Qt's Drawing performance?
    By joeshow in forum Qt Programming
    Replies: 5
    Last Post: 11th September 2007, 19:04
  3. Drawing on QWidget - strech & resize
    By kemp in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2007, 15:39
  4. Drawing an arc.
    By munna in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2006, 06:36
  5. Replies: 4
    Last Post: 17th January 2006, 18:46

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.