Results 1 to 5 of 5

Thread: Changing only Border color of QFRAME and not color text

  1. #1
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Changing only Border color of QFRAME and not color text

    Good morning,
    simple problem I need a widget surrounded by a rectancgle, so i
    create a widget with a Frame.

    i've a QFRAME (box and Plain)
    and i want simply change the border color and not the background color and the text color

    i try to

    frame->setStyleSheet("color:blue");

    the background remains the default colour but in this way i've the border blu and the text blue !

    is there a way to have only border in different color ?

    i try
    frame->setStyleSheet("border: 5px solid black");

    but in this way also my QPushButton and TextBox are sourrounded by the big border

    I need a simple rectangle as widget border !

    Thanks Gabriele

    Thanks Gabriele
    Last edited by gab74; 7th September 2011 at 16:23. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Changing only Border color of QFRAME and not color text

    Qt Code:
    1. frame->setObjectName("myObject");
    2. frame->setStyleSheet("#myObject { border: 5px solid black; }");
    To copy to clipboard, switch view to plain text mode 

    or similar (e.g. using ".QFrame").
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following 3 users say thank you to wysota for this useful post:

    Ashkan_s (16th October 2012), gab74 (12th September 2011), rawfool (29th May 2013)

  4. #3
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Re: Changing only Border color of QFRAME and not color text

    Ok,
    supposing that the frame name is : FrameMain
    i could use :


    frame->setStyleSheet("#MainFrame { border: 5px solid black; }");

    Have I understood correctly ?

    Thanks for your support !!!!

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Changing only Border color of QFRAME and not color text

    No, you have to use "#FrameMain" and not "#MainFrame".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Re: Changing only Border color of QFRAME and not color text

    Ok Thank You for your precious support !!!

Similar Threads

  1. Using a QFrame as a color selection indicator
    By KShots in forum Qt Tools
    Replies: 8
    Last Post: 14th June 2011, 23:55
  2. Replies: 3
    Last Post: 22nd January 2010, 16:46
  3. Dynamically changing QFrame color
    By Doug Broadwell in forum Newbie
    Replies: 6
    Last Post: 16th October 2008, 08:22
  4. How to set the BORDER COLOR of QDialog?
    By ashukla in forum Qt Programming
    Replies: 6
    Last Post: 13th November 2007, 16:09
  5. Changing the text color of a QTreeView leaf.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2006, 23:58

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.