Qt组件的边框颜色 [英] Border color of Qt components

查看:200
本文介绍了Qt组件的边框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改QFrame组件的边框颜色.还尝试过样式表,但在运行时无效.在我的项目中,有各种对话框UI,它们基本上是QFrame,我想更改所选对话框的边框颜色,即QFrame边框颜色.QT中是否有任何解决方法?如下所示,存在两个对话时的选择的它的相应的框架边框颜色应该得到改变任一项

I want to change border color of QFrame component. Also tried with style sheet but no effect at run time. In my project there are various Dialog UI are there which are basically QFrame and i want to change the border color of selected dialog i.e. QFrame border color. Is there any workaround for that in QT. As shown below there are two dialog when any one of selected it's respective frame border color should get changed

推荐答案

尝试一下:

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

这篇关于Qt组件的边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆