[SOLVED] how can i generate such grid (for graphs) using Qt
-
an example of what i want to realize :
-
Hi,
you can write your Widget and reimplementpaintEvent
or try to use external libraries (Qwt for example) -
yes i want to use the first method but the widget that i want paint on is inside another one (not defined in a class) so i can't redefine its paintEvent ,
can i paint on a widget without the paintEvent ?
ps : i installed qwt but i realized that drawing it manually is better,
-
@youzking said:
yes i want to use the first method but the widget that i want paint on is inside another one (not defined in a class) so i can't redefine its paintEvent ,
What does it means?
-
i have a widget created inside another one , for example:
CWidget::CWidget(QWidget *parent) : QWidget(parent)
{
...
QWidget *anotherWidget= new Widget(this);
...
}
(this is just an example) ,
and i want to paint onanotherWidget
, -
Create a new class and use it for anotherWidget
-
this is what i want avoid ,!!
because the widget i want to paint on is created with QT Designer ,
i searched and found that promoting widget may help , but without results !!! -
i want to create a widget , paint on it , and then show it , !
( using QLabel is just a workaround ), -
Ok , i handled it by promoting the widget
-
Promoting widgets is the way to do it (it works); so probably you have some issues using this feature.
If you want use a QLabel you can paint on a QPixmap and after set the label pixmap.
BTW I suggest to use custom widget
-
yes i also prefer using custom widget ,
thanks for your help ^^