Results 1 to 4 of 4

Thread: QFrame makes contents inaccessable.

  1. #1
    Join Date
    Aug 2011
    Posts
    33
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QFrame makes contents inaccessable.

    Well, it didn't take me long to get back in here.

    I'm trying to create custom frames for some of my subclassed QComboBox and QLineEdit widgets.

    But when I set the QFrame as a child of the widget, it does not show.

    If I make it a child of the same parent as the widget, I can see the frame, but I can no longer access the contents of the widget.

    What am I doing wrong?

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QFrame makes contents inaccessable.

    From the docs:
    The frame around the combobox can be styled using the box model
    which is the same as a QPushButton.

    Just for giggles use your style sheet string from the previous thread and change QPushButton to QComboBox:
    Qt Code:
    1. setStyleSheet("QComboBox { "
    2. "color:black;background-color:aqua;"
    3. "background-color:"
    4. "qlineargradient(x1:0,y1:0,x2:0,y2:1,"
    5. "stop:0#eaebfe,stop:1#76878a);"
    6. "min-width : 75; min-height : 15;"
    7. "border-style:outset;border-width:2px;"
    8. "border-radius4px;border-color:black; }"
    9. "QComboBox:pressed {"
    10. "color:white;"
    11. "background-color:"
    12. "qlineargradient(x1:0,y1:0,x2:0,y2:1,"
    13. "stop:0#08080a,stop:1#66777a);"
    14. "border:6pxsolidwhite;"
    15. "border-style:inset;border-width:2px;"
    16. "border-radius6px;border-color:white; }");
    To copy to clipboard, switch view to plain text mode 
    BTW you're welcome

  3. The following user says thank you to norobro for this useful post:

    paie (13th August 2011)

  4. #3
    Join Date
    Aug 2011
    Posts
    33
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFrame makes contents inaccessable.

    WOW!!

    Thanks AGAIN!!!

    Great stuff!!

    What a riot! Now I must do these tests from the command line to avoid rebuilding all the time.


    Added after 6 minutes:


    One more thing. Thanks to the info I got from this thread and the last thread I posted, I've eliminated over a hundred lines of cruft.

    Once you get the hang of style sheets, there's no other way to go.

    And it preserves your look across platforms.

    Many thanks.
    Last edited by paie; 13th August 2011 at 00:52.

  5. #4
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QFrame makes contents inaccessable.

    Quote Originally Posted by paie View Post
    Now I must do these tests from the command line to avoid rebuilding all the time.
    Since you are a "grep'er" here is a hint:
    Qt Code:
    1. grep "\-stylesheet=" *
    To copy to clipboard, switch view to plain text mode 
    Hopefully Wysota won't get mad

Similar Threads

  1. Qwt clear() makes the graph crash
    By Momergil in forum Qwt
    Replies: 4
    Last Post: 24th August 2011, 21:06
  2. QThread run() makes MainWindow get stuck
    By kerim in forum Qt Programming
    Replies: 26
    Last Post: 27th March 2011, 22:24
  3. VideoPlayer makes QX11EmbedContainer disappear
    By simonbolek in forum Qt Programming
    Replies: 0
    Last Post: 3rd January 2011, 10:18
  4. What makes something not thread safe?
    By tgreaves in forum Newbie
    Replies: 9
    Last Post: 20th February 2009, 20:16
  5. Replies: 0
    Last Post: 21st May 2007, 22:38

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
  •  
Qt is a trademark of The Qt Company.