Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, January 2007
QComboBox stylesheet


Message 1 in thread

Anyone know why this doesn't change the color of the combobox's popup? thanks...


#include <QtGui>


int main(int argc, char **argv)
{
  QApplication app(argc, argv);
  QComboBox w;
  w.addItem("hey");
  w.addItem("you");
  w.addItem("guys");
  w.view()->setStyleSheet("QListView { background-color: red; } "); // 1 or...
  w.setStyleSheet("QComboBox QListView { background-color: red; } ");
// ...the other
  w.show();
  app.exec();
}

-- 
 [ signature omitted ] 

Message 2 in thread

Patrick Stinson wrote:

> Anyone know why this doesn't change the color of the combobox's popup?
> thanks...
> 
> #include <QtGui>
> 
> int main(int argc, char **argv)
> {
>   QApplication app(argc, argv);
>   QComboBox w;
>   w.addItem("hey");
>   w.addItem("you");
>   w.addItem("guys");
>   w.view()->setStyleSheet("QListView { background-color: red; } "); // 1
>   or... w.setStyleSheet("QComboBox QListView { background-color: red; }
>   ");
> // ...the other
>   w.show();
>   app.exec();
> }

It works for me with Qt 4.2.1 on Linux using the Plastique style. (The popup
menu has a red background color.)

Can you provide any more information about your platform or the version of
Qt you are using?

David

--
 [ signature omitted ] 

Message 3 in thread

I am on a mac using a subclass of QWindowsStyle set on the combobox.
The style just draws the main combobox label and icon without the
background - so you can just click on the bare text. Maybe I am
forgetting to call something in my implementation?

I have attached the style implementation...

On 1/15/07, David Boddie <dboddie@xxxxxxxxxxxxx> wrote:
> Patrick Stinson wrote:
>
> > Anyone know why this doesn't change the color of the combobox's popup?
> > thanks...
> >
> > #include <QtGui>
> >
> > int main(int argc, char **argv)
> > {
> >   QApplication app(argc, argv);
> >   QComboBox w;
> >   w.addItem("hey");
> >   w.addItem("you");
> >   w.addItem("guys");
> >   w.view()->setStyleSheet("QListView { background-color: red; } "); // 1
> >   or... w.setStyleSheet("QComboBox QListView { background-color: red; }
> >   ");
> > // ...the other
> >   w.show();
> >   app.exec();
> > }
>
> It works for me with Qt 4.2.1 on Linux using the Plastique style. (The popup
> menu has a red background color.)
>
> Can you provide any more information about your platform or the version of
> Qt you are using?
>
> David
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


-- 
 [ signature omitted ] 

Attachment: comboboxstyle.cpp
Description: Binary data


Message 4 in thread

Patrick Stinson wrote:

> I am on a mac using a subclass of QWindowsStyle set on the combobox.
> The style just draws the main combobox label and icon without the
> background - so you can just click on the bare text. Maybe I am
> forgetting to call something in my implementation?
> 
> I have attached the style implementation...

Just a quick question before I start exploring your style: have you managed
to recolor the background of the list view by applying a stylesheet to a
combobox that uses QWindowsStyle? That seems to work on the Mac, so perhaps
there's something strange going on in your style.

David

--
 [ signature omitted ]