【发布时间】:2014-12-20 06:22:13
【问题描述】:
我创建了一个QToolButton,其中包含以下操作:
QToolButton * toolBut1 = new QToolButton(this);
actionGroup1 = new QActionGroup(this);
actionGroup1->setExclusive(true);
action1 = new QAction(QIcon(":/images/icon1"),"", actionGroup1);
action1->setCheckable(true);
action2 = new QAction(QIcon(":/images/icon2"),"", actionGroup1);
action2->setCheckable(true);
action3 = new QAction(QIcon(":/images/icon3"),"", actionGroup1);
action3->setCheckable(true);
toolBut1->addAction(action1);
toolBut1->addAction(action2);
toolBut1->addAction(action3);
但是当我将鼠标指针悬停在操作上时,应用程序输出中会显示一些警告:
QGradient::setColorAt: 颜色位置必须在0到1的范围内指定
为什么会这样?如何解决?
附:我在 Windows 7 上使用 Qt 4.8.4。
【问题讨论】:
-
您没有将项目移植到 Qt 5 吗?至少可以试试 4.8.6 吗?
-
对于
QToolButton,我从未使用过多个QAction。你的意思可能是QToolBar?