2017-01-16 33 views
0

我通常会为此找到一种解决方法,但最近我很紧张,在因特网上的任何地方我都找不到任何有关它的信息。Qt样式表和“一个参数”问题

对,我想改变我在Qt中的进度条的属性,并在窗体设计器中设置了初始值。

这是我在我最初的(和工作)样式表配置:

QProgressBar { 
    border: 2px solid grey; 
    border-radius: 7px; 
} 

QProgressBar::chunk { 
    background-color: #05B8CC; 
    width: 20px; 
} 

(注:裸记住,我在窗体设计器,这是内置的拖放做到了Qt的图形化设计)

不过,我想这样做是为了改变它的编程代码中:

ui->progressBar->styleSheet("QProgressBar::chunk { background-color: #05B8CC; width: 20px;}"); 

按照documentation for style sheets,它应该没有任何问题,是工作,但我得到以下非荒谬的错误:

D:\Qt Projects\test\mainwindow.cpp:165: error: C2660: 'QWidget::styleSheet' : function does not take 1 arguments 

上什么可能导致此任何想法?

+1

这是一个简单的拼写错误:你写的'styleSheet',你的意思'setStyleSheet'。 –

回答

2

你正在寻找的功能是setStyleSheet

+0

https://media.giphy.com/media/oaPcDncoLfgjK/giphy.gif –