Wednesday, July 9th 2008, 4:36am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, April 22nd 2008, 5:10am

font color change for QToolButton

Hi,
I'm curious if there is any routine for changing the font color of a QToolButton at all? I was mistaken that I could use setColor, but to no avail. I'm only trying to change the default color from black to white (hopefully). Is there anything that could work? I would sincerely appreciate any help I can get. Thanks so much!
-Jeff



Here is my example constructor:

Button::Button(const QString &text, const QColor &color, QWidget *parent)
: QToolButton(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
setText(text);
//set font color here to white?
QPalette newPalette = palette();
newPalette.setColor(QPalette::Button, color);
setPalette(newPalette);
}
  • Go to the top of the page

Rate this thread