this may be very simple project, I have to work harder.![]()
this may be very simple project, I have to work harder.![]()
Guys... Try this please:
Is that what you want?Qt Code:
f.setStrikeOut(true); label->setFont(f); label->setText("xxxxx");To copy to clipboard, switch view to plain text mode
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
Maybe it is drawn but then the widget overdraws it with its own paint event routine.
Qt Code:
#include <QtGui> public: protected: pe.setWidth(4); pe.setColor(Qt::red); p.setPen(pe); p.drawLine(rect().topLeft(), rect().bottomRight()); } }; int main(int argc, char **argv){ W w; w.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
It is working fine. I am forgotten to call viewport() and paintEvent inside paintEvent(). Thanks for your kind help.Qt Code:
{ painter.setPen(Qt::blue); painter.drawLine(rect().topLeft(),rect().bottomRight()); }To copy to clipboard, switch view to plain text mode
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
You should have received a warning in the console.
If you opened the painter on a wrong object you should have received a warning. Take my code and change "viewport()" to "this", run the application and look at the console.
Yes, You are saying true in this regard; but I am telling about the below mentioned code.
Qt Code:
{ painter.setPen(Qt::blue); painter.drawLine(rect().topLeft(),rect().bottomRight()); }To copy to clipboard, switch view to plain text mode
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
You said you "forgot to call viewport()". I understood that you didn't open a painter on it.
Bookmarks