Port to qCDebug

wilder
Montel Laurent 8 years ago
parent 9214eb0bf6
commit 1bdb7fef2d
  1. 4
      CMakeLists.txt
  2. 1
      kitemmodels.categories
  3. 2
      src/CMakeLists.txt
  4. 5
      src/kextracolumnsproxymodel.cpp
  5. 5
      src/klinkitemselectionmodel.cpp
  6. 8
      src/kmodelindexproxymapper.cpp

@ -14,6 +14,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMQtDeclareLoggingCategory)
set(REQUIRED_QT_VERSION 5.7.0)
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
@ -75,4 +76,7 @@ install(FILES
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)
# contains list of debug categories, for kdebugsettings
install(FILES kitemmodels.categories DESTINATION ${KDE_INSTALL_CONFDIR})
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

@ -0,0 +1 @@
kf5.kitemmodels KItemModels

@ -12,6 +12,8 @@ set(kitemmodels_SRCS
kselectionproxymodel.cpp
)
ecm_qt_declare_logging_category(kitemmodels_SRCS HEADER kitemmodels_debug.h IDENTIFIER KITEMMODELS_LOG CATEGORY_NAME kf5.kitemmodels)
add_library(KF5ItemModels ${kitemmodels_SRCS})
generate_export_header(KF5ItemModels BASE_NAME KItemModels)
add_library(KF5::ItemModels ALIAS KF5ItemModels)

@ -19,8 +19,9 @@
*/
#include "kextracolumnsproxymodel.h"
#include "kitemmodels_debug.h"
#include <QItemSelection>
#include <QDebug>
class KExtraColumnsProxyModelPrivate
{
@ -115,7 +116,7 @@ QModelIndex KExtraColumnsProxyModel::mapToSource(const QModelIndex &proxyIndex)
}
const int column = proxyIndex.column();
if (column >= sourceModel()->columnCount()) {
qDebug() << "Returning invalid index in mapToSource";
qCDebug(KITEMMODELS_LOG) << "Returning invalid index in mapToSource";
return QModelIndex();
}
return QIdentityProxyModel::mapToSource(proxyIndex);

@ -22,11 +22,10 @@
*/
#include "klinkitemselectionmodel.h"
#include "kitemmodels_debug.h"
#include "kmodelindexproxymapper.h"
#include <QItemSelection>
#include <QDebug>
class KLinkItemSelectionModelPrivate
{
@ -52,7 +51,7 @@ public:
{
Q_FOREACH (const QItemSelectionRange &range, selection) {
if (!range.isValid()) {
qDebug() << selection;
qCDebug(KITEMMODELS_LOG) << selection;
}
Q_ASSERT(range.isValid());
}

@ -22,10 +22,10 @@
*/
#include "kmodelindexproxymapper.h"
#include "kitemmodels_debug.h"
#include <QtCore/QAbstractItemModel>
#include <QtCore/QPointer>
#include <QtCore/QDebug>
#include <QAbstractProxyModel>
#include <QItemSelectionModel>
@ -45,7 +45,7 @@ class KModelIndexProxyMapperPrivate
{
Q_FOREACH (const QItemSelectionRange &range, selection) {
if (!range.isValid()) {
qDebug() << selection << m_leftModel << m_rightModel << m_proxyChainDown << m_proxyChainUp;
qCDebug(KITEMMODELS_LOG) << selection << m_leftModel << m_rightModel << m_proxyChainDown << m_proxyChainUp;
}
Q_ASSERT(range.isValid());
}
@ -228,7 +228,7 @@ QItemSelection KModelIndexProxyMapper::mapSelectionLeftToRight(const QItemSelect
}
if (selection.first().model() != d->m_leftModel) {
qDebug() << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
qCDebug(KITEMMODELS_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
}
Q_ASSERT(selection.first().model() == d->m_leftModel);
@ -282,7 +282,7 @@ QItemSelection KModelIndexProxyMapper::mapSelectionRightToLeft(const QItemSelect
}
if (selection.first().model() != d->m_rightModel) {
qDebug() << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
qCDebug(KITEMMODELS_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
}
Q_ASSERT(selection.first().model() == d->m_rightModel);

Loading…
Cancel
Save