PDA

View Full Version : Changing only Border color of QFRAME and not color text



gab74
7th September 2011, 16:08
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

wysota
7th September 2011, 16:33
frame->setObjectName("myObject");
frame->setStyleSheet("#myObject { border: 5px solid black; }");

or similar (e.g. using ".QFrame").

gab74
7th September 2011, 19:51
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 !!!!

wysota
7th September 2011, 19:58
No, you have to use "#FrameMain" and not "#MainFrame".

gab74
8th September 2011, 08:22
Ok Thank You for your precious support !!!