PDA

View Full Version : help regarding circle



jjbabu
13th September 2007, 13:33
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.

jpn
13th September 2007, 13:46
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().

jjbabu
20th September 2007, 11:23
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.