[Solved]How can grob painter of qwidget that this widget already made ,such as Qtextedit,Qdial,... ?
-
Suppose that you want change background color of Qtextedit or rotate on 45 degree this widget .how do you do it?
Really i want to know when i have Qwidget that already made how can i make minor change in paintEvent but i don't do rewrite this function.
I hope I could get what I mean. -
For the background color:
you can change the [[Doc:QPalette]] of the text editFor the 45° presentation:
My first guess would be a [[Doc:QGraphicsScene]] and use a [[Doc:QGraphicsProxyWidget]] containing the text edit. -
Thanks Mr.Volker
@
//#########################################
#include <QApplication>
#include <QGraphicsProxyWidget>
#include <QTextEdit>
#include <QGraphicsView>
#include <QGraphicsScene>int main (int argc,char* argv[]){
QApplication app(argc,argv);QTextEdit *te=new QTextEdit(0); QGraphicsScene scene; QGraphicsProxyWidget * container=scene.addWidget(te); container->rotate(45); QGraphicsView view(&scene); view.show(); return app.exec();
}
//#########################################
@
it's work correctly :D -
Glad to see that it worked out!
You can prepend "[Solved]" to your topic (title), to mark your question as resolved. -
Excuse me, I'm newbie in qt ,now i have 2 question :
1-when i use Qt-Creator to design my form how can i use this approach ?
i drag and drop plugin (QTextEdit,...) how can i add modified widget to my form!
i can't use QGraphicsView , i think that i just can addwidget(Qwidget) to my Qdialog class and QGraphicsView or QGraphicsProxyWidget not usable for addwidget function.2-if i want to more change Qwidget that already made how can i do it?
for example ,suppose you want to add number on side of notches of QDial or even more suppose you want use special symbol (that you forced draw manually these symbol) on side of notches of QDial.thanks for your attention and your time .