Closed matrixspace closed 10 years ago
Hi,
What happens when you use createLogWidget() instead of the createLogDockWidget()? I am using the mentioned one with no problems (it is an older version of Qtilities though). (Your code seems correct)
@CJCombrink Actually inside createLogDockWidget() function, it uses createLogWidget() function to create a log widget, as the following code snippet shows:
QDockWidget* log_dock_widget = new QDockWidget(dock_name);
QWidget* log_widget = createLogWidget(engine_name,
message_displays_flag,
window_title,
is_active,
message_types,
toolbar_area);
if (log_widget) {
log_dock_widget->setWidget(log_widget);
QObject::connect(log_widget,SIGNAL(destroyed()),log_dock_widget,SLOT(deleteLater()));
return log_dock_widget;
} else {
delete log_dock_widget;
return 0;
}
But unfortunately, the QWidget pointer that createLogWidget() returns is null, I'm trying to step into that and trace debugging. BTW, I'm using Qtilities 1.5, and I have integrated Qtilities into my project using CMake, wondering if that could be the cause of my problem...would you mind doing a little test on this? That would be appreciated!
@CJCombrink Problem solved, I read the source code, it seems Qtilities::Logging::Logger should be initialized before using, so I added this in my mainwindow constructor
Qtilities::Logging::Logger::instance()->initialize();
then it's all good.
Hi @daddybear1208. Thanks for reporting the issue. Yes, the logging framework needs to be initialized first. In normally do that in my main.cpp after initializing QApplication.
It probably makes sense to cout a warning telling you that this is required.
I just started to use Qtilities logging framework, I followed this document, trying to create a dock widget, but the LoggerGui::createLogDockWidget static function always returns null, the following is a snippet of my code.