mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-20 12:53:55 +08:00
QtDialog: remove Qt4-only code
The `reset()` method was actually deprecated for 5.0 which means it can now be removed here.
This commit is contained in:
@@ -115,14 +115,6 @@ int main(int argc, char** argv)
|
|||||||
QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8");
|
QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8");
|
||||||
QTextCodec::setCodecForLocale(utf8_codec);
|
QTextCodec::setCodecForLocale(utf8_codec);
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
// clean out standard Qt paths for plugins, which we don't use anyway
|
|
||||||
// when creating Mac bundles, it potentially causes problems
|
|
||||||
foreach (QString p, QApplication::libraryPaths()) {
|
|
||||||
QApplication::removeLibraryPath(p);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// tell the cmake library where cmake is
|
// tell the cmake library where cmake is
|
||||||
QDir cmExecDir(QApplication::applicationDirPath());
|
QDir cmExecDir(QApplication::applicationDirPath());
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
@@ -340,11 +340,7 @@ void QCMake::interrupt()
|
|||||||
|
|
||||||
bool QCMake::interruptCallback()
|
bool QCMake::interruptCallback()
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
return this->InterruptFlag;
|
|
||||||
#else
|
|
||||||
return this->InterruptFlag.load();
|
return this->InterruptFlag.load();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCMake::progressCallback(const std::string& msg, float percent)
|
void QCMake::progressCallback(const std::string& msg, float percent)
|
||||||
|
@@ -155,11 +155,7 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
|
|||||||
|
|
||||||
void QCMakeCacheView::setShowAdvanced(bool s)
|
void QCMakeCacheView::setShowAdvanced(bool s)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 040300
|
|
||||||
// new 4.3 API that needs to be called. what about an older Qt?
|
|
||||||
this->SearchFilter->invalidate();
|
this->SearchFilter->invalidate();
|
||||||
#endif
|
|
||||||
|
|
||||||
this->AdvancedFilter->setShowAdvanced(s);
|
this->AdvancedFilter->setShowAdvanced(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,9 +205,7 @@ void QCMakeCacheModel::clear()
|
|||||||
|
|
||||||
void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
|
void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
this->beginResetModel();
|
this->beginResetModel();
|
||||||
#endif
|
|
||||||
|
|
||||||
QSet<QCMakeProperty> newProps;
|
QSet<QCMakeProperty> newProps;
|
||||||
QSet<QCMakeProperty> newProps2;
|
QSet<QCMakeProperty> newProps2;
|
||||||
@@ -321,11 +315,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->blockSignals(b);
|
this->blockSignals(b);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
this->endResetModel();
|
this->endResetModel();
|
||||||
#else
|
|
||||||
this->reset();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const
|
QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const
|
||||||
@@ -335,9 +325,7 @@ QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const
|
|||||||
|
|
||||||
void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
|
void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
this->beginResetModel();
|
this->beginResetModel();
|
||||||
#endif
|
|
||||||
|
|
||||||
this->View = t;
|
this->View = t;
|
||||||
|
|
||||||
@@ -354,11 +342,7 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
|
|||||||
this->setProperties(oldProps);
|
this->setProperties(oldProps);
|
||||||
this->setProperties(props);
|
this->setProperties(props);
|
||||||
this->blockSignals(b);
|
this->blockSignals(b);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
this->endResetModel();
|
this->endResetModel();
|
||||||
#else
|
|
||||||
this->reset();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
|
void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
|
||||||
@@ -484,8 +468,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const
|
|||||||
// go to the next in the tree
|
// go to the next in the tree
|
||||||
while (!idxs.isEmpty() &&
|
while (!idxs.isEmpty() &&
|
||||||
(
|
(
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && \
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
|
||||||
(idxs.last().row() + 1) >= rowCount(idxs.last().parent()) ||
|
(idxs.last().row() + 1) >= rowCount(idxs.last().parent()) ||
|
||||||
#endif
|
#endif
|
||||||
!idxs.last().sibling(idxs.last().row() + 1, 0).isValid())) {
|
!idxs.last().sibling(idxs.last().row() + 1, 0).isValid())) {
|
||||||
@@ -645,20 +628,6 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue 205903 fixed in Qt 4.5.0.
|
|
||||||
// Can remove this function and FileDialogFlag when minimum Qt version is 4.5
|
|
||||||
bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt)
|
|
||||||
{
|
|
||||||
// workaround for what looks like a bug in Qt on macOS
|
|
||||||
// where it doesn't create a QWidget wrapper for the native file dialog
|
|
||||||
// so the Qt library ends up assuming the focus was lost to something else
|
|
||||||
|
|
||||||
if (evt->type() == QEvent::FocusOut && this->FileDialogFlag) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return QItemDelegate::eventFilter(object, evt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QCMakeCacheModelDelegate::setModelData(QWidget* editor,
|
void QCMakeCacheModelDelegate::setModelData(QWidget* editor,
|
||||||
QAbstractItemModel* model,
|
QAbstractItemModel* model,
|
||||||
const QModelIndex& index) const
|
const QModelIndex& index) const
|
||||||
|
@@ -144,7 +144,6 @@ public:
|
|||||||
bool editorEvent(QEvent* event, QAbstractItemModel* model,
|
bool editorEvent(QEvent* event, QAbstractItemModel* model,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index);
|
const QModelIndex& index);
|
||||||
bool eventFilter(QObject* object, QEvent* event);
|
|
||||||
void setModelData(QWidget* editor, QAbstractItemModel* model,
|
void setModelData(QWidget* editor, QAbstractItemModel* model,
|
||||||
const QModelIndex& index) const;
|
const QModelIndex& index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem& option,
|
QSize sizeHint(const QStyleOptionViewItem& option,
|
||||||
|
Reference in New Issue
Block a user