Results 1 to 3 of 3

Thread: fixing my widget's palette

  1. #1
    Join Date
    Feb 2006
    Posts
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default fixing my widget's palette

    Salut,

    If you could, please take a look at the attached bitmap. It's a screen capture of a test program for widgets. I have have a simple widget which is simply a combobox plus a fixed-size spacer. The widgets are marked "ComboBox Subclass", but they're QWidget subclasses with a combobox and a spacer. I don't have a clue about why the background is showing through. The heirarchy is this:

    main window
    ...widget stack
    .......tab dialog
    ..........combobox, mycombobox

    ..........frame1 with no set background
    --------------comboBox2, mycombobox2

    ..........frame2 with orange background
    --------------comboBox3, mycombobox3

    ..........groupbox with no set background
    --------------comboBox4, mycombobox4

    It's the widget stack that has the blue background set. The background of my widget shows through in every case except where I set the parent frame's background to orange. Anybody know why?? Here's the simple constructor:
    Qt Code:
    1. #define EDITCOLOR QColor(200,200,100)
    2. ComboBoxSC::ComboBoxSC(QWidget *parent, const char *name)
    3. : QWidget(parent, name)
    4. {
    5. setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    6.  
    7. comboBox1 = new QComboBox( this, "comboBox1" );
    8. comboBox1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    9.  
    10. comboBoxFrameLayout = new QHBoxLayout( this, 0, 0, "comboBoxFrameLayout");
    11. comboBoxFrameLayout->addWidget( comboBox1 );
    12.  
    13. spacerFixed = new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed );
    14. comboBoxFrameLayout->addItem( spacerFixed );
    15.  
    16. setFocusPolicy(QWidget::WheelFocus);
    17. setFocusProxy(comboBox1);
    18.  
    19. // I've tried a hundred variations on these 2 lines
    20. comboBox1->setPaletteBackgroundColor( EDITCOLOR);
    21. setBackgroundMode( parentWidget()->backgroundMode() );
    22. }
    To copy to clipboard, switch view to plain text mode 
    I can't seem to do 3 things:
    1) can't make the blank space of my widget match its parent

    2) can't change the background color of the combobox by itself

    3) can't get a mouse click to give focus to the box. The box will open, but it's won't highlight unless I tab to it.

    Any great insights? Thanks for all.
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Posts
    18

    Default Re: fixing my widget's palette

    try this
    QWidget ::
    setAutoFillBackground(true)

    maybe help
    Cut and Run

  3. #3
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: fixing my widget's palette

    Has the problem been solved? I am also waiting for solution!

    I also want to change the backround colour of widget. Help please.

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. Mac OS X Top-Level Transparent Widgets
    By tinsuke in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 16:01
  3. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  4. Replies: 2
    Last Post: 16th May 2008, 14:39
  5. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.