Results 1 to 3 of 3

Thread: help regarding circle

  1. #1
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy help regarding circle

    i developed one Gui using Qt designer in windows.the steps what i did are mentioned below,
    step1: i have taken main window.

    step2:i placed the tab widget in the mainwindow from qt designer widget list.

    what i need exactly is, the circle which is able to display on my tab widget.

    for this, i developed some code,by this i am able to display the circle on mainwindow,but i cant display the circle on tabwidget.

    in mainwindow.cpp: (i defined function of circle like this)

    void MainWindow:: paintEvent(QPaintEvent *event)
    {

    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing, true);
    painter.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap));
    painter.setBrush(QBrush(Qt::green, Qt::SolidPattern));
    painter.drawEllipse(190, 30, 30, 30);
    }

    in mainwindow .h: (where i called the circle)

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    #include "ui_mainwindow.h"
    class MainWindow : public QMainWindow, public Ui::MainWindow
    {
    Q_OBJECT
    public:
    MainWindow(QWidget *parent = 0);
    void paintEvent(QPaintEvent *event);

    };
    #endif


    i need to display circle in the tabwidget,plz kindly help me,

    thanx in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: help regarding circle

    Reimplement paintEvent() of the widget you want to draw on. If you want to draw on QTabWidget, reimplement its paintEvent() instead of main window's. If you want to draw on a page of tab widget, reimplement its paintEvent().
    J-P Nurmi

  3. #3
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: help regarding circle

    first thanks for ur kind response.

    If you want to draw on QTabWidget, reimplement its paintEvent() instead of main window's.
    in my code where i want to change.i tried in many ways but am not getting,plz provide some detailed explanation about this issue.i am totally getting confused with this.
    thanks in advance.

Similar Threads

  1. Creating QString from std::sstream
    By Dennis_1 in forum Newbie
    Replies: 1
    Last Post: 6th September 2007, 18:20
  2. What is the fastest way to draw a circle ?
    By Vladimir in forum Qt Programming
    Replies: 18
    Last Post: 6th September 2007, 17:26

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.