i have developed an application that has 3X4 icons on widget. i need to navigate among the icons using up, down, right, left arrow keys how do i do it using qtcreator. and default color of text is black is there a way to change it to some other color. i tried editing palette of widget to change color of text but it was not reflected( it still co开发者_C百科ntinues to take default settings)
please do help me
thanks
regards rashmi
I can help you with the text color. I am using QT with Python, you didn't mention what language you are using.
In my application I create a Close button that has the "Close" text colored red. Here is the code:
quit = QtGui.QPushButton('Close', self)
quit.setStyleSheet("QPushButton { color: rgb(255,50,50); }")
The first line creates the QPushButton, and the second sets the color through the "setStyleSheet()" method. This works good for me. You can also modify other settings as well.
You might also want to see: http://thesmithfam.org/blog/2009/09/10/qt-stylesheets-tutorial/
--EDIT-->
I believe that you could do the same thing in C++ with (assuming that qQuit is the pointer to my "Close" QPushButton):
qQuit->setStyleSheet("QPushButton { color: red }");
-Eric
精彩评论