2
我想添加3个项目到状态栏。不应该每个人都在自己的标签?Qt创建者C++,将很多标签添加到状态栏
这可能吗?当我试图添加第二个标签时,它给了我一个错误。
文件mainwindow.h
,
QLabel *m_statusLabel;
QLabel *m_pointLabel;
文件mainwindow.cpp
,
statusBar()->addWidget(m_statusLabel);
statusBar()->addWidget(m_pointLabel);
它有一个标签完美的作品,但是当我添加第二个,然后我得到以下。
Starting C:\Users\Jansu\Desktop\cpp-praktikum05-alus\Joonistamine-build- desktop\src\bin\Joonistamine.exe...
ASSERT: "d" in file ..\..\include/QtCore/../../src/corelib/tools/qscopedpointer.h, line 112
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
C:\Users\Jansu\Desktop\cpp-praktikum05-alus\Joonistamine-build- desktop\src\bin\Joonistamine.exe exited with code -1073741819
这可能不是直接将状态栏添加到小部件中导致的。你如何创建'QLabel'? – Mat 2011-04-10 15:04:07
为什么要添加3个不同的小部件,而不是只包含一切?也许[QStatusBar](http://doc.qt.nokia.com/latest/qstatusbar.html)仅支持一个小部件,但您也可以尝试使用'addPermanentWidget'。 – ierax 2011-04-10 15:31:14