PDA

View Full Version : qt manhattan style



doran
28th August 2013, 00:39
Hello ,

I ahve used qt manhattan style https://github.com/tegesoft/qt-manhattan-style to create a fancy tab widget, I have used a palette to change the color of the widget

Manhattan::FancyTabWidget* ptab = new Manhattan::FancyTabWidget(this);
QPalette* palette = new QPalette();
QLinearGradient linearGradient(QPointF(50, 50), QPointF(200, 200));
linearGradient.setColorAt(0, Qt::lightGray);
linearGradient.setColorAt(1, Qt::gray);
palette->setBrush(QPalette::Window,*(new QBrush(linearGradient)));
ptab->setPalette(*palette);

setCentralWidget(ptab);

the pallete did not take effect. how can I change the back ground of the fancy tab widget to a gradient color.

Regards

ChrisW67
28th August 2013, 01:48
If you want to set the background then perhaps you want setBackgroundBrush().

BTW: Don't allocate things on the heap if they do not need to be. The QPalette and QBrush in your code are memory leaks.

doran
28th August 2013, 20:04
Thanks for the reply, I have used setBackgroundBrush(), but also did not work. I think it is time to define my own style instead of reusing one.

Regards