Commit a7a325b2 authored by jcfr's avatar jcfr

STYLE: Remove obsolete Qt4 code

Co-authored-by: Jean-Christophe Fillion-Robin's avatarJean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Co-authored-by: phcerdan's avatarPablo Hernandez-Cerdan <pablo.hernandez.cerdan@outlook.com>

From: Pablo Hernandez-Cerdan <pablo.hernandez@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@28003 3bd1e089-480b-0410-8dfb-8563597acbee
parent 7479ff50
......@@ -93,7 +93,6 @@ void qSlicerApplicationHelper::preInitializeApplication(
const char* argv0, ctkProxyStyle* style)
{
itk::itkFactoryRegistration();
#if QT_VERSION >= 0x040803
#ifdef Q_OS_MACX
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)
{
......@@ -102,7 +101,6 @@ void qSlicerApplicationHelper::preInitializeApplication(
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
}
#endif
#endif
#ifdef Slicer_VTK_USE_QVTKOPENGLWIDGET
// Set default surface format for QVTKOpenGLWidget. Disable multisampling to
......
......@@ -20,9 +20,7 @@
// Qt includes
#include <QProcess>
#if (QT_VERSION > QT_VERSION_CHECK(5, 0, 0))
#include <QStandardPaths>
#endif
// SlicerQt includes
#include "qSlicerCLIExecutableModuleFactory.h"
......@@ -34,7 +32,6 @@
//-----------------------------------------------------------------------------
QString findPython()
{
#if (QT_VERSION > QT_VERSION_CHECK(5, 0, 0))
QString python_path = QStandardPaths::findExecutable("python-real");
if (python_path.isEmpty())
{
......@@ -47,9 +44,6 @@ QString findPython()
return QString();
}
return python_path;
#else
return QString(); // QStandardPaths is Qt5 only so this feature isn't available
#endif
}
......
......@@ -23,10 +23,6 @@ private slots:
void testHttpsConnection_data();
};
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
#endif
// ----------------------------------------------------------------------------
void qSlicerSslTester::testSupportsSsl()
{
......
......@@ -31,12 +31,7 @@
#include <QResource>
#include <QSettings>
#include <QTranslator>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QDesktopServices>
#else
#include <QStandardPaths>
#endif
// For:
// - Slicer_QTLOADABLEMODULES_LIB_DIR
......@@ -906,11 +901,7 @@ void qSlicerCoreApplication::handleCommandLineArguments()
// Set 'sys.executable' so that Slicer can be used as a "regular" python interpreter
this->corePythonManager()->executeString(
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QString("import sys; sys.executable = '%1'; del sys").arg(QStandardPaths::findExecutable("PythonSlicer"))
#else
QString("import sys, distutils.spawn; sys.executable = distutils.spawn.find_executable('PythonSlicer'); del sys, distutils")
#endif
);
// Clean memory
......@@ -1084,13 +1075,8 @@ QString qSlicerCoreApplication::defaultScenePath() const
{
QSettings* appSettings = this->userSettings();
Q_ASSERT(appSettings);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QString defaultScenePath = appSettings->value(
"DefaultScenePath", QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).toString();
#else
QString defaultScenePath = appSettings->value(
"DefaultScenePath", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).toString();
#endif
return defaultScenePath;
}
......
......@@ -443,11 +443,7 @@ bool qSlicerCoreIOManager::loadFile(const QString& fileName)
//-----------------------------------------------------------------------------
bool qSlicerCoreIOManager::loadNodes(const qSlicerIO::IOFileType& fileType,
#if QT_VERSION < 0x040700
const QVariantMap& parameters,
#else
const qSlicerIO::IOProperties& parameters,
#endif
vtkCollection* loadedNodes)
{
Q_D(qSlicerCoreIOManager);
......
......@@ -97,15 +97,9 @@ public:
/// could also be called with the following parameters: LabelMap (bool), Center (bool)
/// \note Make also sure the case of parameter name is respected
/// \sa qSlicerIO::IOProperties, qSlicerIO::IOFileType, saveNodes()
#if QT_VERSION < 0x040700
Q_INVOKABLE virtual bool loadNodes(const qSlicerIO::IOFileType& fileType,
const QVariantMap& parameters,
vtkCollection* loadedNodes = 0);
#else
Q_INVOKABLE virtual bool loadNodes(const qSlicerIO::IOFileType& fileType,
const qSlicerIO::IOProperties& parameters,
vtkCollection* loadedNodes = 0);
#endif
/// Utility function that loads a bunch of files. The "fileType" attribute should
/// in the parameter map for each node to load.
......@@ -134,13 +128,8 @@ public:
/// For nodes: QString nodeID, bool useCompression
/// \sa qSlicerNodeWriter, qSlicerIO::IOProperties, qSlicerIO::IOFileType,
/// loadNodes()
#if QT_VERSION < 0x040700
Q_INVOKABLE bool saveNodes(qSlicerIO::IOFileType fileType,
const QVariantMap& parameters);
#else
Q_INVOKABLE bool saveNodes(qSlicerIO::IOFileType fileType,
const qSlicerIO::IOProperties& parameters);
#endif
/// Save a scene corresponding to \a fileName
/// This function is provided for convenience and is equivalent to call
......
......@@ -30,10 +30,7 @@
#include <QTemporaryFile>
#include <QTextStream>
#include <QUrl>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QUrlQuery>
#endif
// CTK includes
#include <ctkScopedCurrentDir.h>
......@@ -80,18 +77,11 @@ struct UpdateDownloadInformation
class QStandardItemModelWithRole : public QStandardItemModel
{
public:
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
void setRoleNames(const QHash<int,QByteArray> &roleNames)
{
this->QStandardItemModel::setRoleNames(roleNames);
}
#else
QHash<int, QByteArray> roleNames() const
{
return this->CustomRoleNames;
}
QHash<int,QByteArray> CustomRoleNames;
#endif
};
} // end of anonymous namespace
......@@ -303,14 +293,7 @@ void qSlicerExtensionsManagerModelPrivate::init()
++columnIdx;
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
//
// See QStandardItemModelWithRole::roleNames() for Qt5 implementation
//
this->Model.setRoleNames(roleNames);
#else
this->Model.CustomRoleNames = roleNames;
#endif
QObject::connect(q, SIGNAL(slicerRequirementsChanged(QString,QString,QString)),
q, SLOT(identifyIncompatibleExtensions()));
......@@ -1310,15 +1293,10 @@ qSlicerExtensionsManagerModelPrivate::downloadExtension(
this->debug(QString("Downloading extension [ itemId: %1]").arg(itemId));
QUrl downloadUrl(q->serverUrl());
downloadUrl.setPath(downloadUrl.path() + "/download");
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
downloadUrl.setQueryItems(
QList<QPair<QString, QString> >() << QPair<QString, QString>("items", itemId));
#else
QUrlQuery urlQuery;
urlQuery.setQueryItems(
QList<QPair<QString, QString> >() << QPair<QString, QString>("items", itemId));
downloadUrl.setQuery(urlQuery);
#endif
QNetworkReply* const reply =
this->NetworkManager.get(QNetworkRequest(downloadUrl));
......@@ -1375,11 +1353,7 @@ void qSlicerExtensionsManagerModel::onInstallDownloadFinished(
QNetworkReply* const reply = task->reply();
QUrl downloadUrl = reply->url();
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Q_ASSERT(downloadUrl.hasQueryItem("items"));
#else
Q_ASSERT(QUrlQuery(downloadUrl).hasQueryItem("items"));
#endif
emit this->downloadFinished(reply);
......@@ -1786,11 +1760,7 @@ void qSlicerExtensionsManagerModel::onUpdateDownloadFinished(
// Get network reply
QNetworkReply* const reply = task->reply();
QUrl downloadUrl = reply->url();
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Q_ASSERT(downloadUrl.hasQueryItem("items"));
#else
Q_ASSERT(QUrlQuery(downloadUrl).hasQueryItem("items"));
#endif
// Notify observers of event
emit this->downloadFinished(reply);
......
......@@ -24,7 +24,7 @@
#include <QFile>
#include <QMainWindow>
#if defined(Q_OS_WIN32) && (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#if defined(Q_OS_WIN32)
#include <QtPlatformHeaders\QWindowsWindowFunctions> // for setHasBorderInFullScreen
#endif
......@@ -127,11 +127,7 @@ public:
/// ErrorLogModel - It should exist only one instance of the ErrorLogModel
QSharedPointer<ctkErrorLogModel> ErrorLogModel;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QWeakPointer<qSlicerLayoutManager> LayoutManager;
#else
QPointer<qSlicerLayoutManager> LayoutManager;
#endif
ctkToolTipTrapper* ToolTipTrapper;
ctkSettingsDialog* SettingsDialog;
#ifdef Slicer_BUILD_EXTENSIONMANAGER_SUPPORT
......@@ -677,7 +673,7 @@ ctkSettingsDialog* qSlicerApplication::settingsDialog()const
// --------------------------------------------------------------------------
void qSlicerApplication::setHasBorderInFullScreen(bool hasBorder)
{
#if defined(Q_OS_WIN32) && (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#if defined(Q_OS_WIN32)
QWindowsWindowFunctions::setHasBorderInFullScreen(this->mainWindow()->windowHandle(), hasBorder);
#else
Q_UNUSED(hasBorder);
......
......@@ -21,9 +21,7 @@
// Qt includes
#include <QDebug>
#include <QDesktopServices>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QUrlQuery>
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
#include <QWebFrame>
#include <QWebView>
......@@ -70,12 +68,8 @@ QUrl qSlicerExtensionsInstallWidgetPrivate::extensionsListUrl()
QUrl url(this->ExtensionsManagerModel->serverUrlWithExtensionsStorePath());
//HS Uncomment the following line for debugging and comment above
//QUrl url("http://10.171.2.133:8080/slicerappstore");
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
url.setQueryItems(
#else
QUrlQuery urlQuery;
urlQuery.setQueryItems(
#endif
QUrlQuery urlQuery;
urlQuery.setQueryItems(
QList<QPair<QString, QString> >()
<< QPair<QString, QString>("layout", "empty")
<< QPair<QString, QString>("os", this->SlicerOs)
......@@ -83,10 +77,8 @@ QUrl qSlicerExtensionsInstallWidgetPrivate::extensionsListUrl()
<< QPair<QString, QString>("revision", this->SlicerRevision));
//HS Uncomment the following line for debugging and comment above
//<< QPair<QString, QString>("revision", "19291"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
url.setQuery(urlQuery);
#endif
return url;
url.setQuery(urlQuery);
return url;
}
// --------------------------------------------------------------------------
......
......@@ -35,9 +35,7 @@
#include <QStyledItemDelegate>
#include <QTextBlock>
#include <QTextDocument>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QUrlQuery>
#endif
// Slicer includes
#include "qSlicerExtensionsManagerModel.h"
......@@ -899,17 +897,11 @@ void qSlicerExtensionsManageWidget::onLinkActivated(const QString& link)
QUrl url = d->ExtensionsManagerModel->serverUrl();
url.setPath(url.path() + "/slicerappstore/extension/view");
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
url.addQueryItem("extensionId", link.mid(7)); // remove leading "slicer:"
url.addQueryItem("breadcrumbs", "none");
url.addQueryItem("layout", "empty");
#else
QUrlQuery urlQuery;
urlQuery.addQueryItem("extensionId", link.mid(7)); // remove leading "slicer:"
urlQuery.addQueryItem("breadcrumbs", "none");
urlQuery.addQueryItem("layout", "empty");
url.setQuery(urlQuery);
#endif
emit this->linkActivated(url);
}
......
......@@ -24,9 +24,7 @@
#include <QMessageBox>
#include <QTimerEvent>
#include <QToolButton>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QUrlQuery>
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
#include <QWebFrame>
#include <QWebHistory>
......
......@@ -20,11 +20,7 @@
// Qt includes
#include <QAbstractScrollArea>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QCleanlooksStyle>
#else
#include <QStyleFactory>
#endif
#include <QDebug>
#include <QEvent>
#include <QGroupBox>
......@@ -39,11 +35,7 @@
// --------------------------------------------------------------------------
qSlicerStyle::qSlicerStyle()
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
: Superclass(new QCleanlooksStyle)
#else
: Superclass(QStyleFactory::create("fusion"))
#endif
{
this->baseStyle()->setParent(this);
}
......@@ -127,11 +119,9 @@ int qSlicerStyle::pixelMetric(PixelMetric metric, const QStyleOption * option,
case QStyle::PM_SliderLength:
return 12; // default to 27
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
case QStyle::PM_ButtonIconSize:
return 24; // Like with cleanlooks style
break;
#endif
default:
return Superclass::pixelMetric(metric, option, widget);
break;
......@@ -151,71 +141,6 @@ QRect qSlicerStyle::subControlRect(ComplexControl control, const QStyleOptionCom
/// the following code aims at overriding that value by setting it to 4.
switch(control)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
case CC_GroupBox:
if (const QStyleOptionGroupBox *groupBox =
qstyleoption_cast<const QStyleOptionGroupBox *>(option))
{
int topMargin = 0;
int topHeight = 0;
int verticalAlignment = this->proxy()->styleHint(
SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
bool flat = groupBox->features & QStyleOptionFrameV2::Flat;
if (!groupBox->text.isEmpty())
{
topHeight = groupBox->fontMetrics.height();
if (verticalAlignment & Qt::AlignVCenter)
{
topMargin = topHeight / 2;
}
else if (verticalAlignment & Qt::AlignTop)
{
topMargin = topHeight;
}
}
QRect frameRect = groupBox->rect;
frameRect.setTop(topMargin);
if (subControl == SC_GroupBoxFrame)
{
return rect;
}
else if (subControl == SC_GroupBoxContents)
{
if(flat)
{
int margin = 0;
int leftMarginExtension = 4; // default 16
rect = frameRect.adjusted(leftMarginExtension + margin, margin + topHeight, -margin, -margin);
}
break;
}
if(flat)
{
if (const QGroupBox *groupBoxWidget = qobject_cast<const QGroupBox *>(widget))
{
//Prepare metrics for a bold font
QFont font = widget->font();
font.setBold(true);
QFontMetrics fontMetrics(font);
QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(2, 2);
if (subControl == SC_GroupBoxCheckBox)
{
int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
rect.setWidth(indicatorWidth);
rect.setHeight(indicatorHeight);
rect.moveTop((fontMetrics.height() - indicatorHeight) / 2 + 2);
}
else if (subControl == SC_GroupBoxLabel)
{
rect.setSize(textRect);
}
}
}
}
break;
#endif
#ifndef QT_NO_SLIDER
// <HACK>
// Reimplemented to work around bug: http://bugreports.qt.nokia.com/browse/QTBUG-13318
......
......@@ -45,13 +45,6 @@ qSlicerWebDownloadWidget::qSlicerWebDownloadWidget(QWidget *parent)
// --------------------------------------------------------------------------
void qSlicerWebDownloadWidget::handleDownload(QWebEngineDownloadItem *download)
{
// This code uses C++11 lambdas, which are only available when
// Qt5 is used. This code will never actually be called unless
// QWebEngine is used, so it doesn't need to do anything in the
// non-Qt5 case.
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// need to use a modal dialog here because 'download' will be deleted
// if we don't return 'accept from this slot
QMessageBox *messageBox = new QMessageBox(this);
......@@ -144,5 +137,4 @@ void qSlicerWebDownloadWidget::handleDownload(QWebEngineDownloadItem *download)
QMessageBox::information(this, tr("Web download"), tr("Download complete"));
}
});
#endif
}
......@@ -20,9 +20,6 @@
// Qt includes
#include <QDebug>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QPlastiqueStyle>
#endif
#include <QStandardItem>
// CTK includes
......
......@@ -62,23 +62,11 @@ void qMRMLNodeComboBoxDelegate::paint(QPainter *painter,
if (this->isSeparator(index))
{
QRect rect = option.rect;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
if (const QStyleOptionViewItemV3 *v3 =
qstyleoption_cast<const QStyleOptionViewItemV3*>(&option))
{
if (const QAbstractItemView *view =
qobject_cast<const QAbstractItemView*>(v3->widget))
{
rect.setWidth(view->viewport()->width());
}
}
#else
if (const QAbstractItemView *view =
qobject_cast<const QAbstractItemView*>(option.widget))
{
rect.setWidth(view->viewport()->width());
}
#endif
QStyleOption opt;
opt.rect = rect;
this->mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator,
......
......@@ -66,11 +66,7 @@ QStyleOptionMenuItem qMRMLNodeComboBoxMenuDelegate::getStyleOption(
QPalette resolvedpalette =
option.palette.resolve(QApplication::palette("QMenu"));
QVariant value = index.data(Qt::ForegroundRole);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
if (qVariantCanConvert<QBrush>(value))
#else
if (value.canConvert(QMetaType::QBrush))
#endif
{
resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast<QBrush>(value));
resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(value));
......@@ -144,11 +140,7 @@ QStyleOptionMenuItem qMRMLNodeComboBoxMenuDelegate::getStyleOption(
menuOption.icon = qvariant_cast<QPixmap>(variant);
break;
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
if (qVariantCanConvert<QBrush>(index.data(Qt::BackgroundRole)))
#else
if (index.data(Qt::BackgroundRole).canConvert(QMetaType::QBrush))
#endif
{
menuOption.palette.setBrush(QPalette::All, QPalette::Background,
qvariant_cast<QBrush>(index.data(Qt::BackgroundRole)));
......
......@@ -20,11 +20,7 @@
// QT includes
#include <QButtonGroup>
#include <QMetaProperty>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QWeakPointer>
#else
#include <QPointer>
#endif
// CTK includes
#include <ctkVTKWidgetsUtils.h>
......@@ -61,11 +57,7 @@ public:
void setupUi(QDialog* dialog);
void setCheckedRadioButton(int type);
void setWidgetEnabled(bool state);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QWeakPointer<qMRMLLayoutManager> LayoutManager;
#else
QPointer<qMRMLLayoutManager> LayoutManager;
#endif
vtkSmartPointer<vtkImageData> ImageData;
/// The ID of the associated snapshot node.
/// This is NULL if the dialog has no associated snapshot node (== new snapshot mode).
......
......@@ -20,11 +20,9 @@
// Qt includes
#include <QDebug>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QApplication>
#include <QMainWindow>
#include <QWindow>
#endif
// qMRML includes
#include "qMRMLSliceWidget_p.h"
......@@ -80,12 +78,8 @@ void qMRMLSliceWidgetPrivate::init()
// --------------------------------------------------------------------------
void qMRMLSliceWidgetPrivate::setSliceViewSize(const QSize& size)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
const QSize scaledSize = size * this->SliceView->devicePixelRatio();
this->SliceController->setSliceViewSize(scaledSize);
#else
this->SliceController->setSliceViewSize(size);
#endif
}
// --------------------------------------------------------------------------
......@@ -302,7 +296,6 @@ void qMRMLSliceWidget::showEvent(QShowEvent* event)
{
Superclass::showEvent(event);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
Q_D(qMRMLSliceWidget);
// Reset slice view size when screen changes to account for a possible change
......@@ -322,5 +315,4 @@ void qMRMLSliceWidget::showEvent(QShowEvent* event)
connect(window, SIGNAL(screenChanged(QScreen*)),
d, SLOT(resetSliceViewSize()), Qt::UniqueConnection);
}
#endif
}
......@@ -200,17 +200,11 @@ void qMRMLTableModel::updateModelFromMRML()
vtkTable* table = (tableNode ? tableNode->GetTable() : NULL);
if (table==NULL || table->GetNumberOfColumns()==0)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
beginResetModel();
#endif
// setRowCount and setColumnCount to 0 would not be enough, it's necessary to remove the header as well
setRowCount(0);
setColumnCount(0);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
reset();
#else
endResetModel();
#endif
QObject::connect(this, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onItemChanged(QStandardItem*)), Qt::UniqueConnection);
return;
}
......
......@@ -793,11 +793,7 @@ void qMRMLTreeView::mouseReleaseEvent(QMouseEvent* e)
{
// get the index of the current column
QModelIndex index = this->indexAt(e->pos());
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QStyleOptionViewItemV4 opt = this->viewOptions();
#else
QStyleOptionViewItem opt = this->viewOptions();
#endif
opt.rect = this->visualRect(index);
qobject_cast<qMRMLItemDelegate*>(this->itemDelegate())->initStyleOption(&opt,index);
QRect decorationElement =
......
......@@ -126,17 +126,10 @@ public:
{
return new vtkSegmentEditorEventCallbackCommand;
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
/// Segment editor widget observing the event
QWeakPointer<qMRMLSegmentEditorWidget> EditorWidget;
/// Slice widget or 3D widget
QWeakPointer<qMRMLWidget> ViewWidget;
#else
/// Segment editor widget observing the event
QPointer<qMRMLSegmentEditorWidget> EditorWidget;
/// Slice widget or 3D widget
QPointer<qMRMLWidget> ViewWidget;
#endif
};
//-----------------------------------------------------------------------------
......
......@@ -798,11 +798,7 @@ bool qMRMLSubjectHierarchyTreeView::clickDecoration(QMouseEvent* e)
Q_D(qMRMLSubjectHierarchyTreeView);
QModelIndex index = this->indexAt(e->pos());
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QStyleOptionViewItemV4 opt = this->viewOptions();
#else
QStyleOptionViewItem opt = this->viewOptions();
#endif
opt.rect = this->visualRect(index);
qobject_cast<qMRMLItemDelegate*>(this->itemDelegate())->initStyleOption(&opt,index);
QRect decorationElement = this->style()->subElementRect(QStyle::SE_ItemViewItemDecoration, &opt, this);
......
......@@ -27,10 +27,6 @@
#include <QPixmapCache>
#include <QTextBrowser>
#include <QTimer>
#if QT_VERSION < 0x040700
//# include <private/qtextimagehandler_p.h>
#include <QPixmapCache>
#endif
// CTK includes
#include "ctkTest.h"
......@@ -48,15 +44,6 @@
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#if QT_VERSION < 0x040700
//static QImage pixmapCacheLoader( const QString& name, const QString &context )
//{
// Q_UNUSED(context);
// QPixmap pix;
// return QPixmapCache::find( name, pix ) ? pix.toImage() : QImage();
//}
#endif
// ----------------------------------------------------------------------------
class qSlicerPresetComboBoxTester: public QObject
{
......@@ -129,15 +116,8 @@ void qSlicerPresetComboBoxTester::testPreview()
QLabel label;
QPixmap pixmap;
#if QT_VERSION >= 0x040700
pixmap.convertFromImage(image);
label.setText(QString("<img src=\"%1\"/>").arg(ctk::base64HTMLImageTagSrc(image)));
#else
pixmap = QPixmap::fromImage(image);
QPixmapCache::insert(":cachedImage", pixmap);
//QTextImageHandler::externalLoader = pixmapCacheLoader;
label.setText(QString("<img src=\":cachedImage\"/>"));
#endif
//label.setPixmap(pixmap); ok !
label.show();
......@@ -156,11 +136,7 @@ void qSlicerPresetComboBoxTester::testPreview()
//QVERIFY(image == expectedImage);
//QPixmap expectedPixmap;
//#if QT_VERSION >= 0x040700
// expectedPixmap.convertFromImage(expectedImage);
//#else
// expectedPixmap = QPixmap::fromImage(expectedImage);
//#endif
//expectedPixmap.convertFromImage(expectedImage);
//QLabel expectedLabel;
//expectedLabel.setPixmap(expectedPixmap);
......
......@@ -22,9 +22,6 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QListView>
#if QT_VERSION < 0x040700
#include <QPixmapCache>
#endif
// CTK includes
#include <ctkVTKWidgetsUtils.h>
......@@ -223,12 +220,7 @@ void qSlicerPresetComboBox::setIconToPreset(vtkMRMLNode* presetNode)
volumePropertyNode->GetVolumeProperty() ? volumePropertyNode->GetVolumeProperty()->GetRGBTransferFunction() : 0;
assert(colors && colors->GetRange()[1] > colors->GetRange()[0]);
QImage img = ctk::scalarsToColorsImage(colors, QSize(previewSize, previewSize));
#if QT_VERSION >= 0x040700
QString imgSrc = ctk::base64HTMLImageTagSrc(img);
#else
QString imgSrc = QString(":%1").arg(presetNode->GetName());
QPixmapCache::insert(imgSrc, QPixmap::fromImage(img));
#endif
QString toolTip = QString("<img src=\"%1\"> %2").arg(imgSrc).arg(presetNode->GetName());
sceneModel->setData(sceneModel->indexFromNode(presetNode), toolTip, Qt::ToolTipRole);
}
......
......@@ -25,9 +25,6 @@
// Qt includes
#include <QDebug>
#if QT_VERSION < 0x040700