• 21240阅读
  • 13回复

我要如何改变QTextEdit的边框颜色呢? [复制链接]

上一主题 下一主题
离线cnng2008
 

只看楼主 倒序阅读 楼主  发表于: 2008-03-08
— 本帖被 XChinux 执行加亮操作(2008-03-14) —
我在用QLineEdit的时候,在StyleSheet里填写
background-color: white;border-width: 1px;border-color: #3D74BB; border-style: solid;
后可得到相应的白色底色和象素为1的边框以及颜色。
而我在QTextEdit里为什么就不能了呢?我在QTextEdit里要怎样才能得到上面的那些要求呢?
离线XChinux

只看该作者 1楼 发表于: 2008-03-08
看看styleSheet的文档里QTextEdit到底支持哪些style属性
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线zncggaofei
只看该作者 2楼 发表于: 2008-03-09
我用的QT 4.3.4 open Source版本 貌似是可以改变QTextEdit边框颜色
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线cnng2008

只看该作者 3楼 发表于: 2008-03-10
怎么弄啊?改那个属性值,改成什么?我用的是vs2005来做的
离线cnng2008

只看该作者 4楼 发表于: 2008-03-14
没人知道了吗?我用的是vs2005来做的,急啊……
离线XChinux

只看该作者 5楼 发表于: 2008-03-14
与vs2005还是mingw没关系,你在designer里设置QTextEdit设置它的style sheet属性就行了

border-width:1px;
border-color:#FF0000;
border-style:solid;
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线zncggaofei
只看该作者 6楼 发表于: 2008-03-14
楼上XX
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线cnng2008

只看该作者 7楼 发表于: 2008-03-17
引用第5楼XChinux于2008-03-14 16:06发表的  :
与vs2005还是mingw没关系,你在designer里设置QTextEdit设置它的style sheet属性就行了
border-width:1px;
border-color:#FF0000;
border-style:solid;


我本来就是这样写的,就多加了个底色,不信你看我发的贴:
我在用QLineEdit的时候,在StyleSheet里填写
background-color: white;
border-width: 1px;
border-color: #3D74BB;
border-style: solid;
后可得到相应的白色底色和象素为1的边框以及颜色。
而我在QTextEdit里为什么就不能了呢?我在QTextEdit里要怎样才能得到上面的那些要求呢?
离线zncggaofei
只看该作者 8楼 发表于: 2008-03-17
我把你的border-width改到10px 
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线cnng2008

只看该作者 9楼 发表于: 2008-03-22
为什么我用你的方法就是不行
离线captain08
只看该作者 10楼 发表于: 2008-03-24
我试了一下。可以呀。
离线cnng2008

只看该作者 11楼 发表于: 2008-04-20
是不是除了在SytleSheet属性里加上那一句之外,还要在别的地方加什么东西吗?比如说main.cpp文件里要加什么内容吗?
离线sikylori

只看该作者 12楼 发表于: 2009-02-13
QTextEdit可以用样式表,你说的完全可以实现 的,告诉你一个用样式表简便方法
打开Designer在这里面先试用样式表,这样就不用老去找错误了
离线shirley
只看该作者 13楼 发表于: 2010-01-27
好帖子!顶一下!差一点就要自己重新画了,节省了好多时间呀!
快速回复
限100 字节
 
上一个 下一个