是否有可能在.qss文件中为hex/rgb数字赋予变量名称.对呃
myColor = #FFCC08
QPushButton { background-color: myColor;}
Run Code Online (Sandbox Code Playgroud)
这样我就可以在样式表的顶部定义变量,并使用变量名称wheverver required而不是使用十六进制代码.此外,如果我需要更改颜色,那么我必须在一个地方更改,它将反映在文件中.
我也搜索了萨斯,但不知道如何在qt中使用它.
谢谢 :)
我正在使用 QTestLib 库和 QTest 来运行我的单元测试。我正在 Windows 7 上工作,并在 MVSC 2010 编译器中使用 Qt 4.8。当我使用以下方法运行测试时:
QTest::qExec(TestDateDD/whateverTestClass);
Run Code Online (Sandbox Code Playgroud)
我在控制台中得到输出:
********* Start testing of TestDateDD *********
Config: Using QTest library 4.8.0, Qt 4.8.0
PASS : TestDateDD::initTestCase()
PASS : TestDateDD::testValidity()
FAIL! : TestDateDD::testMonth(2012/7/10) Compared values are not the same
Actual (date.longMonthName(date.month())): July
Expected (monthname): June
..\UnitTestingPlugiin\TestDateDD.cpp(38) : failure location
PASS : TestDateDD::cleanupTestCase()
Totals: 3 passed, 1 failed, 0 skipped
********* Finished testing of TestDateDD *********
Run Code Online (Sandbox Code Playgroud)
但是,我的要求是在我的 GUI 中为每个测试槽显示此消息。我做了一些研究,发现qtestlog.cpp使用它自己的messageHandler来管理测试输出并将结果显示为 PASS 或 FAIL 以及失败消息、行号等。 …